TiMidity++-2.13.2/0040755004711200001440000000000010031564160012674 5ustar tamukiusersTiMidity++-2.13.2/README0100644004711200001440000000711410042660707013562 0ustar tamukiusers====================================================================== TiMidity++ -- MIDI-to-WAVE converter and player Masanao Izumo Apr.25.2004 version 2.13.0 or later ====================================================================== ====================================================================== What is this? ====================================================================== General information TiMidity++ is a software synthesizer. It can play MIDI files by con- verting them into PCM waveform data; give it a MIDI data along with digital instrument data files, then it synthesizes them in real-time, and plays. It can not only play sounds, but also can save the gener- ated waveforms into hard disks as various audio file formats. TiMidity++ is a free software, distributed under the terms of GNU gen- eral public license. The history TiMidity++ is based on TiMidity 0.2i, written by Tuukka Toivonen (He discontinued development because he was too busy with work), released on 1995. No new version of this original project is developed since then. Development has been continued by Masanao Izumo et al. in the new project named TiMidity++. `++' is to show the difference from original project. ====================================================================== Features ====================================================================== * Plays MIDI files without any external MIDI instruments at all * Understands following formats: + SMF (Format 0, 1, 2) + MOD + RCP, R36, G18, G36 (Recomposer formats) + MFi (Version 3; Melody Format for i-Mode) * Converts MIDI files into various audio file formats: + RIFF WAVE (*.wav) + SUN AU (*.au) + Apple Interchange File Format (*.aiff) + Ogg Vorbis, FLAC, Speex (*.ogg) + MPEG-1 Audio layer 3 (*.mp3) (note: Windows only) * Uses following formats as digital instrument data + Gravis Ultrasound compatible patch files + SoundFonts + AIFF and WAV data (Some restrictions are there with AIFF/WAV) * Displays information about the music that is now playing * Various user interfaces: + dumb terminal interface + ncurses interface + S-Lang interface + X Athena Widget interface + Tcl/Tk interface + Motif interface (runs with lesstif) + vt100 interface + Emacs front-end (type ``M-x timidity'' on your emacs) + skin interface: can use WinAmp? skin (Seems not maintained...) + GTK+ interface + ALSA sequencer interface + Windows synthesizer interface + Windows GUI interface + Windows GUI synthesizer interface + PortMIDI synthesizer interface * Plays remote MIDI files over the network + HTTP + FTP + NetNews * Plays MIDI files in archive files. Supported formats are: + Tar archived (*.tar) + Gzip'ed tar (*.tar.gz, *.tgz) + Zip compressed (*.zip) + LHa compressed lh0, lh1, lh2, lh3, lh4, lh5, lh6, lz4, lzs and lz5 (*.lzh) * Displays sound spectrogram for the playing music * Trace playing ====================================================================== Where to get a copy ====================================================================== The latest release of TiMidity++ are available at: http://www.timidity.jp The primary site. http://timidity.sourceforge.net The development goes on this site. Source codes here. http://www.asahi-net.or.jp/~gb7t-ngm/timidity/ Macintosh version http://timidity.s11.xrea.com/index.en.html Windows version ====================================================================== How to install ====================================================================== Refer INSTALL file in the distribution. TiMidity++-2.13.2/AUTHORS0100644004711200001440000000316510017772336013760 0ustar tamukiusersVersion 0.2i and earlier: Tuukka Toivonen Vincent Pagel Takashi Iwai Davide Moretti Chi Ming HUNG Riccardo Facchetti TiMidity++: Maintained by Masanao Izumo Tomokazu Harada Keiichirou Yamate Masaki Kiryu Daisuke Aoki Shoji Matsumoto Masaaki Koyanagi Kunihiko Imai Takaya Nogami Takanori Watanabe Hiroshi Takekawa Daisuke Nagano Kousuke Kinoshita Norikatsu Shigemura Isaku Yamahata Yoshishige Arai Glenn Trigg Colour window manager icon by Tim Allen NAS by Michael Haardt Eric A. Welsh Paolo Bonzini Masahiko Kimoto Takashi Iwai Saito Kentaro Sato Shoichi Tamuki Shohei Urabe Keishi Suenaga Windows synthesizer service mode by Koji Suzuki and other many people sends information and bug-fix codes. TiMidity++-2.13.2/COPYING0100644004711200001440000004313107421005037013730 0ustar tamukiusers GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 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. TiMidity++-2.13.2/ChangeLog0100644004711200001440000003120410127771426014456 0ustar tamukiusers2004-10-03 URABE Shyouhei * NEWS: Add new entry for 2.13.2 * configure.in: Change version to 2.13.2 2004-10-02 URABE Shyouhei * interface/wrdt_wcon.c : Fix double definition of print_ecmd() * timidity/timidity.c (main): s/strcat/strncat/; 2004-09-29 URABE Shyouhei * NEWS: Add new entry for 2.13.1 2004-09-28 URABE Shyouhei * configure.in: Change version to 2.13.1 2004-09-27 URABE Shyouhei * utils/support.c (vsnprintf): ensure snpritnf() to return a \0-terminated string * interface/mac_c.c, interface/server_c.c, interface/w32g_c.c, interface/w32g_i.c, interface/wrdt_dumb.c, interface/wrdt_mac.c, interface/wrdt_tty.c, interface/wrdt_w32g.c, interface/xaw_i.c, interface/xskin_i.c, libarc/arc.c, timidity/audriv_al.c, timidity/audriv_mme.c, timidity/common.c, timidity/mac_qt_a.c, timidity/sun_a.c, timidity/timidity.c, timidity/wrdt_read.c: Fix to use strn* functinos. 2004-09-23 URABE Shyouhei * utils/support.h: ditto * utils/support.c: ditto * configure.in: add strlcpy and strlcat 2004-09-15 Eric A. Welsh * timidity/resample.c: Reimplement bounds cheking 2004-09-09 URABE Shyouhei * interface/gtk_c.c (ctl_total_time): ditto. * interface/gtk_i.c (handle_input): Fix counter overflow (fix for [timidity-bugs-en:00032]) * NEWS: Fix typo. 2004-09-07 Eric A. Welsh * freq.c: mostly rewritten New pitch and chord detection algorithm that is much more robust and accurate than before. * sndfont.c (main): CFG_FOR_SF_SUPPORT_FFT related code modified to work with new freq.c 2004-09-03 URABE Shyouhei * timidity/timidity.c: add null_play_mode (fix for [timidity-bugs-en:00031]) * timidity/timidity.c (parse_opt_h): add prototype for show_ao_device_info() * timidity/readmidi.c (check_midi_file): Fix to recognize .rmi & .mfi (Fix for [timidity-bugs-en:00030]) 2004-09-01 URABE Shyouhei * timidity/timidity.c : Fix for linkage error in W32 * utils/support.h (S_ISDIR): define S_ISDIR for platforms without S_ISDIR * interface/xaw_i.c: avoid all-black file selector when tracer is not enabled, thanks to hmh@debian.org 2004-08-28 Eric A. Welsh * playmidi.c (new_chorus_voice, new_chorus_voice_alternate): v1 and v2 are now swapped correctly * playmidi.c (process_sysex_event): many fixes to XG SYSEX parsing * readmidi.c: (parse_sysex_event_multi): many fixes to XG SYSEX parsing * reverb.c (do_filter_lowpass1_stereo): p->x1l and p->x1r are now properly updated 2004-08-22 Eric A. Welsh * timidity/mix.c (next_stage): Added bounds checking after scaling envelope rates when opt_tva_attack and/or opt_tva_decay are enabled. This fixes previous short/silent note problems when these options were enabled. 2004-07-10 TAMUKI Shoichi * interface/alsaseq_c.c, interface/rtsyn_common.c, timidity/playmidi.c: Suppress force keysig transposition at the beginning of MIDI sequence 2004-07-01 TAMUKI Shoichi * interface/alsaseq_c.c, interface/rtsyn_common.c, timidity/playmidi.c: Adjust force keysig transposition so that performance may feel it natural 2004-06-30 TAMUKI Shoichi * interface/alsaseq_c.c, interface/rtsyn_common.c, timidity/playmidi.[ch], timidity/readmidi.c, timidity/timidity.[ch]: Reflect the result of -K and -T command option on interfaces Improve force keysig calculation Change the base number of measure (bar) counter as 1 (was 0) 2004-06-14 TAMUKI Shoichi * timidity/loadtab.c, timidity/tables.[ch]: Fix bug in -Z command option 2004-06-09 Keishi Suenaga * timidity/reverb.c, timidity/tables.c, doc/C/README.w32, doc/ja_JP.eucJP/README.w32: small fixes for CbuilderX. 2004-06-02 Kentaro Sato * utils/support.[ch]: Implemented subset of stat() for Mac OS. 2004-06-02 URABE Shyouhei * utils/support.h: add things to treat the case of no * timidity/common.c: rebirth of HAVE_SYS_STAT_H 2004-06-01 URABE Shyouhei * timidity/timidity.c (canonicalize_path): fix typo * timidity/common.c: fix compiling problem on VC6. 2004-05-31 Keishi Suenaga * configure.in: dynamic linked runtime library must be used with Open Watcom. 2004-05-31 URABE Shyouhei * timidity/common.c (open_file): ignore directories when searching a normal file * timidity/timidity.c (main): suffix '/' is supplied to each argv elems when the path IS a directory but IS NOT suffixed by '/'. 2004-05-31 Eric A. Welsh * timidity/instrum.h, timidity/instrum.c, timidity/m2m.c, timidity/mod2midi.c, timidity/playmidi.c, timidity/sndfont.c: root_freq_detected, transpose_detected, and chord variables added to Sample type in instrum.h. Pitch detection is applied to drum and MOD samples if surround chorus is enabled. This allows the true pitch of the rendered voices to be determined, so that surround chorus voice cancellation can be avoided by choosing a chorus delay that is not close to half the period. * playmidi.c (new_chorus_voice_alternate): Various fixes to surround chorus. Uses pitch detection for drum and MOD samples. Multiple similar drum instruments (snare1 and snare2, kick1 and kick2) playing at once no longer cause voice cancellation and strange perceived pans. 2004-05-31 Iwata * interface/gtk_i.c (open_file_cb): Fix compiling problem 2004-05-30 URABE Shyouhei * configure.in: ditto * autoconf/Makefile.am (EXTRA_DIST): ditto * autoconf/gtk-2.0.m4: add. 2004-05-30 dai * interface/gtk_i.c: GTK+ 2.x support 2004-05-30 Keishi Suenaga * {interface,libarc,libunimod,timidity,utils}/Makefile.am, configure.in, interface.h.in, interface/ncurs_c.c, interface/vt100_c.c, libunimod/unimod_priv.h, timidity/common.c, timidity/gogo_a.c, timidity/sysdep.h, timidity/timidity.c, timidity/version.c, utils/support.h, utils/tmdy_getopt.h: Can compile OpenWatcom in Msys or Cygwin environment. * doc/C/README.w32, doc/ja_JP.eucJP/README.w32, scripts/wcc386_w.sh: Add compile instructions for Mingw, Borland C, Watcom C and Visual C 2004-05-24 Eric A. Welsh * libunimod/load_mod.c (ConvertNote): Bug fix 2004-05-24 Keishi Suenaga * {interface,libarc,libunimod,timidity,utils}/Makefile.am, configure.in, interface/wrdt_wcon.c, timidity/flac_a.c, timidity/sysdep.h, timidity/timidity.c, timidity/wrdt.c, utils/nkflib.c, utils/support.h: Can compile VCC or BCC in Msys or Cygwin environment. * interface.h.in, timidity/timidity.c: Don't use ANOTHER_MAIN in timw32g and twsyn. 2004-05-23 Kentaro Sato * timidity/timidity.c: Fixed to compile with MrC. 2004-05-19 TAMUKI Shoichi * interface/w32g_syn.c: Fix to fit with case of "current" version * timidity/timidity.c: Fix typo 2004-05-18 Keishi Suenaga * configure.in: Add gcc option -mms-bitfield in windows. GOGO ditection for windows fix. Can use gccXXX in CYGWIN and MSYS. Enable dynamic linked portaudio DLLs with CYGWIN and MSYS. Enable dynamic linked FLAC DLL with CYGWIN and MSYS. * interface/Makefile.am: Enable wrdt_wcon.c in MSYS. Make clean to remove *escaped.c *.res. * interface/w32g_syn.c: Use PACKAGE_VERSION if TIMID_VERSION is not defined. * timidity/portaudio_a.c: A hack for pa_asio.dll with timwin32g and kxdriver(SB Live!). 2004-05-16 TAMUKI Shoichi * timidity/Makefile.{am,in}: Add new files for FLAC/OggFLAC 2004-05-16 Saito * configs/msc[67]-project.zip: Fix for FLAC/OggFLAC DLL. 2004-05-16 Daisuke Aoki * timidity/{flac_a.c,vorbis_a.c,w32_libFLAC_dll.c,w32_libFLAC_dll.h, w32_libFLAC_dll_g.h,w32_libFLAC_dll_i.h,w32_libOggFLAC_dll.c, w32_libOggFLAC_dll.h,w32_libOggFLAC_dll_g.h}: Support for FLAC/OggFLAC DLL. 2004-05-16 Keishi Suenaga * interface/gogo_a.c: Support for MP3 GOGO output in Win32CUI interface. 2004-05-14 TAMUKI Shoichi * configs/msc[67]-project.zip: Change version to "current" * timidity/Makefile.{am,in}: Add w32_portaudio{.h,_dll.c} 2004-05-14 Saito * configs/msc[67]-project.zip: Fix for PortAudio DLL. * timidity/w32g_pref.c: Fix typo. * timidity/mix.c: Fix around envelope. 2004-05-14 Daisuke Aoki * timidity/{output.c,portaudio_a.c,w32_portaudio.h, w32_portaudio_dll.c}: Support for PortAudio DLL. 2004-05-06 TAMUKI Shoichi * interface/tclIndex: Resume order 2003-05-05 Chisato Yamauchi * TiMidity(-uj).ad.in, interface/xaw_i.c: Update app-defaults file for XAW interface 2004-05-03 TAMUKI Shoichi * interface/ncurs_c.c, interface/server_c.c, interface/slang_c.c, interface/vt100_c.c, interface/w32g_{i,syn}.c, interface/xaw_i.c, timidity/timidity.c: Fix to fit with case of "current" version 2004-05-02 URABE Shyouhei * timidity/timidity.c (parse_opt_h): ditto. * timidity/timidity.h (DEFAULT_RESAMPLATION): ditto. * configure.in: --enable-spline was not working 2004-04-29 Saito * timidity/reverb.c, timidity/optcode.h: Fix around Insertion Effect. 2004-04-28 TAMUKI Shoichi * timidity/playmidi.c: Fix around temperament control 2004-04-27 TAMUKI Shoichi * doc/C/timidity.1, doc/ja_JP.eucJP/timidity.1: Update 2004-04-26 TAMUKI Shoichi * doc/C/timidity.1, doc/ja_JP.eucJP/timidity.1: Update * timidity/timidity.c: Rename --flac-compression-level -> --flac-complevel 2004-04-25 TAMUKI Shoichi * doc/C/timidity.1, doc/ja_JP.eucJP/timidity.1, doc/C/timidity.cfg.5, doc/ja_JP.eucJP/timidity.cfg.5: Update * interface/ncurs_c.c: Fix a little 2004-04-25 URABE Shyouhei * configure.in: Bug fix and autoreconf 2004-04-23 Kentaro Sato * timidity/timidity.c: Fixed a bug dealing with a nameless var. 2004-04-23 Saito * timidity/reverb.c, timidity/optcode.h: Fix noises. 2004-04-23 Iwata * timidity/speex_a.c: Add * configure.in, timidity/output.c, timidity/timidity.c, timidity/Makefile.am: Add OggSpeex support 2004-04-21 Saito * timidity/flac_a.c: Fix around filename at Win32GUI interface. 2004-04-20 TAMUKI Shoichi * timidity/timidity.c: Fix a little 2004-04-19 Saito * timidity/flac_a.c: Fix for VC++ environments. 2004-04-18 URABE Shyouhei * configure.in: fix for libAO detection * autoconf/libFLAC.m4, autoconf/libOggFLAC.m4: Add. * configure.in: Change to use above * autoconf/Makefile.am: ditto 2004-04-18 Iwata * timidity/flac_a.c: Add * configure.in, timidity/output.c, timidity/timidity.c, timidity/Makefile.am: Add libFLAC support 2004-04-14 Kentaro Sato * libarc/arc.c, timidity/timidity.c: Removed trailing directory separator from $basedir. 2004-04-13 URABE Shyouhei * autoconf/ao.m4: Add. * configure.in: Change to use ao.m4 * autoconf/Makefile.am (EXTRA_DIST): ditto. 2004-04-13 Iwata * timidity/ao_a.c: Add. * configure.in: Add libao support * timidity/output.c: ditto. * timidity/Makefile.am (EXTRA_timidity_SOURCES): ditto. * timidity/timidity.c (parse_opt_h): ditto. 2004-04-12 Kentaro Sato * timidity/common.[ch], timidity/timidity.c: New syntax of *.cfg: $VARIABLE / ${VARIABLE} They are replaced with the specific string before tokenizing. $basedir is the only implemented one, which represents the base directory of the cfg file being parsed. 2004-03-31 URABE Shyouhei * configure.in: Change version to 'current' (timidity:3161) 2004-03-29 URABE Shyouhei * Makefile.am (EXTRA_DIST): Add entry for ChangeLog.2 * configure.in: Change version to 'development' * ChangeLog.2: Add * ChangeLog: Wipe For the changes before 2.13.0, see ChangeLog.2 TiMidity++-2.13.2/INSTALL0100644004711200001440000004247210020566717013743 0ustar tamukiusers====================================================================== TiMidity++ Installation guide Masanao Izumo Mar.01.2004 version 2.13.0 or later ====================================================================== This document describes how to install TiMidity++ for your UNIX-like machine. You can configure and make timidity.exe on the Cygwin environment of Windows 95/98/Me/NT/2000/XP/2003. If you are in Windows, install Cygwin (or mingw) if you do not have them. Today's Macintosh has FreeBSD userland, so things described here would fly. Methods for older Macintosh ("Classic") are not described here. ====================================================================== Basic Installation ====================================================================== TiMidity++ uses GNU autotools to build. So the simplest way to compile this package is: 1. "cd" to the directory containing TiMidity++'s source code and type "./configure" to configure the package for your system. If you are using csh on an old version of System V, you might need to type "/bin/sh configure" instead to prevent csh from trying to execute configure itself. Running configure takes a while. While running, it prints some messages telling which features it is checking for. 2. Type "make" to compile the package. NOTE: this make method requires GNU make. So if your system has it as gamke, type "gmake" instead. 3. Type "make install" to install the programs and any data files and documentation. ====================================================================== More complecated way ====================================================================== The full installation process is: 1. configre 2. edit common.makefile, Makefile, timidity.h if necessery 3. make 4. installation 5. set up voice data Each processes are explained in following sections. Note that % is the shell prompt. ====================================================================== Configure ====================================================================== First, execute the following command: % /bin/sh configure --help Many options of configure will be displayed. Most of them, such as --help, --prefix=PREFIX, and so on are the regular ones. They exisits on most package that uses autoconf and you do not have to worry about their behavior. There also exists some options that is typical to TiMidity++. Main of these are the following: --enable-debug Enables debug. Things will be compiled with debugging methods/ informations. --without-x TiMidity++ uses X by default. So you must specify this option to prevent linker from linking X libraries. --enable-audio[=audio_list] Enables TiMidity++ to play MIDI files. If --enable-audio=no, TiMidity++ acts as a MIDI-to-WAVE converter. You can specify one or more audio-device listed below. * default: Automatically select audio device. * oss: OSS /dev/dsp * sun: SunOS /dev/audio * hpux: hp-ux /dev/audio * irix: IRIX audio library * mme: OSF/1 MME * sb_dsp: BSD/OS 2.0 /dev/sb_dsp * w32: Windows MMS * darwin: darwin(Mac OS X)'s CoreAudio frameowrk * alsa: ALSA pcm device * alib: hp-ux network audio (Alib) * nas: NAS * portaudio: PortAudio * jack: JACK * arts: aRts * esd: EsounD * vorbis: ogg vorbis * gogo: mp3 Gogo-No-Coder (Windows only) --enable-interface[=interface_list] --enable-dynamic[=interface_list] Specify which interface to use. If you use --enable-dynamic instead of --enable-interface, the interfaces specified will be linked dynamically and the binary size would become a bit smaller. You can select one or more interfaces listed below. * ncurses: ncurses interface. * slang: S-Lang interface. * motif: Motif interface. Motif interface also works under Lestiff. * tcltk: Tcl/Tk interface. * emacs: Emacs front-end. Type M-x timidity to invoke. * vt100: The full-screen interface using vt100 terminal control codes. * xaw: X Athena Widget interface. * xskin: X skin interface. * gtk: GTK+ interface. * w32gui: Build as Windows GUI binary. * winsyn: Build as TiMidity++ Windows Synthesizer server. * alsaseq: Build as ALSA sequencer client. Note that --enable-interface=INTERFACE1,INTERFACE2,... equals as --enable-INTERFACE1=yes --enable-INTERFACE2=yes ... and for the same way, --enable-dynamic=INTERFACE1,INTERFACE2,... equals as --enable-INTERFACE1=dynamic --enable-INTERFACE2=dynamic ... --enable-network Enables network support. This will allow TiMidity++ to open a MIDI file via network. You can specify the location of MIDI files by http://foo.com.tw/bar/baz.mid - like format. --enable-spectrogram With this option specified, TiMidity++ can open a window on X and show sound-spectrogram there. --enable-wrd WRD is a Japanese local lyric-contents format. This option enables WRD interface. * Environment variables and flags to pass to configure Some MIDI files eat too much CPU power. If you choose correct optimizing method, TiMidity++ can play such MIDI files smoothly. You can tell configure which optimizing method to use by following environmental variables: CC the C compiler command e.g. "/usr/bin/gcc" CFLAGS flags to pass to ${CC} e.g. "-O2 -pipe" LDFLAGS flags to pass to linker e.g. "-L/usr/gnu/lib" CPPFLAGS flags to pass to preprocessor e.g. "-traditional-cpp" Your compiler may have many optimization flags. For example, in case of ultrasparc/gcc, you can specify: % env CFLAGS='-O3 -Wall -mv8 -funroll-all-loops -fomit-frame-pointer \ -mcpu=ultrasparc' /bin/sh configure [configure-options]... and the binary will (hopefully) run faster. ====================================================================== Edit some files ====================================================================== If make fails, or if you want to change some parameters, edit common.makefile, Makefile, or timidity.h manually. * Parameters in timidity.h There are some options that are hard-coded into timidity binary. They are # define-ed in timidity.h. You have to change things there if you want to change these flags. ** CONFIG_FILE Edit CONFIG_FILE to your convenience. By default, #define CONFIG_FILE DEFAULT_PATH "/timidity.cfg" are recommended. DEFAULT_PATH is the same as TIMID_DIR in Makefile. If you want to place it to another path, specify as the following: #define CONFIG_FILE "/etc/timidity.cfg" ** DECOMPRESSOR_LIST The file extractor (please ignore in Windows). By default: #define DECOMPRESSOR_LIST { \ ".gz", "gunzip -c %s", \ ".bz2", "bunzip2 -c %s", \ ".Z", "zcat %s", \ ".zip", "unzip -p %s", \ ".lha", "lha -pq %s", \ ".lzh", "lha -pq %s", \ ".shn", "shorten -x %s -", \ 0 } TiMidity++ can handle some of archive format directly. But other format will use this extractor. ** PATCH_CONVERTERS Configuration of of patch file converter (please ignore in Windows). By default: #define PATCH_CONVERTERS { \ ".wav", "wav2pat %s", \ 0 } ** PATCH_EXT_LIST Configuration of extensions of GUS/patch file. If specified in this configuration, the extension can omit in all *.cfg. By default: #define PATCH_EXT_LIST { \ ".pat", \ ".shn", ".pat.shn", \ ".gz", ".pat.gz", \ ".bz2", ".pat.bz2", \ 0 } ** DEFAULT_PROGRAM Configuration of default instrument. By default: #define DEFAULT_PROGRAM 0 If no Program Change event, this program name are adopted. Usually 0 is Piano. ** DEFAULT_DRUMCHANNELS Configuration of drum channel. By default: #define DEFAULT_DRUMCHANNELS {10, -1} Numbers are the list of drum channels, and -1 is the terminator. For example, if you wish to default drum channel be 10 and 16, #define DEFAULT_DRUMCHANNELS {10, 16, -1} This channel can change in command line option. ** FLOAT_T Type of floating point number. Choose one of these: * typedef double FLOAT_T; * typedef float FLOAT_T; Many machine which has FPU results faster operations with double than that with float. But some machine results contrary. ** (MAX|MIN)_OUTPUT_RATE Minimum/maximum range of playing sample rate. By default: #define MIN_OUTPUT_RATE 4000 #define MAX_OUTPUT_RATE 65000 ** DEFAULT_AMPLIFICATION Default value of master volume. By default: #define DEFAULT_AMPLIFICATION 70 This number is the percentage of max volume. This default value will be nice in any occasions. This number can specify in command line option (-A). ** DEFAULT_RATE Default sampling rate. By default: #define DEFAULT_RATE 44100 If you have much CPU power, DAT quality GUS/patch and want to listen funny sound, #define DEFAULT_RATE 48000 is good solution. ** DEFAULT_VOICES Configuration of default polyphony numbers. By default: #define DEFAULT_VOICES 256 DEFAULT_VOICE is the polyphony number in boot-time. This value is configurable by the command line option (-p) from 1 to until memory is allowed. If your machine has much CPU power, #define DEFAULT_VOICES 512 enables good harmony. ** AUDIO_BUFFER_BITS Size of internal buffer. By default: #define AUDIO_BUFFER_BITS 12 I guess this values no need to change. ** CONTROLS_PER_SECOND TiMidity++ do not calculate every envelope changes, but calculate some samples at one time. Small controls yields better quality sound, but also eat much CPU time. By default: #define CONTROLS_PER_SECOND 1000 This can be changed from command line. Leave as it is. ** DEFAULT_RESAMPLATION Type of interpolation engine. By default: #define DEFAULT_RESAMPLATION resample_gauss This definition cause TiMidity++ to Gauss-like interpolation in re- sampling, and the quality of sound would be nice. But it eats CPU powers. I recommend define it if your machine has much power. Other choices are (sorted by their speed): #define DEFAULT_RESAMPLATION resample_none #define DEFAULT_RESAMPLATION resample_linear #define DEFAULT_RESAMPLATION resample_lagrange #define DEFAULT_RESAMPLATION resample_cspline #define DEFAULT_RESAMPLATION resample_gauss #define DEFAULT_RESAMPLATION resample_newton Interpolation methods are changeable from the command line. If you want to prevent users from doing so, uncomment next line and define as this: #define FIXED_RESAMPLATION ** USE_DSP_EFFECT Configuration of USE_DSP_EFFECT to refine chorus, delay, EQ and insertion effect. Default enabled. ** LOOKUP_HACK Configuration of LOOKUP_HACK. By default, this features are undefined like this: /* #define LOOKUP_HACK */ /* #define LOOKUP_INTERPOLATION */ This option saves a little CPU power, but sound quality would decrease noticeably. If your machine suffers from lack of CPU power, enable it. ** SMOOTH_MIXING Defining this greatly reduces popping due to large volume/pan changes. This is definitely worth the slight increase in CPU usage. ** FAST_DECAY Configuration of FAST_DECAY. By default: /* #define FAST_DECAY */ This option makes envelopes twice as fast and saves CPU power. But since the release time of voices is shorten, the sound would be poor. This feature is controllable in command line option. ** FRACTION_BITS TiMidity++ uses fixed-point calculation. Its default is #define FRACTION_BITS 12 and you don't have to change this value. ** ADJUST_SAMPLE_VOLUMES Configuration of adjusting amplitude of GUS/patch. By default: #define ADJUST_SAMPLE_VOLUMES This option makes TiMidity to adjust amplitudes of each GUS/patch to same volume. ** DENGEROUS_RENICE By default this feature is disabled: /* #define DANGEROUS_RENICE -15 */ If you want to increase process priority of TiMidity++ by using setuid root enable this option. This option is only available in UNIX. Once you enabled this option, you should install timidity with the follow- ing procedure: # chown root /usr/local/bin/timidity # chmod u+s /usr/local/bin/timidity Note: You should not set setuid to timidity if DANGEROUS_RENICE isn't enabled. ** MAX_DIE_TIME If this value is too small, click noise would be come. Default is: #define MAX_DIE_TIME 20 and I recommend this value leave to this. ** LOOKUP_SINE #define LOOKUP_SINE On some machines (especially PCs without math coprocessors), looking up sine values in a table will be significantly faster than computing them on the fly. I recommend define it. ** PRECALC_LOOPS Configuration of optimizing re-sampling. By default: #define PRECALC_LOOPS These may not in fact be faster on your particular machine and compiler. ** USE_LDEXP Configuration of use of ldexp(). By default this feature is disabled: /* #define USE_LDEXP */ If your machine can multiply floating point number with ldexp() faster than other method, enable this option. ** DEFAULT_CACHE_DATA_SIZE Size of pre-re-sampling cache. By default: #define DEFAULT_CACHE_DATA_SIZE (2*1024*1024) This can be changed from command line, so you don't have to change here. * Configurations about network TiMidity++ can access any files via networks with URL. This feature are configurable in Makefile. If you have enabled this feature in Makefile (configure --enable-network), configure the following macros: ** MAIL_DOMAIN specifies domain name of your name address. If your name address is "iz@onicos.co.jp" set the macro: #define MAIL_DOMAIN "@onicos.co.jp" ** MAIL_NAME specifies mail name of yours if in Windows. In UNIX, uncomment it. For example, your name address is "iz@onicos.co.jp" set the macro: #define MAIL_NAME "iz" ** TMPDIR Configuration of temporary directory. By default, this option is disabled: /* #define TMPDIR "/var/tmp" */ In UNIX, if this option is disabled TiMidity++ creates temporary files in the path specified by the environment variable TMPDIR. If environ- ment variable TMPDIR also isn't defined, TiMidity++ creates temporary files in /tmp. In Windows, TMPDIR variable are ignored. So you should specify the temporary path with this macro. ** GS_DRUMPART Recognizing GS drum part by GS exclusive message. #define GS_DRUMPART enables to recognize GS exclusive message to set drum part. /* #define GS_DRUMPART */ disables this feature. * Japanese-text-handling related options There are some options for Japanese handling. ** JAPANESE If your system is in Japanese environment, define #define JAPANESE otherwise comment it out like /* #define JAPANESE */ ** OUTPUT_TEXT_CODE specifies output text code (in Japanese environment). You should specify appropriate code name to OUTPUT_TEXT_CODE macro. The follow- ing strings are available: AUTO Auto conversion by `LANG' environment variable (UNIX only) ASCII Convert unreadable characters to '.' (0x2e) NOCNV No conversion 1251 Convert from windows-1251 to koi8-r EUC eucJP JIS JIS SJIS shift-JIS In Japanized UNIX system, all of above are available. In Windows, "ASCII", "NOCNV", "SJIS" are available. If your environment cannot handle Japanese, specify "ASCII" or "NOCNV" alternatively. ** MODULATION_WHEEL_ALLOW ** PORTAMENTO_ALLOW ** NRPN_VIBRATO_ALLOW ** REVERB_CONTROL_ALLOW ** FREEVERB_CONTROL_ALLOW ** CHORUS_CONTROL_ALLOW ** SURROUND_CHORUS_ALLOW ** GM_CHANNEL_PRESSURE_ALLOW ** VOICE_CHAMBERLIN_LPF_ALLOW ** VOICE_MOOG_LPF_ALLOW ** MODULATION_ENVELOPE_ALLOW ** ALWAYS_TRACE_TEXT_META_EVENT ** OVERLAP_VOICE_ALLOW ** TEMPER_CONTROL_ALLOW Controllers of MIDI actions. By default: #define MODULATION_WHEEL_ALLOW #define PORTAMENTO_ALLOW #define NRPN_VIBRATO_ALLOW /* #define REVERB_CONTROL_ALLOW */ #define FREEVERB_CONTROL_ALLOW #define CHORUS_CONTROL_ALLOW /* #define SURROUND_CHORUS_ALLOW */ /* #define GM_CHANNEL_PRESSURE_ALLOW */ #define VOICE_CHAMBERLIN_LPF_ALLOW /* #define VOICE_MOOG_LPF_ALLOW */ /* #define MODULATION_ENVELOPE_ALLOW */ /* #define ALWAYS_TRACE_TEXT_META_EVENT */ #define OVERLAP_VOICE_ALLOW #define TEMPER_CONTROL_ALLOW These values are configurable in command line options. So you may leave these in default value. ====================================================================== Make ====================================================================== Make section has nothing particular to write. Just say "make" ...Oops, almost forgot, TiMidity++'s Makefile needs GNU version of make. If you do not have, get one first. If you have one in a different name than "make", type its true name instead. Installation On UNIX and clones, you can type "make install" to install all files. Or you can select following targets: install.bin installs executable filles install.tk installs Tcl/Tk interface install.el installs Emacs interface install.man installs man files install installs everything I strongly recommend you to check the install destinations and files by setteing -n flag like % make -n ====================================================================== Search for voice data ====================================================================== TiMidity++ uses Either GUS/patch, or SoundFont(, or both) as the voice data to play. You must get a SoundFont or GUS/patch files, and make the configuration file. You must make the configuration file (*.cfg). By default, timidity.cfg is /usr/local/share/timidity/timidity.cfg (or C:\WINDOWS\TIMIDITY.CFG on Windows). And please check the following sites for many voice(patch) data: * http://www.onicos.com/staff/iz/timidity/link.html#gus * http://www.onicos.com/staff/iz/timidity/dist/cfg/ (Some sample *.cfg's) * http://www.i.h.kyoto-u.ac.jp/~shom/timidity/ (10M and 4M patches) * ftp://ftp.cdrom.com/pub/gus/sound/patches/files/ (GUS site) If you got funny voice archive, extract it to appropriate directory and configure *.cfg files with the name and path of these voice datas. TiMidity++-2.13.2/Makefile.am0100644004711200001440000000417610031634122014731 0ustar tamukiusers# TiMidity++ -- MIDI to WAVE converter and player # Copyright (C) 1999-2002 Masanao Izumo # Copyright (C) 1995 Tuukka Toivonen # # 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # # This Makefile is known to work with GNU make. ACLOCAL_AMFLAGS = -I autoconf M4DIR = autoconf SUBDIRS = \ autoconf \ utils \ libarc \ libunimod \ interface \ timidity \ doc \ script \ configs EXTRA_DIST = \ ChangeLog.1 \ ChangeLog.2 \ INSTALL.ja \ README.ja \ TiMidity-uj.ad.in \ TiMidity.ad.in TOOLSDIR = timidity-tools UMPDIR = ump dynamics: cd interface; $(MAKE) $@ install.man install.manj: cd doc; $(MAKE) $@ install.tk: cd interface; $(MAKE) $@ install.el: cd interface; $(MAKE) $@ install.bin: cd timidity; $(MAKE) install ## ## Targets for timidity-tools ## tools:: tools-targets cd $(TOOLSDIR); $(MAKE) tools-targets: $(TOOLSDIR)/Makefile install.tools: cd $(TOOLSDIR); $(MAKE) install $(TOOLSDIR)/Makefile: $(TOOLSDIR)/Makefile.in config.status CONFIG_HEADERS='' CONFIG_FILES=$(TOOLSDIR)/Makefile $(SHELL) ./config.status ## for developers #$(TOOLSDIR)/Makefile.in: $(TOOLSDIR)/Makefile.am # $(AUTOMAKE) --gnu $(TOOLSDIR)/Makefile ## ## Targets for UMP ## ump: ump-targets cd $(UMPDIR); $(MAKE) ump ump-targets: $(UMPDIR)/Makefile $(UMPDIR)/Makefile: $(UMPDIR)/Makefile.in config.status CONFIG_HEADERS='' CONFIG_FILES=ump/Makefile $(SHELL) ./config.status ## for developers #$(UMPDIR)/Makefile.in: $(UMPDIR)/Makefile.am # $(AUTOMAKE) --gnu $(UMPSDIR)/Makefile TiMidity++-2.13.2/Makefile.in0100644004711200001440000005677210124332424014756 0ustar tamukiusers# Makefile.in generated by automake 1.7.6 from Makefile.am. # @configure_input@ # Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 # 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@ # TiMidity++ -- MIDI to WAVE converter and player # Copyright (C) 1999-2002 Masanao Izumo # Copyright (C) 1995 Tuukka Toivonen # # 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # # This Makefile is known to work with GNU make. srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = . am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ 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 = : host_triplet = @host@ ACLOCAL = @ACLOCAL@ ALSA_CFLAGS = @ALSA_CFLAGS@ ALSA_LIBS = @ALSA_LIBS@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AO_CFLAGS = @AO_CFLAGS@ AO_LIBS = @AO_LIBS@ ARTS_CFLAGS = @ARTS_CFLAGS@ ARTS_CONFIG = @ARTS_CONFIG@ ARTS_LIBS = @ARTS_LIBS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ A_so_libs = @A_so_libs@ BORLANDC_FALSE = @BORLANDC_FALSE@ BORLANDC_LDFLAGS = @BORLANDC_LDFLAGS@ BORLANDC_START = @BORLANDC_START@ BORLANDC_TRUE = @BORLANDC_TRUE@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGNUS_FALSE = @CYGNUS_FALSE@ CYGNUS_TRUE = @CYGNUS_TRUE@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ELFILES = @ELFILES@ EMACS = @EMACS@ ENABLE_ALSASEQ_FALSE = @ENABLE_ALSASEQ_FALSE@ ENABLE_ALSASEQ_TRUE = @ENABLE_ALSASEQ_TRUE@ ENABLE_DYNAMIC_TCLTK_FALSE = @ENABLE_DYNAMIC_TCLTK_FALSE@ ENABLE_DYNAMIC_TCLTK_TRUE = @ENABLE_DYNAMIC_TCLTK_TRUE@ ENABLE_DYNAMIC_XAW_FALSE = @ENABLE_DYNAMIC_XAW_FALSE@ ENABLE_DYNAMIC_XAW_TRUE = @ENABLE_DYNAMIC_XAW_TRUE@ ENABLE_EMACS_FALSE = @ENABLE_EMACS_FALSE@ ENABLE_EMACS_TRUE = @ENABLE_EMACS_TRUE@ ENABLE_GTK_FALSE = @ENABLE_GTK_FALSE@ ENABLE_GTK_TRUE = @ENABLE_GTK_TRUE@ ENABLE_MOTIF_FALSE = @ENABLE_MOTIF_FALSE@ ENABLE_MOTIF_TRUE = @ENABLE_MOTIF_TRUE@ ENABLE_NCURSES_FALSE = @ENABLE_NCURSES_FALSE@ ENABLE_NCURSES_TRUE = @ENABLE_NCURSES_TRUE@ ENABLE_NETWORK_FALSE = @ENABLE_NETWORK_FALSE@ ENABLE_NETWORK_TRUE = @ENABLE_NETWORK_TRUE@ ENABLE_PLUGIN_FALSE = @ENABLE_PLUGIN_FALSE@ ENABLE_PLUGIN_TRUE = @ENABLE_PLUGIN_TRUE@ ENABLE_PORTMIDISYN_FALSE = @ENABLE_PORTMIDISYN_FALSE@ ENABLE_PORTMIDISYN_TRUE = @ENABLE_PORTMIDISYN_TRUE@ ENABLE_SERVER_FALSE = @ENABLE_SERVER_FALSE@ ENABLE_SERVER_TRUE = @ENABLE_SERVER_TRUE@ ENABLE_SLANG_FALSE = @ENABLE_SLANG_FALSE@ ENABLE_SLANG_TRUE = @ENABLE_SLANG_TRUE@ ENABLE_SOUND_SPEC_FALSE = @ENABLE_SOUND_SPEC_FALSE@ ENABLE_SOUND_SPEC_TRUE = @ENABLE_SOUND_SPEC_TRUE@ ENABLE_TCLTK_FALSE = @ENABLE_TCLTK_FALSE@ ENABLE_TCLTK_TRUE = @ENABLE_TCLTK_TRUE@ ENABLE_VT100_FALSE = @ENABLE_VT100_FALSE@ ENABLE_VT100_TRUE = @ENABLE_VT100_TRUE@ ENABLE_W32GUI_FALSE = @ENABLE_W32GUI_FALSE@ ENABLE_W32GUI_TRUE = @ENABLE_W32GUI_TRUE@ ENABLE_W32G_SYN_FALSE = @ENABLE_W32G_SYN_FALSE@ ENABLE_W32G_SYN_TRUE = @ENABLE_W32G_SYN_TRUE@ ENABLE_WINSYN_FALSE = @ENABLE_WINSYN_FALSE@ ENABLE_WINSYN_TRUE = @ENABLE_WINSYN_TRUE@ ENABLE_WRD_FALSE = @ENABLE_WRD_FALSE@ ENABLE_WRD_TRUE = @ENABLE_WRD_TRUE@ ENABLE_XAW_FALSE = @ENABLE_XAW_FALSE@ ENABLE_XAW_TRUE = @ENABLE_XAW_TRUE@ ENABLE_XSKIN_FALSE = @ENABLE_XSKIN_FALSE@ ENABLE_XSKIN_TRUE = @ENABLE_XSKIN_TRUE@ ESD_CFLAGS = @ESD_CFLAGS@ ESD_CONFIG = @ESD_CONFIG@ ESD_LIBS = @ESD_LIBS@ EXEEXT = @EXEEXT@ EXTRALIBS = @EXTRALIBS@ GTK_CFLAGS = @GTK_CFLAGS@ GTK_CONFIG = @GTK_CONFIG@ GTK_LIBS = @GTK_LIBS@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INTERFACE_SRCS = @INTERFACE_SRCS@ LDFLAGS = @LDFLAGS@ LIBFLAC_CFLAGS = @LIBFLAC_CFLAGS@ LIBFLAC_LIBS = @LIBFLAC_LIBS@ LIBOBJS = @LIBOBJS@ LIBOGGFLAC_CFLAGS = @LIBOGGFLAC_CFLAGS@ LIBOGGFLAC_LIBS = @LIBOGGFLAC_LIBS@ LIBS = @LIBS@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ MAKEINFO = @MAKEINFO@ MSYS_FALSE = @MSYS_FALSE@ MSYS_TRUE = @MSYS_TRUE@ NEEDDLOPEN_FALSE = @NEEDDLOPEN_FALSE@ NEEDDLOPEN_TRUE = @NEEDDLOPEN_TRUE@ NEEDGETOPT_FALSE = @NEEDGETOPT_FALSE@ NEEDGETOPT_TRUE = @NEEDGETOPT_TRUE@ NETSRCS = @NETSRCS@ OBJEXT = @OBJEXT@ OGG_CFLAGS = @OGG_CFLAGS@ OGG_LIBS = @OGG_LIBS@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PKG_CONFIG = @PKG_CONFIG@ P_so_libs = @P_so_libs@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ SHCFLAGS = @SHCFLAGS@ SHELL = @SHELL@ SHLD = @SHLD@ STRIP = @STRIP@ SYSEXTRAS = @SYSEXTRAS@ T_so_libs = @T_so_libs@ VCPP_FALSE = @VCPP_FALSE@ VCPP_LDFLAGS = @VCPP_LDFLAGS@ VCPP_TRUE = @VCPP_TRUE@ VERSION = @VERSION@ VORBISENC_LIBS = @VORBISENC_LIBS@ VORBISFILE_LIBS = @VORBISFILE_LIBS@ VORBIS_CFLAGS = @VORBIS_CFLAGS@ VORBIS_LIBS = @VORBIS_LIBS@ W32READDIR_FALSE = @W32READDIR_FALSE@ W32READDIR_TRUE = @W32READDIR_TRUE@ WATCOM_C_FALSE = @WATCOM_C_FALSE@ WATCOM_C_TRUE = @WATCOM_C_TRUE@ WATCOM_LDFLAGS = @WATCOM_LDFLAGS@ WISH = @WISH@ W_so_libs = @W_so_libs@ X_CFLAGS = @X_CFLAGS@ X_EXTRA_LIBS = @X_EXTRA_LIBS@ X_LIBS = @X_LIBS@ X_PRE_LIBS = @X_PRE_LIBS@ a_so_libs = @a_so_libs@ ac_ct_CC = @ac_ct_CC@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ datadir = @datadir@ dynamic_targets = @dynamic_targets@ e_so_libs = @e_so_libs@ exec_prefix = @exec_prefix@ g_so_libs = @g_so_libs@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ i_so_libs = @i_so_libs@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ k_so_libs = @k_so_libs@ libdir = @libdir@ libexecdir = @libexecdir@ lispdir = @lispdir@ localstatedir = @localstatedir@ m_so_libs = @m_so_libs@ mandir = @mandir@ n_so_libs = @n_so_libs@ oldincludedir = @oldincludedir@ p_so_libs = @p_so_libs@ prefix = @prefix@ program_transform_name = @program_transform_name@ r_so_libs = @r_so_libs@ s_so_libs = @s_so_libs@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ so = @so@ sysconfdir = @sysconfdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ tcltk_dep = @tcltk_dep@ timidity_LDFLAGS = @timidity_LDFLAGS@ w_so_libs = @w_so_libs@ ACLOCAL_AMFLAGS = -I autoconf M4DIR = autoconf SUBDIRS = \ autoconf \ utils \ libarc \ libunimod \ interface \ timidity \ doc \ script \ configs EXTRA_DIST = \ ChangeLog.1 \ ChangeLog.2 \ INSTALL.ja \ README.ja \ TiMidity-uj.ad.in \ TiMidity.ad.in TOOLSDIR = timidity-tools UMPDIR = ump subdir = . ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 mkinstalldirs = $(SHELL) $(top_srcdir)/autoconf/mkinstalldirs CONFIG_HEADER = config.h interface.h CONFIG_CLEAN_FILES = common.makefile TiMidity.ad TiMidity-uj.ad DIST_SOURCES = RECURSIVE_TARGETS = info-recursive dvi-recursive pdf-recursive \ ps-recursive install-info-recursive uninstall-info-recursive \ all-recursive install-data-recursive install-exec-recursive \ installdirs-recursive install-recursive uninstall-recursive \ check-recursive installcheck-recursive DIST_COMMON = README AUTHORS COPYING ChangeLog INSTALL Makefile.am \ Makefile.in NEWS TODO TiMidity-uj.ad.in TiMidity.ad.in \ aclocal.m4 common.makefile.in config.h.in configure \ configure.in interface.h.in DIST_SUBDIRS = $(SUBDIRS) all: config.h interface.h $(MAKE) $(AM_MAKEFLAGS) all-recursive .SUFFIXES: am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ configure.lineno $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) cd $(top_srcdir) && \ $(AUTOMAKE) --gnu Makefile Makefile: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.in $(top_builddir)/config.status cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe) $(top_builddir)/config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) $(SHELL) ./config.status --recheck $(srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES) cd $(srcdir) && $(AUTOCONF) $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ configure.in autoconf/alsa.m4 autoconf/ao.m4 autoconf/arts.m4 autoconf/esd.m4 autoconf/gtk-2.0.m4 autoconf/gtk.m4 autoconf/libFLAC.m4 autoconf/libOggFLAC.m4 autoconf/ogg.m4 autoconf/utils.m4 autoconf/vorbis.m4 cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) config.h: stamp-h1 @if test ! -f $@; then \ rm -f stamp-h1; \ $(MAKE) stamp-h1; \ else :; fi stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status @rm -f stamp-h1 cd $(top_builddir) && $(SHELL) ./config.status config.h $(srcdir)/config.h.in: @MAINTAINER_MODE_TRUE@ $(top_srcdir)/configure.in $(ACLOCAL_M4) cd $(top_srcdir) && $(AUTOHEADER) touch $(srcdir)/config.h.in interface.h: stamp-h2 @if test ! -f $@; then \ rm -f stamp-h2; \ $(MAKE) stamp-h2; \ else :; fi stamp-h2: $(srcdir)/interface.h.in $(top_builddir)/config.status @rm -f stamp-h2 cd $(top_builddir) && $(SHELL) ./config.status interface.h $(srcdir)/interface.h.in: @MAINTAINER_MODE_TRUE@ $(top_srcdir)/configure.in $(ACLOCAL_M4) cd $(top_srcdir) && $(AUTOHEADER) touch $(srcdir)/interface.h.in distclean-hdr: -rm -f config.h stamp-h1 interface.h stamp-h2 common.makefile: $(top_builddir)/config.status common.makefile.in cd $(top_builddir) && $(SHELL) ./config.status $@ TiMidity.ad: $(top_builddir)/config.status TiMidity.ad.in cd $(top_builddir) && $(SHELL) ./config.status $@ TiMidity-uj.ad: $(top_builddir)/config.status TiMidity-uj.ad.in cd $(top_builddir) && $(SHELL) ./config.status $@ uninstall-info-am: # 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. $(RECURSIVE_TARGETS): @set fnord $$MAKEFLAGS; amf=$$2; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ list='$(SUBDIRS)'; 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; \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" mostlyclean-recursive clean-recursive distclean-recursive \ maintainer-clean-recursive: @set fnord $$MAKEFLAGS; amf=$$2; \ dot_seen=no; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ rev=''; for subdir in $$list; do \ if test "$$subdir" = "."; then :; else \ rev="$$subdir $$rev"; \ fi; \ done; \ rev="$$rev ."; \ target=`echo $@ | sed s/-recursive//`; \ for subdir in $$rev; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ done && test -z "$$fail" tags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ done ctags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ done ETAGS = etags ETAGSFLAGS = CTAGS = ctags CTAGSFLAGS = tags: TAGS ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ mkid -fID $$unique TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in interface.h.in $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ if (etags --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ else \ include_option=--include; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test -f $$subdir/TAGS && \ tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ list='$(SOURCES) $(HEADERS) config.h.in interface.h.in $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ test -z "$(ETAGS_ARGS)$$tags$$unique" \ || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$tags $$unique ctags: CTAGS CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.h.in interface.h.in $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) config.h.in interface.h.in $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ test -z "$(CTAGS_ARGS)$$tags$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$tags $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && cd $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) $$here distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) top_distdir = . distdir = $(PACKAGE)-$(VERSION) am__remove_distdir = \ { test ! -d $(distdir) \ || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \ && rm -fr $(distdir); }; } GZIP_ENV = --best distuninstallcheck_listfiles = find . -type f -print distcleancheck_listfiles = find . -type f -print distdir: $(DISTFILES) $(am__remove_distdir) mkdir $(distdir) $(mkinstalldirs) $(distdir)/. @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ list='$(DISTFILES)'; for file in $$list; do \ case $$file in \ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ esac; \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ $(mkinstalldirs) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ if test -d $$d/$$file; then \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test -d $(distdir)/$$subdir \ || mkdir $(distdir)/$$subdir \ || exit 1; \ (cd $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$(top_distdir)" \ distdir=../$(distdir)/$$subdir \ distdir) \ || exit 1; \ fi; \ done -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -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 $(SHELL) $(install_sh) -c -m a+r {} {} \; \ || chmod -R a+r $(distdir) dist-gzip: distdir $(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(am__remove_distdir) dist-bzip2: distdir $(AMTAR) chof - $(distdir) | bzip2 -9 -c >$(distdir).tar.bz2 $(am__remove_distdir) dist dist-all: distdir $(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(AMTAR) chof - $(distdir) | bzip2 -9 -c >$(distdir).tar.bz2 $(am__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 $(am__remove_distdir) GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(AMTAR) xf - chmod -R a-w $(distdir); chmod a+w $(distdir) mkdir $(distdir)/_build mkdir $(distdir)/_inst chmod a-w $(distdir) dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ && cd $(distdir)/_build \ && ../configure --srcdir=.. --prefix="$$dc_install_base" \ $(DISTCHECK_CONFIGURE_FLAGS) \ && $(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 ../.. && $(mkinstalldirs) "$$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-gzip \ && rm -f $(distdir).tar.gz \ && $(MAKE) $(AM_MAKEFLAGS) distcleancheck $(am__remove_distdir) @echo "$(distdir).tar.gz is ready for distribution" | \ sed 'h;s/./=/g;p;x;p;x' distuninstallcheck: @cd $(distuninstallcheck_dir) \ && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \ || { 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 config.h interface.h 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: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -rm -f Makefile $(CONFIG_CLEAN_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) distclean-am: clean-am distclean-generic distclean-hdr distclean-tags dvi: dvi-recursive dvi-am: info: info-recursive info-am: install-data-am: install-exec-am: install-info: install-info-recursive install-man: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -rf $(top_srcdir)/autom4te.cache 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-info-am uninstall-info: uninstall-info-recursive .PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am clean \ clean-generic clean-recursive ctags ctags-recursive dist \ dist-all dist-bzip2 dist-gzip distcheck distclean \ distclean-generic distclean-hdr distclean-recursive \ distclean-tags distcleancheck distdir distuninstallcheck dvi \ dvi-am dvi-recursive info info-am info-recursive install \ install-am install-data install-data-am install-data-recursive \ install-exec install-exec-am install-exec-recursive \ install-info install-info-am install-info-recursive install-man \ install-recursive install-strip installcheck installcheck-am \ installdirs installdirs-am installdirs-recursive \ maintainer-clean maintainer-clean-generic \ maintainer-clean-recursive mostlyclean mostlyclean-generic \ mostlyclean-recursive pdf pdf-am pdf-recursive ps ps-am \ ps-recursive tags tags-recursive uninstall uninstall-am \ uninstall-info-am uninstall-info-recursive uninstall-recursive dynamics: cd interface; $(MAKE) $@ install.man install.manj: cd doc; $(MAKE) $@ install.tk: cd interface; $(MAKE) $@ install.el: cd interface; $(MAKE) $@ install.bin: cd timidity; $(MAKE) install tools:: tools-targets cd $(TOOLSDIR); $(MAKE) tools-targets: $(TOOLSDIR)/Makefile install.tools: cd $(TOOLSDIR); $(MAKE) install $(TOOLSDIR)/Makefile: $(TOOLSDIR)/Makefile.in config.status CONFIG_HEADERS='' CONFIG_FILES=$(TOOLSDIR)/Makefile $(SHELL) ./config.status #$(TOOLSDIR)/Makefile.in: $(TOOLSDIR)/Makefile.am # $(AUTOMAKE) --gnu $(TOOLSDIR)/Makefile ump: ump-targets cd $(UMPDIR); $(MAKE) ump ump-targets: $(UMPDIR)/Makefile $(UMPDIR)/Makefile: $(UMPDIR)/Makefile.in config.status CONFIG_HEADERS='' CONFIG_FILES=ump/Makefile $(SHELL) ./config.status #$(UMPDIR)/Makefile.in: $(UMPDIR)/Makefile.am # $(AUTOMAKE) --gnu $(UMPSDIR)/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: TiMidity++-2.13.2/NEWS0100644004711200001440000003474310127771427013417 0ustar tamukiusers04/10/2004 * Version 2.13.2 This is a bug fix release that fixes the compile error on Win32 platform. All other platforms aren't affected to this, so you don't have to update if you are not compiling TiMidity++ on Windows. 29/09/2004 * Version 2.13.1 * Newly supported output formats * libao * FLAC * Speex * config file * new syntax ${variable} : they are replaced with the specific string before tokenizing. ${basedir} is the only implemented one, which represents the base directory of the cfg file being parsed. * Windows specific * support for MP3 GOGO output in CUI mode * support for Portaudio DLL * support for FLAC/OggFLAC DLL * interfaces * GTK+2 support * new app-defaults for XAW interface. 29/03/2004 * Verison 2.13.0 * Newly supported platforms * Mac OS X native * ALSA 0.9 and later * Ogg Vorbis RC3 and later * aRts * JACK * Windows Synthesizer mode (TWSYMTH) * PortAudio * PortMIDI Synthesizer mode * Newly supported input format * MFi (Melody format for i-Mode) * RMI * Support for Tcl/Tk 8.3/8.4 * Temperament control * Trial Pure intonation playing (-Zpure) * Support for Temperament Tonality Control Tuning (MTS) * Support for Temperament Type Control Tuning (MTS) * Support for User-defined Temperament Entry (MTS) * Channel mute by temperament type * Not pseudo reverb engine(Schroeder's & Freeverb) * Plate reverberator * Modulation envelope support * voice-by-voice LPF (Chamberlin & Moog VCF) * Insertion/Varidation effect support * Distortion * Overdrive * OD1 / OD2 * HEXA-CHORUS * Lo-Fi * Stereo-EQ * Support for transpose * SoundFont * Support for stereo samples * Support for SF2 scale tuning * Support for sample link * Parameter Numbers * NRPN drum pitch coarse & fine * NRPN drum instrument tva level * NRPN Vibrato Rate & Vibrato Depth * RPN tuning program select * GM2 RPN modulation range * Newly supported system exclusives * GS SysEx Pitch Offset Fine * GS SysEx tone map * GS SysEx Reverb Level * GS SysEx Reverb Time * GS SysEx Note Off * GS SysEx Velocity Sense Depth/Offset * GS SysEx TONE MAP-0 NUMBER * GS/XG SysEx Velocity Limit and Note Limit * XG SysEx reverb/chorus types * XG SysEx Drum Setup * XG Dry Level related SysEx * GM2 SysEx system ON * Support for Checksum calculation of GS SysEx * GM2 support * GM2 volume curve * GM2 pan table * GM2 SysEx Bulk Tuning Dump (MTS) * GM2 SysEx Single Note Tuning Change (MTS) * Other MIDI Tuning Standard related SysEx (see above) * Support for channel layer (GS - Rx. Channel / XG - Rcv Channel) * Support for XG Multi EQ and Part EQ * Resampling engine * modified Gauss resample * Newton polynomials * Noise shaper for 16bit output * Automatic volume compensation * User control for volume curve * volume curve's default also changed * Realtime channel mute support * Non-linear panning * Support ME_TIMESIG/ME_KEYSIG for RCP/R36/G18/G36 MIDI data * Support for RCP tempo gradation * Support for WAV and AIFF files as sample data * Support NeoWrd * Command-line options * Support for getopt_long() * too many changes. refer timidity(1) * Config file * path name to be quotable with "" * New options * note= * pan= * strip=tail * amp * fc= * q= * (trem|mod)(pitch|fc)= * fc(keyf|velf)= * qvelf= * scl(note|tune)= * ADSR-type options * New mappings for map command * gm2[drum] * sc8850[drum] * New extension commands * #extension copymap * #extension legato * #extension level * #extension playnote * #extension (reverb|chorus|delay)send * #extension damper * #extension rnddelay * New command * drumset * Project files for VC6 and VC7 are included 1/18, 2002 * Version 2.11.3 released. * New config file option "tune=" 01/12, 2002 * Version 2.11.2 released. 12/29, 2001 * Version 2.11.1 released. 12/27, 2001 * Version 2.11.0 released. * Configuration menu of Windows GUI was changed. * Supported vorbis for Windows GUI version. * Supported gogo for Windows GUI version. * (ncursese interface) Chaged from 3 to 4 digits in audio queue monitor. * (Sun audio): Enabled specify audio device file with AUDIODEV environment. * Updates Win32GUI version. * Improved GS SysEx * Added attack/release/decay-time(CC/NRPN tone/NRPN dram) * Added drum level * Added CC#94 pseudo delay (like chorus method) * Adjusted reverb level * Added resonance filter * Modified enverope attack * Adjusted velocity * Supported user drumset (SC-88) * Added some GS SysEx'es. * Upgrade develop environment: automake 1.5 + autoconf 2.5x + libtool 1.4.x * Vorbis 1.0 support * MOD to MIDI conversion. * -EFchorus=2 is default. * Support RIFF MIDI. 03/18, 2001 * Version 2.10.4 released. 03/10, 2001 * Version 2.10.3 released. 11/02, 2000 * Version 2.10.2 released. 10/18, 2000 * Version 2.10.1 released. 08/09, 2000 * Version 2.10.0 released. * Enable to write each separated wav file if `-o' command line option is omitted. The output filename is automatically generated from the input MIDI filename. The file extention is changed to ".wav". * configure: Added new options. --with-includes=DIRS Specify include directories (colon separated) --with-libraries=DIRS Specify library directories (colon separated) * Ogg Vorbis output. * ALSA MIDI sequencer client. 07/05, 2000 * Version 2.9.5 released. * Upgrade Windows version. 05/24, 2000 * Version 2.9.4 released. * Support ALSA 0.6 05/08, 2000 * Version 2.9.3 released. * Enable drum bends. This fix also enables drum chorus, mod-wheel, portament, and other drum bend controls. 04/10, 2000 * Version 2.9.2 released. 03/21, 2000 * Version 2.9.1 released. * New command line option -T n: Adjust tempo to n%; 120=play MOD files with an NTSC Amiga's timing. 02/27, 2000 * Version 2.9.0 released. * Support full module midi files. 02/07, 2000 * Version 2.8.2 released. * Support ALSA 0.5 11/29, 1999 * Version 2.8.1 released. 11/24, 1999 * Version 2.8.0 released. * In GTK, added support for printing the lyrics from .kar files and also make the text area clear between files. * New command line option: -M -M auto: Use *.mid.wav or *.mid.aiff instread of MIDI to WAVE convertion. The PCM file format must be 16bit sample and the sampling rate equals as timidity's rate. -M none: Disable this feature (default) -M : Use the specified file. * In GTK interface, added support for printing the lyrics from .kar files and also make the text area clear between files. * New configure option to choose wave interpolation in resampling. --with-spline=linear Linear interpolation (default) --with-spline=cubic Cubic interpolation --with-spline=lagrange Lagrange interpolation --with-spline=no No interplation * New command line option `-m N' to specify sustain time (msec). -m 1 Effectively behaves as if all sustains are ignored, volume ramping is the same as normal stage 3. -m 0 Disable sustain ramping, causes constant volume sustains. (default) -m 3000 A note at full volume will decay for 3 seconds once it begins to be sustained (assuming the regular stage 3 rate would not cause it to decay even longer). Softer notes will of course die sooner. 10/12, 1999 * Version 2.7.0 released. * adjust_panning_immediately (-F) is true by default. * GS Sysex for bank+program change. * Bug fix. 9/27, 1999 * Version 2.6.1 released. * Support for XG Multi Part Data parameter change SysEx events. * Added new Channel structure member `int pan_random' for random pan flag. Note that all of dynamic interfaces must be re-compiled, because the size of `Channel' structure is changed. * Bug fix. 9/21, 1999 * Version 2.6.0 released. * Some configurations and installations are changed. * -EFchorus=2 for the surround sound instead of detuned chorus. * Bug fix. 8/27, 1999 * Version 2.5.1 released. * Bug fix. 8/26, 1999 * Version 2.5.0 released. * Upgrade Windows GUI. * MIMPI WRD for TrueColor X Window works more stable. * In ncurses interface, support to display GSLCD. * In ncurses interface, Enable to display channels more than 16ch. The terminal must be able to display more than 24 rows to display more than 16ch. * On Windows, recognize both `\' and `/' as path separator if the binary is compiled with Cygwin. * Improvement for CSPLINE_INTERPOLATION and LAGRANGE_INTERPOLATION. * Less CPU% in trace playing. * Bug fix. 8/11, 1999 * Version 2.4.1 released. * Bug fix. 8/9, 1999 * Version 2.4.0 released. * Make archive library (libarc) code more simple. * On linux, fixed problem of audio queue analysing. 8/1, 1999 * Version 2.3.0 released. * Make Windows GUI code elegant. * Support MIDI to WAVE converter in Windows GUI. 7/26, 1999 * New feature: Auto polyphony reduction. 7/19, 1999 * Version 2.2.0 released. * Enabled to specify the software buffer size with `-q' option * Enabled build UMP on FreeBSD-ELF environment. 7/9, 1999 * Version 2.1.1 released. 6/10, 1999 * Version 2.1.0 released. * Enable a multi-point interpolation in resampling. Cubic spline curve and lagrange interpolation is supported. * Support linux axp * Load frequency table with -Z option. 4/28, 1999 * Version 2.0.2 released. 4/25, 1999 * Version 2.0.1 released. 4/17, 1999 Major changes in release 2.0.0: * Auto voice reduction If there is no enough machine power to play the MIDI in realtime, TiMidity automatically reduces the voice. * Audio buffering TiMidity has internal audio buffer. TiMidity doesn't start to play until this buffer is filled. * Support Windows GUI. * Support Sherry WRD. * Support NAS (Network Audio System) output. * Support EsounD output. * Enable to play the stream MIDI in realtime. The stream format is same as OSS /dev/sequencer stream. See the protocol in interface/server_c.c * Enable to assign patch from part of soundfont. * Lower CPU load average in trace playing. v1 is implemented with busy-wait-method to synchronize audio and interface, but v2 is not. * Reverb and chorus effect is enabled by default. You can disable their controls with command line option. * DEFAULT_VOICES is now 64. You can change this value to modify `timidity.h'. * Modified reverb optimaize implementation. (The algorithm is not changed) * Add sun_a.c which is modified from the original of TiMidity. And then remove audriv_sun.c because it is not used in this version. * Implement function to change the audio sample rate for 'n' interface. * `altassign' of drumset 0 is used by default. * Add -EF option for effects. Obsolete -b, -n, -EC, -Ec, -ER, -Er, and -r options. Use -EFdelay=? instead of -b?, -EFns=? instead of -n?, -EFchorus=0 instead of -EC, -EFchorus=1 instead of -Ec, -EFreverb=0 instead of -ER, -EFreverb=1 instead of -Er, -EFreverb=2 instead of -r. * Portamento control time is completely adjusted. * Expanded playlist files (.m3u, .pls, and .asx). * s/win32/w32/gi * 3/23, 1999 Released TiMidity++ v1.3.6. * In XAW interface, added new user interfaces. * 3/8, 1999 Released TiMidity++ v1.3.5. * In XAW interface, added new user interfaces. * 3/1, 1999 Released TiMidity++ v1.3.4. * Fixed some bugs and problems. * Added a new WM-icon for GTK. * 2/24, 1999 Released TiMidity++ v1.3.3. * Improve XAW interface. * Fixed some bugs and problems. * 2/10, 1999 Released TiMidity++ v1.3.2. * Fixed some bugs and problems. * Changed icons of motif interface. * Changed sorting algorithm for xaw and tcktl interface. * 2/5, 1999 Released TiMidity++ v1.3.1. * Fixed some bugs. * Enabled compile with gcc from MINGW32. * 2/3, 1999 Released TiMidity++ v1.3.0. New features and major change from v1.2.x: * Enabled to configure & compile on cygnus. * Improved XAW interface for trace playing. * Improved reverb sounds. * Fixed MIME/Multipart bug. * 1/25, 1999 Released TiMidity++ v1.2.1. Added missing files. Fixed some configuration problems. Added --enable-dynamic configure option. * 1/21, 1999 Released TiMidity++ v1.2.0. New features and major change from v1.1.x: * XAW interface: - Changed button bitmap of random & repeat - Modified some implementations. * Gtk interface: - Added buttons (& implementation) for raising & lowering the pitch. - Added buttons (& implementation) for increasing/decreasing the tempo. * Lookup TIMIDITY_SOUND_CARD and TIMIDITY_PCM_DEVICE environment variable to select the PCM device of ALSA. * Added interface.h to define IA_* macro for TiMidity interface. This file is generated automatically by configure. * 1/18, 1999 Released TiMidity++ v1.1.1. v1.1.0 had configuration problems, so v1.1.1 was released immediately. Fixed some configure bugs. Modified that xaw interface is enable to run without any midi files. * 1/18, 1999 Released TiMidity++ v1.1.0. Support OffiX file drag & drop interface for xaw. Support UMP configuration. * 1/14, 1999 Released TiMidity++ v1.0.1. Modfied for OffiX file drag & drop interface for xaw. If you want build this, define OFFIX in interface/xaw.h and link libDnd. * 1/6, 1999 Released TiMidity++ v1.0.0. See `ChangeLog' for major changes from the original of TiMidity 0.2i TiMidity++-2.13.2/TODO0100644004711200001440000000157107421005043013364 0ustar tamukiusersBUG: - About the Xaw interface troubles with the file-selector. YMMV since I know near to 0% about Xaw. - The tcl interface doesn't like filenames with white space. (but doesn't mind if it happens in the config file ?). Private notes: @mail 35 timidity-io.c: http://www.mega-tokyo.com/cgi-bin/yabb/YaBB.pl?board=SIERRA_AGI_SCI&action=display&num=990734937 SEQ_DEFINEBUF(128); #define seqbuf_dump timidity_seqbuf_dump ȤԤʤФʤʤ @mail 36 BSD 饤󥹤ǻȤ @mail 37 timidity -idqqqqqqq /home/bryce/tmp/test.midi Ǥ mcop warning: user defined signal handler found for SIG_PIPE, overriding ɽƤޤ -> 'q' ץ¿Ȥ stderr,stdout /dev/null ˥쥯 @mail 41 alsa 0.9 б @mail 46 -io Ȥ organ 󥿡եꤿ #define INTERACTIVE_INTERFACE_IDS "kmqagrwA" o ɲäʤФʤʤΡ TiMidity++-2.13.2/TiMidity-uj.ad.in0100644004711200001440000003401310046111313015747 0ustar tamukiusers! TiMidity.ad -- app-defaults file for TiMidity++ XAW interface ! Created by Yoshishige Arai ! Modified by Chisato Yamauchi TiMidity*international: True TiMidity*inputMethod: none TiMidity*gradientBar: True TiMidity*highlightThickness: 1 TiMidity*BitmapDir: @pkglibdir@/bitmaps/ TiMidity*file_simplemenu*international: True TiMidity*file_simplemenu.load.label: եΥ (Meta-N) TiMidity*file_simplemenu.saveconfig.label: ¸ (Meta-S) TiMidity*file_simplemenu.hidetext.label: åɽ/ɽ (Ctrl-M) TiMidity*file_simplemenu.hidetrace.label: ȥ졼̤ɽ/ɽ (Ctrl-T) TiMidity*file_simplemenu.shuffle.label: åե (Ctrl-S) TiMidity*file_simplemenu.repeat.label: ԡ (Ctrl-R) TiMidity*file_simplemenu.autostart.label: ư TiMidity*file_simplemenu.autoquit.label: ưλ TiMidity*file_simplemenu.filelist.label: եեꥹ (Ctrl-F) TiMidity*file_simplemenu.modes.label: ĥ⡼ (Ctrl-O) TiMidity*file_simplemenu.about.label: TiMidity++ ˤĤ TiMidity*file_simplemenu.quit.label: λ (Meta-Q, Q) TiMidity*load_dialog.label: ե̾ TiMidity*load_dialog.OK.label: ǧ TiMidity*load_dialog.add.label: ٤Ƥɲ TiMidity*load_dialog.cancel.label: 󥻥 TiMidity*flist_cmdbox.fplaybutton.label: TiMidity*flist_cmdbox.fdeletebutton.label: TiMidity*flist_cmdbox.fdelallbutton.label: ٤Ƥ TiMidity*popup_abox.OK.label: ǧ TiMidity*modul_box.modul_lbl.label: ⥸졼󥳥ȥ TiMidity*porta_box.porta_lbl.label: ݥ륿ȥȥ TiMidity*nrpnv_box.nrpnv_lbl.label: NRPN ӥ֥顼 TiMidity*reverb_box.reverb_lbl.label: С֥եȥȥ TiMidity*chorus_box.chorus_lbl.label: 饹եȥȥ TiMidity*chpressure_box.chpressure_lbl.label: ͥץå㡼 TiMidity*overlapvoice_box.overlapv_lbl.label: Ʊ첻νʣ TiMidity*txtmeta_box.txtmeta_lbl.label: ٤ƤΥƥȥ᥿٥Ȥȥ졼 TiMidity*closebutton.label: Ĥ TiMidity*base_form.translations: #override\n\ ~Ctrl Metas: do-menu(101)\n\ Ctrlm: do-menu(102)\n\ Ctrlt: do-menu(103)\n\ Ctrls: do-menu(104)\n\ Ctrlr: do-menu(105)\n\ ~Ctrl Metan: do-load()\n\ Right: do-next()\n\ ~Metan: do-next()\n\ Left: do-prev()\n\ p: do-prev()\n\ KP_Enter: do-play()\n\ Return: do-play()\n\ ~Ctrlr: do-play()\n\ ~Ctrlf: do-forward()\n\ ~Ctrlb: do-back()\n\ ~Ctrlspace: do-pause()\n\ ~Ctrls: do-stop()\n\ Up: do-volupdown(10)\n\ ~Ctrl Shiftv: do-volupdown(10)\n\ Down: do-volupdown(-10)\n\ ~Ctrl ~Shiftv: do-volupdown(-10)\n\ KP_Add: do-key()\n\ ~Ctrlplus: do-key()\n\ KP_Subtract: do-key(1)\n\ ~Shift-: do-key(1)\n\ ~Ctrlgreater: do-speed()\n\ ~Ctrlless: do-speed(1)\n\ ~Ctrl Shifto: do-voice(1)\n\ ~Ctrl ~Shifto: do-voice()\n\ ~Ctrlg: do-sndspec()\n\ ~Ctrlx: do-exchange()\n\ ~Ctrlt: do-toggletrace()\n\ l: do-filelist()\n\ Ctrlf: do-filelist()\n\ Ctrlo: do-options()\n\ a: do-about()\n\ : do-resize()\n\ ~Ctrlq: do-quit() TiMidity*menu_width: 300 TiMidity*menu_box.borderWidth: 0 TiMidity*MenuButton.translations: \ : highlight()\n\ : reset()\n\ Any: reset() fix-menu() PopupMenu() TiMidity*Command*international: True TiMidity*file_menubutton.menuName: file_simplemenu TiMidity*file_menubutton.width: 60 TiMidity*file_menubutton.height: 26 TiMidity*file_menubutton.horizDistance: 6 TiMidity*file_menubutton.vertDistance: 4 TiMidity*file_menubutton.shadowWidth: 1 TiMidity*title_menubutton.menuName: title_simplemenu TiMidity*title_menubutton.width: 210 TiMidity*title_menubutton.height: 26 TiMidity*title_menubutton.resize: false TiMidity*title_menubutton.fromHoriz: file_menubutton TiMidity*title_menubutton.horizDistance: 6 TiMidity*title_menubutton.vertDistance: 4 TiMidity*title_menubutton.shadowWidth: 1 TiMidity*time_label.label: time / mode TiMidity*time_label.width: 92 TiMidity*time_label.height: 26 TiMidity*time_label.resize: false TiMidity*time_label.fromHoriz: title_menubutton TiMidity*time_label.horizDistance: 1 TiMidity*time_label.vertDistance: 4 TiMidity*time_label.shadowWidth: 1 TiMidity*time_label.translations: #override\n\ : do-menu(103)\n\ : do-exchange() TiMidity*button_box.height: 40 TiMidity*button_box.horizDistance: 4 TiMidity*button_box.borderWidth: 0 TiMidity*play_button.width: 32 TiMidity*play_button.height: 32 TiMidity*play_button.horizDistance: 1 TiMidity*play_button.vertDistance: 9 TiMidity*pause_button.width: 32 TiMidity*pause_button.height: 32 TiMidity*pause_button.horizDistance: 1 TiMidity*pause_button.vertDistance: 1 TiMidity*stop_button.width: 32 TiMidity*stop_button.height: 32 TiMidity*stop_button.horizDistance: 1 TiMidity*stop_button.vertDistance: 1 TiMidity*prev_button.width: 32 TiMidity*prev_button.height: 32 TiMidity*prev_button.horizDistance: 1 TiMidity*prev_button.vertDistance: 1 TiMidity*back_button.width: 32 TiMidity*back_button.height: 32 TiMidity*back_button.horizDistance: 1 TiMidity*back_button.vertDistance: 1 TiMidity*fwd_button.width: 32 TiMidity*fwd_button.height: 32 TiMidity*fwd_button.horizDistance: 1 TiMidity*fwd_button.vertDistance: 1 TiMidity*next_button.width: 32 TiMidity*next_button.height: 32 TiMidity*next_button.horizDistance: 1 TiMidity*next_button.vertDistance: 1 TiMidity*quit_button.width: 32 TiMidity*quit_button.height: 32 TiMidity*quit_button.horizDistance: 1 TiMidity*quit_button.vertDistance: 1 TiMidity*random_button.width: 32 TiMidity*random_button.height: 32 TiMidity*random_button.horizDistance: 4 TiMidity*random_button.vertDistance: 1 TiMidity*repeat_button.width: 32 TiMidity*repeat_button.height: 32 TiMidity*repeat_button.horizDistance: 1 TiMidity*repeat_button.vertDistance: 1 TiMidity*volume_label.vertDistance: 0 TiMidity*volume_label.borderWidth: 0 TiMidity*volume_box.vertDistance: 2 TiMidity*volume_box.borderWidth: 0 TiMidity*volume_bar.length: 330 TiMidity*volume_bar.translations: #override\n\ ~Ctrl Shift: do-volupdown(-50)\n\ ~Ctrl Shift: do-volupdown(50)\n\ Ctrl ~Shift: do-volupdown(-5)\n\ Ctrl ~Shift: do-volupdown(5)\n\ : MoveThumb()\n\ : NotifyScroll(FullLength) EndScroll() TiMidity*tune_label.label: ---- TiMidity*tune_label.horizDistance: 0 TiMidity*tune_label.vertDistance: 0 TiMidity*tune_label0.horizDistance: 0 TiMidity*tune_box.vertDistance: 2 TiMidity*tune_box.borderWidth: 0 TiMidity*tune_bar.length: 330 TiMidity*tune_bar.translations: #override\n\ : do-tuneset()\n\ : do-tuneslide()\n\ : MoveThumb()\n\ : NotifyScroll(FullLength) EndScroll() TiMidity*lyric_text.international: True TiMidity*lyric_text.height: 120 TiMidity*lyric_text.fromVert: tune_box TiMidity*lyric_text.horizDistance: 6 TiMidity*lyric_text.vertDistance: 4 TiMidity*lyric_text.borderWidth: 1 TiMidity*lyric_text.scrollVertical: WhenNeeded TiMidity*lyric_text.translations: #override\n\ : do-deltext() TiMidity*trace.vertDistance: 2 TiMidity*trace.borderWidth: 1 TiMidity*trace.translations: #override\n\ : do-toggletrace()\n\ : do-revcaption()\n\ : do-revcaption()\n\ : draw-trace() TiMidity*trace_vport.borderWidth: 1 TiMidity*popup_load.title: TiMidity TiMidity*popup_loadform.height: 400 TiMidity*load_dialog.borderWidth: 0 TiMidity*load_dialog.height: 132 TiMidity*load_dialog.value.translations: #override\n\ Escape: do-dialog-button(1)\n\ Ctrl ~Shiftg: do-dialog-button(1)\n\ ~CtrlKP_Enter: do-chgdir()\n\ ~CtrlReturn: do-chgdir()\n\ BackSpace: do-backspace() delete-previous-character()\n\ ~Ctrl ~MetaTab: do-complete() end-of-line() TiMidity*popup_file.title: TiMidity TiMidity*popup_fbox.translations: #override\n\ ~Ctrlc: do-closeparent()\n\ Down: do-flistmove(1)\n\ n: do-flistmove(1)\n\ Up: do-flistmove(-1)\n\ p: do-flistmove(-1)\n\ Next: do-flistmove(5)\n\ Left: do-flistmove(5)\n\ Prior: do-flistmove(-5)\n\ Right: do-flistmove(-5)\n\ KP_Enter: do-fselect()\n\ Return: do-fselect()\n\ Ctrlm: do-fselect()\n\ ~Ctrlr: do-fselect()\n\ d: do-fdelete()\n\ ~Ctrlf: do-forward()\n\ ~Ctrlb: do-back()\n\ space: do-pause()\n\ s: do-stop()\n\ Shiftv: do-volupdown(10)\n\ ~Shiftv: do-volupdown(-10)\n\ ~Ctrlq: do-quit() TiMidity*popup_option.title: TiMidity TiMidity*popup_optbox*international: True TiMidity*popup_optbox.translations: #override\n\ ~Ctrlc: do-closeparent()\n\ ~Ctrlq: do-quit() TiMidity*popup_about.title: Information TiMidity*popup_abox.translations: #override\n\ ~Ctrlc: do-closeparent()\n\ KP_Enter: do-closeparent()\n\ Return: do-closeparent() TiMidity*foreground: #c0c0c0 TiMidity*background: #171717 TiMidity*BoxColor: #666666 TiMidity*Scrollbar*background: gray82 TiMidity*ButtonForeground: #c0c0c0 TiMidity*ButtonBackground: #444444 TiMidity*ToggleForeground: #c0c0f0 TiMidity*MenuButtonBackground: #839573 TiMidity*menu_box*Foreground: #000000 TiMidity*menu_box*SimpleMenu*Foreground: #c0c0c0 TiMidity*Command.background: gray78 TiMidity*Label.foreground: black TiMidity*Label.background: #CCFF33 TiMidity*Text*background: gray82 TiMidity*Text*scrollbar*background: gray82 TiMidity*TextBackground: #666666 TiMidity*Text2Background: #4e5945 TiMidity*Dialog.Command.background: gray78 TiMidity*Dialog.Text.background: gray82 TiMidity*lyric_text*Foreground: #c0c0c0 TiMidity*lyric_text*Background: #444444 TiMidity*lyric_text*Scrollbar*Background: #666666 TiMidity*TraceBackground: #4e5945 TiMidity*VelForeground: #c0a080 TiMidity*VelDrumForeground: #c08080 TiMidity*VolForeground: #c0b0b0 TiMidity*PanForeground: #a0a0c0 TiMidity*ReverbColor: #c0c080 TiMidity*CaptionColor: #a0a0a0 TiMidity*ExpForeground: #80c0c0 TiMidity*ChorusColor: #c0b080 TiMidity*WhiteKeyColor: #d8d8d8 TiMidity*trace_vport*background: #666666 TiMidity*load_dialog.label.background: gray67 TiMidity*popup_load*Viewport*background: #666666 TiMidity*popup_load*load_dialog.Command*background: #666666 TiMidity*popup_load*load_dialog*label*background: #666666 TiMidity*popup_load*load_dialog*value.background: #666666 TiMidity*popup_load*load_dialog*value.MultiSrc.background: #666666 TiMidity*popup_load*load_dialog*value.MultiSink.background: #666666 TiMidity*popup_load*load_dialog*value*TransientShell.Form.background: #c0c0c0 TiMidity*popup_load*load_dialog*value*TransientShell.Form.Label.background: #c0c0c0 TiMidity*popup_load*load_dialog*value*TransientShell.Form.Toggle.foreground: #000000 TiMidity*popup_load*load_dialog*value*TransientShell.Form.Toggle.background: #c0c0c0 TiMidity*popup_load*load_dialog*value*TransientShell.Form.Command.foreground: #000000 TiMidity*popup_load*load_dialog*value*TransientShell.Form.Command.background: #c0c0c0 TiMidity*popup_load*load_dialog*value*TransientShell.Form.Text.foreground: #000000 TiMidity*popup_load*load_dialog*value*TransientShell.Form.Text.background: #e7e7e7 TiMidity*popup_load*load_dialog*value*TransientShell.Form.Text.borderColor: #6f6f6f TiMidity*popup_load*load_dialog*value*TransientShell.Form.Text.MultiSrc.foreground: #000000 TiMidity*popup_load*load_dialog*value*TransientShell.Form.Text.MultiSrc.background: #e7e7e7 TiMidity*popup_load*load_dialog*value*TransientShell.Form.Text.MultiSink.foreground: #000000 TiMidity*popup_load*load_dialog*value*TransientShell.Form.Text.MultiSink.background: #e7e7e7 TiMidity*popup_load*popup_loadform*load_dialog*label*foreground: #c0c0c0 TiMidity*popup_load*popup_loadform*cwd_label*foreground: #c0c0c0 TiMidity*popup_load*popup_loadform*cwd_info*foreground: #c0c0c0 TiMidity*popup_file*background: #666666 TiMidity*popup_option*background: #666666 TiMidity*popup_about*background: #666666 TiMidity*fontSet: -*-fixed-medium-r-normal--14-*-*-*-*-*-iso8859-1,-*-fixed-medium-r-normal--14-*-*-*-*-*-*-* TiMidity*Form*fontSet: -adobe-helvetica-medium-r-normal--12-*-*-*-*-*-iso8859-1,-*-fixed-medium-r-normal--14-*-*-*-*-*-*-* TiMidity*MenuButton*fontSet: -adobe-helvetica-bold-r-normal--12-*-*-*-*-*-iso8859-1,-*-fixed-medium-r-normal--14-*-*-*-*-*-*-* TiMidity*TextFontSet: -*-fixed-medium-r-normal--14-*-*-*-*-*-iso8859-1,-*-fixed-medium-r-normal--14-*-*-*-*-*-*-* TiMidity*SmeBSB.fontSet: -adobe-helvetica-medium-r-normal--12-*-*-*-*-*-iso8859-1,-*-fixed-medium-r-normal--14-*-*-*-*-*-*-* TiMidity*Command*fontSet: -adobe-helvetica-bold-r-normal--12-*-*-*-*-*-iso8859-1,-*-fixed-medium-r-normal--14-*-*-*-*-*-*-* TiMidity*List*fontSet: -adobe-helvetica-medium-r-normal--12-*-*-*-*-*-iso8859-1,-*-fixed-medium-r-normal--14-*-*-*-*-*-*-* TiMidity*Label*fontSet: -adobe-helvetica-medium-r-normal--14-*-*-*-*-*-iso8859-1,-*-fixed-medium-r-normal--14-*-*-*-*-*-*-* TiMidity*cwd_label.font: -adobe-helvetica-medium-r-normal--12-*-*-*-*-*-*-* TiMidity*Text*fontSet: -*-fixed-medium-r-normal--14-*-*-*-*-*-iso8859-1,-*-fixed-medium-r-normal--14-*-*-*-*-*-*-* TiMidity*file_menubutton.file_simplemenu*fontSet: -*-fixed-medium-r-normal--14-*-*-*-*-*-iso8859-1,-*-fixed-medium-r-normal--14-*-*-*-*-*-*-* TiMidity*title_menubutton.title_simplemenu*fontSet: -adobe-helvetica-medium-r-normal--12-*-*-*-*-*-iso8859-1,-*-fixed-medium-r-normal--14-*-*-*-*-*-*-* TiMidity*time_label.font: -adobe-helvetica-bold-r-normal--14-*-*-*-*-*-*-* TiMidity*time_label*cwd_info.font: -adobe-helvetica-medium-r-normal--12-*-*-*-*-*-*-* TiMidity*volume_box*fontSet: -adobe-helvetica-bold-r-normal--12-*-*-*-*-*-iso8859-1,-*-fixed-medium-r-normal--14-*-*-*-*-*-*-* TiMidity*tune_box*fontSet: -adobe-helvetica-bold-r-normal--12-*-*-*-*-*-iso8859-1,-*-fixed-medium-r-normal--14-*-*-*-*-*-*-* TiMidity*popup_loadform.load_dialog.label.fontSet: -*-fixed-medium-r-normal--14-*-*-*-*-*-iso8859-1,-*-fixed-medium-r-normal--14-*-*-*-*-*-*-* TiMidity*popup_abox*fontSet: -adobe-helvetica-bold-o-normal--14-*-*-*-*-*-*-*,-*-fixed-medium-r-normal--14-*-*-*-*-*-*-* TiMidity++-2.13.2/TiMidity.ad.in0100644004711200001440000003231010046111313015331 0ustar tamukiusers! TiMidity.ad -- app-defaults file for TiMidity++ XAW interface ! Created by Yoshishige Arai ! Modified by Chisato Yamauchi TiMidity*international: True TiMidity*inputMethod: none TiMidity*gradientBar: True TiMidity*highlightThickness: 1 TiMidity*BitmapDir: @pkglibdir@/bitmaps/ TiMidity*file_simplemenu*international: True TiMidity*file_simplemenu.load.label: Load (Meta-N) TiMidity*file_simplemenu.saveconfig.label: Save Config (Meta-S) TiMidity*file_simplemenu.hidetext.label: (Un)Hide Messages (Ctrl-M) TiMidity*file_simplemenu.hidetrace.label: (Un)Hide Trace (Ctrl-T) TiMidity*file_simplemenu.shuffle.label: Shuffle (Ctrl-S) TiMidity*file_simplemenu.repeat.label: Repeat (Ctrl-R) TiMidity*file_simplemenu.autostart.label: Auto Start TiMidity*file_simplemenu.autoquit.label: Auto Exit TiMidity*file_simplemenu.filelist.label: File List (Ctrl-F) TiMidity*file_simplemenu.modes.label: Extend Modes (Ctrl-O) TiMidity*file_simplemenu.about.label: About TiMidity*file_simplemenu.quit.label: Quit (Meta-Q, Q) TiMidity*load_dialog.label: File Name TiMidity*load_dialog.OK.label: OK TiMidity*load_dialog.add.label: Add ALL TiMidity*load_dialog.cancel.label: Cancel TiMidity*flist_cmdbox.fplaybutton.label: Play TiMidity*flist_cmdbox.fdeletebutton.label: Delete TiMidity*flist_cmdbox.fdelallbutton.label: Delete ALL TiMidity*popup_abox.OK.label: OK TiMidity*modul_box.modul_lbl.label: Modulation control TiMidity*porta_box.porta_lbl.label: Portamento control TiMidity*nrpnv_box.nrpnv_lbl.label: NRPN Vibration TiMidity*reverb_box.reverb_lbl.label: Reverb control TiMidity*chorus_box.chorus_lbl.label: Chorus control TiMidity*chpressure_box.chpressure_lbl.label: Channel Pressure control TiMidity*overlapvoice_box.overlapv_lbl.label: Allow Multiple Same Notes TiMidity*txtmeta_box.txtmeta_lbl.label: Tracing All Text Meta Events TiMidity*closebutton.label: Close TiMidity*base_form.translations: #override\n\ ~Ctrl Metas: do-menu(101)\n\ Ctrlm: do-menu(102)\n\ Ctrlt: do-menu(103)\n\ Ctrls: do-menu(104)\n\ Ctrlr: do-menu(105)\n\ ~Ctrl Metan: do-load()\n\ Right: do-next()\n\ ~Metan: do-next()\n\ Left: do-prev()\n\ p: do-prev()\n\ KP_Enter: do-play()\n\ Return: do-play()\n\ ~Ctrlr: do-play()\n\ ~Ctrlf: do-forward()\n\ ~Ctrlb: do-back()\n\ ~Ctrlspace: do-pause()\n\ ~Ctrls: do-stop()\n\ Up: do-volupdown(10)\n\ ~Ctrl Shiftv: do-volupdown(10)\n\ Down: do-volupdown(-10)\n\ ~Ctrl ~Shiftv: do-volupdown(-10)\n\ KP_Add: do-key()\n\ ~Ctrlplus: do-key()\n\ KP_Subtract: do-key(1)\n\ ~Shift-: do-key(1)\n\ ~Ctrlgreater: do-speed()\n\ ~Ctrlless: do-speed(1)\n\ ~Ctrl Shifto: do-voice(1)\n\ ~Ctrl ~Shifto: do-voice()\n\ ~Ctrlg: do-sndspec()\n\ ~Ctrlx: do-exchange()\n\ ~Ctrlt: do-toggletrace()\n\ l: do-filelist()\n\ Ctrlf: do-filelist()\n\ Ctrlo: do-options()\n\ a: do-about()\n\ : do-resize()\n\ ~Ctrlq: do-quit() TiMidity*menu_width: 300 TiMidity*menu_box.borderWidth: 0 TiMidity*MenuButton.translations: \ : highlight()\n\ : reset()\n\ Any: reset() fix-menu() PopupMenu() TiMidity*Command*international: True TiMidity*file_menubutton.menuName: file_simplemenu TiMidity*file_menubutton.width: 60 TiMidity*file_menubutton.height: 26 TiMidity*file_menubutton.horizDistance: 6 TiMidity*file_menubutton.vertDistance: 4 TiMidity*file_menubutton.shadowWidth: 1 TiMidity*title_menubutton.menuName: title_simplemenu TiMidity*title_menubutton.width: 210 TiMidity*title_menubutton.height: 26 TiMidity*title_menubutton.resize: false TiMidity*title_menubutton.fromHoriz: file_menubutton TiMidity*title_menubutton.horizDistance: 6 TiMidity*title_menubutton.vertDistance: 4 TiMidity*title_menubutton.shadowWidth: 1 TiMidity*time_label.label: time / mode TiMidity*time_label.width: 92 TiMidity*time_label.height: 26 TiMidity*time_label.resize: false TiMidity*time_label.fromHoriz: title_menubutton TiMidity*time_label.horizDistance: 1 TiMidity*time_label.vertDistance: 4 TiMidity*time_label.shadowWidth: 1 TiMidity*time_label.translations: #override\n\ : do-menu(103)\n\ : do-exchange() TiMidity*button_box.height: 40 TiMidity*button_box.horizDistance: 4 TiMidity*button_box.borderWidth: 0 TiMidity*play_button.width: 32 TiMidity*play_button.height: 32 TiMidity*play_button.horizDistance: 1 TiMidity*play_button.vertDistance: 9 TiMidity*pause_button.width: 32 TiMidity*pause_button.height: 32 TiMidity*pause_button.horizDistance: 1 TiMidity*pause_button.vertDistance: 1 TiMidity*stop_button.width: 32 TiMidity*stop_button.height: 32 TiMidity*stop_button.horizDistance: 1 TiMidity*stop_button.vertDistance: 1 TiMidity*prev_button.width: 32 TiMidity*prev_button.height: 32 TiMidity*prev_button.horizDistance: 1 TiMidity*prev_button.vertDistance: 1 TiMidity*back_button.width: 32 TiMidity*back_button.height: 32 TiMidity*back_button.horizDistance: 1 TiMidity*back_button.vertDistance: 1 TiMidity*fwd_button.width: 32 TiMidity*fwd_button.height: 32 TiMidity*fwd_button.horizDistance: 1 TiMidity*fwd_button.vertDistance: 1 TiMidity*next_button.width: 32 TiMidity*next_button.height: 32 TiMidity*next_button.horizDistance: 1 TiMidity*next_button.vertDistance: 1 TiMidity*quit_button.width: 32 TiMidity*quit_button.height: 32 TiMidity*quit_button.horizDistance: 1 TiMidity*quit_button.vertDistance: 1 TiMidity*random_button.width: 32 TiMidity*random_button.height: 32 TiMidity*random_button.horizDistance: 4 TiMidity*random_button.vertDistance: 1 TiMidity*repeat_button.width: 32 TiMidity*repeat_button.height: 32 TiMidity*repeat_button.horizDistance: 1 TiMidity*repeat_button.vertDistance: 1 TiMidity*volume_label.vertDistance: 0 TiMidity*volume_label.borderWidth: 0 TiMidity*volume_box.vertDistance: 2 TiMidity*volume_box.borderWidth: 0 TiMidity*volume_bar.length: 330 TiMidity*volume_bar.translations: #override\n\ ~Ctrl Shift: do-volupdown(-50)\n\ ~Ctrl Shift: do-volupdown(50)\n\ Ctrl ~Shift: do-volupdown(-5)\n\ Ctrl ~Shift: do-volupdown(5)\n\ : MoveThumb()\n\ : NotifyScroll(FullLength) EndScroll() TiMidity*tune_label.label: ---- TiMidity*tune_label.horizDistance: 0 TiMidity*tune_label.vertDistance: 0 TiMidity*tune_label0.horizDistance: 0 TiMidity*tune_box.vertDistance: 2 TiMidity*tune_box.borderWidth: 0 TiMidity*tune_bar.length: 330 TiMidity*tune_bar.translations: #override\n\ : do-tuneset()\n\ : do-tuneslide()\n\ : MoveThumb()\n\ : NotifyScroll(FullLength) EndScroll() TiMidity*lyric_text.international: True TiMidity*lyric_text.height: 120 TiMidity*lyric_text.fromVert: tune_box TiMidity*lyric_text.horizDistance: 6 TiMidity*lyric_text.vertDistance: 4 TiMidity*lyric_text.borderWidth: 1 TiMidity*lyric_text.scrollVertical: WhenNeeded TiMidity*lyric_text.translations: #override\n\ : do-deltext() TiMidity*trace.vertDistance: 2 TiMidity*trace.borderWidth: 1 TiMidity*trace.translations: #override\n\ : do-toggletrace()\n\ : do-revcaption()\n\ : do-revcaption()\n\ : draw-trace() TiMidity*trace_vport.borderWidth: 1 TiMidity*popup_load.title: TiMidity TiMidity*popup_loadform.height: 400 TiMidity*load_dialog.borderWidth: 0 TiMidity*load_dialog.height: 132 TiMidity*load_dialog.value.translations: #override\n\ Escape: do-dialog-button(1)\n\ Ctrl ~Shiftg: do-dialog-button(1)\n\ ~CtrlKP_Enter: do-chgdir()\n\ ~CtrlReturn: do-chgdir()\n\ BackSpace: do-backspace() delete-previous-character()\n\ ~Ctrl ~MetaTab: do-complete() end-of-line() TiMidity*popup_file.title: TiMidity TiMidity*popup_fbox.translations: #override\n\ ~Ctrlc: do-closeparent()\n\ Down: do-flistmove(1)\n\ n: do-flistmove(1)\n\ Up: do-flistmove(-1)\n\ p: do-flistmove(-1)\n\ Next: do-flistmove(5)\n\ Left: do-flistmove(5)\n\ Prior: do-flistmove(-5)\n\ Right: do-flistmove(-5)\n\ KP_Enter: do-fselect()\n\ Return: do-fselect()\n\ Ctrlm: do-fselect()\n\ ~Ctrlr: do-fselect()\n\ d: do-fdelete()\n\ ~Ctrlf: do-forward()\n\ ~Ctrlb: do-back()\n\ space: do-pause()\n\ s: do-stop()\n\ Shiftv: do-volupdown(10)\n\ ~Shiftv: do-volupdown(-10)\n\ ~Ctrlq: do-quit() TiMidity*popup_option.title: TiMidity TiMidity*popup_optbox*international: True TiMidity*popup_optbox.translations: #override\n\ ~Ctrlc: do-closeparent()\n\ ~Ctrlq: do-quit() TiMidity*popup_about.title: Information TiMidity*popup_abox.translations: #override\n\ ~Ctrlc: do-closeparent()\n\ KP_Enter: do-closeparent()\n\ Return: do-closeparent() TiMidity*foreground: #c0c0c0 TiMidity*background: #171717 TiMidity*BoxColor: #666666 TiMidity*Scrollbar*background: gray82 TiMidity*ButtonForeground: #c0c0c0 TiMidity*ButtonBackground: #444444 TiMidity*ToggleForeground: #c0c0f0 TiMidity*MenuButtonBackground: #839573 TiMidity*menu_box*Foreground: #000000 TiMidity*menu_box*SimpleMenu*Foreground: #c0c0c0 TiMidity*Command.background: gray78 TiMidity*Label.foreground: black TiMidity*Label.background: #CCFF33 TiMidity*Text*background: gray82 TiMidity*Text*scrollbar*background: gray82 TiMidity*TextBackground: #666666 TiMidity*Text2Background: #4e5945 TiMidity*Dialog.Command.background: gray78 TiMidity*Dialog.Text.background: gray82 TiMidity*lyric_text*Foreground: #c0c0c0 TiMidity*lyric_text*Background: #444444 TiMidity*lyric_text*Scrollbar*Background: #666666 TiMidity*TraceBackground: #4e5945 TiMidity*VelForeground: #c0a080 TiMidity*VelDrumForeground: #c08080 TiMidity*VolForeground: #c0b0b0 TiMidity*PanForeground: #a0a0c0 TiMidity*ReverbColor: #c0c080 TiMidity*CaptionColor: #a0a0a0 TiMidity*ExpForeground: #80c0c0 TiMidity*ChorusColor: #c0b080 TiMidity*WhiteKeyColor: #d8d8d8 TiMidity*trace_vport*background: #666666 TiMidity*load_dialog.label.background: gray67 TiMidity*popup_load*Viewport*background: #666666 TiMidity*popup_load*load_dialog.Command*background: #666666 TiMidity*popup_load*load_dialog*label*background: #666666 TiMidity*popup_load*load_dialog*value.background: #666666 TiMidity*popup_load*load_dialog*value.MultiSrc.background: #666666 TiMidity*popup_load*load_dialog*value.MultiSink.background: #666666 TiMidity*popup_load*load_dialog*value*TransientShell.Form.background: #c0c0c0 TiMidity*popup_load*load_dialog*value*TransientShell.Form.Label.background: #c0c0c0 TiMidity*popup_load*load_dialog*value*TransientShell.Form.Toggle.foreground: #000000 TiMidity*popup_load*load_dialog*value*TransientShell.Form.Toggle.background: #c0c0c0 TiMidity*popup_load*load_dialog*value*TransientShell.Form.Command.foreground: #000000 TiMidity*popup_load*load_dialog*value*TransientShell.Form.Command.background: #c0c0c0 TiMidity*popup_load*load_dialog*value*TransientShell.Form.Text.foreground: #000000 TiMidity*popup_load*load_dialog*value*TransientShell.Form.Text.background: #e7e7e7 TiMidity*popup_load*load_dialog*value*TransientShell.Form.Text.borderColor: #6f6f6f TiMidity*popup_load*load_dialog*value*TransientShell.Form.Text.MultiSrc.foreground: #000000 TiMidity*popup_load*load_dialog*value*TransientShell.Form.Text.MultiSrc.background: #e7e7e7 TiMidity*popup_load*load_dialog*value*TransientShell.Form.Text.MultiSink.foreground: #000000 TiMidity*popup_load*load_dialog*value*TransientShell.Form.Text.MultiSink.background: #e7e7e7 TiMidity*popup_load*popup_loadform*load_dialog*label*foreground: #c0c0c0 TiMidity*popup_load*popup_loadform*cwd_label*foreground: #c0c0c0 TiMidity*popup_load*popup_loadform*cwd_info*foreground: #c0c0c0 TiMidity*popup_file*background: #666666 TiMidity*popup_option*background: #666666 TiMidity*popup_about*background: #666666 TiMidity*fontSet: -*-fixed-medium-r-normal--14-*-*-*-*-*-*-* TiMidity*Form*fontSet: -adobe-helvetica-medium-r-normal--12-*-*-*-*-*-*-* TiMidity*MenuButton*fontSet: -adobe-helvetica-bold-r-normal--14-*-*-*-*-*-*-* TiMidity*TextFontSet: -*-fixed-medium-r-normal--14-*-*-*-*-*-*-* TiMidity*SmeBSB.fontSet: -adobe-helvetica-medium-r-normal--12-*-*-*-*-*-*-* TiMidity*Command*fontSet: -adobe-helvetica-bold-r-normal--12-*-*-*-*-*-*-* TiMidity*List*fontSet: -adobe-helvetica-medium-r-normal--12-*-*-*-*-*-*-* TiMidity*Label*fontSet: -adobe-helvetica-bold-o-normal--14-*-*-*-*-*-*-* TiMidity*cwd_label.font: -adobe-helvetica-medium-r-normal--12-*-*-*-*-*-*-* TiMidity*Text*fontSet: -*-fixed-medium-r-normal--14-*-*-*-*-*-*-* TiMidity*file_menubutton.file_simplemenu*fontSet: -adobe-helvetica-medium-r-normal--12-*-*-*-*-*-*-* TiMidity*title_menubutton.title_simplemenu*fontSet: -adobe-helvetica-medium-r-normal--12-*-*-*-*-*-*-* TiMidity*time_label.font: -adobe-helvetica-bold-r-normal--14-*-*-*-*-*-*-* TiMidity*time_label*cwd_info.font: -adobe-helvetica-medium-r-normal--12-*-*-*-*-*-*-* TiMidity*volume_box*fontSet: -adobe-helvetica-bold-r-normal--12-*-*-*-*-*-*-* TiMidity*tune_box*fontSet: -adobe-helvetica-bold-r-normal--12-*-*-*-*-*-*-* TiMidity*popup_loadform.load_dialog.label.fontSet: -adobe-helvetica-bold-o-normal--14-*-*-*-*-*-*-* TiMidity*popup_abox*fontSet: -adobe-helvetica-bold-o-normal--14-*-*-*-*-*-*-* TiMidity++-2.13.2/aclocal.m40100644004711200001440000027066210124332424014545 0ustar tamukiusers# generated automatically by aclocal 1.7.6 -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002 # 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. # Do all the work for Automake. -*- Autoconf -*- # 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. # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 # 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, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. # serial 10 AC_PREREQ([2.54]) # Autoconf 2.50 wants to disallow AM_ names. We explicitly allow # the ones we care about. m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl # 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_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl AC_REQUIRE([AC_PROG_INSTALL])dnl # test to see if srcdir already configured if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) 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], [m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl AC_SUBST([PACKAGE], [$1])dnl AC_SUBST([VERSION], [$2])], [_AM_SET_OPTIONS([$1])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) AM_MISSING_PROG(AMTAR, tar) AM_PROG_INSTALL_SH AM_PROG_INSTALL_STRIP # We need awk for the "check" target. 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([no-dependencies],, [AC_PROVIDE_IFELSE([AC_PROG_CC], [_AM_DEPENDENCIES(CC)], [define([AC_PROG_CC], defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl AC_PROVIDE_IFELSE([AC_PROG_CXX], [_AM_DEPENDENCIES(CXX)], [define([AC_PROG_CXX], defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl ]) ]) # 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_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $1 | $1:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count]) # Copyright 2002 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, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 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. AC_DEFUN([AM_AUTOMAKE_VERSION],[am__api_version="1.7"]) # AM_SET_CURRENT_AUTOMAKE_VERSION # ------------------------------- # Call AM_AUTOMAKE_VERSION so it can be traced. # This function is AC_REQUIREd by AC_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], [AM_AUTOMAKE_VERSION([1.7.6])]) # Helper functions for option handling. -*- Autoconf -*- # Copyright 2001, 2002 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, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. # serial 2 # _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], [AC_FOREACH([_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])]) # # Check to make sure that the build environment is sane. # # Copyright 1996, 1997, 2000, 2001 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, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. # serial 3 # AM_SANITY_CHECK # --------------- AC_DEFUN([AM_SANITY_CHECK], [AC_MSG_CHECKING([whether build environment is sane]) # Just in case sleep 1 echo timestamp > conftest.file # 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 ( 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 rm -f conftest.file 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 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)]) # -*- Autoconf -*- # Copyright 1997, 1999, 2000, 2001 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, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. # serial 3 # 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 supports --run. # If it does, set am_missing_run to use it, otherwise, to nothing. AC_DEFUN([AM_MISSING_HAS_RUN], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing" # Use eval to expand $SHELL if eval "$MISSING --run true"; then am_missing_run="$MISSING --run " else am_missing_run= AC_MSG_WARN([`missing' script is too old or missing]) fi ]) # AM_AUX_DIR_EXPAND # Copyright 2001 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, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. # 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. # Rely on autoconf to set up CDPATH properly. AC_PREREQ([2.50]) AC_DEFUN([AM_AUX_DIR_EXPAND], [ # expand $ac_aux_dir to an absolute path am_aux_dir=`cd $ac_aux_dir && pwd` ]) # AM_PROG_INSTALL_SH # ------------------ # Define $install_sh. # Copyright 2001 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, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. AC_DEFUN([AM_PROG_INSTALL_SH], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl install_sh=${install_sh-"$am_aux_dir/install-sh"} AC_SUBST(install_sh)]) # AM_PROG_INSTALL_STRIP # Copyright 2001 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, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. # 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="\${SHELL} \$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) # -*- Autoconf -*- # Copyright (C) 2003 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, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. # serial 1 # 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])]) # serial 5 -*- Autoconf -*- # Copyright (C) 1999, 2000, 2001, 2002, 2003 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, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. # 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", "GCJ", or "OBJC". # 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 ifelse([$1], CC, [depcc="$CC" am_compiler_list=], [$1], CXX, [depcc="$CXX" am_compiler_list=], [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'], [$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'. 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 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 : > sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf case $depmode in 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 ;; none) break ;; esac # 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. if depmode=$depmode \ source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftest.${OBJEXT-o} 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 # (even with -Werror). So we grep stderr for any message # that says an option was ignored. if grep 'ignoring option' 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, [ --disable-dependency-tracking Speeds up one-time builds --enable-dependency-tracking Do not reject slow dependency extractors]) if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' fi AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) AC_SUBST([AMDEPBACKSLASH]) ]) # Generate code to set up dependency tracking. -*- Autoconf -*- # Copyright 1999, 2000, 2001, 2002 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, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. #serial 2 # _AM_OUTPUT_DEPENDENCY_COMMANDS # ------------------------------ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], [for mf in $CONFIG_FILES; do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. # We used to match only the files named `Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. # So let's grep whole file. if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then dirpart=`AS_DIRNAME("$mf")` else continue fi grep '^DEP_FILES *= *[[^ @%:@]]' < "$mf" > /dev/null || continue # Extract the definition of DEP_FILES from the Makefile without # running `make'. DEPDIR=`sed -n -e '/^DEPDIR = / s///p' < "$mf"` test -z "$DEPDIR" && continue # When using ansi2knr, U may be empty or an underscore; expand it U=`sed -n -e '/^U = / s///p' < "$mf"` test -d "$dirpart/$DEPDIR" || mkdir "$dirpart/$DEPDIR" # We invoke sed twice because it is the simplest approach to # changing $(DEPDIR) to its actual value in the expansion. for file in `sed -n -e ' /^DEP_FILES = .*\\\\$/ { s/^DEP_FILES = // :loop s/\\\\$// p n /\\\\$/ b loop p } /^DEP_FILES = / s/^DEP_FILES = //p' < "$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`AS_DIRNAME(["$file"])` AS_MKDIR_P([$dirpart/$fdir]) # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done ])# _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. FIXME. This creates each `.P' file that we will # 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" ac_aux_dir="$ac_aux_dir"]) ]) # Check to see how 'make' treats includes. -*- Autoconf -*- # Copyright (C) 2001, 2002, 2003 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, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. # serial 2 # AM_MAKE_INCLUDE() # ----------------- # Check to see how make treats includes. AC_DEFUN([AM_MAKE_INCLUDE], [am_make=${MAKE-make} cat > confinc << 'END' am__doit: @echo done .PHONY: am__doit END # If we don't find an include directive, just comment out the code. AC_MSG_CHECKING([for style of include used by $am_make]) am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # We grep out `Entering directory' and `Leaving directory' # messages which can occur if `w' ends up in MAKEFLAGS. # In particular we don't look at `^make:' because GNU make might # be invoked under some other name (usually "gmake"), in which # case it prints its new name instead of `make'. if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then am__include=include am__quote= _am_result=GNU fi # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then am__include=.include am__quote="\"" _am_result=BSD fi fi AC_SUBST([am__include]) AC_SUBST([am__quote]) AC_MSG_RESULT([$_am_result]) rm -f confinc confmf ]) # AM_CONDITIONAL -*- Autoconf -*- # Copyright 1997, 2000, 2001 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, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. # serial 5 AC_PREREQ(2.52) # AM_CONDITIONAL(NAME, SHELL-CONDITION) # ------------------------------------- # Define a conditional. AC_DEFUN([AM_CONDITIONAL], [ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl AC_SUBST([$1_TRUE]) AC_SUBST([$1_FALSE]) 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])]) # Add --enable-maintainer-mode option to configure. # From Jim Meyering # Copyright 1996, 1998, 2000, 2001, 2002 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, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. # serial 2 AC_DEFUN([AM_MAINTAINER_MODE], [AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles]) dnl maintainer-mode is disabled by default AC_ARG_ENABLE(maintainer-mode, [ --enable-maintainer-mode enable make rules and dependencies not useful (and sometimes confusing) to the casual installer], USE_MAINTAINER_MODE=$enableval, USE_MAINTAINER_MODE=no) AC_MSG_RESULT([$USE_MAINTAINER_MODE]) AM_CONDITIONAL(MAINTAINER_MODE, [test $USE_MAINTAINER_MODE = yes]) MAINT=$MAINTAINER_MODE_TRUE AC_SUBST(MAINT)dnl ] ) AU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE]) dnl TiMidity++ -- MIDI to WAVE converter and player dnl Copyright (C) 1999-2002 Masanao Izumo dnl Copyright (C) 1995 Tuukka Toivonen 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, dnl but WITHOUT ANY WARRANTY; without even the implied warranty of dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the dnl GNU 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 02111-1307 USA dnl MY_DEFINE(VARIABLE) AC_DEFUN(MY_DEFINE, [cat >> confdefs.h < dyna.c < fred.c < #$i_dlfcn I_DLFCN #ifdef I_DLFCN #include /* the dynamic linker include file for Sunos/Solaris */ #else #include #include #include #endif extern int fred() ; main() { void * handle ; void * symbol ; #ifndef RTLD_LAZY int mode = 1 ; #else int mode = RTLD_LAZY ; #endif handle = dlopen("./dyna.$so", mode) ; if (handle == NULL) { printf ("1\n") ; fflush (stdout) ; exit(0); } symbol = dlsym(handle, "fred") ; if (symbol == NULL) { /* try putting a leading underscore */ symbol = dlsym(handle, "_fred") ; if (symbol == NULL) { printf ("2\n") ; fflush (stdout) ; exit(0); } printf ("3\n") ; } else printf ("4\n") ; fflush (stdout) ; exit(0); } EOM : Call the object file tmp-dyna.o in case dlext=o. if ${CC-cc} $CFLAGS $SHCFLAGS $CPPFLAGS -c dyna.c > /dev/null 2>&1 && mv dyna.o tmp-dyna.o > /dev/null 2>&1 && $SHLD $SHLDFLAGS -o dyna.$so tmp-dyna.o > /dev/null 2>&1 && ${CC-cc} -o fred $CFLAGS $CPPFLAGS $LDFLAGS fred.c $LIBS $lib_dl_opt > /dev/null 2>&1; then xxx=`./fred` case $xxx in 1) AC_MSG_WARN(Test program failed using dlopen. Perhaps you should not use dynamic loading.) ;; 2) AC_MSG_WARN(Test program failed using dlsym. Perhaps you should not use dynamic loading.) ;; 3) timidity_cv_func_dlsym_underscore=yes ;; 4) timidity_cv_func_dlsym_underscore=no ;; esac else AC_MSG_WARN(I can't compile and run the test program.) fi rm -f dyna.c dyna.o dyna.$so tmp-dyna.o fred.c fred.o fred ]) case "x$timidity_cv_func_dlsym_underscore" in xyes) [$1] AC_MSG_RESULT(yes) ;; xno) [$2] AC_MSG_RESULT(no) ;; esac ]) dnl contains program from perl5 dnl CONTAINS_INIT() AC_DEFUN(CONTAINS_INIT, [dnl Some greps do not return status, grrr. AC_MSG_CHECKING(whether grep returns status) echo "grimblepritz" >grimble if grep blurfldyick grimble >/dev/null 2>&1 ; then contains="./contains" elif grep grimblepritz grimble >/dev/null 2>&1 ; then contains=grep else contains="./contains" fi rm -f grimble dnl the following should work in any shell case "$contains" in grep) AC_MSG_RESULT(yes) ;; ./contains) AC_MSG_RESULT(AGH! Grep doesn't return a status. Attempting remedial action.) cat >./contains <<'EOSS' grep "[$]1" "[$]2" >.greptmp && cat .greptmp && test -s .greptmp EOSS chmod +x "./contains" ;; esac ]) dnl CONTAINS(word,filename,action-if-found,action-if-not-found) AC_DEFUN(CONTAINS, [if $contains "^[$1]"'[$]' $2 >/dev/null 2>&1; then [$3] else [$4] fi ]) dnl SET_UNIQ_WORDS(shell-variable,words...) AC_DEFUN(SET_UNIQ_WORDS, [rm -f wordtmp >/dev/null 2>&1 val='' for f in $2; do CONTAINS([$f],wordtmp,:,[echo $f >>wordtmp; val="$val $f"]) done $1="$val" rm -f wordtmp >/dev/null 2>&1 ]) dnl WAPI_CHECK_FUNC(FUNCTION, INCLUDES, TEST-BODY, [ACTION-FI-FOUND [, ACTION-IF-NOT-FOUND]]) AC_DEFUN(WAPI_CHECK_FUNC, [AC_MSG_CHECKING(for $1) AC_CACHE_VAL(wapi_cv_func_$1, [AC_TRY_LINK([#include $2 ], [$3], wapi_cv_func_$1=yes, wapi_cv_func_$1=no)]) if eval "test \"`echo '$wapi_cv_func_'$1`\" = yes"; then AC_MSG_RESULT(yes) ifelse([$4], , :, [$4]) else AC_MSG_RESULT(no) ifelse([$5], , , [$5 ])dnl fi ]) dnl WAPI_CHECK_LIB(LIBRARY, FUNCTION, dnl INCLUDES, TEST-BODY dnl [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND dnl [, OTHER-LIBRARIES]]]) AC_DEFUN(WAPI_CHECK_LIB, [AC_MSG_CHECKING([for $2 in -l$1]) ac_lib_var=`echo $1['_']$2 | sed 'y%./+-%__p_%'` AC_CACHE_VAL(wapi_cv_lib_$ac_lib_var, [ac_save_LIBS="$LIBS" LIBS="-l$1 $7 $LIBS" AC_TRY_LINK([#include $3 ], [$4], eval "wapi_cv_lib_$ac_lib_var=yes", eval "wapi_cv_lib_$ac_lib_var=no") LIBS="$ac_save_LIBS" ])dnl if eval "test \"`echo '$wapi_cv_lib_'$ac_lib_var`\" = yes"; then AC_MSG_RESULT(yes) ifelse([$5], ,LIBS="-l$1 $LIBS", [$5]) else AC_MSG_RESULT(no) ifelse([$6], , , [$6 ])dnl fi ]) dnl EXTRACT_CPPFLAGS(CPPFLAGS-to-append,others-to-append,FLAGS) AC_DEFUN(EXTRACT_CPPFLAGS, [for f in $3; do case ".$f" in .-I?*|.-D?*) $1="[$]$1 $f" ;; *) $2="[$]$1 $f" ;; esac done ]) dnl CHECK_COMPILER_OPTION(OPTIONS [, ACTION-IF-SUCCEED [, ACTION-IF-FAILED]]) AC_DEFUN(CHECK_COMPILER_OPTION, [AC_MSG_CHECKING([whether -$1 option is recognized]) ac_ccoption=`echo $1 | sed 'y%./+-%__p_%'` AC_CACHE_VAL(timidity_cv_ccoption_$ac_ccoption, [cat > conftest.$ac_ext < conftest.out 2>&1; then if test -s conftest.out; then eval "timidity_cv_ccoption_$ac_ccoption=no" else eval "timidity_cv_ccoption_$ac_ccoption=yes" fi else eval "timidity_cv_ccoption_$ac_ccoption=no" fi ]) if eval "test \"`echo '$timidity_cv_ccoption_'$ac_ccoption`\" = yes"; then AC_MSG_RESULT(yes) ifelse([$2], , , [$2 ]) else AC_MSG_RESULT(no) ifelse([$3], , , [$3 ]) fi ]) dnl MY_SEARCH_LIBS(FUNCTION, LIBRARIES [, ACTION-IF-FOUND dnl [, ACTION-IF-NOT-FOUND [, OTHER-LIBRARIES]]]) dnl Search for a library defining FUNC, if it's not already available. AC_DEFUN(MY_SEARCH_LIBS, [AC_CACHE_CHECK([for library containing $1], [timidity_cv_search_$1], [ac_func_search_save_LIBS="$LIBS" timidity_cv_search_$1="no" for i in $2; do LIBS="$i $5 $ac_func_search_save_LIBS" AC_TRY_LINK_FUNC([$1], [timidity_cv_search_$1="$i"; break]) done LIBS="$ac_func_search_save_LIBS"]) if test "$timidity_cv_search_$1" != "no"; then $3 else : $4 fi]) # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 # 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, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. # serial 7 # AM_PATH_LISPDIR # --------------- AC_DEFUN([AM_PATH_LISPDIR], [AC_ARG_WITH(lispdir, [ --with-lispdir Override the default lisp directory ], [ lispdir="$withval" AC_MSG_CHECKING([where .elc files should go]) AC_MSG_RESULT([$lispdir])], [ # If set to t, that means we are running in a shell under Emacs. # If you have an Emacs named "t", then use the full path. test x"$EMACS" = xt && EMACS= AC_CHECK_PROGS(EMACS, emacs xemacs, no) if test $EMACS != "no"; then if test x${lispdir+set} != xset; then AC_CACHE_CHECK([where .elc files should go], [am_cv_lispdir], [# If $EMACS isn't GNU Emacs or XEmacs, this can blow up pretty badly # Some emacsen will start up in interactive mode, requiring C-x C-c to exit, # which is non-obvious for non-emacs users. # Redirecting /dev/null should help a bit; pity we can't detect "broken" # emacsen earlier and avoid running this altogether. AC_RUN_LOG([$EMACS -batch -q -eval '(while load-path (princ (concat (car load-path) "\n")) (setq load-path (cdr load-path)))' conftest.out]) am_cv_lispdir=`sed -n \ -e 's,/$,,' \ -e '/.*\/lib\/x\?emacs\/site-lisp$/{s,.*/lib/\(x\?emacs/site-lisp\)$,${libdir}/\1,;p;q;}' \ -e '/.*\/share\/x\?emacs\/site-lisp$/{s,.*/share/\(x\?emacs/site-lisp\),${datadir}/\1,;p;q;}' \ conftest.out` rm conftest.out if test -z "$am_cv_lispdir"; then am_cv_lispdir='${datadir}/emacs/site-lisp' fi ]) lispdir="$am_cv_lispdir" fi fi ]) AC_SUBST(lispdir) ])# AM_PATH_LISPDIR AU_DEFUN([ud_PATH_LISPDIR], [AM_PATH_LISPDIR]) dnl Configure Paths for Alsa dnl Some modifications by Richard Boulton dnl Christopher Lansdown dnl Jaroslav Kysela dnl Modified for TiMidity++ by URABE, Shyouhei dnl Original : alsa.m4,v 1.22 2002/05/27 11:14:20 tiwai Exp dnl This version: alsa.m4, 2002/10/08 22:30:18 JST dnl AM_PATH_ALSA([MINIMUM-VERSION [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) dnl Test for libasound, and define ALSA_CFLAGS and ALSA_LIBS as appropriate. dnl enables arguments --with-alsa-prefix= dnl --with-alsa-enc-prefix= dnl --disable-alsatest (this has no effect, as yet) 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 dnl dnl Get the cflags and libraries for alsa dnl AC_ARG_WITH(alsa-prefix, [ --with-alsa-prefix=PFX Prefix where Alsa library is installed(optional)], [alsa_prefix="$withval"], [alsa_prefix=""]) AC_ARG_WITH(alsa-inc-prefix, [ --with-alsa-inc-prefix=PFX Prefix where include libraries are (optional)], [alsa_inc_prefix="$withval"], [alsa_inc_prefix=""]) dnl FIXME: this is not yet implemented AC_ARG_ENABLE(alsatest, [ --disable-alsatest Do not try to compile and run a test Alsa program], [enable_alsatest=no], [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) 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 -ldl -lpthread" LIBS=`echo $LIBS | sed 's/-lm//'` LIBS=`echo $LIBS | sed 's/-ldl//'` LIBS=`echo $LIBS | sed 's/-lpthread//'` LIBS=`echo $LIBS | sed 's/ //'` LIBS="$ALSA_LIBS $LIBS" AC_MSG_RESULT($ALSA_LIBS) dnl Check for a working version of libasound that is of the right version. min_alsa_version=ifelse([$1], ,0.1.1,$1) AC_MSG_CHECKING(for libasound headers version >= $min_alsa_version) 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/'` dnl This is the test program. AC_DEFUN([MPUT_ALSA_TRY],[ /* 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); ])dnl macro MPUT_ALSA_TRY AC_LANG_SAVE AC_LANG_C AC_TRY_COMPILE([ #include ], MPUT_ALSA_TRY(), [AC_MSG_RESULT(found.)], [AC_TRY_COMPILE([ #include ], MPUT_ALSA_TRY(), [AC_MSG_RESULT(found.)], [AC_MSG_RESULT(not present.) ifelse([$3], ,[AC_MSG_RESULT(libasound was not found anywhere.)]) alsa_found=no]) ifelse([$3], ,[AC_MSG_RESULT(Sufficiently new version of libasound not found.)]) ]) AC_LANG_RESTORE dnl Now that we know we have the right version, why not see if we dnl have the library and not just the headers. AC_CHECK_LIB([asound],[snd_ctl_open], , [ifelse([$3], ,[AC_MSG_RESULT(No linkable libasound was found.)]) alsa_found=no ]) 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" else ifelse([$3], , :, [$3]) CFLAGS="$alsa_save_CFLAGS" LDFLAGS="$alsa_save_LDFLAGS" LIBS="$alsa_save_LIBS" ALSA_CFLAGS="" ALSA_LIBS="" fi dnl That should be it. Now just export out symbols: AC_SUBST(ALSA_CFLAGS) AC_SUBST(ALSA_LIBS) ]) dnl This should be pulled in from arts.m4 dnl dnl Oh my word, I've never hacked automake before - let me know if this is a dnl complete rubbish! dnl Peter L Jones 2002-05-12 dnl Snarfed from the ESD code below - but the faults are all mine! dnl AM_PATH_ARTS([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) dnl Test for aRts, and define ARTS_CFLAGS and ARTS_LIBS dnl AC_DEFUN(AM_PATH_ARTS, [dnl dnl Get the cflags and libraries from the arts-config script dnl AC_ARG_WITH(arts-prefix,[ --with-arts-prefix=PFX Prefix where ARTS is installed (optional)], arts_prefix="$withval", arts_prefix="") AC_ARG_ENABLE(artstest, [ --disable-artstest Do not try to compile and run a test ARTS program], , enable_artstest=yes) if test x$arts_prefix != x ; then arts_args="$arts_args --prefix=$arts_prefix" if test x${ARTS_CONFIG+set} != xset ; then ARTS_CONFIG=$arts_prefix/bin/artsc-config fi fi AC_PATH_PROG(ARTS_CONFIG, artsc-config, no) min_arts_version=ifelse([$1], ,0.9.5,$1) AC_MSG_CHECKING(for ARTS - version >= $min_arts_version) no_arts="" if test "$ARTS_CONFIG" = "no" ; then no_arts=yes else ARTS_CFLAGS=`$ARTS_CONFIG $artsconf_args --cflags` ARTS_LIBS=`$ARTS_CONFIG $artsconf_args --libs` arts_major_version=`$ARTS_CONFIG $arts_args --version | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` arts_minor_version=`$ARTS_CONFIG $arts_args --version | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` arts_micro_version=`$ARTS_CONFIG $arts_config_args --version | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` if test "x$enable_artstest" = "xyes" ; then ac_save_CFLAGS="$CFLAGS" ac_save_LIBS="$LIBS" CFLAGS="$CFLAGS $ARTS_CFLAGS" LIBS="$LIBS $ARTS_LIBS" dnl dnl Now check if the installed ARTS is sufficiently new. (Also sanity dnl checks the results of arts-config to some extent dnl rm -f conf.artstest AC_TRY_RUN([ #include #include #include #include char* my_strdup (char *str) { char *new_str; if (str) { new_str = malloc ((strlen (str) + 1) * sizeof(char)); strcpy (new_str, str); } else new_str = NULL; return new_str; } int main () { int major, minor, micro; char *tmp_version; system ("touch conf.artstest"); /* HP/UX 9 (%@#!) writes to sscanf strings */ tmp_version = my_strdup("$min_arts_version"); if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { printf("%s, bad version string\n", "$min_arts_version"); exit(1); } if (($arts_major_version > major) || (($arts_major_version == major) && ($arts_minor_version > minor)) || (($arts_major_version == major) && ($arts_minor_version == minor) && ($arts_micro_version >= micro))) { return 0; } else { printf("\n*** 'artsc-config --version' returned %d.%d.%d, but the minimum version\n", $arts_major_version, $arts_minor_version, $arts_micro_version); printf("*** of ARTS required is %d.%d.%d. If artsc-config is correct, then it is\n", major, minor, micro); printf("*** best to upgrade to the required version.\n"); printf("*** If artsc-config was wrong, set the environment variable ARTS_CONFIG\n"); printf("*** to point to the correct copy of artsc-config, and remove the file\n"); printf("*** config.cache before re-running configure\n"); return 1; } } ],, no_arts=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) CFLAGS="$ac_save_CFLAGS" LIBS="$ac_save_LIBS" fi fi if test "x$no_arts" = x ; then AC_MSG_RESULT(yes) ifelse([$2], , :, [$2]) else AC_MSG_RESULT(no) if test "$ARTS_CONFIG" = "no" ; then echo "*** The artsc-config script installed by ARTS could not be found" echo "*** If ARTS was installed in PREFIX, make sure PREFIX/bin is in" echo "*** your path, or set the ARTS_CONFIG environment variable to the" echo "*** full path to artsc-config." else if test -f conf.artstest ; then : else echo "*** Could not run ARTS test program, checking why..." CFLAGS="$CFLAGS $ARTS_CFLAGS" LIBS="$LIBS $ARTS_LIBS" AC_TRY_LINK([ #include #include ], [ return 0; ], [ echo "*** The test program compiled, but did not run. This usually means" echo "*** that the run-time linker is not finding ARTS or finding the wrong" echo "*** version of ARTS. If it is not finding ARTS, you'll need to set your" echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" echo "*** to the installed location Also, make sure you have run ldconfig if that" echo "*** is required on your system" echo "***" echo "*** If you have an old version installed, it is best to remove it, although" echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"], [ echo "*** The test program failed to compile or link. See the file config.log for the" echo "*** exact error that occured. This usually means ARTS was incorrectly installed" echo "*** or that you have moved ARTS since it was installed. In the latter case, you" echo "*** may want to edit the arts-config script: $ARTS_CONFIG" ]) CFLAGS="$ac_save_CFLAGS" LIBS="$ac_save_LIBS" fi fi ARTS_CFLAGS="" ARTS_LIBS="" ifelse([$3], , :, [$3]) fi AC_SUBST(ARTS_CFLAGS) AC_SUBST(ARTS_LIBS) rm -f conf.artstest ]) dnl End of aRts # Configure paths for ESD # Manish Singh 98-9-30 # stolen back from Frank Belew # stolen from Manish Singh # Shamelessly stolen from Owen Taylor dnl AM_PATH_ESD([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) dnl Test for ESD, and define ESD_CFLAGS and ESD_LIBS dnl AC_DEFUN(AM_PATH_ESD, [dnl dnl Get the cflags and libraries from the esd-config script dnl AC_ARG_WITH(esd-prefix,[ --with-esd-prefix=PFX Prefix where ESD is installed (optional)], esd_prefix="$withval", esd_prefix="") AC_ARG_WITH(esd-exec-prefix,[ --with-esd-exec-prefix=PFX Exec prefix where ESD is installed (optional)], esd_exec_prefix="$withval", esd_exec_prefix="") AC_ARG_ENABLE(esdtest, [ --disable-esdtest Do not try to compile and run a test ESD program], , enable_esdtest=yes) if test x$esd_exec_prefix != x ; then esd_args="$esd_args --exec-prefix=$esd_exec_prefix" if test x${ESD_CONFIG+set} != xset ; then ESD_CONFIG=$esd_exec_prefix/bin/esd-config fi fi if test x$esd_prefix != x ; then esd_args="$esd_args --prefix=$esd_prefix" if test x${ESD_CONFIG+set} != xset ; then ESD_CONFIG=$esd_prefix/bin/esd-config fi fi AC_PATH_PROG(ESD_CONFIG, esd-config, no) min_esd_version=ifelse([$1], ,0.2.7,$1) AC_MSG_CHECKING(for ESD - version >= $min_esd_version) no_esd="" if test "$ESD_CONFIG" = "no" ; then no_esd=yes else AC_LANG_SAVE AC_LANG_C ESD_CFLAGS=`$ESD_CONFIG $esdconf_args --cflags` ESD_LIBS=`$ESD_CONFIG $esdconf_args --libs` esd_major_version=`$ESD_CONFIG $esd_args --version | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` esd_minor_version=`$ESD_CONFIG $esd_args --version | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` esd_micro_version=`$ESD_CONFIG $esd_config_args --version | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` if test "x$enable_esdtest" = "xyes" ; then ac_save_CFLAGS="$CFLAGS" ac_save_LIBS="$LIBS" CFLAGS="$CFLAGS $ESD_CFLAGS" LIBS="$LIBS $ESD_LIBS" dnl dnl Now check if the installed ESD is sufficiently new. (Also sanity dnl checks the results of esd-config to some extent dnl rm -f conf.esdtest AC_TRY_RUN([ #include #include #include #include char* my_strdup (char *str) { char *new_str; if (str) { new_str = malloc ((strlen (str) + 1) * sizeof(char)); strcpy (new_str, str); } else new_str = NULL; return new_str; } int main () { int major, minor, micro; char *tmp_version; system ("touch conf.esdtest"); /* HP/UX 9 (%@#!) writes to sscanf strings */ tmp_version = my_strdup("$min_esd_version"); if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { printf("%s, bad version string\n", "$min_esd_version"); exit(1); } if (($esd_major_version > major) || (($esd_major_version == major) && ($esd_minor_version > minor)) || (($esd_major_version == major) && ($esd_minor_version == minor) && ($esd_micro_version >= micro))) { return 0; } else { printf("\n*** 'esd-config --version' returned %d.%d.%d, but the minimum version\n", $esd_major_version, $esd_minor_version, $esd_micro_version); printf("*** of ESD required is %d.%d.%d. If esd-config is correct, then it is\n", major, minor, micro); printf("*** best to upgrade to the required version.\n"); printf("*** If esd-config was wrong, set the environment variable ESD_CONFIG\n"); printf("*** to point to the correct copy of esd-config, and remove the file\n"); printf("*** config.cache before re-running configure\n"); return 1; } } ],, no_esd=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) CFLAGS="$ac_save_CFLAGS" LIBS="$ac_save_LIBS" AC_LANG_RESTORE fi fi if test "x$no_esd" = x ; then AC_MSG_RESULT(yes) ifelse([$2], , :, [$2]) else AC_MSG_RESULT(no) if test "$ESD_CONFIG" = "no" ; then echo "*** The esd-config script installed by ESD could not be found" echo "*** If ESD was installed in PREFIX, make sure PREFIX/bin is in" echo "*** your path, or set the ESD_CONFIG environment variable to the" echo "*** full path to esd-config." else if test -f conf.esdtest ; then : else echo "*** Could not run ESD test program, checking why..." CFLAGS="$CFLAGS $ESD_CFLAGS" LIBS="$LIBS $ESD_LIBS" AC_LANG_SAVE AC_LANG_C AC_TRY_LINK([ #include #include ], [ return 0; ], [ echo "*** The test program compiled, but did not run. This usually means" echo "*** that the run-time linker is not finding ESD or finding the wrong" echo "*** version of ESD. If it is not finding ESD, you'll need to set your" echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" echo "*** to the installed location Also, make sure you have run ldconfig if that" echo "*** is required on your system" echo "***" echo "*** If you have an old version installed, it is best to remove it, although" echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"], [ echo "*** The test program failed to compile or link. See the file config.log for the" echo "*** exact error that occured. This usually means ESD was incorrectly installed" echo "*** or that you have moved ESD since it was installed. In the latter case, you" echo "*** may want to edit the esd-config script: $ESD_CONFIG" ]) CFLAGS="$ac_save_CFLAGS" LIBS="$ac_save_LIBS" AC_LANG_RESTORE fi fi ESD_CFLAGS="" ESD_LIBS="" ifelse([$3], , :, [$3]) fi AC_SUBST(ESD_CFLAGS) AC_SUBST(ESD_LIBS) rm -f conf.esdtest ]) dnl AM_ESD_SUPPORTS_MULTIPLE_RECORD([ACTION-IF-SUPPORTS [, ACTION-IF-NOT-SUPPORTS]]) dnl Test, whether esd supports multiple recording clients (version >=0.2.21) dnl AC_DEFUN(AM_ESD_SUPPORTS_MULTIPLE_RECORD, [dnl AC_MSG_NOTICE([whether installed esd version supports multiple recording clients]) ac_save_ESD_CFLAGS="$ESD_CFLAGS" ac_save_ESD_LIBS="$ESD_LIBS" AM_PATH_ESD(0.2.21, ifelse([$1], , [ AM_CONDITIONAL(ESD_SUPPORTS_MULTIPLE_RECORD, true) AC_DEFINE(ESD_SUPPORTS_MULTIPLE_RECORD, 1, [Define if you have esound with support of multiple recording clients.])], [$1]), ifelse([$2], , [AM_CONDITIONAL(ESD_SUPPORTS_MULTIPLE_RECORD, false)], [$2]) if test "x$ac_save_ESD_CFLAGS" != x ; then ESD_CFLAGS="$ac_save_ESD_CFLAGS" fi if test "x$ac_save_ESD_LIBS" != x ; then ESD_LIBS="$ac_save_ESD_LIBS" fi ) ]) # ao.m4 # Configure paths for libao # Jack Moffitt 10-21-2000 # Shamelessly stolen from Owen Taylor and Manish Singh dnl XIPH_PATH_AO([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]) dnl Test for libao, and define AO_CFLAGS and AO_LIBS dnl AC_DEFUN(XIPH_PATH_AO, [dnl dnl Get the cflags and libraries dnl AC_ARG_WITH(ao,[ --with-ao=PFX Prefix where libao is installed (optional)], ao_prefix="$withval", ao_prefix="") AC_ARG_WITH(ao-libraries,[ --with-ao-libraries=DIR Directory where libao library is installed (optional)], ao_libraries="$withval", ao_libraries="") AC_ARG_WITH(ao-includes,[ --with-ao-includes=DIR Directory where libao header files are installed (optional)], ao_includes="$withval", ao_includes="") AC_ARG_ENABLE(aotest, [ --disable-aotest Do not try to compile and run a test ao program],, enable_aotest=yes) if test "x$ao_libraries" != "x" ; then AO_LIBS="-L$ao_libraries" elif test "x$ao_prefix" != "x"; then AO_LIBS="-L$ao_prefix/lib" elif test "x$prefix" != "xNONE"; then AO_LIBS="-L$prefix/lib" fi if test "x$ao_includes" != "x" ; then AO_CFLAGS="-I$ao_includes" elif test "x$ao_prefix" != "x"; then AO_CFLAGS="-I$ao_prefix/include" elif test "x$prefix" != "xNONE"; then AO_CFLAGS="-I$prefix/include" fi # see where dl* and friends live AC_CHECK_FUNCS(dlopen, [AO_DL_LIBS=""], [ AC_CHECK_LIB(dl, dlopen, [AO_DL_LIBS="-ldl"], [ AC_MSG_WARN([could not find dlopen() needed by libao sound drivers your system may not be supported.]) ]) ]) AO_LIBS="$AO_LIBS -lao $AO_DL_LIBS" AC_MSG_CHECKING(for ao) no_ao="" if test "x$enable_aotest" = "xyes" ; then ac_save_CFLAGS="$CFLAGS" ac_save_LIBS="$LIBS" CFLAGS="$CFLAGS $AO_CFLAGS" LIBS="$LIBS $AO_LIBS" dnl dnl Now check if the installed ao is sufficiently new. dnl rm -f conf.aotest AC_TRY_RUN([ #include #include #include #include int main () { system("touch conf.aotest"); return 0; } ],, no_ao=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) CFLAGS="$ac_save_CFLAGS" LIBS="$ac_save_LIBS" fi if test "x$no_ao" = "x" ; then AC_MSG_RESULT(yes) ifelse([$1], , :, [$1]) else AC_MSG_RESULT(no) if test -f conf.aotest ; then : else echo "*** Could not run ao test program, checking why..." CFLAGS="$CFLAGS $AO_CFLAGS" LIBS="$LIBS $AO_LIBS" AC_TRY_LINK([ #include #include ], [ return 0; ], [ echo "*** The test program compiled, but did not run. This usually means" echo "*** that the run-time linker is not finding ao or finding the wrong" echo "*** version of ao. If it is not finding ao, you'll need to set your" echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" echo "*** to the installed location Also, make sure you have run ldconfig if that" echo "*** is required on your system" echo "***" echo "*** If you have an old version installed, it is best to remove it, although" echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"], [ echo "*** The test program failed to compile or link. See the file config.log for the" echo "*** exact error that occured. This usually means ao was incorrectly installed" echo "*** or that you have moved ao since it was installed." ]) CFLAGS="$ac_save_CFLAGS" LIBS="$ac_save_LIBS" fi AO_CFLAGS="" AO_LIBS="" ifelse([$2], , :, [$2]) fi AC_SUBST(AO_CFLAGS) AC_SUBST(AO_LIBS) rm -f conf.aotest ]) # Configure paths for libogg # Jack Moffitt 10-21-2000 # Shamelessly stolen from Owen Taylor and Manish Singh dnl AM_PATH_OGG([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]) dnl Test for libogg, and define OGG_CFLAGS and OGG_LIBS dnl AC_DEFUN(AM_PATH_OGG, [dnl dnl Get the cflags and libraries dnl AC_ARG_WITH(ogg,[ --with-ogg=PFX Prefix where libogg is installed (optional)], ogg_prefix="$withval", ogg_prefix="") AC_ARG_WITH(ogg-libraries,[ --with-ogg-libraries=DIR Directory where libogg library is installed (optional)], ogg_libraries="$withval", ogg_libraries="") AC_ARG_WITH(ogg-includes,[ --with-ogg-includes=DIR Directory where libogg header files are installed (optional)], ogg_includes="$withval", ogg_includes="") AC_ARG_ENABLE(oggtest, [ --disable-oggtest Do not try to compile and run a test Ogg program],, enable_oggtest=yes) if test "x$ogg_libraries" != "x" ; then OGG_LIBS="-L$ogg_libraries" elif test "x$ogg_prefix" != "x" ; then OGG_LIBS="-L$ogg_prefix/lib" elif test "x$prefix" != "xNONE" ; then OGG_LIBS="-L$prefix/lib" fi OGG_LIBS="$OGG_LIBS -logg" if test "x$ogg_includes" != "x" ; then OGG_CFLAGS="-I$ogg_includes" elif test "x$ogg_prefix" != "x" ; then OGG_CFLAGS="-I$ogg_prefix/include" elif test "x$prefix" != "xNONE"; then OGG_CFLAGS="-I$prefix/include" fi AC_MSG_CHECKING(for Ogg) no_ogg="" if test "x$enable_oggtest" = "xyes" ; then ac_save_CFLAGS="$CFLAGS" ac_save_LIBS="$LIBS" CFLAGS="$CFLAGS $OGG_CFLAGS" LIBS="$LIBS $OGG_LIBS" dnl dnl Now check if the installed Ogg is sufficiently new. dnl rm -f conf.oggtest AC_TRY_RUN([ #include #include #include #include int main () { system("touch conf.oggtest"); return 0; } ],, no_ogg=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) CFLAGS="$ac_save_CFLAGS" LIBS="$ac_save_LIBS" fi if test "x$no_ogg" = "x" ; then AC_MSG_RESULT(yes) ifelse([$1], , :, [$1]) else AC_MSG_RESULT(no) if test -f conf.oggtest ; then : else echo "*** Could not run Ogg test program, checking why..." CFLAGS="$CFLAGS $OGG_CFLAGS" LIBS="$LIBS $OGG_LIBS" AC_TRY_LINK([ #include #include ], [ return 0; ], [ echo "*** The test program compiled, but did not run. This usually means" echo "*** that the run-time linker is not finding Ogg or finding the wrong" echo "*** version of Ogg. If it is not finding Ogg, you'll need to set your" echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" echo "*** to the installed location Also, make sure you have run ldconfig if that" echo "*** is required on your system" echo "***" echo "*** If you have an old version installed, it is best to remove it, although" echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"], [ echo "*** The test program failed to compile or link. See the file config.log for the" echo "*** exact error that occured. This usually means Ogg was incorrectly installed" echo "*** or that you have moved Ogg since it was installed. In the latter case, you" echo "*** may want to edit the ogg-config script: $OGG_CONFIG" ]) CFLAGS="$ac_save_CFLAGS" LIBS="$ac_save_LIBS" fi OGG_CFLAGS="" OGG_LIBS="" ifelse([$2], , :, [$2]) fi AC_SUBST(OGG_CFLAGS) AC_SUBST(OGG_LIBS) rm -f conf.oggtest ]) # Configure paths for libvorbis # Jack Moffitt 10-21-2000 # Shamelessly stolen from Owen Taylor and Manish Singh dnl AM_PATH_VORBIS([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]) dnl Test for libvorbis, and define VORBIS_CFLAGS and VORBIS_LIBS dnl AC_DEFUN(AM_PATH_VORBIS, [dnl dnl Get the cflags and libraries dnl AC_ARG_WITH(vorbis,[ --with-vorbis=PFX Prefix where libvorbis is installed (optional)], vorbis_prefix="$withval", vorbis_prefix="") AC_ARG_WITH(vorbis-libraries,[ --with-vorbis-libraries=DIR Directory where libvorbis library is installed (optional)], vorbis_libraries="$withval", vorbis_libraries="") AC_ARG_WITH(vorbis-includes,[ --with-vorbis-includes=DIR Directory where libvorbis header files are installed (optional)], vorbis_includes="$withval", vorbis_includes="") AC_ARG_ENABLE(vorbistest, [ --disable-vorbistest Do not try to compile and run a test Vorbis program],, enable_vorbistest=yes) if test "x$vorbis_libraries" != "x" ; then VORBIS_LIBS="-L$vorbis_libraries" elif test "x$vorbis_prefix" != "x" ; then VORBIS_LIBS="-L$vorbis_prefix/lib" elif test "x$prefix" != "xNONE"; then VORBIS_LIBS="-L$prefix/lib" fi VORBIS_LIBS="$VORBIS_LIBS -lvorbis -lm" VORBISFILE_LIBS="-lvorbisfile" VORBISENC_LIBS="-lvorbisenc" if test "x$vorbis_includes" != "x" ; then VORBIS_CFLAGS="-I$vorbis_includes" elif test "x$vorbis_prefix" != "x" ; then VORBIS_CFLAGS="-I$vorbis_prefix/include" elif test "x$prefix" != "xNONE"; then VORBIS_CFLAGS="-I$prefix/include" fi AC_MSG_CHECKING(for Vorbis) no_vorbis="" if test "x$enable_vorbistest" = "xyes" ; then ac_save_CFLAGS="$CFLAGS" ac_save_LIBS="$LIBS" CFLAGS="$CFLAGS $VORBIS_CFLAGS $OGG_CFLAGS" LIBS="$LIBS $VORBIS_LIBS $OGG_LIBS" dnl dnl Now check if the installed Vorbis is sufficiently new. dnl rm -f conf.vorbistest AC_TRY_RUN([ #include #include #include #include int main () { system("touch conf.vorbistest"); return 0; } ],, no_vorbis=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) CFLAGS="$ac_save_CFLAGS" LIBS="$ac_save_LIBS" fi if test "x$no_vorbis" = "x" ; then AC_MSG_RESULT(yes) ifelse([$1], , :, [$1]) else AC_MSG_RESULT(no) if test -f conf.vorbistest ; then : else echo "*** Could not run Vorbis test program, checking why..." CFLAGS="$CFLAGS $VORBIS_CFLAGS" LIBS="$LIBS $VORBIS_LIBS $OGG_LIBS" AC_TRY_LINK([ #include #include ], [ return 0; ], [ echo "*** The test program compiled, but did not run. This usually means" echo "*** that the run-time linker is not finding Vorbis or finding the wrong" echo "*** version of Vorbis. If it is not finding Vorbis, you'll need to set your" echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" echo "*** to the installed location Also, make sure you have run ldconfig if that" echo "*** is required on your system" echo "***" echo "*** If you have an old version installed, it is best to remove it, although" echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"], [ echo "*** The test program failed to compile or link. See the file config.log for the" echo "*** exact error that occured. This usually means Vorbis was incorrectly installed" echo "*** or that you have moved Vorbis since it was installed." ]) CFLAGS="$ac_save_CFLAGS" LIBS="$ac_save_LIBS" fi VORBIS_CFLAGS="" VORBIS_LIBS="" VORBISFILE_LIBS="" VORBISENC_LIBS="" ifelse([$2], , :, [$2]) fi AC_SUBST(VORBIS_CFLAGS) AC_SUBST(VORBIS_LIBS) AC_SUBST(VORBISFILE_LIBS) AC_SUBST(VORBISENC_LIBS) rm -f conf.vorbistest ]) # Configure paths for libFLAC # "Inspired" by ogg.m4 dnl AM_PATH_LIBFLAC([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]) dnl Test for libFLAC, and define LIBFLAC_CFLAGS and LIBFLAC_LIBS dnl AC_DEFUN(AM_PATH_LIBFLAC, [dnl dnl Get the cflags and libraries dnl AC_ARG_WITH(libFLAC,[ --with-libFLAC=PFX Prefix where libFLAC is installed (optional)], libFLAC_prefix="$withval", libFLAC_prefix="") AC_ARG_WITH(libFLAC-libraries,[ --with-libFLAC-libraries=DIR Directory where libFLAC library is installed (optional)], libFLAC_libraries="$withval", libFLAC_libraries="") AC_ARG_WITH(libFLAC-includes,[ --with-libFLAC-includes=DIR Directory where libFLAC header files are installed (optional)], libFLAC_includes="$withval", libFLAC_includes="") AC_ARG_ENABLE(libFLACtest, [ --disable-libFLACtest Do not try to compile and run a test libFLAC program],, enable_libFLACtest=yes) if test "x$libFLAC_libraries" != "x" ; then LIBFLAC_LIBS="-L$libFLAC_libraries" elif test "x$libFLAC_prefix" != "x" ; then LIBFLAC_LIBS="-L$libFLAC_prefix/lib" elif test "x$prefix" != "xNONE" ; then LIBFLAC_LIBS="-L$prefix/lib" fi LIBFLAC_LIBS="$LIBFLAC_LIBS -lFLAC -lm" if test "x$libFLAC_includes" != "x" ; then LIBFLAC_CFLAGS="-I$libFLAC_includes" elif test "x$libFLAC_prefix" != "x" ; then LIBFLAC_CFLAGS="-I$libFLAC_prefix/include" elif test "$prefix" != "xNONE"; then LIBFLAC_CFLAGS="-I$prefix/include" fi AC_MSG_CHECKING(for libFLAC) no_libFLAC="" if test "x$enable_libFLACtest" = "xyes" ; then ac_save_CFLAGS="$CFLAGS" ac_save_CXXFLAGS="$CXXFLAGS" ac_save_LIBS="$LIBS" CFLAGS="$CFLAGS $LIBFLAC_CFLAGS" CXXFLAGS="$CXXFLAGS $LIBFLAC_CFLAGS" LIBS="$LIBS $LIBFLAC_LIBS" dnl dnl Now check if the installed libFLAC is sufficiently new. dnl rm -f conf.libFLACtest AC_TRY_RUN([ #include #include #include #include int main () { system("touch conf.libFLACtest"); return 0; } ],, no_libFLAC=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) CFLAGS="$ac_save_CFLAGS" LIBS="$ac_save_LIBS" fi if test "x$no_libFLAC" = "x" ; then AC_MSG_RESULT(yes) ifelse([$1], , :, [$1]) else AC_MSG_RESULT(no) if test -f conf.libFLACtest ; then : else echo "*** Could not run libFLAC test program, checking why..." CFLAGS="$CFLAGS $LIBFLAC_CFLAGS" LIBS="$LIBS $LIBFLAC_LIBS" AC_TRY_LINK([ #include #include ], [ return 0; ], [ echo "*** The test program compiled, but did not run. This usually means" echo "*** that the run-time linker is not finding libFLAC or finding the wrong" echo "*** version of libFLAC. If it is not finding libFLAC, you'll need to set your" echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" echo "*** to the installed location Also, make sure you have run ldconfig if that" echo "*** is required on your system" echo "***" echo "*** If you have an old version installed, it is best to remove it, although" echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"], [ echo "*** The test program failed to compile or link. See the file config.log for the" echo "*** exact error that occured. This usually means libFLAC was incorrectly installed" echo "*** or that you have moved libFLAC since it was installed. In the latter case, you" echo "*** may want to edit the libFLAC-config script: $LIBFLAC_CONFIG" ]) CFLAGS="$ac_save_CFLAGS" LIBS="$ac_save_LIBS" fi LIBFLAC_CFLAGS="" LIBFLAC_LIBS="" ifelse([$2], , :, [$2]) fi AC_SUBST(LIBFLAC_CFLAGS) AC_SUBST(LIBFLAC_LIBS) rm -f conf.libFLACtest ]) # Configure paths for libOggFLAC # "Inspired" by ogg.m4 dnl AM_PATH_LIBOGGFLAC([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]) dnl Test for libOggFLAC, and define LIBOGGFLAC_CFLAGS and LIBOGGFLAC_LIBS dnl AC_DEFUN(AM_PATH_LIBOGGFLAC, [dnl dnl Get the cflags and libraries dnl AC_ARG_WITH(libOggFLAC,[ --with-libOggFLAC=PFX Prefix where libOggFLAC is installed (optional)], libOggFLAC_prefix="$withval", libOggFLAC_prefix="") AC_ARG_WITH(libOggFLAC-libraries,[ --with-libOggFLAC-libraries=DIR Directory where libOggFLAC library is installed (optional)], libOggFLAC_libraries="$withval", libOggFLAC_libraries="") AC_ARG_WITH(libOggFLAC-includes,[ --with-libOggFLAC-includes=DIR Directory where libOggFLAC header files are installed (optional)], libOggFLAC_includes="$withval", libOggFLAC_includes="") AC_ARG_ENABLE(libOggFLACtest, [ --disable-libOggFLACtest Do not try to compile and run a test libOggFLAC program],, enable_libOggFLACtest=yes) if test "x$libOggFLAC_libraries" != "x" ; then LIBOGGFLAC_LIBS="-L$libOggFLAC_libraries" elif test "x$libOggFLAC_prefix" != "x" ; then LIBOGGFLAC_LIBS="-L$libOggFLAC_prefix/lib" elif test "x$prefix" != "xNONE" ; then LIBOGGFLAC_LIBS="-L$prefix/lib" fi LIBOGGFLAC_LIBS="$LIBOGGFLAC_LIBS -lOggFLAC -lFLAC -lm" if test "x$libOggFLAC_includes" != "x" ; then LIBOGGFLAC_CFLAGS="-I$libOggFLAC_includes" elif test "x$libOggFLAC_prefix" != "x" ; then LIBOGGFLAC_CFLAGS="-I$libOggFLAC_prefix/include" elif test "$prefix" != "xNONE"; then LIBOGGFLAC_CFLAGS="-I$prefix/include" fi AC_MSG_CHECKING(for libOggFLAC) no_libOggFLAC="" if test "x$enable_libOggFLACtest" = "xyes" ; then ac_save_CFLAGS="$CFLAGS" ac_save_CXXFLAGS="$CXXFLAGS" ac_save_LIBS="$LIBS" CFLAGS="$CFLAGS $LIBOGGFLAC_CFLAGS" CXXFLAGS="$CXXFLAGS $LIBOGGFLAC_CFLAGS" LIBS="$LIBS $LIBOGGFLAC_LIBS" dnl dnl Now check if the installed libOggFLAC is sufficiently new. dnl rm -f conf.libOggFLACtest AC_TRY_RUN([ #include #include #include #include int main () { system("touch conf.libOggFLACtest"); return 0; } ],, no_libOggFLAC=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) CFLAGS="$ac_save_CFLAGS" LIBS="$ac_save_LIBS" fi if test "x$no_libOggFLAC" = "x" ; then AC_MSG_RESULT(yes) ifelse([$1], , :, [$1]) else AC_MSG_RESULT(no) if test -f conf.libOggFLACtest ; then : else echo "*** Could not run libOggFLAC test program, checking why..." CFLAGS="$CFLAGS $LIBOGGFLAC_CFLAGS" LIBS="$LIBS $LIBOGGFLAC_LIBS" AC_TRY_LINK([ #include #include ], [ return 0; ], [ echo "*** The test program compiled, but did not run. This usually means" echo "*** that the run-time linker is not finding libOggFLAC or finding the wrong" echo "*** version of libOggFLAC. If it is not finding libOggFLAC, you'll need to set your" echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" echo "*** to the installed location Also, make sure you have run ldconfig if that" echo "*** is required on your system" echo "***" echo "*** If you have an old version installed, it is best to remove it, although" echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"], [ echo "*** The test program failed to compile or link. See the file config.log for the" echo "*** exact error that occured. This usually means libOggFLAC was incorrectly installed" echo "*** or that you have moved libOggFLAC since it was installed. In the latter case, you" echo "*** may want to edit the libOggFLAC-config script: $LIBOGGFLAC_CONFIG" ]) CFLAGS="$ac_save_CFLAGS" LIBS="$ac_save_LIBS" fi LIBOGGFLAC_CFLAGS="" LIBOGGFLAC_LIBS="" ifelse([$2], , :, [$2]) fi AC_SUBST(LIBOGGFLAC_CFLAGS) AC_SUBST(LIBOGGFLAC_LIBS) rm -f conf.libOggFLACtest ]) # Configure paths for GTK+ # Owen Taylor 1997-2001 dnl AM_PATH_GTK_2_0([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]]) dnl Test for GTK+, and define GTK_CFLAGS and GTK_LIBS, if gthread is specified in MODULES, dnl pass to pkg-config dnl AC_DEFUN(AM_PATH_GTK_2_0, [dnl dnl Get the cflags and libraries from pkg-config dnl AC_ARG_ENABLE(gtktest, [ --disable-gtktest do not try to compile and run a test GTK+ program], , enable_gtktest=yes) pkg_config_args=gtk+-2.0 for module in . $4 do case "$module" in gthread) pkg_config_args="$pkg_config_args gthread-2.0" ;; esac done no_gtk="" AC_PATH_PROG(PKG_CONFIG, pkg-config, no) if test x$PKG_CONFIG != xno ; then if pkg-config --atleast-pkgconfig-version 0.7 ; then : else echo *** pkg-config too old; version 0.7 or better required. no_gtk=yes PKG_CONFIG=no fi else no_gtk=yes fi min_gtk_version=ifelse([$1], ,2.0.0,$1) AC_MSG_CHECKING(for GTK+ - version >= $min_gtk_version) if test x$PKG_CONFIG != xno ; then ## don't try to run the test against uninstalled libtool libs if $PKG_CONFIG --uninstalled $pkg_config_args; then echo "Will use uninstalled version of GTK+ found in PKG_CONFIG_PATH" enable_gtktest=no fi if $PKG_CONFIG --atleast-version $min_gtk_version $pkg_config_args; then : else no_gtk=yes fi fi if test x"$no_gtk" = x ; then GTK_CFLAGS=`$PKG_CONFIG $pkg_config_args --cflags` GTK_LIBS=`$PKG_CONFIG $pkg_config_args --libs` gtk_config_major_version=`$PKG_CONFIG --modversion gtk+-2.0 | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` gtk_config_minor_version=`$PKG_CONFIG --modversion gtk+-2.0 | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` gtk_config_micro_version=`$PKG_CONFIG --modversion gtk+-2.0 | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` if test "x$enable_gtktest" = "xyes" ; then ac_save_CFLAGS="$CFLAGS" ac_save_LIBS="$LIBS" CFLAGS="$CFLAGS $GTK_CFLAGS" LIBS="$GTK_LIBS $LIBS" dnl dnl Now check if the installed GTK+ is sufficiently new. (Also sanity dnl checks the results of pkg-config to some extent) dnl rm -f conf.gtktest AC_TRY_RUN([ #include #include #include int main () { int major, minor, micro; char *tmp_version; system ("touch conf.gtktest"); /* HP/UX 9 (%@#!) writes to sscanf strings */ tmp_version = g_strdup("$min_gtk_version"); if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { printf("%s, bad version string\n", "$min_gtk_version"); exit(1); } if ((gtk_major_version != $gtk_config_major_version) || (gtk_minor_version != $gtk_config_minor_version) || (gtk_micro_version != $gtk_config_micro_version)) { printf("\n*** 'pkg-config --modversion gtk+-2.0' returned %d.%d.%d, but GTK+ (%d.%d.%d)\n", $gtk_config_major_version, $gtk_config_minor_version, $gtk_config_micro_version, gtk_major_version, gtk_minor_version, gtk_micro_version); printf ("*** was found! If pkg-config was correct, then it is best\n"); printf ("*** to remove the old version of GTK+. You may also be able to fix the error\n"); printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n"); printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n"); printf("*** required on your system.\n"); printf("*** If pkg-config was wrong, set the environment variable PKG_CONFIG_PATH\n"); printf("*** to point to the correct configuration files\n"); } else if ((gtk_major_version != GTK_MAJOR_VERSION) || (gtk_minor_version != GTK_MINOR_VERSION) || (gtk_micro_version != GTK_MICRO_VERSION)) { printf("*** GTK+ header files (version %d.%d.%d) do not match\n", GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION); printf("*** library (version %d.%d.%d)\n", gtk_major_version, gtk_minor_version, gtk_micro_version); } else { if ((gtk_major_version > major) || ((gtk_major_version == major) && (gtk_minor_version > minor)) || ((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_micro_version >= micro))) { return 0; } else { printf("\n*** An old version of GTK+ (%d.%d.%d) was found.\n", gtk_major_version, gtk_minor_version, gtk_micro_version); printf("*** You need a version of GTK+ newer than %d.%d.%d. The latest version of\n", major, minor, micro); printf("*** GTK+ is always available from ftp://ftp.gtk.org.\n"); printf("***\n"); printf("*** If you have already installed a sufficiently new version, this error\n"); printf("*** probably means that the wrong copy of the pkg-config shell script is\n"); printf("*** being found. The easiest way to fix this is to remove the old version\n"); printf("*** of GTK+, but you can also set the PKG_CONFIG environment to point to the\n"); printf("*** correct copy of pkg-config. (In this case, you will have to\n"); printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n"); printf("*** so that the correct libraries are found at run-time))\n"); } } return 1; } ],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) CFLAGS="$ac_save_CFLAGS" LIBS="$ac_save_LIBS" fi fi if test "x$no_gtk" = x ; then AC_MSG_RESULT(yes (version $gtk_config_major_version.$gtk_config_minor_version.$gtk_config_micro_version)) ifelse([$2], , :, [$2]) else AC_MSG_RESULT(no) if test "$PKG_CONFIG" = "no" ; then echo "*** A new enough version of pkg-config was not found." echo "*** See http://pkgconfig.sourceforge.net" else if test -f conf.gtktest ; then : else echo "*** Could not run GTK+ test program, checking why..." ac_save_CFLAGS="$CFLAGS" ac_save_LIBS="$LIBS" CFLAGS="$CFLAGS $GTK_CFLAGS" LIBS="$LIBS $GTK_LIBS" AC_TRY_LINK([ #include #include ], [ return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version)); ], [ echo "*** The test program compiled, but did not run. This usually means" echo "*** that the run-time linker is not finding GTK+ or finding the wrong" echo "*** version of GTK+. If it is not finding GTK+, you'll need to set your" echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" echo "*** to the installed location Also, make sure you have run ldconfig if that" echo "*** is required on your system" echo "***" echo "*** If you have an old version installed, it is best to remove it, although" echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" ], [ echo "*** The test program failed to compile or link. See the file config.log for the" echo "*** exact error that occured. This usually means GTK+ is incorrectly installed."]) CFLAGS="$ac_save_CFLAGS" LIBS="$ac_save_LIBS" fi fi GTK_CFLAGS="" GTK_LIBS="" ifelse([$3], , :, [$3]) fi AC_SUBST(GTK_CFLAGS) AC_SUBST(GTK_LIBS) rm -f conf.gtktest ]) # Configure paths for GTK+ # Owen Taylor 97-11-3 dnl AM_PATH_GTK([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]]) dnl Test for GTK, and define GTK_CFLAGS and GTK_LIBS dnl AC_DEFUN(AM_PATH_GTK, [dnl dnl Get the cflags and libraries from the gtk-config script dnl AC_ARG_WITH(gtk-prefix,[ --with-gtk-prefix=PFX Prefix where GTK is installed (optional)], gtk_config_prefix="$withval", gtk_config_prefix="") AC_ARG_WITH(gtk-exec-prefix,[ --with-gtk-exec-prefix=PFX Exec prefix where GTK is installed (optional)], gtk_config_exec_prefix="$withval", gtk_config_exec_prefix="") AC_ARG_ENABLE(gtktest, [ --disable-gtktest Do not try to compile and run a test GTK program], , enable_gtktest=yes) for module in . $4 do case "$module" in gthread) gtk_config_args="$gtk_config_args gthread" ;; esac done if test x$gtk_config_exec_prefix != x ; then gtk_config_args="$gtk_config_args --exec-prefix=$gtk_config_exec_prefix" if test x${GTK_CONFIG+set} != xset ; then GTK_CONFIG=$gtk_config_exec_prefix/bin/gtk-config fi fi if test x$gtk_config_prefix != x ; then gtk_config_args="$gtk_config_args --prefix=$gtk_config_prefix" if test x${GTK_CONFIG+set} != xset ; then GTK_CONFIG=$gtk_config_prefix/bin/gtk-config fi fi AC_PATH_PROG(GTK_CONFIG, gtk-config, no) min_gtk_version=ifelse([$1], ,0.99.7,$1) AC_MSG_CHECKING(for GTK - version >= $min_gtk_version) no_gtk="" if test "$GTK_CONFIG" = "no" ; then no_gtk=yes else GTK_CFLAGS=`$GTK_CONFIG $gtk_config_args --cflags` GTK_LIBS=`$GTK_CONFIG $gtk_config_args --libs` gtk_config_major_version=`$GTK_CONFIG $gtk_config_args --version | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` gtk_config_minor_version=`$GTK_CONFIG $gtk_config_args --version | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` gtk_config_micro_version=`$GTK_CONFIG $gtk_config_args --version | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` if test "x$enable_gtktest" = "xyes" ; then ac_save_CFLAGS="$CFLAGS" ac_save_LIBS="$LIBS" CFLAGS="$CFLAGS $GTK_CFLAGS" LIBS="$GTK_LIBS $LIBS" dnl dnl Now check if the installed GTK is sufficiently new. (Also sanity dnl checks the results of gtk-config to some extent dnl rm -f conf.gtktest AC_TRY_RUN([ #include #include #include int main () { int major, minor, micro; char *tmp_version; system ("touch conf.gtktest"); /* HP/UX 9 (%@#!) writes to sscanf strings */ tmp_version = g_strdup("$min_gtk_version"); if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { printf("%s, bad version string\n", "$min_gtk_version"); exit(1); } if ((gtk_major_version != $gtk_config_major_version) || (gtk_minor_version != $gtk_config_minor_version) || (gtk_micro_version != $gtk_config_micro_version)) { printf("\n*** 'gtk-config --version' returned %d.%d.%d, but GTK+ (%d.%d.%d)\n", $gtk_config_major_version, $gtk_config_minor_version, $gtk_config_micro_version, gtk_major_version, gtk_minor_version, gtk_micro_version); printf ("*** was found! If gtk-config was correct, then it is best\n"); printf ("*** to remove the old version of GTK+. You may also be able to fix the error\n"); printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n"); printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n"); printf("*** required on your system.\n"); printf("*** If gtk-config was wrong, set the environment variable GTK_CONFIG\n"); printf("*** to point to the correct copy of gtk-config, and remove the file config.cache\n"); printf("*** before re-running configure\n"); } #if defined (GTK_MAJOR_VERSION) && defined (GTK_MINOR_VERSION) && defined (GTK_MICRO_VERSION) else if ((gtk_major_version != GTK_MAJOR_VERSION) || (gtk_minor_version != GTK_MINOR_VERSION) || (gtk_micro_version != GTK_MICRO_VERSION)) { printf("*** GTK+ header files (version %d.%d.%d) do not match\n", GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION); printf("*** library (version %d.%d.%d)\n", gtk_major_version, gtk_minor_version, gtk_micro_version); } #endif /* defined (GTK_MAJOR_VERSION) ... */ else { if ((gtk_major_version > major) || ((gtk_major_version == major) && (gtk_minor_version > minor)) || ((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_micro_version >= micro))) { return 0; } else { printf("\n*** An old version of GTK+ (%d.%d.%d) was found.\n", gtk_major_version, gtk_minor_version, gtk_micro_version); printf("*** You need a version of GTK+ newer than %d.%d.%d. The latest version of\n", major, minor, micro); printf("*** GTK+ is always available from ftp://ftp.gtk.org.\n"); printf("***\n"); printf("*** If you have already installed a sufficiently new version, this error\n"); printf("*** probably means that the wrong copy of the gtk-config shell script is\n"); printf("*** being found. The easiest way to fix this is to remove the old version\n"); printf("*** of GTK+, but you can also set the GTK_CONFIG environment to point to the\n"); printf("*** correct copy of gtk-config. (In this case, you will have to\n"); printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n"); printf("*** so that the correct libraries are found at run-time))\n"); } } return 1; } ],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) CFLAGS="$ac_save_CFLAGS" LIBS="$ac_save_LIBS" fi fi if test "x$no_gtk" = x ; then AC_MSG_RESULT(yes) ifelse([$2], , :, [$2]) else AC_MSG_RESULT(no) if test "$GTK_CONFIG" = "no" ; then echo "*** The gtk-config script installed by GTK could not be found" echo "*** If GTK was installed in PREFIX, make sure PREFIX/bin is in" echo "*** your path, or set the GTK_CONFIG environment variable to the" echo "*** full path to gtk-config." else if test -f conf.gtktest ; then : else echo "*** Could not run GTK test program, checking why..." CFLAGS="$CFLAGS $GTK_CFLAGS" LIBS="$LIBS $GTK_LIBS" AC_TRY_LINK([ #include #include ], [ return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version)); ], [ echo "*** The test program compiled, but did not run. This usually means" echo "*** that the run-time linker is not finding GTK or finding the wrong" echo "*** version of GTK. If it is not finding GTK, you'll need to set your" echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" echo "*** to the installed location Also, make sure you have run ldconfig if that" echo "*** is required on your system" echo "***" echo "*** If you have an old version installed, it is best to remove it, although" echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" echo "***" echo "*** If you have a RedHat 5.0 system, you should remove the GTK package that" echo "*** came with the system with the command" echo "***" echo "*** rpm --erase --nodeps gtk gtk-devel" ], [ echo "*** The test program failed to compile or link. See the file config.log for the" echo "*** exact error that occured. This usually means GTK was incorrectly installed" echo "*** or that you have moved GTK since it was installed. In the latter case, you" echo "*** may want to edit the gtk-config script: $GTK_CONFIG" ]) CFLAGS="$ac_save_CFLAGS" LIBS="$ac_save_LIBS" fi fi GTK_CFLAGS="" GTK_LIBS="" ifelse([$3], , :, [$3]) fi AC_SUBST(GTK_CFLAGS) AC_SUBST(GTK_LIBS) rm -f conf.gtktest ]) TiMidity++-2.13.2/common.makefile.in0100644004711200001440000000527010016464700016273 0ustar tamukiusers## TiMidity++ -- MIDI to WAVE converter and player ## Copyright (C) 1999-2002 Masanao Izumo ## Copyright (C) 1995 Tuukka Toivonen ## ## 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # Define follows if you want to change. # Note that the definition of beginning with just one `#' implies # default value from configure. SHELL=@SHELL@ ## Package compilations ## Please modify and uncomment if you want to change. #CC= @CC@ #CFLAGS = @CFLAGS@ # For pentium gcc ##CFLAGS = -O3 -mpentium -march=pentium -fomit-frame-pointer \ ## -funroll-all-loops -malign-double -ffast-math # For PGCC ##CFLAGS = -O6 -mpentium -fomit-frame-pointer -funroll-all-loops -ffast-math \ ## -fno-peep-spills \ ## -fno-exceptions -malign-jumps=0 -malign-loops=0 -malign-functions=0 #CPPFLAGS = @CPPFLAGS@ #DEFS = @DEFS@ #LDFLAGS = @LDFLAGS@ #LIBS = @LIBS@ #SHLD = @SHLD@ #SHCFLAGS = @SHCFLAGS@ #@SET_MAKE@ ## Package installations: #prefix = @prefix@ #exec_prefix = @exec_prefix@ #bindir = @bindir@ #libdir = @libdir@ #datadir = @datadir@ #mandir = @mandir@ pkglibdir = @pkglibdir@ pkgdatadir = @pkgdatadir@ #INSTALL = @INSTALL@ # Where to install the patches, config files. PKGDATADIR = $(pkgdatadir) # Where to install the Tcl code and the bitmaps. # It also contains bitmaps which are shared with XAW interface. PKGLIBDIR = $(pkglibdir) # Where to install the dynamic link interface. SHLIB_DIR = $(pkglibdir) # Where to install timidity.el ELISP_DIR = $(lispdir) # If you want to change TCL_DIR, please do follows. # * Add -DTKPROGPATH=\"$(TCL_DIR)/tkmidity.tcl\" to CPPFLAGS. # * Make a symbolic link $(PKGLIBDIR)/bitmaps to $(TCL_DIR)/bitmaps TCL_DIR = $(PKGLIBDIR) ##CPPFLAGS += -DTKPROGPATH=\"$(TCL_DIR)/tkmidity.tcl\" # Define the timidity default file search path. DEF_DEFAULT_PATH = -DDEFAULT_PATH=\"$(PKGDATADIR)\" # You sould not change follows definitions. DEF_PKGDATADIR = -DPKGDATADIR=\"$(PKGDATADIR)\" DEF_PKGLIBDIR = -DPKGLIBDIR=\"$(PKGLIBDIR)\" DEF_SHLIB_DIR = -DSHLIB_DIR=\"$(SHLIB_DIR)\" BITMAP_DIR = $(TCL_DIR)/bitmaps TiMidity++-2.13.2/config.h.in0100644004711200001440000003106110124332425014715 0ustar tamukiusers/* config.h.in. Generated from configure.in by autoheader. */ /* Define to 1 if you are in debug mode */ #undef DEBUG /* place to install patches */ #undef DEFAULT_PATH /* Define resampler. */ #undef DEFAULT_RESAMPLATION /* Define to 1 if you have to add "_" to every identifiers. */ #undef DLSYM_NEEDS_UNDERSCORE /* Define to 1 if you enable Sherry WRD */ #undef ENABLE_SHERRY /* Define to 1 if you have the `alarm' function. */ #undef HAVE_ALARM /* Define to 1 if you have the header file. */ #undef HAVE_ALSA_ASOUNDLIB_H /* Define to 1 if you have the header file. */ #undef HAVE_ARPA_INET_H /* Define to 1 if you have the header file. */ #undef HAVE_CURSES_H /* Define to 1 if you have the header file, and it defines `DIR'. */ #undef HAVE_DIRENT_H /* Define to 1 if you have the header file. */ #undef HAVE_DLFCN_H /* Define to 1 if you have the `dlopen' function. */ #undef HAVE_DLOPEN /* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */ #undef HAVE_DOPRNT /* Define to 1 if you have the `dup2' function. */ #undef HAVE_DUP2 /* Define to 1 if you have the header file. */ #undef HAVE_ERRNO_H /* Define to 1 if you have the header file. */ #undef HAVE_FCNTL_H /* Define to 1 if you have the `floor' function. */ #undef HAVE_FLOOR /* Define to 1 if you have the `fork' function. */ #undef HAVE_FORK /* Define to 1 if you have the `getcwd' function. */ #undef HAVE_GETCWD /* Define to 1 if you have the `gethostbyname' function. */ #undef HAVE_GETHOSTBYNAME /* Define to 1 if you have the `getopt' function. */ #undef HAVE_GETOPT /* Define to 1 if you have the header file. */ #undef HAVE_GETOPT_H /* Define to 1 if you have `getopt_long function' */ #undef HAVE_GETOPT_LONG /* Define to 1 if you have the `getpagesize' function. */ #undef HAVE_GETPAGESIZE /* Define to 1 if you have the `gettimeofday' function. */ #undef HAVE_GETTIMEOFDAY /* Define to 1 if you have the `getwd' function. */ #undef HAVE_GETWD /* Define to 1 if you have the header file. */ #undef HAVE_GLOB_H /* Define to 1 if you have GTK+ 2.x */ #undef HAVE_GTK_2 /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H /* Define to 1 if you have the `isatty' function. */ #undef HAVE_ISATTY /* Define to 1 if you have the `asound' library (-lasound). */ #undef HAVE_LIBASOUND /* Define to 1 if you have the `ICE' library (-lICE). */ #undef HAVE_LIBICE /* Define to 1 if you have the `m' library (-lm). */ #undef HAVE_LIBM /* Define to 1 if you have the `nsl' library (-lnsl). */ #undef HAVE_LIBNSL /* Define to 1 if you have the `ossaudio' library (-lossaudio). */ #undef HAVE_LIBOSSAUDIO /* Define to 1 if you have the `socket' library (-lsocket). */ #undef HAVE_LIBSOCKET /* Define to 1 if you have the `X11' library (-lX11). */ #undef HAVE_LIBX11 /* Define to 1 if you have the `xpg4' library (-lxpg4). */ #undef HAVE_LIBXPG4 /* Define to 1 if you have the header file. */ #undef HAVE_LIMITS_H /* Define to 1 if you have the header file. */ #undef HAVE_MACHINE_ENDIAN_H /* Define to 1 if you have the header file. */ #undef HAVE_MALLOC_H /* Define to 1 if you have the `memchr' function. */ #undef HAVE_MEMCHR /* Define to 1 if you have the `memmove' function. */ #undef HAVE_MEMMOVE /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H /* Define to 1 if you have the `memset' function. */ #undef HAVE_MEMSET /* Define to 1 if you have a working `mmap' system call. */ #undef HAVE_MMAP /* Define to 1 if you have the `modf' function. */ #undef HAVE_MODF /* Define to 1 if you have the `munmap' function. */ #undef HAVE_MUNMAP /* Define to 1 if you have the header file. */ #undef HAVE_NCURSES_CURSES_H /* Define to 1 if you have the header file. */ #undef HAVE_NCURSES_H /* Define to 1 if you have the header file, and it defines `DIR'. */ #undef HAVE_NDIR_H /* Define to 1 if you have the header file. */ #undef HAVE_NETDB_H /* Define to 1 if you have the header file. */ #undef HAVE_NETINET_IN_H /* Define to 1 if you have file */ #undef HAVE_NEW_MMSYSTEM /* Define to 1 if you have the header file. */ #undef HAVE_NLIST_H /* Define to 1 if you have the `popen' function. */ #undef HAVE_POPEN /* Define to 1 if you have the `pow' function. */ #undef HAVE_POW /* Define to 1 if you have the `select' function. */ #undef HAVE_SELECT /* Define to 1 if you have the `signal' function. */ #undef HAVE_SIGNAL /* Define to 1 if you have the header file. */ #undef HAVE_SLANG_H /* Define to 1 if you have the header file. */ #undef HAVE_SLANG_SLANG_H /* Define to 1 if you have the `sleep' function. */ #undef HAVE_SLEEP /* Define to 1 if you have the `snd_seq_port_info_set_timestamping' function. */ #undef HAVE_SND_SEQ_PORT_INFO_SET_TIMESTAMPING /* Define to 1 if you have the `snprintf' function. */ #undef HAVE_SNPRINTF /* Define to 1 if you have the `socket' function. */ #undef HAVE_SOCKET /* Define to 1 if you have the header file. */ #undef HAVE_SOUNDCARD_H /* Define to 1 if you have the `sqrt' function. */ #undef HAVE_SQRT /* Define to 1 if stdbool.h conforms to C99. */ #undef HAVE_STDBOOL_H /* Define to 1 if you have the header file. */ #undef HAVE_STDDEF_H /* 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 `strcasecmp' function. */ #undef HAVE_STRCASECMP /* Define to 1 if you have the `strchr' function. */ #undef HAVE_STRCHR /* Define to 1 if you have the `strdup' function. */ #undef HAVE_STRDUP /* Define to 1 if you have the `strerror' function. */ #undef HAVE_STRERROR /* Define to 1 if cpp supports the ANSI # stringizing operator. */ #undef HAVE_STRINGIZE /* 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 `strlcat' function. */ #undef HAVE_STRLCAT /* Define to 1 if you have the `strlcpy' function. */ #undef HAVE_STRLCPY /* Define to 1 if you have the `strncasecmp' function. */ #undef HAVE_STRNCASECMP /* Define to 1 if you have the header file. */ #undef HAVE_STROPTS_H /* Define to 1 if you have the `strrchr' function. */ #undef HAVE_STRRCHR /* Define to 1 if you have the `strstr' function. */ #undef HAVE_STRSTR /* Define to 1 if you have the `strtol' function. */ #undef HAVE_STRTOL /* Define to 1 if you have the header file. */ #undef HAVE_SYS_ASOUNDLIB_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_AUDIOIO_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_AWE_VOICE_H /* Define to 1 if you have the header file, and it defines `DIR'. */ #undef HAVE_SYS_DIR_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_IOCTL_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_IPC_H /* Define to 1 if you have the header file, and it defines `DIR'. */ #undef HAVE_SYS_NDIR_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_PARAM_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_SHM_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_SOCKET_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_SOUNDCARD_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_SYSCTL_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TIME_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TYPES_H /* Define to 1 if you have that is POSIX.1 compatible. */ #undef HAVE_SYS_WAIT_H /* Define to 1 if you have the header file. */ #undef HAVE_TERMIOS_H /* Define to 1 if you use semun keyword */ #undef HAVE_UNION_SEMUN /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H /* Define to 1 if you have the `usleep' function. */ #undef HAVE_USLEEP /* Define to 1 if you have the `vfork' function. */ #undef HAVE_VFORK /* Define to 1 if you have the header file. */ #undef HAVE_VFORK_H /* Define to 1 if you have the `vprintf' function. */ #undef HAVE_VPRINTF /* Define to 1 if you have the `vsnprintf' function. */ #undef HAVE_VSNPRINTF /* Define to 1 if `fork' works. */ #undef HAVE_WORKING_FORK /* Define to 1 if `vfork' works. */ #undef HAVE_WORKING_VFORK /* Define to 1 if you have the header file. */ #undef HAVE_X11_EXTENSIONS_XSHM_H /* Define to 1 if you have the header file. */ #undef HAVE_X11_XLIB_H /* Define to 1 if you have the header file. */ #undef HAVE_X11_XMU_EXTAGENT_H /* Define to 1 if you have the `XmuRegisterExternalAgent' function. */ #undef HAVE_XMUREGISTEREXTERNALAGENT /* Define to 1 if you have the `XShmCreatePixmap' function. */ #undef HAVE_XSHMCREATEPIXMAP /* Define to 1 if the system has the type `_Bool'. */ #undef HAVE__BOOL /* Define to 1 if you are NOT in debug mode */ #undef NDEBUG /* Define to 1 if you do not have . */ #undef NO_STRING_H /* Define to 1 if you cannot use volatile keyword */ #undef NO_VOLATILE /* Define to 1 if you need offix support */ #undef OFFIX /* oss device name */ #undef OSS_DEVICE /* 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 version of this package. */ #undef PACKAGE_VERSION /* a compatibility matter. ignore it. */ #undef PKGDATADIR /* place to install modules */ #undef PKGLIBDIR /* Define to 1 if the C compiler supports function prototypes. */ #undef PROTOTYPES /* Define as the return type of signal handlers (`int' or `void'). */ #undef RETSIGTYPE /* Define to 1 if the `setvbuf' function takes the buffering type as its second argument and the buffer pointer as the third, as on System V before release 3. */ #undef SETVBUF_REVERSED /* shared library extention */ #undef SHARED_LIB_EXT /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS /* Define to 1 if you need network support */ #undef SUPPORT_SOCKET /* Define to 1 if you need spectrogram vewer. */ #undef SUPPORT_SOUNDSPEC /* Define to 1 if you can safely include both and . */ #undef TIME_WITH_SYS_TIME /* the output specification */ #undef TIMIDITY_OUTPUT_ID /* for windows gui */ #undef TIMID_VERSION /* Define to 1 if your declares `struct tm'. */ #undef TM_IN_SYS_TIME /* Define to 1 if you use altivec */ #undef USE_ALTIVEC /* Define to 1 if you use PDcurses */ #undef USE_PDCURSES /* Version number of package */ #undef VERSION /* Define to 1 if your processor stores words with the most significant byte first (like Motorola and SPARC, unlike Intel and VAX). */ #undef WORDS_BIGENDIAN /* Define to 1 if you need wrd support for X. */ #undef WRDT_X /* Define to 1 if you have libXaw3d. */ #undef XAW3D /* Define to 1 if the X Window System is missing or not being used. */ #undef X_DISPLAY_MISSING /* Define to 1 if type `char' is unsigned and you are not using gcc. */ #ifndef __CHAR_UNSIGNED__ # undef __CHAR_UNSIGNED__ #endif /* Define like PROTOTYPES; this can be used by system headers. */ #undef __PROTOTYPES /* 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 /* Define to `long' if does not define. */ #undef off_t /* for VC */ #undef pclose /* Define to `int' if does not define. */ #undef pid_t /* for VC */ #undef popen /* Define to `unsigned' if does not define. */ #undef size_t /* for VC */ #undef snprintf /* Define as `fork' if `vfork' does not work. */ #undef vfork /* Define to empty if the keyword `volatile' does not work. Warning: valid code using `volatile' can become incorrect without. Disable with care. */ #undef volatile /* for VC */ #undef vsnprintf TiMidity++-2.13.2/configure0100755004711200001440000230150610127771427014623 0ustar tamukiusers#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.59 for TiMidity++ 2.13.2. # # Report bugs to . # # Copyright (C) 2003 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 Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then set -o posix fi DUALCASE=1; export DUALCASE # for MKS sh # Support unset when possible. if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # Work around bugs in pre-3.0 UWIN ksh. $as_unset ENV MAIL MAILPATH PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. for as_var in \ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ LC_TELEPHONE LC_TIME do if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then eval $as_var=C; export $as_var else $as_unset $as_var fi done # Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1; 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 # Name of the executable. as_me=`$as_basename "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)$' \| \ . : '\(.\)' 2>/dev/null || echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } /^X\/\(\/\/\)$/{ s//\1/; q; } /^X\/\(\/\).*/{ s//\1/; q; } s/.*/./; q'` # PATH needs CR, and LINENO needs CR and PATH. # 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 # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then echo "#! /bin/sh" >conf$$.sh echo "exit 0" >>conf$$.sh chmod +x conf$$.sh if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: fi rm -f conf$$.sh fi as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" || { # Find who we are. Look in the path if we contain no path at all # relative or not. 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 ;; 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 { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2 { (exit 1); exit 1; }; } fi case $CONFIG_SHELL in '') as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for as_base in sh bash ksh sh5; do case $as_dir in /*) if ("$as_dir/$as_base" -c ' as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } CONFIG_SHELL=$as_dir/$as_base export CONFIG_SHELL exec "$CONFIG_SHELL" "$0" ${1+"$@"} fi;; esac done done ;; esac # Create $as_me.lineno as a copy of $as_myself, but with $LINENO # uniformly replaced by the line number. The first 'sed' inserts a # line-number line before each line; the second 'sed' does the real # work. The second script uses 'N' to pair each line-number line # with the numbered line, and appends trailing '-' during # substitution so that $LINENO is not a special case at line end. # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) sed '=' <$as_myself | sed ' N s,$,-, : loop s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, t loop s,-$,, s,^['$as_cr_digits']*\n,, ' >$as_me.lineno && chmod +x $as_me.lineno || { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 { (exit 1); exit 1; }; } # 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 sensible to this). . ./$as_me.lineno # Exit status is that of the last command. exit } case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in *c*,-n*) ECHO_N= ECHO_C=' ' ECHO_T=' ' ;; *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; *) ECHO_N= ECHO_C='\c' ECHO_T= ;; esac if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file echo >conf$$.file if ln -s conf$$.file conf$$ 2>/dev/null; then # We could just check for DJGPP; but this test a) works b) is more generic # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). if test -f conf$$.exe; then # Don't use ln at all; we don't have any links as_ln_s='cp -p' else as_ln_s='ln -s' fi elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.file if mkdir -p . 2>/dev/null; then as_mkdir_p=: else test -d ./-p && rmdir ./-p as_mkdir_p=false fi as_executable_p="test -f" # 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'" # IFS # We need space, tab and new line, in precisely that order. as_nl=' ' IFS=" $as_nl" # CDPATH. $as_unset CDPATH # Name of the host. # hostname on some systems (SVR3.2, Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` exec 6>&1 # # Initializations. # ac_default_prefix=/usr/local ac_config_libobj_dir=. cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= SHELL=${CONFIG_SHELL-/bin/sh} # Maximum number of lines to put in a shell here document. # This variable seems obsolete. It should probably be removed, and # only ac_max_sed_lines should be used. : ${ac_max_here_lines=38} # Identity of this package. PACKAGE_NAME='TiMidity++' PACKAGE_TARNAME='TiMidity++' PACKAGE_VERSION='2.13.2' PACKAGE_STRING='TiMidity++ 2.13.2' PACKAGE_BUGREPORT='root@mput.dip.jp' ac_unique_file="timidity/timidity.c" # Factoring default headers for most tests. ac_includes_default="\ #include #if HAVE_SYS_TYPES_H # include #endif #if HAVE_SYS_STAT_H # include #endif #if STDC_HEADERS # include # include #else # if HAVE_STDLIB_H # include # endif #endif #if HAVE_STRING_H # if !STDC_HEADERS && HAVE_MEMORY_H # include # endif # include #endif #if HAVE_STRINGS_H # include #endif #if HAVE_INTTYPES_H # include #else # if HAVE_STDINT_H # include # endif #endif #if HAVE_UNISTD_H # include #endif" ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO AMTAR install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM AWK SET_MAKE am__leading_dot MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT EMACS lispdir CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE CPP EGREP RANLIB ac_ct_RANLIB LN_S X_CFLAGS X_PRE_LIBS X_LIBS X_EXTRA_LIBS LIBOBJS NEEDGETOPT_TRUE NEEDGETOPT_FALSE ALSA_CFLAGS ALSA_LIBS ARTS_CONFIG ARTS_CFLAGS ARTS_LIBS ESD_CONFIG ESD_CFLAGS ESD_LIBS AO_CFLAGS AO_LIBS VORBIS_CFLAGS VORBIS_LIBS VORBISFILE_LIBS VORBISENC_LIBS OGG_CFLAGS OGG_LIBS LIBFLAC_CFLAGS LIBFLAC_LIBS LIBOGGFLAC_CFLAGS LIBOGGFLAC_LIBS NEEDDLOPEN_TRUE NEEDDLOPEN_FALSE ENABLE_NCURSES_TRUE ENABLE_NCURSES_FALSE n_so_libs ENABLE_SLANG_TRUE ENABLE_SLANG_FALSE s_so_libs ENABLE_MOTIF_TRUE ENABLE_MOTIF_FALSE m_so_libs ENABLE_TCLTK_TRUE ENABLE_TCLTK_FALSE k_so_libs ENABLE_DYNAMIC_TCLTK_TRUE ENABLE_DYNAMIC_TCLTK_FALSE ENABLE_EMACS_TRUE ENABLE_EMACS_FALSE e_so_libs ENABLE_VT100_TRUE ENABLE_VT100_FALSE T_so_libs ENABLE_XAW_TRUE ENABLE_XAW_FALSE a_so_libs ENABLE_DYNAMIC_XAW_TRUE ENABLE_DYNAMIC_XAW_FALSE ENABLE_XSKIN_TRUE ENABLE_XSKIN_FALSE i_so_libs ENABLE_GTK_TRUE ENABLE_GTK_FALSE PKG_CONFIG GTK_CONFIG GTK_CFLAGS GTK_LIBS g_so_libs ENABLE_SERVER_TRUE ENABLE_SERVER_FALSE r_so_libs ENABLE_ALSASEQ_TRUE ENABLE_ALSASEQ_FALSE A_so_libs ENABLE_WINSYN_TRUE ENABLE_WINSYN_FALSE W_so_libs ENABLE_PORTMIDISYN_TRUE ENABLE_PORTMIDISYN_FALSE P_so_libs ENABLE_W32G_SYN_TRUE ENABLE_W32G_SYN_FALSE ENABLE_W32GUI_TRUE ENABLE_W32GUI_FALSE w_so_libs ENABLE_PLUGIN_TRUE ENABLE_PLUGIN_FALSE p_so_libs ENABLE_NETWORK_TRUE ENABLE_NETWORK_FALSE ENABLE_SOUND_SPEC_TRUE ENABLE_SOUND_SPEC_FALSE ENABLE_WRD_TRUE ENABLE_WRD_FALSE CYGNUS_TRUE CYGNUS_FALSE MSYS_TRUE MSYS_FALSE VCPP_TRUE VCPP_FALSE BORLANDC_TRUE BORLANDC_FALSE WATCOM_C_TRUE WATCOM_C_FALSE W32READDIR_TRUE W32READDIR_FALSE BORLANDC_START BORLANDC_LDFLAGS timidity_LDFLAGS WATCOM_LDFLAGS VCPP_LDFLAGS SYSEXTRAS EXTRALIBS NETSRCS ELFILES SHLD SHCFLAGS dynamic_targets so WISH tcltk_dep INTERFACE_SRCS pkgdatadir pkglibdir LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. ac_init_help= ac_init_version=false # 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. bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datadir='${prefix}/share' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' libdir='${exec_prefix}/lib' includedir='${prefix}/include' oldincludedir='/usr/include' infodir='${prefix}/info' mandir='${prefix}/man' ac_prev= 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 ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'` # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_option in -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 | --data | --dat | --da) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ | --da=*) datadir=$ac_optarg ;; -disable-* | --disable-*) ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid feature name: $ac_feature" >&2 { (exit 1); exit 1; }; } ac_feature=`echo $ac_feature | sed 's/-/_/g'` eval "enable_$ac_feature=no" ;; -enable-* | --enable-*) ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid feature name: $ac_feature" >&2 { (exit 1); exit 1; }; } ac_feature=`echo $ac_feature | sed 's/-/_/g'` case $ac_option in *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; *) ac_optarg=yes ;; esac eval "enable_$ac_feature='$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 ;; -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 ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst \ | --locals | --local | --loca | --loc | --lo) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* \ | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) 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 ;; -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_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid package name: $ac_package" >&2 { (exit 1); exit 1; }; } ac_package=`echo $ac_package| sed 's/-/_/g'` case $ac_option in *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; *) ac_optarg=yes ;; esac eval "with_$ac_package='$ac_optarg'" ;; -without-* | --without-*) ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid package name: $ac_package" >&2 { (exit 1); exit 1; }; } ac_package=`echo $ac_package | sed 's/-/_/g'` eval "with_$ac_package=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 ;; -*) { echo "$as_me: error: unrecognized option: $ac_option Try \`$0 --help' for more information." >&2 { (exit 1); exit 1; }; } ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 { (exit 1); exit 1; }; } ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` eval "$ac_envvar='$ac_optarg'" export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && 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'` { echo "$as_me: error: missing argument to $ac_option" >&2 { (exit 1); exit 1; }; } fi # Be sure to have absolute paths. for ac_var in exec_prefix prefix do eval ac_val=$`echo $ac_var` case $ac_val in [\\/$]* | ?:[\\/]* | NONE | '' ) ;; *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 { (exit 1); exit 1; }; };; esac done # Be sure to have absolute paths. for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \ localstatedir libdir includedir oldincludedir infodir mandir do eval ac_val=$`echo $ac_var` case $ac_val in [\\/$]* | ?:[\\/]* ) ;; *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 { (exit 1); exit 1; }; };; esac 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 echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. If a cross compiler is detected then cross compile mode will be used." >&2 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 # 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 its parent. ac_confdir=`(dirname "$0") 2>/dev/null || $as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$0" : 'X\(//\)[^/]' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$0" | 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 if test "$ac_srcdir_defaulted" = yes; then { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2 { (exit 1); exit 1; }; } else { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 { (exit 1); exit 1; }; } fi fi (cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null || { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2 { (exit 1); exit 1; }; } srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'` ac_env_build_alias_set=${build_alias+set} ac_env_build_alias_value=$build_alias ac_cv_env_build_alias_set=${build_alias+set} ac_cv_env_build_alias_value=$build_alias ac_env_host_alias_set=${host_alias+set} ac_env_host_alias_value=$host_alias ac_cv_env_host_alias_set=${host_alias+set} ac_cv_env_host_alias_value=$host_alias ac_env_target_alias_set=${target_alias+set} ac_env_target_alias_value=$target_alias ac_cv_env_target_alias_set=${target_alias+set} ac_cv_env_target_alias_value=$target_alias ac_env_CC_set=${CC+set} ac_env_CC_value=$CC ac_cv_env_CC_set=${CC+set} ac_cv_env_CC_value=$CC ac_env_CFLAGS_set=${CFLAGS+set} ac_env_CFLAGS_value=$CFLAGS ac_cv_env_CFLAGS_set=${CFLAGS+set} ac_cv_env_CFLAGS_value=$CFLAGS ac_env_LDFLAGS_set=${LDFLAGS+set} ac_env_LDFLAGS_value=$LDFLAGS ac_cv_env_LDFLAGS_set=${LDFLAGS+set} ac_cv_env_LDFLAGS_value=$LDFLAGS ac_env_CPPFLAGS_set=${CPPFLAGS+set} ac_env_CPPFLAGS_value=$CPPFLAGS ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set} ac_cv_env_CPPFLAGS_value=$CPPFLAGS ac_env_CPP_set=${CPP+set} ac_env_CPP_value=$CPP ac_cv_env_CPP_set=${CPP+set} ac_cv_env_CPP_value=$CPP # # 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 TiMidity++ 2.13.2 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 \`..'] _ACEOF cat <<_ACEOF 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] --datadir=DIR read-only architecture-independent data [PREFIX/share] --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] --infodir=DIR info documentation [PREFIX/info] --mandir=DIR man documentation [PREFIX/man] _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 X features: --x-includes=DIR X include files are in DIR --x-libraries=DIR X library files are in DIR System types: --build=BUILD configure for building on BUILD [guessed] --host=HOST cross-compile to build programs to run on HOST [BUILD] --target=TARGET configure for building compilers for TARGET [HOST] _ACEOF fi if test -n "$ac_init_help"; then case $ac_init_help in short | recursive ) echo "Configuration of TiMidity++ 2.13.2:";; esac cat <<\_ACEOF Optional Features: --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --enable-maintainer-mode enable make rules and dependencies not useful (and sometimes confusing) to the casual installer --enable-debug Build a debugging version. --disable-dependency-tracking Speeds up one-time builds --enable-dependency-tracking Do not reject slow dependency extractors --enable-audio=mode_list Enable audio (Specify comma separated mode list): default: Automatically select audio device. oss: OSS /dev/dsp sun: SunOS /dev/audio hpux: HPUX /dev/audio irix: IRIX audio library mme: OSF/1 MME sb_dsp: BSD/OS 2.0 /dev/sb_dsp w32: Windows MMS darwin: Darwin CoreAudio alsa: ALSA pcm device alib: HPUX network audio (Alib) nas: NAS - Network Audio System arts: aRts esd: EsounD - Enlightened Sound Daemon portaudio: PortAudio jack: JACK ao: Libao vorbis: Ogg Vorbis flac: FLAC / OggFLAC speex: Ogg Speex gogo: MP3 GOGO (Only Windows is supported) --disable-alsatest Do not try to compile and run a test Alsa program --disable-artstest Do not try to compile and run a test ARTS program --disable-esdtest Do not try to compile and run a test ESD program --disable-aotest Do not try to compile and run a test ao program --disable-oggtest Do not try to compile and run a test Ogg program --disable-vorbistest Do not try to compile and run a test Vorbis program --disable-libFLACtest Do not try to compile and run a test libFLAC program --disable-libOggFLACtest Do not try to compile and run a test libOggFLAC program --enable-interface=interface_list Comma separated interface list --enable-dynamic Enable dynamic link interface (default is no) --enable-dynamic=dynamic_list Comma separated dynamic interface list --enable-ncurses Enable ncurses interface (default is no) --enable-slang Enable slang interface (default is no) --enable-motif Enable motif interface (default is no) --enable-tcltk Enable tcltk interface (default is no) --enable-emacs Enable emacs interface (default is no) --enable-vt100 Enable VT100 interface (default is no) --enable-xaw Enable athena interface (default is no) --enable-xskin Enable X skin interface (default is no) --enable-gtk Enable GTK+ interface (default is no) --disable-gtktest do not try to compile and run a test GTK+ program --disable-gtktest Do not try to compile and run a test GTK program --enable-server Enable server interface (default is no) --enable-alsaseq Enable ALSA sequencer server interface (default is no) --enable-winsyn Enable Windows Synthesizer interface (default is no) --enable-portmidisyn Enable PortMIDI Synthesizer interface (default is no) --enable-winsyng Enable Windows GUI Synthesizer interface (default is no) --enable-w32gui Enable Windows GUI interface (default is no) --enable-ump UMP configuration (default is no) --enable-offix Enable offix support (default is no) --enable-network Enable network support (default is no) --enable-spectrogram Enable Sound Spectrogram Viewer (default is no) --enable-spline=method Specify spline method. one of no,linear,cubic,lagrange,newton,gauss (default is linear) --enable-wrd Enable WRD interface for X (default is no) Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-includes=DIR Specify include directories (colon separated) --with-libraries=DIR Specify library directories (colon separated) --with-default-path=DIR Where timidity.cfg is (PREFIX/share/timidity) --with-module-dir=DIR Where to install interfaces (PREFIX/lib/timidity) --with-lispdir Override the default lisp directory --with-elf create ELF shared object instead of AOUT --with-x use the X Window System --with-tcl-includes=DIR Tcl include file path --with-tcl-libs=DIR Tcl library file path --with-tk-includes=DIR Tk include file path --with-tk-libs=DIR Tk library file path --with-offix-includes=DIR Offix include file path --with-offix-libs=DIR Offix include file path --with-nas-library=library NAS absolute library path(Don't use -laudio) --with-nas-includes=DIR NAS include files are in dir --with-default-output= Specify default output mode (optional): (default|alsa|alib|arts|nas| esd|wav|au|aiff|list|vorbis|flac|speex| gogo|portaudio|jack|ao) --with-alsa-prefix=PFX Prefix where Alsa library is installed(optional) --with-alsa-inc-prefix=PFX Prefix where include libraries are (optional) --with-arts-prefix=PFX Prefix where ARTS is installed (optional) --with-esd-prefix=PFX Prefix where ESD is installed (optional) --with-esd-exec-prefix=PFX Exec prefix where ESD is installed (optional) --with-ao=PFX Prefix where libao is installed (optional) --with-ao-libraries=DIR Directory where libao library is installed (optional) --with-ao-includes=DIR Directory where libao header files are installed (optional) --with-ogg=PFX Prefix where libogg is installed (optional) --with-ogg-libraries=DIR Directory where libogg library is installed (optional) --with-ogg-includes=DIR Directory where libogg header files are installed (optional) --with-vorbis=PFX Prefix where libvorbis is installed (optional) --with-vorbis-libraries=DIR Directory where libvorbis library is installed (optional) --with-vorbis-includes=DIR Directory where libvorbis header files are installed (optional) --with-libFLAC=PFX Prefix where libFLAC is installed (optional) --with-libFLAC-libraries=DIR Directory where libFLAC library is installed (optional) --with-libFLAC-includes=DIR Directory where libFLAC header files are installed (optional) --with-libOggFLAC=PFX Prefix where libOggFLAC is installed (optional) --with-libOggFLAC-libraries=DIR Directory where libOggFLAC library is installed (optional) --with-libOggFLAC-includes=DIR Directory where libOggFLAC header files are installed (optional) --with-gtk-prefix=PFX Prefix where GTK is installed (optional) --with-gtk-exec-prefix=PFX Exec prefix where GTK is installed (optional) 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 CPPFLAGS C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory CPP C preprocessor 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 . _ACEOF fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. ac_popdir=`pwd` for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d $ac_dir || continue ac_builddir=. if test "$ac_dir" != .; then ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A "../" for each directory in $ac_dir_suffix. ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` else ac_dir_suffix= ac_top_builddir= fi case $srcdir in .) # No --srcdir option. We are building in place. ac_srcdir=. if test -z "$ac_top_builddir"; then ac_top_srcdir=. else ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` fi ;; [\\/]* | ?:[\\/]* ) # Absolute path. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ;; *) # Relative path. ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_builddir$srcdir ;; esac # Do not use `cd foo && pwd` to compute absolute paths, because # the directories may not exist. case `pwd` in .) ac_abs_builddir="$ac_dir";; *) case "$ac_dir" in .) ac_abs_builddir=`pwd`;; [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; *) ac_abs_builddir=`pwd`/"$ac_dir";; esac;; esac case $ac_abs_builddir in .) ac_abs_top_builddir=${ac_top_builddir}.;; *) case ${ac_top_builddir}. in .) ac_abs_top_builddir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; esac;; esac case $ac_abs_builddir in .) ac_abs_srcdir=$ac_srcdir;; *) case $ac_srcdir in .) ac_abs_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; esac;; esac case $ac_abs_builddir in .) ac_abs_top_srcdir=$ac_top_srcdir;; *) case $ac_top_srcdir in .) ac_abs_top_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; esac;; esac cd $ac_dir # Check for guested configure; otherwise get Cygnus style 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 elif test -f $ac_srcdir/configure.ac || test -f $ac_srcdir/configure.in; then echo $ac_configure --help else echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi cd $ac_popdir done fi test -n "$ac_init_help" && exit 0 if $ac_init_version; then cat <<\_ACEOF TiMidity++ configure 2.13.2 generated by GNU Autoconf 2.59 Copyright (C) 2003 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 0 fi exec 5>config.log cat >&5 <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by TiMidity++ $as_me 2.13.2, which was generated by GNU Autoconf 2.59. Invocation command line was $ $0 $@ _ACEOF { 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` hostinfo = `(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=. echo "PATH: $as_dir" done } >&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_sep= 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=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; 2) ac_configure_args1="$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 ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'" # Get rid of the leading space. ac_sep=" " ;; esac done done $as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } $as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export 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: Be sure not to use single quotes in there, as some shells, # such as our DU 5.0 friend, will then `close' the trap. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo cat <<\_ASBOX ## ---------------- ## ## Cache variables. ## ## ---------------- ## _ASBOX echo # The following way of writing the cache mishandles newlines in values, { (set) 2>&1 | case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in *ac_space=\ *) sed -n \ "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" ;; *) sed -n \ "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" ;; esac; } echo cat <<\_ASBOX ## ----------------- ## ## Output variables. ## ## ----------------- ## _ASBOX echo for ac_var in $ac_subst_vars do eval ac_val=$`echo $ac_var` echo "$ac_var='"'"'$ac_val'"'"'" done | sort echo if test -n "$ac_subst_files"; then cat <<\_ASBOX ## ------------- ## ## Output files. ## ## ------------- ## _ASBOX echo for ac_var in $ac_subst_files do eval ac_val=$`echo $ac_var` echo "$ac_var='"'"'$ac_val'"'"'" done | sort echo fi if test -s confdefs.h; then cat <<\_ASBOX ## ----------- ## ## confdefs.h. ## ## ----------- ## _ASBOX echo sed "/^$/d" confdefs.h | sort echo fi test "$ac_signal" != 0 && echo "$as_me: caught signal $ac_signal" echo "$as_me: exit $exit_status" } >&5 rm -f core *.core && rm -rf conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -rf conftest* confdefs.h # AIX cpp loses on an empty file, so make sure it contains at least a newline. echo >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 # Let the site file select an alternate cache file if it wants to. # Prefer explicitly selected file to automatically selected ones. if test -z "$CONFIG_SITE"; then if test "x$prefix" != xNONE; then CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" else CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" fi fi for ac_site_file in $CONFIG_SITE; do if test -r "$ac_site_file"; then { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" 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. if test -f "$cache_file"; then { echo "$as_me:$LINENO: loading cache $cache_file" >&5 echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . $cache_file;; *) . ./$cache_file;; esac fi else { echo "$as_me:$LINENO: creating cache $cache_file" >&5 echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in `(set) 2>&1 | sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; 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,) { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 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 { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 echo "$as_me: former value: $ac_old_val" >&2;} { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 echo "$as_me: current value: $ac_new_val" >&2;} ac_cache_corrupted=: fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) ac_arg=$ac_var=`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. *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 echo "$as_me: error: changes in the environment can compromise the build" >&2;} { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} { (exit 1); exit 1; }; } 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_aux_dir= for ac_dir in autoconf $srcdir/autoconf; 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 { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in autoconf $srcdir/autoconf" >&5 echo "$as_me: error: cannot find install-sh or install.sh in autoconf $srcdir/autoconf" >&2;} { (exit 1); exit 1; }; } fi ac_config_guess="$SHELL $ac_aux_dir/config.guess" ac_config_sub="$SHELL $ac_aux_dir/config.sub" ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure. # Make sure we can run config.sub. $ac_config_sub sun4 >/dev/null 2>&1 || { { echo "$as_me:$LINENO: error: cannot run $ac_config_sub" >&5 echo "$as_me: error: cannot run $ac_config_sub" >&2;} { (exit 1); exit 1; }; } echo "$as_me:$LINENO: checking build system type" >&5 echo $ECHO_N "checking build system type... $ECHO_C" >&6 if test "${ac_cv_build+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_build_alias=$build_alias test -z "$ac_cv_build_alias" && ac_cv_build_alias=`$ac_config_guess` test -z "$ac_cv_build_alias" && { { echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5 echo "$as_me: error: cannot guess build type; you must specify one" >&2;} { (exit 1); exit 1; }; } ac_cv_build=`$ac_config_sub $ac_cv_build_alias` || { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_build_alias failed" >&5 echo "$as_me: error: $ac_config_sub $ac_cv_build_alias failed" >&2;} { (exit 1); exit 1; }; } fi echo "$as_me:$LINENO: result: $ac_cv_build" >&5 echo "${ECHO_T}$ac_cv_build" >&6 build=$ac_cv_build build_cpu=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` build_vendor=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` build_os=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` echo "$as_me:$LINENO: checking host system type" >&5 echo $ECHO_N "checking host system type... $ECHO_C" >&6 if test "${ac_cv_host+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_host_alias=$host_alias test -z "$ac_cv_host_alias" && ac_cv_host_alias=$ac_cv_build_alias ac_cv_host=`$ac_config_sub $ac_cv_host_alias` || { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_host_alias failed" >&5 echo "$as_me: error: $ac_config_sub $ac_cv_host_alias failed" >&2;} { (exit 1); exit 1; }; } fi echo "$as_me:$LINENO: result: $ac_cv_host" >&5 echo "${ECHO_T}$ac_cv_host" >&6 host=$ac_cv_host host_cpu=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` host_vendor=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` host_os=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` echo "$as_me:$LINENO: checking target system type" >&5 echo $ECHO_N "checking target system type... $ECHO_C" >&6 if test "${ac_cv_target+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_target_alias=$target_alias test "x$ac_cv_target_alias" = "x" && ac_cv_target_alias=$ac_cv_host_alias ac_cv_target=`$ac_config_sub $ac_cv_target_alias` || { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_target_alias failed" >&5 echo "$as_me: error: $ac_config_sub $ac_cv_target_alias failed" >&2;} { (exit 1); exit 1; }; } fi echo "$as_me:$LINENO: result: $ac_cv_target" >&5 echo "${ECHO_T}$ac_cv_target" >&6 target=$ac_cv_target target_cpu=`echo $ac_cv_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` target_vendor=`echo $ac_cv_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` target_os=`echo $ac_cv_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` # The aliases save the names the user supplied, while $host etc. # will get canonicalized. test -n "$target_alias" && test "$program_prefix$program_suffix$program_transform_name" = \ NONENONEs,x,x, && program_prefix=${target_alias}- am__api_version="1.7" # 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. echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6 if test -z "$INSTALL"; then if test "${ac_cv_path_install+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&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_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 ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" break 3 fi fi done done ;; esac done 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. We don't cache a # path for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the path is relative. INSTALL=$ac_install_sh fi fi echo "$as_me:$LINENO: result: $INSTALL" >&5 echo "${ECHO_T}$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' echo "$as_me:$LINENO: checking whether build environment is sane" >&5 echo $ECHO_N "checking whether build environment is sane... $ECHO_C" >&6 # Just in case sleep 1 echo timestamp > conftest.file # 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 ( 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 rm -f conftest.file 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". { { echo "$as_me:$LINENO: error: ls -t appears to fail. Make sure there is not a broken alias in your environment" >&5 echo "$as_me: error: ls -t appears to fail. Make sure there is not a broken alias in your environment" >&2;} { (exit 1); exit 1; }; } fi test "$2" = conftest.file ) then # Ok. : else { { echo "$as_me:$LINENO: error: newly created file is older than distributed files! Check your system clock" >&5 echo "$as_me: error: newly created file is older than distributed files! Check your system clock" >&2;} { (exit 1); exit 1; }; } fi echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 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 $. echo might interpret backslashes. # By default was `s,x,x', remove it if useless. cat <<\_ACEOF >conftest.sed s/[\\$]/&&/g;s/;s,x,x,$// _ACEOF program_transform_name=`echo $program_transform_name | sed -f conftest.sed` rm conftest.sed # expand $ac_aux_dir to an absolute path am_aux_dir=`cd $ac_aux_dir && pwd` test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing" # Use eval to expand $SHELL if eval "$MISSING --run true"; then am_missing_run="$MISSING --run " else am_missing_run= { echo "$as_me:$LINENO: WARNING: \`missing' script is too old or missing" >&5 echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} fi 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 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_AWK+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&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_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_AWK="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then echo "$as_me:$LINENO: result: $AWK" >&5 echo "${ECHO_T}$AWK" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$AWK" && break done echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5 echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,:./+-,___p_,'` if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.make <<\_ACEOF all: @echo 'ac_maketemp="$(MAKE)"' _ACEOF # GNU make sometimes prints "make[1]: Entering...", which would confuse us. eval `${MAKE-make} -f conftest.make 2>/dev/null | grep temp=` if test -n "$ac_maketemp"; then eval ac_cv_prog_make_${ac_make}_set=yes else eval ac_cv_prog_make_${ac_make}_set=no fi rm -f conftest.make fi if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 SET_MAKE= else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}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 # test to see if srcdir already configured if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then { { echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5 echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;} { (exit 1); exit 1; }; } 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='TiMidity++' VERSION='2.13.2' 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"} AMTAR=${AMTAR-"${am_missing_run}tar"} install_sh=${install_sh-"$am_aux_dir/install-sh"} # 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 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_STRIP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&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_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then echo "$as_me:$LINENO: result: $STRIP" >&5 echo "${ECHO_T}$STRIP" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}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 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&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_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_STRIP="strip" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_prog_ac_ct_STRIP" && ac_cv_prog_ac_ct_STRIP=":" fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5 echo "${ECHO_T}$ac_ct_STRIP" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi STRIP=$ac_ct_STRIP else STRIP="$ac_cv_prog_STRIP" fi fi INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s" # We need awk for the "check" target. The system "awk" is bad on # some platforms. ac_config_headers="$ac_config_headers config.h interface.h" echo "$as_me:$LINENO: checking whether to enable maintainer-specific portions of Makefiles" >&5 echo $ECHO_N "checking whether to enable maintainer-specific portions of Makefiles... $ECHO_C" >&6 # Check whether --enable-maintainer-mode or --disable-maintainer-mode was given. if test "${enable_maintainer_mode+set}" = set; then enableval="$enable_maintainer_mode" USE_MAINTAINER_MODE=$enableval else USE_MAINTAINER_MODE=no fi; echo "$as_me:$LINENO: result: $USE_MAINTAINER_MODE" >&5 echo "${ECHO_T}$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 SHELL=${CONFIG_SHELL-"/bin/sh"} WISH=${WISH-"wish"} echo "$as_me:$LINENO: checking whether grep returns status" >&5 echo $ECHO_N "checking whether grep returns status... $ECHO_C" >&6 echo "grimblepritz" >grimble if grep blurfldyick grimble >/dev/null 2>&1 ; then contains="./contains" elif grep grimblepritz grimble >/dev/null 2>&1 ; then contains=grep else contains="./contains" fi rm -f grimble case "$contains" in grep) echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 ;; ./contains) echo "$as_me:$LINENO: result: AGH! Grep doesn't return a status. Attempting remedial action." >&5 echo "${ECHO_T}AGH! Grep doesn't return a status. Attempting remedial action." >&6 cat >./contains <<'EOSS' grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp EOSS chmod +x "./contains" ;; esac # Check for compiler options -- such as debug flags. echo "$as_me:$LINENO: checking if --enable-debug option specified" >&5 echo $ECHO_N "checking if --enable-debug option specified... $ECHO_C" >&6 # Check whether --enable-debug or --disable-debug was given. if test "${enable_debug+set}" = set; then enableval="$enable_debug" timidity_cv_debug="yes" else timidity_cv_debug="no" fi; if test "x$timidity_cv_debug" = "xyes"; then cat >>confdefs.h <<\_ACEOF #define DEBUG 1 _ACEOF CFLAGS=${CFLAGS-"-g"} fi if test "x$timidity_cv_debug" = "xno"; then cat >>confdefs.h <<\_ACEOF #define NDEBUG 1 _ACEOF fi echo "$as_me:$LINENO: result: $timidity_cv_debug" >&5 echo "${ECHO_T}$timidity_cv_debug" >&6 CFLAGS=${CFLAGS-"-O2"} if test "x$with_x" = x; then with_x=yes else x_config_flag=yes fi # Checking gcc environment for i in `echo $LIBRARY_PATH|sed -e 's,:, ,g'`; do LDFLAGS="$LDFLAGS -L${i}" done for i in `echo $C_INCLUDE_PATH|sed -e 's,:, ,g'`; do CPPFLAGS="$CPPFLAGS -I${i}" done # add $prefix if specified. if test "x$prefix" != xNONE -a "x$prefix" != "x$ac_default_prefix" -a "x$prefix" != "x/usr"; then LDFLAGS="-L$prefix/lib $LDFLAGS" SHLDFLAGS="-L$prefix/lib $SHLDFLAGS" CPPFLAGS="-I$prefix/include $CPPFLAGS" fi # Check whether --with-includes or --without-includes was given. if test "${with_includes+set}" = set; then withval="$with_includes" j=' ' for i in `echo "$withval"|sed -e 's,:, ,g'`; do j="${j}-I${i} " done CPPFLAGS="$j$CPPFLAGS" fi; # Check whether --with-libraries or --without-libraries was given. if test "${with_libraries+set}" = set; then withval="$with_libraries" j=' ' for i in `echo "$withval"|sed -e 's,:, ,g'`; do j="${j}-L${i} " done LDFLAGS="$j$LDFLAGS" fi; # Check whether --with-default-path or --without-default-path was given. if test "${with_default_path+set}" = set; then withval="$with_default_path" pkgdatadir=$withval else if test "x$prefix" != "xNONE"; then pkgdatadir='${prefix}/share/timidity' else pkgdatadir='/usr/local/share/timidity' fi fi; tmpdefpath="`eval \"echo ${pkgdatadir}\"`" cat >>confdefs.h <<_ACEOF #define DEFAULT_PATH "$tmpdefpath" _ACEOF cat >>confdefs.h <<\_ACEOF #define PKGDATADIR DEFAULT_PATH _ACEOF # Check whether --with-module-dir or --without-module-dir was given. if test "${with_module_dir+set}" = set; then withval="$with_module_dir" pkglibdir=$withval else if test "x$prefix" != "xNONE"; then pkglibdir='${prefix}/lib/timidity' else pkglibdir='/usr/local/lib/timidity' fi fi; tmplibdir="`eval \"echo ${pkglibdir}\"`" cat >>confdefs.h <<_ACEOF #define PKGLIBDIR "$tmplibdir" _ACEOF # Checks for programs. # Check whether --with-lispdir or --without-lispdir was given. if test "${with_lispdir+set}" = set; then withval="$with_lispdir" lispdir="$withval" echo "$as_me:$LINENO: checking where .elc files should go" >&5 echo $ECHO_N "checking where .elc files should go... $ECHO_C" >&6 echo "$as_me:$LINENO: result: $lispdir" >&5 echo "${ECHO_T}$lispdir" >&6 else # If set to t, that means we are running in a shell under Emacs. # If you have an Emacs named "t", then use the full path. test x"$EMACS" = xt && EMACS= for ac_prog in emacs xemacs do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_EMACS+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$EMACS"; then ac_cv_prog_EMACS="$EMACS" # 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_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_EMACS="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi EMACS=$ac_cv_prog_EMACS if test -n "$EMACS"; then echo "$as_me:$LINENO: result: $EMACS" >&5 echo "${ECHO_T}$EMACS" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$EMACS" && break done test -n "$EMACS" || EMACS="no" if test $EMACS != "no"; then if test x${lispdir+set} != xset; then echo "$as_me:$LINENO: checking where .elc files should go" >&5 echo $ECHO_N "checking where .elc files should go... $ECHO_C" >&6 if test "${am_cv_lispdir+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # If $EMACS isn't GNU Emacs or XEmacs, this can blow up pretty badly # Some emacsen will start up in interactive mode, requiring C-x C-c to exit, # which is non-obvious for non-emacs users. # Redirecting /dev/null should help a bit; pity we can't detect "broken" # emacsen earlier and avoid running this altogether. { (echo "$as_me:$LINENO: \$EMACS -batch -q -eval '(while load-path (princ (concat (car load-path) \"\\n\")) (setq load-path (cdr load-path)))' conftest.out") >&5 ($EMACS -batch -q -eval '(while load-path (princ (concat (car load-path) "\n")) (setq load-path (cdr load-path)))' conftest.out) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } am_cv_lispdir=`sed -n \ -e 's,/$,,' \ -e '/.*\/lib\/x\?emacs\/site-lisp$/{s,.*/lib/\(x\?emacs/site-lisp\)$,${libdir}/\1,;p;q;}' \ -e '/.*\/share\/x\?emacs\/site-lisp$/{s,.*/share/\(x\?emacs/site-lisp\),${datadir}/\1,;p;q;}' \ conftest.out` rm conftest.out if test -z "$am_cv_lispdir"; then am_cv_lispdir='${datadir}/emacs/site-lisp' fi fi echo "$as_me:$LINENO: result: $am_cv_lispdir" >&5 echo "${ECHO_T}$am_cv_lispdir" >&6 lispdir="$am_cv_lispdir" fi fi 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 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&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_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}gcc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}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 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&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_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="gcc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi CC=$ac_ct_CC 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 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&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_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&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_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi CC=$ac_ct_CC else CC="$ac_cv_prog_CC" 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 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&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_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" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done 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 echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl 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 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&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_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&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_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$ac_ct_CC" && break done CC=$ac_ct_CC fi fi test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH See \`config.log' for more details." >&5 echo "$as_me: error: no acceptable C compiler found in \$PATH See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } # Provide some information about the compiler. echo "$as_me:$LINENO:" \ "checking for C compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 (eval $ac_compiler --version &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 (eval $ac_compiler -v &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 (eval $ac_compiler -V &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out 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. echo "$as_me:$LINENO: checking for C compiler default output file name" >&5 echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6 ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5 (eval $ac_link_default) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # Find the output, starting from the most likely. This scheme is # not robust to junk in `.', hence go to wildcards (a.*) only as a last # resort. # Be careful to initialize this variable, since it used to be cached. # Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile. ac_cv_exeext= # b.out is created by i960 compilers. for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;; conftest.$ac_ext ) # This is the source file. ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` # FIXME: I believe we export ac_cv_exeext for Libtool, # but it would be cool to find out if it's true. Does anybody # maintain Libtool? --akim. export ac_cv_exeext break;; * ) break;; esac done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { echo "$as_me:$LINENO: error: C compiler cannot create executables See \`config.log' for more details." >&5 echo "$as_me: error: C compiler cannot create executables See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; } fi ac_exeext=$ac_cv_exeext echo "$as_me:$LINENO: result: $ac_file" >&5 echo "${ECHO_T}$ac_file" >&6 # Check the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. echo "$as_me:$LINENO: checking whether the C compiler works" >&5 echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6 # FIXME: These cross compiler hacks should be removed for Autoconf 3.0 # If not cross compiling, check that we can run a simple program. if test "$cross_compiling" != yes; then if { ac_try='./$ac_file' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { echo "$as_me:$LINENO: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details." >&5 echo "$as_me: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi fi fi echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 rm -f a.out a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save # Check the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6 echo "$as_me:$LINENO: result: $cross_compiling" >&5 echo "${ECHO_T}$cross_compiling" >&6 echo "$as_me:$LINENO: checking for suffix of executables" >&5 echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6 if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; 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 | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` export ac_cv_exeext break;; * ) break;; esac done else { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute suffix of executables: cannot compile and link See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi rm -f conftest$ac_cv_exeext echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 echo "${ECHO_T}$ac_cv_exeext" >&6 rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT echo "$as_me:$LINENO: checking for suffix of object files" >&5 echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6 if test "${ac_cv_objext+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 echo "${ECHO_T}$ac_cv_objext" >&6 OBJEXT=$ac_cv_objext ac_objext=$OBJEXT echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6 if test "${ac_cv_c_compiler_gnu+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_compiler_gnu=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_compiler_gnu=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6 GCC=`test $ac_compiler_gnu = yes && echo yes` ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS CFLAGS="-g" echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6 if test "${ac_cv_prog_cc_g+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_prog_cc_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_prog_cc_g=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 echo "${ECHO_T}$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 echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5 echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6 if test "${ac_cv_prog_cc_stdc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_prog_cc_stdc=no ac_save_CC=$CC cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include /* 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 -std1 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 -std1. */ int osf4_cc_array ['\x00' == 0 ? 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 # Don't try gcc -ansi; that turns off useful extensions and # breaks some systems' header files. # AIX -qlanglvl=ansi # Ultrix and OSF/1 -std1 # HP-UX 10.20 and later -Ae # HP-UX older versions -Aa -D_HPUX_SOURCE # SVR4 -Xc -D__EXTENSIONS__ for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_prog_cc_stdc=$ac_arg break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext done rm -f conftest.$ac_ext conftest.$ac_objext CC=$ac_save_CC fi case "x$ac_cv_prog_cc_stdc" in x|xno) echo "$as_me:$LINENO: result: none needed" >&5 echo "${ECHO_T}none needed" >&6 ;; *) echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5 echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6 CC="$CC $ac_cv_prog_cc_stdc" ;; esac # Some people use a C++ compiler to compile C. Since we use `exit', # in C++ we need to declare it. In case someone uses the same compiler # for both compiling C and C++ we need to have the C++ compiler decide # the declaration of exit, since it's the most demanding environment. cat >conftest.$ac_ext <<_ACEOF #ifndef __cplusplus choke me #endif _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then for ac_declaration in \ '' \ 'extern "C" void std::exit (int) throw (); using std::exit;' \ 'extern "C" void std::exit (int); using std::exit;' \ 'extern "C" void exit (int) throw ();' \ 'extern "C" void exit (int);' \ 'void exit (int);' do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_declaration #include int main () { exit (42); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 continue fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_declaration int main () { exit (42); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext done rm -f conftest* if test -n "$ac_declaration"; then echo '#ifdef __cplusplus' >>confdefs.h echo $ac_declaration >>confdefs.h echo '#endif' >>confdefs.h fi else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f 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 DEPDIR="${am__leading_dot}deps" ac_config_commands="$ac_config_commands depfiles" am_make=${MAKE-make} cat > confinc << 'END' am__doit: @echo done .PHONY: am__doit END # If we don't find an include directive, just comment out the code. echo "$as_me:$LINENO: checking for style of include used by $am_make" >&5 echo $ECHO_N "checking for style of include used by $am_make... $ECHO_C" >&6 am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # We grep out `Entering directory' and `Leaving directory' # messages which can occur if `w' ends up in MAKEFLAGS. # In particular we don't look at `^make:' because GNU make might # be invoked under some other name (usually "gmake"), in which # case it prints its new name instead of `make'. if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then am__include=include am__quote= _am_result=GNU fi # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then am__include=.include am__quote="\"" _am_result=BSD fi fi echo "$as_me:$LINENO: result: $_am_result" >&5 echo "${ECHO_T}$_am_result" >&6 rm -f confinc confmf # Check whether --enable-dependency-tracking or --disable-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='\' fi if test "x$enable_dependency_tracking" != xno; then AMDEP_TRUE= AMDEP_FALSE='#' else AMDEP_TRUE='#' AMDEP_FALSE= fi depcc="$CC" am_compiler_list= echo "$as_me:$LINENO: checking dependency style of $depcc" >&5 echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6 if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&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'. 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 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 : > sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf case $depmode in 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 ;; none) break ;; esac # 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. if depmode=$depmode \ source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftest.${OBJEXT-o} 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 # (even with -Werror). So we grep stderr for any message # that says an option was ignored. if grep 'ignoring option' 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 echo "$as_me:$LINENO: result: $am_cv_CC_dependencies_compiler_type" >&5 echo "${ECHO_T}$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 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 echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if test "${ac_cv_prog_CPP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&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 >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether non-existent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then # Broken: success on invalid input. continue else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f 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 echo "$as_me:$LINENO: result: $CPP" >&5 echo "${ECHO_T}$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 >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether non-existent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then # Broken: success on invalid input. continue else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details." >&5 echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } 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 echo "$as_me:$LINENO: checking for egrep" >&5 echo $ECHO_N "checking for egrep... $ECHO_C" >&6 if test "${ac_cv_prog_egrep+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if echo a | (grep -E '(a|b)') >/dev/null 2>&1 then ac_cv_prog_egrep='grep -E' else ac_cv_prog_egrep='egrep' fi fi echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5 echo "${ECHO_T}$ac_cv_prog_egrep" >&6 EGREP=$ac_cv_prog_egrep if test $ac_cv_c_compiler_gnu = yes; then echo "$as_me:$LINENO: checking whether $CC needs -traditional" >&5 echo $ECHO_N "checking whether $CC needs -traditional... $ECHO_C" >&6 if test "${ac_cv_prog_gcc_traditional+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_pattern="Autoconf.*'x'" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* 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 >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* 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 echo "$as_me:$LINENO: result: $ac_cv_prog_gcc_traditional" >&5 echo "${ECHO_T}$ac_cv_prog_gcc_traditional" >&6 if test $ac_cv_prog_gcc_traditional = yes; then CC="$CC -traditional" fi fi # 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. echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6 if test -z "$INSTALL"; then if test "${ac_cv_path_install+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&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_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 ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" break 3 fi fi done done ;; esac done 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. We don't cache a # path for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the path is relative. INSTALL=$ac_install_sh fi fi echo "$as_me:$LINENO: result: $INSTALL" >&5 echo "${ECHO_T}$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' 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 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_AWK+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&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_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_AWK="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then echo "$as_me:$LINENO: result: $AWK" >&5 echo "${ECHO_T}$AWK" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$AWK" && break done if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_RANLIB+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$RANLIB"; then ac_cv_prog_RANLIB="$RANLIB" # 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_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi RANLIB=$ac_cv_prog_RANLIB if test -n "$RANLIB"; then echo "$as_me:$LINENO: result: $RANLIB" >&5 echo "${ECHO_T}$RANLIB" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$ac_cv_prog_RANLIB"; then ac_ct_RANLIB=$RANLIB # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_RANLIB"; then ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # 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_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_RANLIB="ranlib" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_prog_ac_ct_RANLIB" && ac_cv_prog_ac_ct_RANLIB=":" fi fi ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB if test -n "$ac_ct_RANLIB"; then echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5 echo "${ECHO_T}$ac_ct_RANLIB" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi RANLIB=$ac_ct_RANLIB else RANLIB="$ac_cv_prog_RANLIB" fi echo "$as_me:$LINENO: checking whether ln -s works" >&5 echo $ECHO_N "checking whether ln -s works... $ECHO_C" >&6 LN_S=$as_ln_s if test "$LN_S" = "ln -s"; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 else echo "$as_me:$LINENO: result: no, using $LN_S" >&5 echo "${ECHO_T}no, using $LN_S" >&6 fi echo "$as_me:$LINENO: checking whether -rdynamic option is recognized" >&5 echo $ECHO_N "checking whether -rdynamic option is recognized... $ECHO_C" >&6 ac_ccoption=`echo rdynamic | sed 'y%./+-%__p_%'` if eval "test \"\${timidity_cv_ccoption_$ac_ccoption+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat > conftest.$ac_ext < conftest.out 2>&1; then if test -s conftest.out; then eval "timidity_cv_ccoption_$ac_ccoption=no" else eval "timidity_cv_ccoption_$ac_ccoption=yes" fi else eval "timidity_cv_ccoption_$ac_ccoption=no" fi fi if eval "test \"`echo '$timidity_cv_ccoption_'$ac_ccoption`\" = yes"; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi # Checks for target dependencies # Check whether --with-elf or --without-elf was given. if test "${with_elf+set}" = set; then withval="$with_elf" ELFFORMAT=$withval else ELFFORMAT="yes" fi; # AC_ARG_WITH(simd, # [ --with-simd create SIMD friendly binary (default is no) ], # [ SIMD=$withval ], [ SIMD="no" ]) case "$target" in *-*-hpux*) EXTRADEFS="-DHPUX" test -n "$SHLD" || SHLD="ld -b" so="sl" ;; *-sgi-irix*) case ".$CC" in .cc*) EXTRACFLAGS="-signed";; esac test -n "$SHLD" || SHLD="cc -shared -all" so="so" ;; *-*-netbsd*) test -n "$SHLD" || SHLD="$CC -shared -nostartfiles" so="so" ;; *-*-freebsd2*) test -n "$SHLD" || SHLD="ld -Bshareable" so="so" ;; *-*-freebsd*) if test "$ELFFORMAT" = yes; then test -n "$SHLD" || SHLD="ld -Bshareable" else SHCFLAGS=-aou SHLDFLAGS="-L/usr/X11R6/lib/aout $SHLDFLAGS" test -n "$SHLD" || SHLD="env OBJFORMAT=aout ld -shared" fi so="so" ;; # *-*-freebsd*) # EXTRALIBS="$EXTRALIBS -lxpg4" # test -n "$SHLD" || SHLD="ld -Bshareable" # so="so" # ;; *-*-cygwin*) EXTRADEFS="-D__W32__" # ?? case "x${CC} " in "xbcc32 "*) # test -n "$SHLD" || SHLD="tlink32 -Tpd" test -n "$SHLD" || SHLD="BCC32 -WD" BORLANDC=yes BORLANDC_LDFLAGS="kernel32.lib winspool.lib comdlg32.lib advapi32.lib oleaut32.lib uuid.lib odbc32.lib wsock32.lib user32.lib shell32.lib cw32mt.lib" BORLANDC_START='C0X32.OBJ' CFLAGS="$CFLAGS -tWM -VM" EXTRADEFS="$EXTRADEFS -D_WINDOWS -DWIN32" ;; "xwcc386_w.sh "*) WATCOM_C=yes CFLAGS="$CFLAGS -br -5s -zk0 -bm -zp=16 -w=4 -D_WINDOWS -DWIN32 -DINCLUDE_WINDOWS_H" WATCOM_LDFLAGS= EXTRALIBS="$EXTRALIBS kernel32.lib winspool.lib comdlg32.lib advapi32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib user32.lib shell32.lib libcmt.lib" ;; "xcl "*) test -n "$SHLD" || SHLD="link -dll" VCPP_LDFLAGS="-nologo -incremental:no -nodefaultlib:libc.lib -nodefaultlib:msvcrt.lib kernel32.lib winspool.lib comdlg32.lib advapi32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib user32.lib shell32.lib libcmt.lib" CFLAGS="$CFLAGS -nologo -Zp16 -MT -W3 -GX -Ob2" EXTRADEFS="$EXTRADEFS -DNDEBUG -D_WINDOWS -DWIN32 -DMBCS -D_MT -YX -FD -c" VCPP=yes ;; "xgcc"*) test -n "$SHLD" || SHLD="gcc -mdll" ;; *) test -n "$SHLD" || SHLD="unknown" ;; esac so="dll" CYGNUS=yes lib_user32_test=-luser32 ;; *-*-mingw*) EXTRADEFS="-D__W32__" # ?? case "x${CC} " in "xbcc32 "*) # test -n "$SHLD" || SHLD="tlink32 -Tpd" test -n "$SHLD" || SHLD="BCC32 -WD" BORLANDC=yes BORLANDC_LDFLAGS="kernel32.lib winspool.lib comdlg32.lib advapi32.lib oleaut32.lib uuid.lib odbc32.lib wsock32.lib user32.lib shell32.lib cw32mt.lib" BORLANDC_START='C0X32.OBJ' CFLAGS="$CFLAGS -tWM -VM" EXTRADEFS="$EXTRADEFS -D_WINDOWS -DWIN32" ;; "xwcc386_w.sh "*) WATCOM_C=yes CFLAGS="$CFLAGS -br -5s -zk0 -bm -zp=16 -w=4 -D_WINDOWS -DWIN32 -DINCLUDE_WINDOWS_H" WATCOM_LDFLAGS= EXTRALIBS="$EXTRALIBS kernel32.lib winspool.lib comdlg32.lib advapi32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib user32.lib shell32.lib libcmt.lib" ;; "xcl "*) test -n "$SHLD" || SHLD="link -dll" VCPP=yes VCPP_LDFLAGS="-nologo -incremental:no -nodefaultlib:libc.lib -nodefaultlib:msvcrt.lib kernel32.lib winspool.lib comdlg32.lib advapi32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib user32.lib shell32.lib libcmt.lib" CFLAGS="$CFLAGS -nologo -Zp16 -MT -W3 -GX -Ob2" EXTRADEFS="$EXTRADEFS -DNDEBUG -D_WINDOWS -DWIN32 -DMBCS -D_MT -YX -FD -c" ;; "xgcc"*) test -n "$SHLD" || SHLD="gcc -mdll" ;; *) test -n "$SHLD" || SHLD="unknown" ;; esac so="dll" MSYS=yes lib_user32_test=-luser32 ;; *-dec-*) EXTRADEFS="-DDEC" test -n "$SHLD" || SHLD="ld -Bdynamic -G" so="so" ;; *-*-solaris*) EXTRADEFS="-DSOLARIS" test -n "$SHLD" || SHLD="/usr/ccs/bin/ld -G" so="so" ;; *-*-nextstep*) test -n "$SHLD" || SHLD="/usr/ccs/bin/ld -G" so="so" ;; *-*-darwin*) if test "x$SIMD" = "xyes"; then cat >>confdefs.h <<\_ACEOF #define USE_ALTIVEC 1 _ACEOF # EXTRACFLAGS="$EXTRACFLAGS -faltivec -mabi=altivec -maltivec" # for GCC3. EXTRACFLAGS="$EXTRACFLAGS -faltivec" else cat >>confdefs.h <<\_ACEOF #define USE_ALTIVEC 0 _ACEOF fi CPPFLAGS="$CPPFLAGS -no-cpp-precomp" LDOPTS="-dynamic -undefined suppress -flat_namespace $LDOPTS" test -n "$SHLD" || SHLD="$CC -dynamic -bundle -undefined suppress -flat_namespace $LDFLAGS" so="bundle" ;; *) test -n "$SHLD" || \ if test "x$GCC" = xyes; then SHLD="$CC -shared" else SHLD="ld -Bdynamic -G" fi so="so" ;; esac # Checks for libraries. echo "$as_me:$LINENO: checking for sqrt in -lm" >&5 echo $ECHO_N "checking for sqrt in -lm... $ECHO_C" >&6 if test "${ac_cv_lib_m_sqrt+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lm $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char sqrt (); int main () { sqrt (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_m_sqrt=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_m_sqrt=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_m_sqrt" >&5 echo "${ECHO_T}$ac_cv_lib_m_sqrt" >&6 if test $ac_cv_lib_m_sqrt = yes; then cat >>confdefs.h <<_ACEOF #define HAVE_LIBM 1 _ACEOF LIBS="-lm $LIBS" fi echo "$as_me:$LINENO: checking for socket in -lsocket" >&5 echo $ECHO_N "checking for socket in -lsocket... $ECHO_C" >&6 if test "${ac_cv_lib_socket_socket+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lsocket $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char socket (); int main () { socket (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_socket_socket=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_socket_socket=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_socket_socket" >&5 echo "${ECHO_T}$ac_cv_lib_socket_socket" >&6 if test $ac_cv_lib_socket_socket = yes; then cat >>confdefs.h <<_ACEOF #define HAVE_LIBSOCKET 1 _ACEOF LIBS="-lsocket $LIBS" fi echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6 if test "${ac_cv_lib_dl_dlopen+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char dlopen (); int main () { dlopen (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_dl_dlopen=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_dl_dlopen=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6 if test $ac_cv_lib_dl_dlopen = yes; then lib_dl_opt=-ldl fi echo "$as_me:$LINENO: checking for NSLinkModule in -lobjc" >&5 echo $ECHO_N "checking for NSLinkModule in -lobjc... $ECHO_C" >&6 if test "${ac_cv_lib_objc_NSLinkModule+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lobjc $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char NSLinkModule (); int main () { NSLinkModule (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_objc_NSLinkModule=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_objc_NSLinkModule=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_objc_NSLinkModule" >&5 echo "${ECHO_T}$ac_cv_lib_objc_NSLinkModule" >&6 if test $ac_cv_lib_objc_NSLinkModule = yes; then lib_dl_opt=-lobjc fi # Mac OS X need this. if test "x$VCPP" != "xyes" && test "x$BORLANDC" != "xyes" && test "x$WATCOM_C" != "xyes"; then echo "$as_me:$LINENO: checking for setlocale in -lxpg4" >&5 echo $ECHO_N "checking for setlocale in -lxpg4... $ECHO_C" >&6 if test "${ac_cv_lib_xpg4_setlocale+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lxpg4 $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char setlocale (); int main () { setlocale (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_xpg4_setlocale=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_xpg4_setlocale=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_xpg4_setlocale" >&5 echo "${ECHO_T}$ac_cv_lib_xpg4_setlocale" >&6 if test $ac_cv_lib_xpg4_setlocale = yes; then cat >>confdefs.h <<_ACEOF #define HAVE_LIBXPG4 1 _ACEOF LIBS="-lxpg4 $LIBS" fi # Mac OS X (and maybe NetBSD) need this. fi for ac_func in gethostbyname do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` echo "$as_me:$LINENO: checking for $ac_func" >&5 echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 if eval "test \"\${$as_ac_var+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define $ac_func to an innocuous variant, in case declares $ac_func. For example, HP-UX 11i declares gettimeofday. */ #define $ac_func innocuous_$ac_func /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $ac_func /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" { #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char $ac_func (); /* 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_$ac_func) || defined (__stub___$ac_func) choke me #else char (*f) () = $ac_func; #endif #ifdef __cplusplus } #endif int main () { return f != $ac_func; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then eval "$as_ac_var=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 if test `eval echo '${'$as_ac_var'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF else echo "$as_me:$LINENO: checking for gethostbyname in -lnsl" >&5 echo $ECHO_N "checking for gethostbyname in -lnsl... $ECHO_C" >&6 if test "${ac_cv_lib_nsl_gethostbyname+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lnsl $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char gethostbyname (); int main () { gethostbyname (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_nsl_gethostbyname=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_nsl_gethostbyname=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_nsl_gethostbyname" >&5 echo "${ECHO_T}$ac_cv_lib_nsl_gethostbyname" >&6 if test $ac_cv_lib_nsl_gethostbyname = yes; then cat >>confdefs.h <<_ACEOF #define HAVE_LIBNSL 1 _ACEOF LIBS="-lnsl $LIBS" fi fi done echo "$as_me:$LINENO: checking for X" >&5 echo $ECHO_N "checking for X... $ECHO_C" >&6 # Check whether --with-x or --without-x was given. if test "${with_x+set}" = set; then withval="$with_x" fi; # $have_x is `yes', `no', `disabled', or empty when we do not yet know. if test "x$with_x" = xno; then # The user explicitly disabled X. have_x=disabled else if test "x$x_includes" != xNONE && test "x$x_libraries" != xNONE; then # Both variables are already set. have_x=yes else if test "${ac_cv_have_x+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # One or both of the vars are not set, and there is no cached value. ac_x_includes=no ac_x_libraries=no rm -fr conftest.dir if mkdir conftest.dir; then cd conftest.dir # Make sure to not put "make" in the Imakefile rules, since we grep it out. cat >Imakefile <<'_ACEOF' acfindx: @echo 'ac_im_incroot="${INCROOT}"; ac_im_usrlibdir="${USRLIBDIR}"; ac_im_libdir="${LIBDIR}"' _ACEOF if (xmkmf) >/dev/null 2>/dev/null && test -f Makefile; then # GNU make sometimes prints "make[1]: Entering...", which would confuse us. eval `${MAKE-make} acfindx 2>/dev/null | grep -v make` # Open Windows xmkmf reportedly sets LIBDIR instead of USRLIBDIR. for ac_extension in a so sl; do if test ! -f $ac_im_usrlibdir/libX11.$ac_extension && test -f $ac_im_libdir/libX11.$ac_extension; then ac_im_usrlibdir=$ac_im_libdir; break fi done # Screen out bogus values from the imake configuration. They are # bogus both because they are the default anyway, and because # using them would break gcc on systems where it needs fixed includes. case $ac_im_incroot in /usr/include) ;; *) test -f "$ac_im_incroot/X11/Xos.h" && ac_x_includes=$ac_im_incroot;; esac case $ac_im_usrlibdir in /usr/lib | /lib) ;; *) test -d "$ac_im_usrlibdir" && ac_x_libraries=$ac_im_usrlibdir ;; esac fi cd .. rm -fr conftest.dir fi # Standard set of common directories for X headers. # Check X11 before X11Rn because it is often a symlink to the current release. ac_x_header_dirs=' /usr/X11/include /usr/X11R6/include /usr/X11R5/include /usr/X11R4/include /usr/include/X11 /usr/include/X11R6 /usr/include/X11R5 /usr/include/X11R4 /usr/local/X11/include /usr/local/X11R6/include /usr/local/X11R5/include /usr/local/X11R4/include /usr/local/include/X11 /usr/local/include/X11R6 /usr/local/include/X11R5 /usr/local/include/X11R4 /usr/X386/include /usr/x386/include /usr/XFree86/include/X11 /usr/include /usr/local/include /usr/unsupported/include /usr/athena/include /usr/local/x11r5/include /usr/lpp/Xamples/include /usr/openwin/include /usr/openwin/share/include' if test "$ac_x_includes" = no; then # Guess where to find include files, by looking for Intrinsic.h. # First, try using that file with no special directory specified. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then # We can compile using X headers with no special include directory. ac_x_includes= else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 for ac_dir in $ac_x_header_dirs; do if test -r "$ac_dir/X11/Intrinsic.h"; then ac_x_includes=$ac_dir break fi done fi rm -f conftest.err conftest.$ac_ext fi # $ac_x_includes = no if test "$ac_x_libraries" = no; then # Check for the libraries. # See if we find them without any special options. # Don't add to $LIBS permanently. ac_save_LIBS=$LIBS LIBS="-lXt $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include int main () { XtMalloc (0) ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then LIBS=$ac_save_LIBS # We can link X programs with no special library path. ac_x_libraries= else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 LIBS=$ac_save_LIBS for ac_dir in `echo "$ac_x_includes $ac_x_header_dirs" | sed s/include/lib/g` do # Don't even attempt the hair of trying to link an X program! for ac_extension in a so sl; do if test -r $ac_dir/libXt.$ac_extension; then ac_x_libraries=$ac_dir break 2 fi done done fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi # $ac_x_libraries = no if test "$ac_x_includes" = no || test "$ac_x_libraries" = no; then # Didn't find X anywhere. Cache the known absence of X. ac_cv_have_x="have_x=no" else # Record where we found X for the cache. ac_cv_have_x="have_x=yes \ ac_x_includes=$ac_x_includes ac_x_libraries=$ac_x_libraries" fi fi fi eval "$ac_cv_have_x" fi # $with_x != no if test "$have_x" != yes; then echo "$as_me:$LINENO: result: $have_x" >&5 echo "${ECHO_T}$have_x" >&6 no_x=yes else # If each of the values was on the command line, it overrides each guess. test "x$x_includes" = xNONE && x_includes=$ac_x_includes test "x$x_libraries" = xNONE && x_libraries=$ac_x_libraries # Update the cache value to reflect the command line values. ac_cv_have_x="have_x=yes \ ac_x_includes=$x_includes ac_x_libraries=$x_libraries" echo "$as_me:$LINENO: result: libraries $x_libraries, headers $x_includes" >&5 echo "${ECHO_T}libraries $x_libraries, headers $x_includes" >&6 fi if test "$no_x" = yes; then # Not all programs may use this symbol, but it does not hurt to define it. cat >>confdefs.h <<\_ACEOF #define X_DISPLAY_MISSING 1 _ACEOF X_CFLAGS= X_PRE_LIBS= X_LIBS= X_EXTRA_LIBS= else if test -n "$x_includes"; then X_CFLAGS="$X_CFLAGS -I$x_includes" fi # It would also be nice to do this for all -L options, not just this one. if test -n "$x_libraries"; then X_LIBS="$X_LIBS -L$x_libraries" # For Solaris; some versions of Sun CC require a space after -R and # others require no space. Words are not sufficient . . . . case `(uname -sr) 2>/dev/null` in "SunOS 5"*) echo "$as_me:$LINENO: checking whether -R must be followed by a space" >&5 echo $ECHO_N "checking whether -R must be followed by a space... $ECHO_C" >&6 ac_xsave_LIBS=$LIBS; LIBS="$LIBS -R$x_libraries" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_R_nospace=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_R_nospace=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test $ac_R_nospace = yes; then echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 X_LIBS="$X_LIBS -R$x_libraries" else LIBS="$ac_xsave_LIBS -R $x_libraries" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_R_space=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_R_space=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test $ac_R_space = yes; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 X_LIBS="$X_LIBS -R $x_libraries" else echo "$as_me:$LINENO: result: neither works" >&5 echo "${ECHO_T}neither works" >&6 fi fi LIBS=$ac_xsave_LIBS esac fi # Check for system-dependent libraries X programs must link with. # Do this before checking for the system-independent R6 libraries # (-lICE), since we may need -lsocket or whatever for X linking. if test "$ISC" = yes; then X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl_s -linet" else # Martyn Johnson says this is needed for Ultrix, if the X # libraries were built with DECnet support. And Karl Berry says # the Alpha needs dnet_stub (dnet does not exist). ac_xsave_LIBS="$LIBS"; LIBS="$LIBS $X_LIBS -lX11" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char XOpenDisplay (); int main () { XOpenDisplay (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 echo "$as_me:$LINENO: checking for dnet_ntoa in -ldnet" >&5 echo $ECHO_N "checking for dnet_ntoa in -ldnet... $ECHO_C" >&6 if test "${ac_cv_lib_dnet_dnet_ntoa+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldnet $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char dnet_ntoa (); int main () { dnet_ntoa (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_dnet_dnet_ntoa=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_dnet_dnet_ntoa=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_dnet_dnet_ntoa" >&5 echo "${ECHO_T}$ac_cv_lib_dnet_dnet_ntoa" >&6 if test $ac_cv_lib_dnet_dnet_ntoa = yes; then X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet" fi if test $ac_cv_lib_dnet_dnet_ntoa = no; then echo "$as_me:$LINENO: checking for dnet_ntoa in -ldnet_stub" >&5 echo $ECHO_N "checking for dnet_ntoa in -ldnet_stub... $ECHO_C" >&6 if test "${ac_cv_lib_dnet_stub_dnet_ntoa+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldnet_stub $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char dnet_ntoa (); int main () { dnet_ntoa (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_dnet_stub_dnet_ntoa=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_dnet_stub_dnet_ntoa=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_dnet_stub_dnet_ntoa" >&5 echo "${ECHO_T}$ac_cv_lib_dnet_stub_dnet_ntoa" >&6 if test $ac_cv_lib_dnet_stub_dnet_ntoa = yes; then X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet_stub" fi fi fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS="$ac_xsave_LIBS" # msh@cis.ufl.edu says -lnsl (and -lsocket) are needed for his 386/AT, # to get the SysV transport functions. # Chad R. Larson says the Pyramis MIS-ES running DC/OSx (SVR4) # needs -lnsl. # The nsl library prevents programs from opening the X display # on Irix 5.2, according to T.E. Dickey. # The functions gethostbyname, getservbyname, and inet_addr are # in -lbsd on LynxOS 3.0.1/i386, according to Lars Hecking. echo "$as_me:$LINENO: checking for gethostbyname" >&5 echo $ECHO_N "checking for gethostbyname... $ECHO_C" >&6 if test "${ac_cv_func_gethostbyname+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define gethostbyname to an innocuous variant, in case declares gethostbyname. For example, HP-UX 11i declares gettimeofday. */ #define gethostbyname innocuous_gethostbyname /* System header to define __stub macros and hopefully few prototypes, which can conflict with char gethostbyname (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef gethostbyname /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" { #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char gethostbyname (); /* 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_gethostbyname) || defined (__stub___gethostbyname) choke me #else char (*f) () = gethostbyname; #endif #ifdef __cplusplus } #endif int main () { return f != gethostbyname; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_gethostbyname=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_gethostbyname=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_func_gethostbyname" >&5 echo "${ECHO_T}$ac_cv_func_gethostbyname" >&6 if test $ac_cv_func_gethostbyname = no; then echo "$as_me:$LINENO: checking for gethostbyname in -lnsl" >&5 echo $ECHO_N "checking for gethostbyname in -lnsl... $ECHO_C" >&6 if test "${ac_cv_lib_nsl_gethostbyname+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lnsl $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char gethostbyname (); int main () { gethostbyname (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_nsl_gethostbyname=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_nsl_gethostbyname=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_nsl_gethostbyname" >&5 echo "${ECHO_T}$ac_cv_lib_nsl_gethostbyname" >&6 if test $ac_cv_lib_nsl_gethostbyname = yes; then X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl" fi if test $ac_cv_lib_nsl_gethostbyname = no; then echo "$as_me:$LINENO: checking for gethostbyname in -lbsd" >&5 echo $ECHO_N "checking for gethostbyname in -lbsd... $ECHO_C" >&6 if test "${ac_cv_lib_bsd_gethostbyname+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lbsd $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char gethostbyname (); int main () { gethostbyname (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_bsd_gethostbyname=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_bsd_gethostbyname=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_bsd_gethostbyname" >&5 echo "${ECHO_T}$ac_cv_lib_bsd_gethostbyname" >&6 if test $ac_cv_lib_bsd_gethostbyname = yes; then X_EXTRA_LIBS="$X_EXTRA_LIBS -lbsd" fi fi fi # lieder@skyler.mavd.honeywell.com says without -lsocket, # socket/setsockopt and other routines are undefined under SCO ODT # 2.0. But -lsocket is broken on IRIX 5.2 (and is not necessary # on later versions), says Simon Leinen: it contains gethostby* # variants that don't use the name server (or something). -lsocket # must be given before -lnsl if both are needed. We assume that # if connect needs -lnsl, so does gethostbyname. echo "$as_me:$LINENO: checking for connect" >&5 echo $ECHO_N "checking for connect... $ECHO_C" >&6 if test "${ac_cv_func_connect+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define connect to an innocuous variant, in case declares connect. For example, HP-UX 11i declares gettimeofday. */ #define connect innocuous_connect /* System header to define __stub macros and hopefully few prototypes, which can conflict with char connect (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef connect /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" { #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char connect (); /* 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_connect) || defined (__stub___connect) choke me #else char (*f) () = connect; #endif #ifdef __cplusplus } #endif int main () { return f != connect; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_connect=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_connect=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_func_connect" >&5 echo "${ECHO_T}$ac_cv_func_connect" >&6 if test $ac_cv_func_connect = no; then echo "$as_me:$LINENO: checking for connect in -lsocket" >&5 echo $ECHO_N "checking for connect in -lsocket... $ECHO_C" >&6 if test "${ac_cv_lib_socket_connect+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lsocket $X_EXTRA_LIBS $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char connect (); int main () { connect (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_socket_connect=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_socket_connect=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_socket_connect" >&5 echo "${ECHO_T}$ac_cv_lib_socket_connect" >&6 if test $ac_cv_lib_socket_connect = yes; then X_EXTRA_LIBS="-lsocket $X_EXTRA_LIBS" fi fi # Guillermo Gomez says -lposix is necessary on A/UX. echo "$as_me:$LINENO: checking for remove" >&5 echo $ECHO_N "checking for remove... $ECHO_C" >&6 if test "${ac_cv_func_remove+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define remove to an innocuous variant, in case declares remove. For example, HP-UX 11i declares gettimeofday. */ #define remove innocuous_remove /* System header to define __stub macros and hopefully few prototypes, which can conflict with char remove (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef remove /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" { #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char remove (); /* 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_remove) || defined (__stub___remove) choke me #else char (*f) () = remove; #endif #ifdef __cplusplus } #endif int main () { return f != remove; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_remove=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_remove=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_func_remove" >&5 echo "${ECHO_T}$ac_cv_func_remove" >&6 if test $ac_cv_func_remove = no; then echo "$as_me:$LINENO: checking for remove in -lposix" >&5 echo $ECHO_N "checking for remove in -lposix... $ECHO_C" >&6 if test "${ac_cv_lib_posix_remove+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lposix $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char remove (); int main () { remove (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_posix_remove=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_posix_remove=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_posix_remove" >&5 echo "${ECHO_T}$ac_cv_lib_posix_remove" >&6 if test $ac_cv_lib_posix_remove = yes; then X_EXTRA_LIBS="$X_EXTRA_LIBS -lposix" fi fi # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay. echo "$as_me:$LINENO: checking for shmat" >&5 echo $ECHO_N "checking for shmat... $ECHO_C" >&6 if test "${ac_cv_func_shmat+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define shmat to an innocuous variant, in case declares shmat. For example, HP-UX 11i declares gettimeofday. */ #define shmat innocuous_shmat /* System header to define __stub macros and hopefully few prototypes, which can conflict with char shmat (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef shmat /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" { #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char shmat (); /* 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_shmat) || defined (__stub___shmat) choke me #else char (*f) () = shmat; #endif #ifdef __cplusplus } #endif int main () { return f != shmat; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_shmat=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_shmat=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_func_shmat" >&5 echo "${ECHO_T}$ac_cv_func_shmat" >&6 if test $ac_cv_func_shmat = no; then echo "$as_me:$LINENO: checking for shmat in -lipc" >&5 echo $ECHO_N "checking for shmat in -lipc... $ECHO_C" >&6 if test "${ac_cv_lib_ipc_shmat+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lipc $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char shmat (); int main () { shmat (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_ipc_shmat=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_ipc_shmat=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_ipc_shmat" >&5 echo "${ECHO_T}$ac_cv_lib_ipc_shmat" >&6 if test $ac_cv_lib_ipc_shmat = yes; then X_EXTRA_LIBS="$X_EXTRA_LIBS -lipc" fi fi fi # Check for libraries that X11R6 Xt/Xaw programs need. ac_save_LDFLAGS=$LDFLAGS test -n "$x_libraries" && LDFLAGS="$LDFLAGS -L$x_libraries" # SM needs ICE to (dynamically) link under SunOS 4.x (so we have to # check for ICE first), but we must link in the order -lSM -lICE or # we get undefined symbols. So assume we have SM if we have ICE. # These have to be linked with before -lX11, unlike the other # libraries we check for below, so use a different variable. # John Interrante, Karl Berry echo "$as_me:$LINENO: checking for IceConnectionNumber in -lICE" >&5 echo $ECHO_N "checking for IceConnectionNumber in -lICE... $ECHO_C" >&6 if test "${ac_cv_lib_ICE_IceConnectionNumber+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lICE $X_EXTRA_LIBS $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char IceConnectionNumber (); int main () { IceConnectionNumber (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_ICE_IceConnectionNumber=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_ICE_IceConnectionNumber=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_ICE_IceConnectionNumber" >&5 echo "${ECHO_T}$ac_cv_lib_ICE_IceConnectionNumber" >&6 if test $ac_cv_lib_ICE_IceConnectionNumber = yes; then X_PRE_LIBS="$X_PRE_LIBS -lSM -lICE" fi LDFLAGS=$ac_save_LDFLAGS fi # Checks for X if test "x$with_x" = xyes; then if test "x$have_x" = xno; then if test "x$x_config_flag" = xyes; then { { echo "$as_me:$LINENO: error: Could not configure X" >&5 echo "$as_me: error: Could not configure X" >&2;} { (exit 1); exit 1; }; } else { echo "$as_me:$LINENO: WARNING: Could not configure X" >&5 echo "$as_me: WARNING: Could not configure X" >&2;} fi fi fi if test "x$with_x" = xyes -a "x$have_x" = xyes; then if test "x$x_libraries" != x; then ldflags_x_opt="-L$x_libraries" LDFLAGS="$LDFLAGS $ldflags_x_opt" SHLDFLAGS="$SHLDFLAGS $ldflags_x_opt" else ldflags_x_opt= fi if test "x$x_includes" != x; then CPPFLAGS="$CPPFLAGS -I$x_includes" fi echo "$as_me:$LINENO: checking for XOpenDisplay in -lX11" >&5 echo $ECHO_N "checking for XOpenDisplay in -lX11... $ECHO_C" >&6 if test "${ac_cv_lib_X11_XOpenDisplay+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lX11 $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char XOpenDisplay (); int main () { XOpenDisplay (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_X11_XOpenDisplay=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_X11_XOpenDisplay=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_X11_XOpenDisplay" >&5 echo "${ECHO_T}$ac_cv_lib_X11_XOpenDisplay" >&6 if test $ac_cv_lib_X11_XOpenDisplay = yes; then cat >>confdefs.h <<_ACEOF #define HAVE_LIBX11 1 _ACEOF LIBS="-lX11 $LIBS" fi echo "$as_me:$LINENO: checking X11 version 6" >&5 echo $ECHO_N "checking X11 version 6... $ECHO_C" >&6 if test "${timidity_cv_x11_version_6+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include int main () { #if XlibSpecificationRelease < 6 fail; #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then timidity_cv_x11_version_6=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 timidity_cv_x11_version_6=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi if test "$timidity_cv_x11_version_6" = "yes"; then echo "$as_me:$LINENO: result: 6 or newer" >&5 echo "${ECHO_T}6 or newer" >&6 else echo "$as_me:$LINENO: result: before 6" >&5 echo "${ECHO_T}before 6" >&6 fi KEEPLIBS=$LIBS echo "$as_me:$LINENO: checking for XShapeCombineMask in -lXext" >&5 echo $ECHO_N "checking for XShapeCombineMask in -lXext... $ECHO_C" >&6 if test "${ac_cv_lib_Xext_XShapeCombineMask+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lXext $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char XShapeCombineMask (); int main () { XShapeCombineMask (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_Xext_XShapeCombineMask=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_Xext_XShapeCombineMask=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_Xext_XShapeCombineMask" >&5 echo "${ECHO_T}$ac_cv_lib_Xext_XShapeCombineMask" >&6 if test $ac_cv_lib_Xext_XShapeCombineMask = yes; then have_xext=yes; LIBS="-lXext $LIBS" else have_xext=no fi echo "$as_me:$LINENO: checking for IceConnectionNumber in -lICE" >&5 echo $ECHO_N "checking for IceConnectionNumber in -lICE... $ECHO_C" >&6 if test "${ac_cv_lib_ICE_IceConnectionNumber+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lICE $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char IceConnectionNumber (); int main () { IceConnectionNumber (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_ICE_IceConnectionNumber=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_ICE_IceConnectionNumber=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_ICE_IceConnectionNumber" >&5 echo "${ECHO_T}$ac_cv_lib_ICE_IceConnectionNumber" >&6 if test $ac_cv_lib_ICE_IceConnectionNumber = yes; then cat >>confdefs.h <<_ACEOF #define HAVE_LIBICE 1 _ACEOF LIBS="-lICE $LIBS" fi echo "$as_me:$LINENO: checking for SmcOpenConnection in -lSM" >&5 echo $ECHO_N "checking for SmcOpenConnection in -lSM... $ECHO_C" >&6 if test "${ac_cv_lib_SM_SmcOpenConnection+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lSM $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char SmcOpenConnection (); int main () { SmcOpenConnection (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_SM_SmcOpenConnection=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_SM_SmcOpenConnection=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_SM_SmcOpenConnection" >&5 echo "${ECHO_T}$ac_cv_lib_SM_SmcOpenConnection" >&6 if test $ac_cv_lib_SM_SmcOpenConnection = yes; then have_xprelibs=yes; LIBS="-lSM $LIBS" else have_xprelibs=no fi echo "$as_me:$LINENO: checking for XtVaAppInitialize in -lXt" >&5 echo $ECHO_N "checking for XtVaAppInitialize in -lXt... $ECHO_C" >&6 if test "${ac_cv_lib_Xt_XtVaAppInitialize+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lXt $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char XtVaAppInitialize (); int main () { XtVaAppInitialize (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_Xt_XtVaAppInitialize=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_Xt_XtVaAppInitialize=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_Xt_XtVaAppInitialize" >&5 echo "${ECHO_T}$ac_cv_lib_Xt_XtVaAppInitialize" >&6 if test $ac_cv_lib_Xt_XtVaAppInitialize = yes; then have_xt=yes; LIBS="-lXt $LIBS" else have_xt=no fi echo "$as_me:$LINENO: checking for XmuInternAtom in -lXmu" >&5 echo $ECHO_N "checking for XmuInternAtom in -lXmu... $ECHO_C" >&6 if test "${ac_cv_lib_Xmu_XmuInternAtom+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lXmu $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char XmuInternAtom (); int main () { XmuInternAtom (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_Xmu_XmuInternAtom=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_Xmu_XmuInternAtom=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_Xmu_XmuInternAtom" >&5 echo "${ECHO_T}$ac_cv_lib_Xmu_XmuInternAtom" >&6 if test $ac_cv_lib_Xmu_XmuInternAtom = yes; then LIBS="-lXmu $LIBS" fi for ac_func in XmuRegisterExternalAgent do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` echo "$as_me:$LINENO: checking for $ac_func" >&5 echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 if eval "test \"\${$as_ac_var+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define $ac_func to an innocuous variant, in case declares $ac_func. For example, HP-UX 11i declares gettimeofday. */ #define $ac_func innocuous_$ac_func /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $ac_func /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" { #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char $ac_func (); /* 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_$ac_func) || defined (__stub___$ac_func) choke me #else char (*f) () = $ac_func; #endif #ifdef __cplusplus } #endif int main () { return f != $ac_func; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then eval "$as_ac_var=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 if test `eval echo '${'$as_ac_var'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done echo "$as_me:$LINENO: checking for XawInitializeWidgetSet in -lXaw3d" >&5 echo $ECHO_N "checking for XawInitializeWidgetSet in -lXaw3d... $ECHO_C" >&6 if test "${ac_cv_lib_Xaw3d_XawInitializeWidgetSet+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lXaw3d $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char XawInitializeWidgetSet (); int main () { XawInitializeWidgetSet (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_Xaw3d_XawInitializeWidgetSet=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_Xaw3d_XawInitializeWidgetSet=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_Xaw3d_XawInitializeWidgetSet" >&5 echo "${ECHO_T}$ac_cv_lib_Xaw3d_XawInitializeWidgetSet" >&6 if test $ac_cv_lib_Xaw3d_XawInitializeWidgetSet = yes; then have_xaw=3d else echo "$as_me:$LINENO: checking for XawInitializeWidgetSet in -lXaw" >&5 echo $ECHO_N "checking for XawInitializeWidgetSet in -lXaw... $ECHO_C" >&6 if test "${ac_cv_lib_Xaw_XawInitializeWidgetSet+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lXaw $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char XawInitializeWidgetSet (); int main () { XawInitializeWidgetSet (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_Xaw_XawInitializeWidgetSet=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_Xaw_XawInitializeWidgetSet=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_Xaw_XawInitializeWidgetSet" >&5 echo "${ECHO_T}$ac_cv_lib_Xaw_XawInitializeWidgetSet" >&6 if test $ac_cv_lib_Xaw_XawInitializeWidgetSet = yes; then have_xaw=yes else have_xaw=no fi fi echo "$as_me:$LINENO: checking for XmCreateForm in -lXm" >&5 echo $ECHO_N "checking for XmCreateForm in -lXm... $ECHO_C" >&6 if test "${ac_cv_lib_Xm_XmCreateForm+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lXm $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char XmCreateForm (); int main () { XmCreateForm (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_Xm_XmCreateForm=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_Xm_XmCreateForm=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_Xm_XmCreateForm" >&5 echo "${ECHO_T}$ac_cv_lib_Xm_XmCreateForm" >&6 if test $ac_cv_lib_Xm_XmCreateForm = yes; then have_xm=yes else have_xm=no fi for ac_func in XShmCreatePixmap do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` echo "$as_me:$LINENO: checking for $ac_func" >&5 echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 if eval "test \"\${$as_ac_var+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define $ac_func to an innocuous variant, in case declares $ac_func. For example, HP-UX 11i declares gettimeofday. */ #define $ac_func innocuous_$ac_func /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $ac_func /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" { #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char $ac_func (); /* 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_$ac_func) || defined (__stub___$ac_func) choke me #else char (*f) () = $ac_func; #endif #ifdef __cplusplus } #endif int main () { return f != $ac_func; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then eval "$as_ac_var=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 if test `eval echo '${'$as_ac_var'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done LIBS=$KEEPLIBS fi # Checks for header files. echo "$as_me:$LINENO: checking for ANSI C header files" >&5 echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6 if test "${ac_cv_header_stdc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_header_stdc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_header_stdc=no fi rm -f 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 >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* 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 >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* 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 >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #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)) exit(2); exit (0); } _ACEOF rm -f conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_header_stdc=no fi rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi fi echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 echo "${ECHO_T}$ac_cv_header_stdc" >&6 if test $ac_cv_header_stdc = yes; then cat >>confdefs.h <<\_ACEOF #define STDC_HEADERS 1 _ACEOF 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=`echo "ac_cv_header_$ac_header" | $as_tr_sh` echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then eval "$as_ac_Header=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_Header=no" fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done echo "$as_me:$LINENO: checking for stdbool.h that conforms to C99" >&5 echo $ECHO_N "checking for stdbool.h that conforms to C99... $ECHO_C" >&6 if test "${ac_cv_header_stdbool_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #ifndef bool # error bool is not defined #endif #ifndef false # error false is not defined #endif #if false # error false is not 0 #endif #ifndef true # error true is not defined #endif #if true != 1 # error true is not 1 #endif #ifndef __bool_true_false_are_defined # error __bool_true_false_are_defined is not defined #endif struct s { _Bool s: 1; _Bool t; } s; char a[true == 1 ? 1 : -1]; char b[false == 0 ? 1 : -1]; char c[__bool_true_false_are_defined == 1 ? 1 : -1]; char d[(bool) -0.5 == true ? 1 : -1]; bool e = &s; char f[(_Bool) -0.0 == false ? 1 : -1]; char g[true]; char h[sizeof (_Bool)]; char i[sizeof s.t]; int main () { return !a + !b + !c + !d + !e + !f + !g + !h + !i; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_header_stdbool_h=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_header_stdbool_h=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_header_stdbool_h" >&5 echo "${ECHO_T}$ac_cv_header_stdbool_h" >&6 echo "$as_me:$LINENO: checking for _Bool" >&5 echo $ECHO_N "checking for _Bool... $ECHO_C" >&6 if test "${ac_cv_type__Bool+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { if ((_Bool *) 0) return 0; if (sizeof (_Bool)) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_type__Bool=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type__Bool=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_type__Bool" >&5 echo "${ECHO_T}$ac_cv_type__Bool" >&6 if test $ac_cv_type__Bool = yes; then cat >>confdefs.h <<_ACEOF #define HAVE__BOOL 1 _ACEOF fi if test $ac_cv_header_stdbool_h = yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_STDBOOL_H 1 _ACEOF fi echo "$as_me:$LINENO: checking for sys/wait.h that is POSIX.1 compatible" >&5 echo $ECHO_N "checking for sys/wait.h that is POSIX.1 compatible... $ECHO_C" >&6 if test "${ac_cv_header_sys_wait_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #ifndef WEXITSTATUS # define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8) #endif #ifndef WIFEXITED # define WIFEXITED(stat_val) (((stat_val) & 255) == 0) #endif int main () { int s; wait (&s); s = WIFEXITED (s) ? WEXITSTATUS (s) : 1; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_header_sys_wait_h=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_header_sys_wait_h=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_header_sys_wait_h" >&5 echo "${ECHO_T}$ac_cv_header_sys_wait_h" >&6 if test $ac_cv_header_sys_wait_h = yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_SYS_WAIT_H 1 _ACEOF fi if test "x$WATCOM_C" != xyes ; then echo "$as_me:$LINENO: checking whether time.h and sys/time.h may both be included" >&5 echo $ECHO_N "checking whether time.h and sys/time.h may both be included... $ECHO_C" >&6 if test "${ac_cv_header_time+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include int main () { if ((struct tm *) 0) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_header_time=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_header_time=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_header_time" >&5 echo "${ECHO_T}$ac_cv_header_time" >&6 if test $ac_cv_header_time = yes; then cat >>confdefs.h <<\_ACEOF #define TIME_WITH_SYS_TIME 1 _ACEOF fi fi ac_header_dirent=no for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h; do as_ac_Header=`echo "ac_cv_header_dirent_$ac_hdr" | $as_tr_sh` echo "$as_me:$LINENO: checking for $ac_hdr that defines DIR" >&5 echo $ECHO_N "checking for $ac_hdr that defines DIR... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include <$ac_hdr> int main () { if ((DIR *) 0) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then eval "$as_ac_Header=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_Header=no" fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_hdr" | $as_tr_cpp` 1 _ACEOF ac_header_dirent=$ac_hdr; break fi done # Two versions of opendir et al. are in -ldir and -lx on SCO Xenix. if test $ac_header_dirent = dirent.h; then echo "$as_me:$LINENO: checking for library containing opendir" >&5 echo $ECHO_N "checking for library containing opendir... $ECHO_C" >&6 if test "${ac_cv_search_opendir+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_func_search_save_LIBS=$LIBS ac_cv_search_opendir=no cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char opendir (); int main () { opendir (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_search_opendir="none required" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test "$ac_cv_search_opendir" = no; then for ac_lib in dir; do LIBS="-l$ac_lib $ac_func_search_save_LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char opendir (); int main () { opendir (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_search_opendir="-l$ac_lib" break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext done fi LIBS=$ac_func_search_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_search_opendir" >&5 echo "${ECHO_T}$ac_cv_search_opendir" >&6 if test "$ac_cv_search_opendir" != no; then test "$ac_cv_search_opendir" = "none required" || LIBS="$ac_cv_search_opendir $LIBS" fi else echo "$as_me:$LINENO: checking for library containing opendir" >&5 echo $ECHO_N "checking for library containing opendir... $ECHO_C" >&6 if test "${ac_cv_search_opendir+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_func_search_save_LIBS=$LIBS ac_cv_search_opendir=no cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char opendir (); int main () { opendir (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_search_opendir="none required" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test "$ac_cv_search_opendir" = no; then for ac_lib in x; do LIBS="-l$ac_lib $ac_func_search_save_LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char opendir (); int main () { opendir (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_search_opendir="-l$ac_lib" break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext done fi LIBS=$ac_func_search_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_search_opendir" >&5 echo "${ECHO_T}$ac_cv_search_opendir" >&6 if test "$ac_cv_search_opendir" != no; then test "$ac_cv_search_opendir" = "none required" || LIBS="$ac_cv_search_opendir $LIBS" fi fi for ac_header in \ arpa/inet.h \ errno.h \ getopt.h \ glob.h \ dlfcn.h \ fcntl.h \ inttypes.h \ limits.h \ machine/endian.h \ malloc.h \ memory.h \ netdb.h \ netinet/in.h \ nlist.h \ stddef.h \ stdlib.h \ stdint.h \ string.h \ strings.h \ stropts.h \ soundcard.h \ alsa/asoundlib.h \ sys/asoundlib.h \ sys/audioio.h \ sys/awe_voice.h\ sys/ioctl.h \ sys/ipc.h \ sys/param.h \ sys/shm.h \ sys/socket.h \ sys/soundcard.h \ sys/param.h \ sys/time.h \ sys/types.h \ sys/sysctl.h \ termios.h \ unistd.h \ X11/Xlib.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if eval "test \"\${$as_ac_Header+set}\" = set"; then echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 else # Is the header compilable? echo "$as_me:$LINENO: checking $ac_header usability" >&5 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 # Is the header present? echo "$as_me:$LINENO: checking $ac_header presence" >&5 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6 # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ------------------------------- ## ## Report this to root@mput.dip.jp ## ## ------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 fi if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_header in \ X11/extensions/XShm.h X11/Xmu/ExtAgent.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef HAVE_X11_XLIB_H #include #endif #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then eval "$as_ac_Header=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_Header=no" fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done if test "${ac_cv_header_string_h+set}" = set; then echo "$as_me:$LINENO: checking for string.h" >&5 echo $ECHO_N "checking for string.h... $ECHO_C" >&6 if test "${ac_cv_header_string_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi echo "$as_me:$LINENO: result: $ac_cv_header_string_h" >&5 echo "${ECHO_T}$ac_cv_header_string_h" >&6 else # Is the header compilable? echo "$as_me:$LINENO: checking string.h usability" >&5 echo $ECHO_N "checking string.h usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 # Is the header present? echo "$as_me:$LINENO: checking string.h presence" >&5 echo $ECHO_N "checking string.h presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6 # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: string.h: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: string.h: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: string.h: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: string.h: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: string.h: present but cannot be compiled" >&5 echo "$as_me: WARNING: string.h: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: string.h: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: string.h: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: string.h: see the Autoconf documentation" >&5 echo "$as_me: WARNING: string.h: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: string.h: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: string.h: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: string.h: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: string.h: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: string.h: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: string.h: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ------------------------------- ## ## Report this to root@mput.dip.jp ## ## ------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac echo "$as_me:$LINENO: checking for string.h" >&5 echo $ECHO_N "checking for string.h... $ECHO_C" >&6 if test "${ac_cv_header_string_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_header_string_h=$ac_header_preproc fi echo "$as_me:$LINENO: result: $ac_cv_header_string_h" >&5 echo "${ECHO_T}$ac_cv_header_string_h" >&6 fi if test $ac_cv_header_string_h = yes; then : else cat >>confdefs.h <<\_ACEOF #define NO_STRING_H 1 _ACEOF fi # Checks for typedefs, structures, and compiler characteristics. if test "x$WATCOM_C" != xyes ; then echo "$as_me:$LINENO: checking whether byte ordering is bigendian" >&5 echo $ECHO_N "checking whether byte ordering is bigendian... $ECHO_C" >&6 if test "${ac_cv_c_bigendian+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # See if sys/param.h defines the BYTE_ORDER macro. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include int main () { #if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN bogus endian macros #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then # It does; now see whether it defined to BIG_ENDIAN or not. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include int main () { #if BYTE_ORDER != BIG_ENDIAN not big endian #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_c_bigendian=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_c_bigendian=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # It does not; compile a test program. if test "$cross_compiling" = yes; then # try to guess the endianness by grepping values into an object file ac_cv_c_bigendian=unknown cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ short ascii_mm[] = { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 }; short ascii_ii[] = { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 }; void _ascii () { char *s = (char *) ascii_mm; s = (char *) ascii_ii; } short ebcdic_ii[] = { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 }; short ebcdic_mm[] = { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 }; void _ebcdic () { char *s = (char *) ebcdic_mm; s = (char *) ebcdic_ii; } int main () { _ascii (); _ebcdic (); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then if grep BIGenDianSyS conftest.$ac_objext >/dev/null ; then ac_cv_c_bigendian=yes fi if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then if test "$ac_cv_c_bigendian" = unknown; then ac_cv_c_bigendian=no else # finding both strings is unlikely to happen, but who knows? ac_cv_c_bigendian=unknown fi fi else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { /* Are we little or big endian? From Harbison&Steele. */ union { long l; char c[sizeof (long)]; } u; u.l = 1; exit (u.c[sizeof (long) - 1] == 1); } _ACEOF rm -f conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_c_bigendian=no else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_c_bigendian=yes fi rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_c_bigendian" >&5 echo "${ECHO_T}$ac_cv_c_bigendian" >&6 case $ac_cv_c_bigendian in yes) cat >>confdefs.h <<\_ACEOF #define WORDS_BIGENDIAN 1 _ACEOF ;; no) ;; *) { { echo "$as_me:$LINENO: error: unknown endianness presetting ac_cv_c_bigendian=no (or yes) will help" >&5 echo "$as_me: error: unknown endianness presetting ac_cv_c_bigendian=no (or yes) will help" >&2;} { (exit 1); exit 1; }; } ;; esac fi echo "$as_me:$LINENO: checking whether char is unsigned" >&5 echo $ECHO_N "checking whether char is unsigned... $ECHO_C" >&6 if test "${ac_cv_c_char_unsigned+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((char) -1) < 0)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_c_char_unsigned=no else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_c_char_unsigned=yes fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_c_char_unsigned" >&5 echo "${ECHO_T}$ac_cv_c_char_unsigned" >&6 if test $ac_cv_c_char_unsigned = yes && test "$GCC" != yes; then cat >>confdefs.h <<\_ACEOF #define __CHAR_UNSIGNED__ 1 _ACEOF fi echo "$as_me:$LINENO: checking for an ANSI C-conforming const" >&5 echo $ECHO_N "checking for an ANSI C-conforming const... $ECHO_C" >&6 if test "${ac_cv_c_const+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { /* FIXME: Include the comments suggested by Paul. */ #ifndef __cplusplus /* Ultrix mips cc rejects this. */ typedef int charset[2]; const charset x; /* SunOS 4.1.1 cc rejects this. */ char const *const *ccp; char **p; /* 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"; ccp = &g + (g ? g-g : 0); /* HPUX 7.0 cc rejects these. */ ++ccp; p = (char**) ccp; ccp = (char const *const *) p; { /* SCO 3.2v4 cc rejects this. */ char *t; char const *s = 0 ? (char *) 0 : (char const *) 0; *t++ = 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 saying "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ struct s { int j; const int *ap[3]; }; struct s *b; b->j = 5; } { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ const int foo = 10; } #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_c_const=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_c_const=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_c_const" >&5 echo "${ECHO_T}$ac_cv_c_const" >&6 if test $ac_cv_c_const = no; then cat >>confdefs.h <<\_ACEOF #define const _ACEOF fi echo "$as_me:$LINENO: checking for inline" >&5 echo $ECHO_N "checking for inline... $ECHO_C" >&6 if test "${ac_cv_c_inline+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_c_inline=no for ac_kw in inline __inline__ __inline; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* 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 rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_c_inline=$ac_kw; break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext done fi echo "$as_me:$LINENO: result: $ac_cv_c_inline" >&5 echo "${ECHO_T}$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 echo "$as_me:$LINENO: checking for working volatile" >&5 echo $ECHO_N "checking for working volatile... $ECHO_C" >&6 if test "${ac_cv_c_volatile+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { volatile int x; int * volatile y; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_c_volatile=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_c_volatile=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_c_volatile" >&5 echo "${ECHO_T}$ac_cv_c_volatile" >&6 if test $ac_cv_c_volatile = no; then cat >>confdefs.h <<\_ACEOF #define volatile _ACEOF fi echo "$as_me:$LINENO: checking for preprocessor stringizing operator" >&5 echo $ECHO_N "checking for preprocessor stringizing operator... $ECHO_C" >&6 if test "${ac_cv_c_stringize+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #define x(y) #y char *s = x(teststring); _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "#teststring" >/dev/null 2>&1; then ac_cv_c_stringize=no else ac_cv_c_stringize=yes fi rm -f conftest* fi echo "$as_me:$LINENO: result: $ac_cv_c_stringize" >&5 echo "${ECHO_T}$ac_cv_c_stringize" >&6 if test $ac_cv_c_stringize = yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_STRINGIZE 1 _ACEOF fi echo "$as_me:$LINENO: checking for function prototypes" >&5 echo $ECHO_N "checking for function prototypes... $ECHO_C" >&6 if test "$ac_cv_prog_cc_stdc" != no; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 cat >>confdefs.h <<\_ACEOF #define PROTOTYPES 1 _ACEOF cat >>confdefs.h <<\_ACEOF #define __PROTOTYPES 1 _ACEOF else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi echo "$as_me:$LINENO: checking whether struct tm is in sys/time.h or time.h" >&5 echo $ECHO_N "checking whether struct tm is in sys/time.h or time.h... $ECHO_C" >&6 if test "${ac_cv_struct_tm+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include int main () { struct tm *tp; tp->tm_sec; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_struct_tm=time.h else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_struct_tm=sys/time.h fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_struct_tm" >&5 echo "${ECHO_T}$ac_cv_struct_tm" >&6 if test $ac_cv_struct_tm = sys/time.h; then cat >>confdefs.h <<\_ACEOF #define TM_IN_SYS_TIME 1 _ACEOF fi echo "$as_me:$LINENO: checking for size_t" >&5 echo $ECHO_N "checking for size_t... $ECHO_C" >&6 if test "${ac_cv_type_size_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { if ((size_t *) 0) return 0; if (sizeof (size_t)) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_type_size_t=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_size_t=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_type_size_t" >&5 echo "${ECHO_T}$ac_cv_type_size_t" >&6 if test $ac_cv_type_size_t = yes; then : else cat >>confdefs.h <<_ACEOF #define size_t unsigned _ACEOF fi echo "$as_me:$LINENO: checking for off_t" >&5 echo $ECHO_N "checking for off_t... $ECHO_C" >&6 if test "${ac_cv_type_off_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { if ((off_t *) 0) return 0; if (sizeof (off_t)) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_type_off_t=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_off_t=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_type_off_t" >&5 echo "${ECHO_T}$ac_cv_type_off_t" >&6 if test $ac_cv_type_off_t = yes; then : else cat >>confdefs.h <<_ACEOF #define off_t long _ACEOF fi echo "$as_me:$LINENO: checking for pid_t" >&5 echo $ECHO_N "checking for pid_t... $ECHO_C" >&6 if test "${ac_cv_type_pid_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { if ((pid_t *) 0) return 0; if (sizeof (pid_t)) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_type_pid_t=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_pid_t=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_type_pid_t" >&5 echo "${ECHO_T}$ac_cv_type_pid_t" >&6 if test $ac_cv_type_pid_t = yes; then : else cat >>confdefs.h <<_ACEOF #define pid_t int _ACEOF fi echo "$as_me:$LINENO: checking volatile declaration" >&5 echo $ECHO_N "checking volatile declaration... $ECHO_C" >&6 if test "${timidity_cv_type_volatile+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { volatile int x ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then timidity_cv_type_volatile=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 timidity_cv_type_volatile=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $timidity_cv_type_volatile" >&5 echo "${ECHO_T}$timidity_cv_type_volatile" >&6 if test $timidity_cv_type_volatile = no; then cat >>confdefs.h <<\_ACEOF #define NO_VOLATILE 1 _ACEOF fi echo "$as_me:$LINENO: checking union semun declaration" >&5 echo $ECHO_N "checking union semun declaration... $ECHO_C" >&6 if test "${timidity_cv_type_union_semun+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include int main () { union semun x ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then timidity_cv_type_union_semun=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 timidity_cv_type_union_semun=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $timidity_cv_type_union_semun" >&5 echo "${ECHO_T}$timidity_cv_type_union_semun" >&6 if test $timidity_cv_type_union_semun = yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_UNION_SEMUN 1 _ACEOF fi if test "x$CYGNUS" = xyes || test "x$MSYS" = xyes; then case "x${CC}" in "xgcc"*) msnative_struct='' echo "$as_me:$LINENO: checking how to get MSVC-compatible struct packing" >&5 echo $ECHO_N "checking how to get MSVC-compatible struct packing... $ECHO_C" >&6 if test -z "$ac_cv_prog_CC"; then our_gcc="$CC" else our_gcc="$ac_cv_prog_CC" fi case `$our_gcc --version | sed -e 's,\..*,.,' -e q` in 2.) if $our_gcc -v --help 2>/dev/null | grep fnative-struct >/dev/null; then msnative_struct='-fnative-struct' fi ;; *) if $our_gcc -v --help 2>/dev/null | grep ms-bitfields >/dev/null; then msnative_struct='-mms-bitfields' fi ;; esac if test x"$msnative_struct" = x ; then echo "$as_me:$LINENO: result: no way" >&5 echo "${ECHO_T}no way" >&6 { echo "$as_me:$LINENO: WARNING: produced binary will be incompatible with windows' GUI " >&5 echo "$as_me: WARNING: produced binary will be incompatible with windows' GUI " >&2;} else CFLAGS="$CFLAGS $msnative_struct" CPPFLAGS="$CPPFLAGS $msnative_struct" echo "$as_me:$LINENO: result: ${msnative_struct}" >&5 echo "${ECHO_T}${msnative_struct}" >&6 fi ;; *) ;; esac fi if test "x$CYGNUS" = xyes || test "x$MSYS" = xyes; then echo "$as_me:$LINENO: checking Cygwin new mmsystem" >&5 echo $ECHO_N "checking Cygwin new mmsystem... $ECHO_C" >&6 if test "${timidity_cv_header_new_mmsystem+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include int main () { return WOM_OPEN != 0x3BB ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then timidity_cv_header_new_mmsystem=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 timidity_cv_header_new_mmsystem=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $timidity_cv_header_new_mmsystem" >&5 echo "${ECHO_T}$timidity_cv_header_new_mmsystem" >&6 if test $timidity_cv_header_new_mmsystem = yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_NEW_MMSYSTEM 1 _ACEOF fi fi # Checks for library functions. echo "$as_me:$LINENO: checking for error_at_line" >&5 echo $ECHO_N "checking for error_at_line... $ECHO_C" >&6 if test "${ac_cv_lib_error_at_line+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { error_at_line (0, 0, "", 0, ""); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_error_at_line=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_error_at_line=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_lib_error_at_line" >&5 echo "${ECHO_T}$ac_cv_lib_error_at_line" >&6 if test $ac_cv_lib_error_at_line = no; then case $LIBOBJS in "error.$ac_objext" | \ *" error.$ac_objext" | \ "error.$ac_objext "* | \ *" error.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS error.$ac_objext" ;; esac fi for ac_header in unistd.h vfork.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if eval "test \"\${$as_ac_Header+set}\" = set"; then echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 else # Is the header compilable? echo "$as_me:$LINENO: checking $ac_header usability" >&5 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 # Is the header present? echo "$as_me:$LINENO: checking $ac_header presence" >&5 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6 # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ------------------------------- ## ## Report this to root@mput.dip.jp ## ## ------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 fi if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_func in fork vfork do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` echo "$as_me:$LINENO: checking for $ac_func" >&5 echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 if eval "test \"\${$as_ac_var+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define $ac_func to an innocuous variant, in case declares $ac_func. For example, HP-UX 11i declares gettimeofday. */ #define $ac_func innocuous_$ac_func /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $ac_func /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" { #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char $ac_func (); /* 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_$ac_func) || defined (__stub___$ac_func) choke me #else char (*f) () = $ac_func; #endif #ifdef __cplusplus } #endif int main () { return f != $ac_func; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then eval "$as_ac_var=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 if test `eval echo '${'$as_ac_var'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done if test "x$ac_cv_func_fork" = xyes; then echo "$as_me:$LINENO: checking for working fork" >&5 echo $ECHO_N "checking for working fork... $ECHO_C" >&6 if test "${ac_cv_func_fork_works+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then ac_cv_func_fork_works=cross else cat >conftest.$ac_ext <<_ACEOF /* By Ruediger Kuhlmann. */ #include #if HAVE_UNISTD_H # include #endif /* Some systems only have a dummy stub for fork() */ int main () { if (fork() < 0) exit (1); exit (0); } _ACEOF rm -f conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_fork_works=yes else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_func_fork_works=no fi rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi echo "$as_me:$LINENO: result: $ac_cv_func_fork_works" >&5 echo "${ECHO_T}$ac_cv_func_fork_works" >&6 else ac_cv_func_fork_works=$ac_cv_func_fork fi if test "x$ac_cv_func_fork_works" = xcross; then case $host in *-*-amigaos* | *-*-msdosdjgpp*) # Override, as these systems have only a dummy fork() stub ac_cv_func_fork_works=no ;; *) ac_cv_func_fork_works=yes ;; esac { echo "$as_me:$LINENO: WARNING: result $ac_cv_func_fork_works guessed because of cross compilation" >&5 echo "$as_me: WARNING: result $ac_cv_func_fork_works guessed because of cross compilation" >&2;} fi ac_cv_func_vfork_works=$ac_cv_func_vfork if test "x$ac_cv_func_vfork" = xyes; then echo "$as_me:$LINENO: checking for working vfork" >&5 echo $ECHO_N "checking for working vfork... $ECHO_C" >&6 if test "${ac_cv_func_vfork_works+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then ac_cv_func_vfork_works=cross else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Thanks to Paul Eggert for this test. */ #include #include #include #include #include #if HAVE_UNISTD_H # include #endif #if HAVE_VFORK_H # include #endif /* On some sparc systems, changes by the child to local and incoming argument registers are propagated back to the parent. The compiler is told about this with #include , but some compilers (e.g. gcc -O) don't grok . Test for this by using a static variable whose address is put into a register that is clobbered by the vfork. */ static void #ifdef __cplusplus sparc_address_test (int arg) # else sparc_address_test (arg) int arg; #endif { static pid_t child; if (!child) { child = vfork (); if (child < 0) { perror ("vfork"); _exit(2); } if (!child) { arg = getpid(); write(-1, "", 0); _exit (arg); } } } int main () { pid_t parent = getpid (); pid_t child; sparc_address_test (0); child = vfork (); if (child == 0) { /* Here is another test for sparc vfork register problems. This test uses lots of local variables, at least as many local variables as main has allocated so far including compiler temporaries. 4 locals are enough for gcc 1.40.3 on a Solaris 4.1.3 sparc, but we use 8 to be safe. A buggy compiler should reuse the register of parent for one of the local variables, since it will think that parent can't possibly be used any more in this routine. Assigning to the local variable will thus munge parent in the parent process. */ pid_t p = getpid(), p1 = getpid(), p2 = getpid(), p3 = getpid(), p4 = getpid(), p5 = getpid(), p6 = getpid(), p7 = getpid(); /* Convince the compiler that p..p7 are live; otherwise, it might use the same hardware register for all 8 local variables. */ if (p != p1 || p != p2 || p != p3 || p != p4 || p != p5 || p != p6 || p != p7) _exit(1); /* On some systems (e.g. IRIX 3.3), vfork doesn't separate parent from child file descriptors. If the child closes a descriptor before it execs or exits, this munges the parent's descriptor as well. Test for this by closing stdout in the child. */ _exit(close(fileno(stdout)) != 0); } else { int status; struct stat st; while (wait(&status) != child) ; exit( /* Was there some problem with vforking? */ child < 0 /* Did the child fail? (This shouldn't happen.) */ || status /* Did the vfork/compiler bug occur? */ || parent != getpid() /* Did the file descriptor bug occur? */ || fstat(fileno(stdout), &st) != 0 ); } } _ACEOF rm -f conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_vfork_works=yes else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_func_vfork_works=no fi rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi echo "$as_me:$LINENO: result: $ac_cv_func_vfork_works" >&5 echo "${ECHO_T}$ac_cv_func_vfork_works" >&6 fi; if test "x$ac_cv_func_fork_works" = xcross; then ac_cv_func_vfork_works=$ac_cv_func_vfork { echo "$as_me:$LINENO: WARNING: result $ac_cv_func_vfork_works guessed because of cross compilation" >&5 echo "$as_me: WARNING: result $ac_cv_func_vfork_works guessed because of cross compilation" >&2;} fi if test "x$ac_cv_func_vfork_works" = xyes; then cat >>confdefs.h <<\_ACEOF #define HAVE_WORKING_VFORK 1 _ACEOF else cat >>confdefs.h <<\_ACEOF #define vfork fork _ACEOF fi if test "x$ac_cv_func_fork_works" = xyes; then cat >>confdefs.h <<\_ACEOF #define HAVE_WORKING_FORK 1 _ACEOF fi echo "$as_me:$LINENO: checking for working memcmp" >&5 echo $ECHO_N "checking for working memcmp... $ECHO_C" >&6 if test "${ac_cv_func_memcmp_working+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then ac_cv_func_memcmp_working=no else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { /* Some versions of memcmp are not 8-bit clean. */ char c0 = 0x40, c1 = 0x80, c2 = 0x81; if (memcmp(&c0, &c2, 1) >= 0 || memcmp(&c1, &c2, 1) >= 0) exit (1); /* The Next x86 OpenStep bug shows up only when comparing 16 bytes or more and with at least one buffer not starting on a 4-byte boundary. William Lewis provided this test program. */ { char foo[21]; char bar[21]; int i; for (i = 0; i < 4; i++) { char *a = foo + i; char *b = bar + i; strcpy (a, "--------01111111"); strcpy (b, "--------10000000"); if (memcmp (a, b, 16) >= 0) exit (1); } exit (0); } ; return 0; } _ACEOF rm -f conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_memcmp_working=yes else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_func_memcmp_working=no fi rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi echo "$as_me:$LINENO: result: $ac_cv_func_memcmp_working" >&5 echo "${ECHO_T}$ac_cv_func_memcmp_working" >&6 test $ac_cv_func_memcmp_working = no && case $LIBOBJS in "memcmp.$ac_objext" | \ *" memcmp.$ac_objext" | \ "memcmp.$ac_objext "* | \ *" memcmp.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS memcmp.$ac_objext" ;; esac for ac_header in stdlib.h unistd.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if eval "test \"\${$as_ac_Header+set}\" = set"; then echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 else # Is the header compilable? echo "$as_me:$LINENO: checking $ac_header usability" >&5 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 # Is the header present? echo "$as_me:$LINENO: checking $ac_header presence" >&5 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6 # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ------------------------------- ## ## Report this to root@mput.dip.jp ## ## ------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 fi if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_func in getpagesize do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` echo "$as_me:$LINENO: checking for $ac_func" >&5 echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 if eval "test \"\${$as_ac_var+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define $ac_func to an innocuous variant, in case declares $ac_func. For example, HP-UX 11i declares gettimeofday. */ #define $ac_func innocuous_$ac_func /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $ac_func /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" { #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char $ac_func (); /* 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_$ac_func) || defined (__stub___$ac_func) choke me #else char (*f) () = $ac_func; #endif #ifdef __cplusplus } #endif int main () { return f != $ac_func; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then eval "$as_ac_var=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 if test `eval echo '${'$as_ac_var'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done echo "$as_me:$LINENO: checking for working mmap" >&5 echo $ECHO_N "checking for working mmap... $ECHO_C" >&6 if test "${ac_cv_func_mmap_fixed_mapped+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then ac_cv_func_mmap_fixed_mapped=no else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default /* malloc might have been renamed as rpl_malloc. */ #undef malloc /* Thanks to Mike Haertel and Jim Avera for this test. Here is a matrix of mmap possibilities: mmap private not fixed mmap private fixed at somewhere currently unmapped mmap private fixed at somewhere already mapped mmap shared not fixed mmap shared fixed at somewhere currently unmapped mmap shared fixed at somewhere already mapped For private mappings, we should verify that changes cannot be read() back from the file, nor mmap's back from the file at a different address. (There have been systems where private was not correctly implemented like the infamous i386 svr4.0, and systems where the VM page cache was not coherent with the file system buffer cache like early versions of FreeBSD and possibly contemporary NetBSD.) For shared mappings, we should conversely verify that changes get propagated back to all the places they're supposed to be. Grep wants private fixed already mapped. The main things grep needs to know about mmap are: * does it exist and is it safe to write into the mmap'd area * how to use it (BSD variants) */ #include #include #if !STDC_HEADERS && !HAVE_STDLIB_H char *malloc (); #endif /* This mess was copied from the GNU getpagesize.h. */ #if !HAVE_GETPAGESIZE /* Assume that all systems that can run configure have sys/param.h. */ # if !HAVE_SYS_PARAM_H # define HAVE_SYS_PARAM_H 1 # endif # ifdef _SC_PAGESIZE # define getpagesize() sysconf(_SC_PAGESIZE) # else /* no _SC_PAGESIZE */ # if HAVE_SYS_PARAM_H # include # ifdef EXEC_PAGESIZE # define getpagesize() EXEC_PAGESIZE # else /* no EXEC_PAGESIZE */ # ifdef NBPG # define getpagesize() NBPG * CLSIZE # ifndef CLSIZE # define CLSIZE 1 # endif /* no CLSIZE */ # else /* no NBPG */ # ifdef NBPC # define getpagesize() NBPC # else /* no NBPC */ # ifdef PAGESIZE # define getpagesize() PAGESIZE # endif /* PAGESIZE */ # endif /* no NBPC */ # endif /* no NBPG */ # endif /* no EXEC_PAGESIZE */ # else /* no HAVE_SYS_PARAM_H */ # define getpagesize() 8192 /* punt totally */ # endif /* no HAVE_SYS_PARAM_H */ # endif /* no _SC_PAGESIZE */ #endif /* no HAVE_GETPAGESIZE */ int main () { char *data, *data2, *data3; int i, pagesize; int fd; pagesize = getpagesize (); /* First, make a file with some known garbage in it. */ data = (char *) malloc (pagesize); if (!data) exit (1); for (i = 0; i < pagesize; ++i) *(data + i) = rand (); umask (0); fd = creat ("conftest.mmap", 0600); if (fd < 0) exit (1); if (write (fd, data, pagesize) != pagesize) exit (1); close (fd); /* Next, try to mmap the file at a fixed address which already has something else allocated at it. If we can, also make sure that we see the same garbage. */ fd = open ("conftest.mmap", O_RDWR); if (fd < 0) exit (1); data2 = (char *) malloc (2 * pagesize); if (!data2) exit (1); data2 += (pagesize - ((long) data2 & (pagesize - 1))) & (pagesize - 1); if (data2 != mmap (data2, pagesize, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_FIXED, fd, 0L)) exit (1); for (i = 0; i < pagesize; ++i) if (*(data + i) != *(data2 + i)) exit (1); /* Finally, make sure that changes to the mapped area do not percolate back to the file as seen by read(). (This is a bug on some variants of i386 svr4.0.) */ for (i = 0; i < pagesize; ++i) *(data2 + i) = *(data2 + i) + 1; data3 = (char *) malloc (pagesize); if (!data3) exit (1); if (read (fd, data3, pagesize) != pagesize) exit (1); for (i = 0; i < pagesize; ++i) if (*(data + i) != *(data3 + i)) exit (1); close (fd); exit (0); } _ACEOF rm -f conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_mmap_fixed_mapped=yes else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_func_mmap_fixed_mapped=no fi rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi echo "$as_me:$LINENO: result: $ac_cv_func_mmap_fixed_mapped" >&5 echo "${ECHO_T}$ac_cv_func_mmap_fixed_mapped" >&6 if test $ac_cv_func_mmap_fixed_mapped = yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_MMAP 1 _ACEOF fi rm -f conftest.mmap echo "$as_me:$LINENO: checking whether setvbuf arguments are reversed" >&5 echo $ECHO_N "checking whether setvbuf arguments are reversed... $ECHO_C" >&6 if test "${ac_cv_func_setvbuf_reversed+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_func_setvbuf_reversed=no cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include # if PROTOTYPES int (setvbuf) (FILE *, int, char *, size_t); # endif int main () { char buf; return setvbuf (stdout, _IOLBF, &buf, 1); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include # if PROTOTYPES int (setvbuf) (FILE *, int, char *, size_t); # endif int main () { char buf; return setvbuf (stdout, &buf, _IOLBF, 1); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then # It compiles and links either way, so it must not be declared # with a prototype and most likely this is a K&R C compiler. # Try running it. if test "$cross_compiling" = yes; then : # Assume setvbuf is not reversed when cross-compiling. else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include int main () { /* This call has the arguments reversed. A reversed system may check and see that the address of buf is not _IOLBF, _IONBF, or _IOFBF, and return nonzero. */ char buf; if (setvbuf (stdout, _IOLBF, &buf, 1) != 0) exit (1); putchar ('\r'); exit (0); /* Non-reversed systems SEGV here. */ ; return 0; } _ACEOF rm -f conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_setvbuf_reversed=yes else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) rm -f core *.core fi rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi ac_cv_func_setvbuf_reversed=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_func_setvbuf_reversed" >&5 echo "${ECHO_T}$ac_cv_func_setvbuf_reversed" >&6 if test $ac_cv_func_setvbuf_reversed = yes; then cat >>confdefs.h <<\_ACEOF #define SETVBUF_REVERSED 1 _ACEOF fi echo "$as_me:$LINENO: checking return type of signal handlers" >&5 echo $ECHO_N "checking return type of signal handlers... $ECHO_C" >&6 if test "${ac_cv_type_signal+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #ifdef signal # undef signal #endif #ifdef __cplusplus extern "C" void (*signal (int, void (*)(int)))(int); #else void (*signal ()) (); #endif int main () { int i; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_type_signal=void else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_signal=int fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_type_signal" >&5 echo "${ECHO_T}$ac_cv_type_signal" >&6 cat >>confdefs.h <<_ACEOF #define RETSIGTYPE $ac_cv_type_signal _ACEOF if test "x$VCPP" != xyes && test "x$BORLANDC" != xyes && test "x$WATCOM_C" != "xyes"; then for ac_func in vprintf do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` echo "$as_me:$LINENO: checking for $ac_func" >&5 echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 if eval "test \"\${$as_ac_var+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define $ac_func to an innocuous variant, in case declares $ac_func. For example, HP-UX 11i declares gettimeofday. */ #define $ac_func innocuous_$ac_func /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $ac_func /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" { #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char $ac_func (); /* 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_$ac_func) || defined (__stub___$ac_func) choke me #else char (*f) () = $ac_func; #endif #ifdef __cplusplus } #endif int main () { return f != $ac_func; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then eval "$as_ac_var=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 if test `eval echo '${'$as_ac_var'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF echo "$as_me:$LINENO: checking for _doprnt" >&5 echo $ECHO_N "checking for _doprnt... $ECHO_C" >&6 if test "${ac_cv_func__doprnt+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define _doprnt to an innocuous variant, in case declares _doprnt. For example, HP-UX 11i declares gettimeofday. */ #define _doprnt innocuous__doprnt /* System header to define __stub macros and hopefully few prototypes, which can conflict with char _doprnt (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef _doprnt /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" { #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char _doprnt (); /* 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__doprnt) || defined (__stub____doprnt) choke me #else char (*f) () = _doprnt; #endif #ifdef __cplusplus } #endif int main () { return f != _doprnt; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func__doprnt=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func__doprnt=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_func__doprnt" >&5 echo "${ECHO_T}$ac_cv_func__doprnt" >&6 if test $ac_cv_func__doprnt = yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_DOPRNT 1 _ACEOF fi fi done fi for ac_func in \ alarm \ dup2 \ floor \ getcwd \ getopt \ gethostbyname \ gettimeofday \ getwd \ isatty \ memchr \ memmove \ memset \ modf \ munmap \ popen \ pow \ select \ signal \ socket \ sleep \ vsnprintf \ snprintf \ sqrt \ strchr \ strdup \ strstr \ strerror \ strcasecmp \ strncasecmp \ strrchr \ strstr \ strtol \ strlcat \ strlcpy \ usleep do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` echo "$as_me:$LINENO: checking for $ac_func" >&5 echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 if eval "test \"\${$as_ac_var+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define $ac_func to an innocuous variant, in case declares $ac_func. For example, HP-UX 11i declares gettimeofday. */ #define $ac_func innocuous_$ac_func /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $ac_func /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" { #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char $ac_func (); /* 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_$ac_func) || defined (__stub___$ac_func) choke me #else char (*f) () = $ac_func; #endif #ifdef __cplusplus } #endif int main () { return f != $ac_func; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then eval "$as_ac_var=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 if test `eval echo '${'$as_ac_var'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done if test "x$VCPP" = xyes; then cat >>confdefs.h <<\_ACEOF #define RETSIGTYPE int _ACEOF cat >>confdefs.h <<\_ACEOF #define HAVE_GETCWD int _ACEOF fi if test "x$VCPP" = xyes || test "x$BORLANDC" = xyes || test "x$WATCOM_C" = xyes; then cat >>confdefs.h <<\_ACEOF #define HAVE_GETHOSTBYNAME 1 _ACEOF cat >>confdefs.h <<\_ACEOF #define HAVE_POPEN 1 _ACEOF cat >>confdefs.h <<\_ACEOF #define popen _popen _ACEOF cat >>confdefs.h <<\_ACEOF #define pclose _pclose _ACEOF cat >>confdefs.h <<\_ACEOF #define HAVE_SELECT 1 _ACEOF cat >>confdefs.h <<\_ACEOF #define HAVE_SNPRINTF 1 _ACEOF cat >>confdefs.h <<\_ACEOF #define HAVE_STRDUP 1 _ACEOF cat >>confdefs.h <<\_ACEOF #define HAVE_STRERROR 1 _ACEOF cat >>confdefs.h <<\_ACEOF #define HAVE_STRNCASECMP 1 _ACEOF cat >>confdefs.h <<\_ACEOF #define HAVE_STRSTR 1 _ACEOF cat >>confdefs.h <<\_ACEOF #define snprintf _snprintf _ACEOF cat >>confdefs.h <<\_ACEOF #define HAVE_SOCKET 1 _ACEOF cat >>confdefs.h <<\_ACEOF #define HAVE_VSNPRINTF 1 _ACEOF cat >>confdefs.h <<\_ACEOF #define vsnprintf _vsnprintf _ACEOF cat >>confdefs.h <<\_ACEOF #define TIMID_VERSION $(PACKAGE_VERSION) _ACEOF fi echo "$as_me:$LINENO: checking for getopt_long" >&5 echo $ECHO_N "checking for getopt_long... $ECHO_C" >&6 if test "${ac_cv_func_getopt_long+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define getopt_long to an innocuous variant, in case declares getopt_long. For example, HP-UX 11i declares gettimeofday. */ #define getopt_long innocuous_getopt_long /* System header to define __stub macros and hopefully few prototypes, which can conflict with char getopt_long (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef getopt_long /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" { #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char getopt_long (); /* 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_getopt_long) || defined (__stub___getopt_long) choke me #else char (*f) () = getopt_long; #endif #ifdef __cplusplus } #endif int main () { return f != getopt_long; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_getopt_long=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_getopt_long=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_func_getopt_long" >&5 echo "${ECHO_T}$ac_cv_func_getopt_long" >&6 if test $ac_cv_func_getopt_long = yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_GETOPT_LONG 1 _ACEOF tm_cv_needgetopt="no" else tm_cv_needgetopt="yes" fi if test "x$tm_cv_needgetopt" = "xyes"; then NEEDGETOPT_TRUE= NEEDGETOPT_FALSE='#' else NEEDGETOPT_TRUE='#' NEEDGETOPT_FALSE= fi # Checks on cygnus and MYSYS if test "x$CYGNUS" = xyes || test "x$MSYS" = xyes; then case "$ac_cv_header_dirent_dirent_h$ac_cv_header_dirent_sys_ndir_h$ac_cv_header_dirent_sys_dir_h$ac_cv_header_dirent_ndir_h" in *yes*) echo "$as_me:$LINENO: checking for opendir" >&5 echo $ECHO_N "checking for opendir... $ECHO_C" >&6 if test "${ac_cv_func_opendir+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define opendir to an innocuous variant, in case declares opendir. For example, HP-UX 11i declares gettimeofday. */ #define opendir innocuous_opendir /* System header to define __stub macros and hopefully few prototypes, which can conflict with char opendir (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef opendir /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" { #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char opendir (); /* 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_opendir) || defined (__stub___opendir) choke me #else char (*f) () = opendir; #endif #ifdef __cplusplus } #endif int main () { return f != opendir; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_opendir=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_opendir=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_func_opendir" >&5 echo "${ECHO_T}$ac_cv_func_opendir" >&6 if test $ac_cv_func_opendir = yes; then : else EXTRADEFS="$EXTRADEFS -D__W32READDIR__" W32READDIR=yes fi ;; *)EXTRADEFS="$EXTRADEFS -D__W32READDIR__" W32READDIR=yes ;; esac if test "x$enable_network" = "xyes"; then if test "x$VCPP" = xyes || test "x$BORLANDC" = xyes || test "x$WATCOM_C" = xyes; then EXTRALIBS="$EXTRALIBS wsock32.lib" EXTRADEFS="$EXTRADEFS -DWINSOCK" else echo "$as_me:$LINENO: checking for socket" >&5 echo $ECHO_N "checking for socket... $ECHO_C" >&6 if test "${ac_cv_func_socket+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define socket to an innocuous variant, in case declares socket. For example, HP-UX 11i declares gettimeofday. */ #define socket innocuous_socket /* System header to define __stub macros and hopefully few prototypes, which can conflict with char socket (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef socket /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" { #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char socket (); /* 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_socket) || defined (__stub___socket) choke me #else char (*f) () = socket; #endif #ifdef __cplusplus } #endif int main () { return f != socket; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_socket=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_socket=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_func_socket" >&5 echo "${ECHO_T}$ac_cv_func_socket" >&6 if test $ac_cv_func_socket = yes; then : else echo "$as_me:$LINENO: checking for WSAStartup in -lwsock32" >&5 echo $ECHO_N "checking for WSAStartup in -lwsock32... $ECHO_C" >&6 ac_lib_var=`echo wsock32'_'WSAStartup | sed 'y%./+-%__p_%'` if eval "test \"\${wapi_cv_lib_$ac_lib_var+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_save_LIBS="$LIBS" LIBS="-lwsock32 $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include int main () { WSAStartup(0,0); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then eval "wapi_cv_lib_$ac_lib_var=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "wapi_cv_lib_$ac_lib_var=no" fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS="$ac_save_LIBS" fi if eval "test \"`echo '$wapi_cv_lib_'$ac_lib_var`\" = yes"; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 EXTRALIBS="$EXTRALIBS -lwsock32" EXTRADEFS="$EXTRADEFS -DWINSOCK" else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi fi fi fi # Checks on extra paths # Check whether --with-tcl-includes or --without-tcl-includes was given. if test "${with_tcl_includes+set}" = set; then withval="$with_tcl_includes" if test ! -d $withval; then { echo "$as_me:$LINENO: WARNING: $withval is not found." >&5 echo "$as_me: WARNING: $withval is not found." >&2;} fi tcl_include_dir="-I$withval" fi; # Check whether --with-tcl-libs or --without-tcl-libs was given. if test "${with_tcl_libs+set}" = set; then withval="$with_tcl_libs" if test ! -d $withval; then { echo "$as_me:$LINENO: WARNING: $withval is not found." >&5 echo "$as_me: WARNING: $withval is not found." >&2;} fi tcl_libdir="-L$withval" fi; # Check whether --with-tk-includes or --without-tk-includes was given. if test "${with_tk_includes+set}" = set; then withval="$with_tk_includes" if test ! -d $withval; then { echo "$as_me:$LINENO: WARNING: $withval is not found." >&5 echo "$as_me: WARNING: $withval is not found." >&2;} fi tk_includes="-I$withval" fi; # Check whether --with-tk-libs or --without-tk-libs was given. if test "${with_tk_libs+set}" = set; then withval="$with_tk_libs" if test ! -d $withval; then { echo "$as_me:$LINENO: WARNING: $withval is not found." >&5 echo "$as_me: WARNING: $withval is not found." >&2;} fi tk_libdir="-L$withval" fi; # Check whether --with-offix-includes or --without-offix-includes was given. if test "${with_offix_includes+set}" = set; then withval="$with_offix_includes" if test ! -d $withval; then { echo "$as_me:$LINENO: WARNING: $withval is not found." >&5 echo "$as_me: WARNING: $withval is not found." >&2;} fi offix_include_dir="-I$withval" fi; # Check whether --with-offix-libs or --without-offix-libs was given. if test "${with_offix_libs+set}" = set; then withval="$with_offix_libs" if test ! -d $withval; then { echo "$as_me:$LINENO: WARNING: $withval is not found." >&5 echo "$as_me: WARNING: $withval is not found." >&2;} fi offix_lib_dir="-L$withval" fi; # # audio section # audio_targets='default oss alsa sun hpux irix mme sb_dsp w32 alib nas arts esd vorbis flac gogo portaudio jack ao' # Check whether --with-nas-library or --without-nas-library was given. if test "${with_nas_library+set}" = set; then withval="$with_nas_library" fi; # Check whether --with-nas-includes or --without-nas-includes was given. if test "${with_nas_includes+set}" = set; then withval="$with_nas_includes" fi; # Check whether --enable-audio or --disable-audio was given. if test "${enable_audio+set}" = set; then enableval="$enable_audio" enable_audio=$enableval have_audio_opt=yes else enable_audio=yes have_audio_opt=no fi; test "x$enable_audio" = xyes && enable_audio=default if test "x$enable_audio" != xno; then for i in `echo $enable_audio | sed 's/,/ /g'`; do eval "au_enable_$i=yes" done fi DEFAULT_PLAYMODE= # Check whether --with-default-output or --without-default-output was given. if test "${with_default_output+set}" = set; then withval="$with_default_output" if test "$enable_audio" != no; then DEFAULT_PLAYMODE=$withval eval "au_enable_$DEFAULT_PLAYMODE=yes" else { echo "$as_me:$LINENO: WARNING: --with-default-output=$withval: audio is not enabled" >&5 echo "$as_me: WARNING: --with-default-output=$withval: audio is not enabled" >&2;} fi fi; if test "x$au_enable_default" = xyes; then case "$target" in *-*-linux*|*-*-freebsd*) au_enable_oss=yes ;; *-*-bsdi2.0) au_enable_sb_dsp=yes ;; *-*-bsdi2.1|*-*-bsdi3.?|*-*-bsdi4.?) au_enable_oss=yes ;; *-*-hpux*) au_enable_hpux=yes ;; *-dec-*) au_enable_mme=yes ;; *irix*) au_enable_irix=yes ;; *-*-sunos4*) au_enable_sun=yes ;; *-*-solaris*) au_enable_sun=yes ;; *-*-netbsd*) au_enable_sun=yes ;; *-*-cygwin*) au_enable_w32=yes ;; *-*-mingw*) au_enable_w32=yes ;; *-*-darwin*) au_enable_darwin=yes ;; *) { echo "$as_me:$LINENO: WARNING: No --enable-audio=default audio for $target" >&5 echo "$as_me: WARNING: No --enable-audio=default audio for $target" >&2;} ;; esac fi # Each audio mode's configurations echo "$as_me:$LINENO: checking enable_audio=oss" >&5 echo $ECHO_N "checking enable_audio=oss... $ECHO_C" >&6 if test "x$au_enable_oss" = xyes; then EXTRADEFS="$EXTRADEFS -DAU_OSS" SYSEXTRAS="$SYSEXTRAS oss_a.c" if test "x$ac_cv_header_sys_soundcard_h" = xyes; then echo "$as_me:$LINENO: result: yes - " >&5 echo "${ECHO_T}yes - " >&6 else case "$target" in *linux*|*freebsd*) echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 ;; *) if test "x$ac_cv_header_soundcard_h" = xyes; then echo "$as_me:$LINENO: result: yes - " >&5 echo "${ECHO_T}yes - " >&6 else { echo "$as_me:$LINENO: WARNING: is not found" >&5 echo "$as_me: WARNING: is not found" >&2;} fi ;; esac fi echo "$as_me:$LINENO: checking for open in -lossaudio" >&5 echo $ECHO_N "checking for open in -lossaudio... $ECHO_C" >&6 if test "${ac_cv_lib_ossaudio_open+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lossaudio $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char open (); int main () { open (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_ossaudio_open=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_ossaudio_open=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_ossaudio_open" >&5 echo "${ECHO_T}$ac_cv_lib_ossaudio_open" >&6 if test $ac_cv_lib_ossaudio_open = yes; then cat >>confdefs.h <<_ACEOF #define HAVE_LIBOSSAUDIO 1 _ACEOF LIBS="-lossaudio $LIBS" fi case "$target" in *openbsd*) if test ! -e "/dev/dsp"; then oss_device=/dev/audio fi ;; esac else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi echo "$as_me:$LINENO: checking enable_audio=sun" >&5 echo $ECHO_N "checking enable_audio=sun... $ECHO_C" >&6 if test "x$au_enable_sun" = xyes; then case "$target" in *-*-sunos4*) if test -f /usr/demo/SOUND/libaudio.a; then EXTRALIBS="$EXTRALIBS /usr/demo/SOUND/libaudio.a" echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 else echo "$as_me:$LINENO: result: Notice: libaudio.a is not found (ignore)" >&5 echo "${ECHO_T}Notice: libaudio.a is not found (ignore)" >&6 fi ;; *-*-solaris*) if test -f /usr/demo/SOUND/lib/libaudio.a; then EXTRALIBS="$EXTRALIBS /usr/demo/SOUND/lib/libaudio.a" echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 else echo "$as_me:$LINENO: result: Notice: libaudio.a is not found (ignore)" >&5 echo "${ECHO_T}Notice: libaudio.a is not found (ignore)" >&6 fi ;; *) echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 ;; esac EXTRADEFS="$EXTRADEFS -DAU_SUN" SYSEXTRAS="$SYSEXTRAS sun_a.c" else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi echo "$as_me:$LINENO: checking enable_audio=hpux" >&5 echo $ECHO_N "checking enable_audio=hpux... $ECHO_C" >&6 if test "x$au_enable_hpux" = xyes; then case "$target" in *-*-hpux*) echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 ;; *) { echo "$as_me:$LINENO: WARNING: may not work on $target" >&5 echo "$as_me: WARNING: may not work on $target" >&2;} ;; esac EXTRADEFS="$EXTRADEFS -DAU_HPUX_AUDIO" SYSEXTRAS="$SYSEXTRAS hpux_d_a.c" else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi echo "$as_me:$LINENO: checking enable_audio=irix" >&5 echo $ECHO_N "checking enable_audio=irix... $ECHO_C" >&6 if test "x$au_enable_irix" = xyes; then case "$target" in *-sgi-irix5*|*-sgi-irix6.2) EXTRADEFS="$EXTRADEFS -DAU_AUDRIV -DSGI_OLDAL" echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 ;; *-sgi-irix6*) EXTRADEFS="$EXTRADEFS -DAU_AUDRIV -DSGI_NEWAL" echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 ;; *) { echo "$as_me:$LINENO: WARNING: may not work on $target" >&5 echo "$as_me: WARNING: may not work on $target" >&2;} ;; esac SYSEXTRAS="$SYSEXTRAS audriv_a.c audriv_al.c" EXTRALIBS="$EXTRASLIBS -laudio" else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi echo "$as_me:$LINENO: checking enable_audio=mme" >&5 echo $ECHO_N "checking enable_audio=mme... $ECHO_C" >&6 if test "x$au_enable_mme" = xyes; then case "$target" in *-dec-*) echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 ;; *) { echo "$as_me:$LINENO: WARNING: may not work on $target" >&5 echo "$as_me: WARNING: may not work on $target" >&2;} ;; esac EXTRADEFS="$EXTRADEFS -DAU_DEC -DAU_AUDRIV" SYSEXTRAS="$SYSEXTRAS audriv_a.c audriv_mme.c" CPPFLAGS="$CPPFLAGS -I/usr/opt/MME210/include" EXTRALIBS="$EXTRALIBS /usr/opt/MME220/lib/libmme.a" else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi echo "$as_me:$LINENO: checking enable_audio=sb_dsp" >&5 echo $ECHO_N "checking enable_audio=sb_dsp... $ECHO_C" >&6 if test "x$au_enable_sb_dsp" = xyes; then case "$target" in *-*-bsdi2.0) echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 ;; *) { echo "$as_me:$LINENO: WARNING: may not work on $target" >&5 echo "$as_me: WARNING: may not work on $target" >&2;} ;; esac EXTRADEFS="$EXTRADEFS -DAU_BSDI -DDEFAULT_RATE=22500" SYSEXTRAS="$SYSEXTRAS bsd20_a.c" else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi echo "$as_me:$LINENO: checking enable_audio=w32" >&5 echo $ECHO_N "checking enable_audio=w32... $ECHO_C" >&6 if test "x$au_enable_w32" = xyes; then case "$target" in *-*-cygwin*) echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 ;; *-*-mingw32) echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 ;; *) { echo "$as_me:$LINENO: WARNING: may not work on $target" >&5 echo "$as_me: WARNING: may not work on $target" >&2;} ;; esac SYSEXTRAS="$SYSEXTRAS w32_a.c" if test "x$VCPP" = xyes || test "x$BORLANDC" = xyes || test "x$WATCOM_C" = xyes; then EXTRALIBS="$EXTRALIBS winmm.lib" else EXTRALIBS="$EXTRALIBS -lwinmm" fi EXTRADEFS="$EXTRADEFS -DAU_W32" else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi echo "$as_me:$LINENO: checking enable_audio=darwin" >&5 echo $ECHO_N "checking enable_audio=darwin... $ECHO_C" >&6 if test "x$au_enable_darwin" = xyes; then EXTRADEFS="$EXTRADEFS -DAU_DARWIN" SYSEXTRAS="$SYSEXTRAS darwin_a.c" EXTRALIBS="$EXTRALIBS -framework CoreAudio" case "$target" in *-*-darwin*) echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6;; *) { echo "$as_me:$LINENO: WARNING: may not work on $target" >&5 echo "$as_me: WARNING: may not work on $target" >&2;} ;; esac else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi echo "$as_me:$LINENO: checking enable_audio=alsa" >&5 echo $ECHO_N "checking enable_audio=alsa... $ECHO_C" >&6 if test "x$au_enable_alsa" = xyes; then echo "$as_me:$LINENO: result: yes, configuring alsa" >&5 echo "${ECHO_T}yes, configuring alsa" >&6 KEEPCFLAGS=$CFLAGS KEEPLIBS=$LIBS KEEPLDFLAGS=$LDFLAGS alsa_save_CFLAGS="$CFLAGS" alsa_save_LDFLAGS="$LDFLAGS" alsa_save_LIBS="$LIBS" alsa_found=yes # Check whether --with-alsa-prefix or --without-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 or --without-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-alsatest or --disable-alsatest was given. if test "${enable_alsatest+set}" = set; then enableval="$enable_alsatest" enable_alsatest=no else enable_alsatest=yes fi; echo "$as_me:$LINENO: checking for ALSA CFLAGS" >&5 echo $ECHO_N "checking for ALSA CFLAGS... $ECHO_C" >&6 if test "$alsa_inc_prefix" != "" ; then ALSA_CFLAGS="$ALSA_CFLAGS -I$alsa_inc_prefix" CFLAGS="$CFLAGS -I$alsa_inc_prefix" fi echo "$as_me:$LINENO: result: $ALSA_CFLAGS" >&5 echo "${ECHO_T}$ALSA_CFLAGS" >&6 echo "$as_me:$LINENO: checking for ALSA LDFLAGS" >&5 echo $ECHO_N "checking for ALSA LDFLAGS... $ECHO_C" >&6 if test "$alsa_prefix" != "" ; then ALSA_LIBS="$ALSA_LIBS -L$alsa_prefix" LDFLAGS="$LDFLAGS $ALSA_LIBS" fi ALSA_LIBS="$ALSA_LIBS -lasound -lm -ldl -lpthread" LIBS=`echo $LIBS | sed 's/-lm//'` LIBS=`echo $LIBS | sed 's/-ldl//'` LIBS=`echo $LIBS | sed 's/-lpthread//'` LIBS=`echo $LIBS | sed 's/ //'` LIBS="$ALSA_LIBS $LIBS" echo "$as_me:$LINENO: result: $ALSA_LIBS" >&5 echo "${ECHO_T}$ALSA_LIBS" >&6 min_alsa_version=0.1.1 echo "$as_me:$LINENO: checking for libasound headers version >= $min_alsa_version" >&5 echo $ECHO_N "checking for libasound headers version >= $min_alsa_version... $ECHO_C" >&6 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_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 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* 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 rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then echo "$as_me:$LINENO: result: found." >&5 echo "${ECHO_T}found." >&6 else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* 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 rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then echo "$as_me:$LINENO: result: found." >&5 echo "${ECHO_T}found." >&6 else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 echo "$as_me:$LINENO: result: not present." >&5 echo "${ECHO_T}not present." >&6 echo "$as_me:$LINENO: result: libasound was not found anywhere." >&5 echo "${ECHO_T}libasound was not found anywhere." >&6 alsa_found=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: Sufficiently new version of libasound not found." >&5 echo "${ECHO_T}Sufficiently new version of libasound not found." >&6 fi rm -f 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 echo "$as_me:$LINENO: checking for snd_ctl_open in -lasound" >&5 echo $ECHO_N "checking for snd_ctl_open in -lasound... $ECHO_C" >&6 if test "${ac_cv_lib_asound_snd_ctl_open+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lasound $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char snd_ctl_open (); int main () { snd_ctl_open (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_asound_snd_ctl_open=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_asound_snd_ctl_open=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_asound_snd_ctl_open" >&5 echo "${ECHO_T}$ac_cv_lib_asound_snd_ctl_open" >&6 if test $ac_cv_lib_asound_snd_ctl_open = yes; then cat >>confdefs.h <<_ACEOF #define HAVE_LIBASOUND 1 _ACEOF LIBS="-lasound $LIBS" else echo "$as_me:$LINENO: result: No linkable libasound was found." >&5 echo "${ECHO_T}No linkable libasound was found." >&6 alsa_found=no fi if test "x$alsa_found" = "xyes" ; then : LIBS=`echo $LIBS | sed 's/-lasound//g'` LIBS=`echo $LIBS | sed 's/ //'` LIBS="-lasound $LIBS" else : CFLAGS="$alsa_save_CFLAGS" LDFLAGS="$alsa_save_LDFLAGS" LIBS="$alsa_save_LIBS" ALSA_CFLAGS="" ALSA_LIBS="" fi if test "x$alsa_found" = "xyes" ; then EXTRADEFS="$EXTRADEFS -DAU_ALSA" SYSEXTRAS="$SYSEXTRAS alsa_a.c" for f in $ALSA_CFLAGS; do case ".$f" in .-I?*|.-D?*) CPPFLAGS="$CPPFLAGS $f" ;; *) CFLAGS="$CPPFLAGS $f" ;; esac done LIBS="$LIBS $ALSA_LIBS" for ac_func in snd_seq_port_info_set_timestamping do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` echo "$as_me:$LINENO: checking for $ac_func" >&5 echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 if eval "test \"\${$as_ac_var+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define $ac_func to an innocuous variant, in case declares $ac_func. For example, HP-UX 11i declares gettimeofday. */ #define $ac_func innocuous_$ac_func /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $ac_func /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" { #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char $ac_func (); /* 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_$ac_func) || defined (__stub___$ac_func) choke me #else char (*f) () = $ac_func; #endif #ifdef __cplusplus } #endif int main () { return f != $ac_func; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then eval "$as_ac_var=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 if test `eval echo '${'$as_ac_var'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done else { echo "$as_me:$LINENO: WARNING: Couldn't configure alsa." >&5 echo "$as_me: WARNING: Couldn't configure alsa." >&2;} CFLAGS=$KEEPCFLAGS LIBS=$KEEPLIBS LDFLAGS=$KEEPLDFLAGS fi else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi echo "$as_me:$LINENO: checking enable_audio=alib" >&5 echo $ECHO_N "checking enable_audio=alib... $ECHO_C" >&6 if test "x$au_enable_alib" = xyes; then case "$target" in *-*-hpux*) echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 ;; *) { echo "$as_me:$LINENO: WARNING: may not work on $target" >&5 echo "$as_me: WARNING: may not work on $target" >&2;} ;; esac SYSEXTRAS="$SYSEXTRAS hpux_a.c" EXTRADEFS="$EXTRADEFS -DAU_HPUX_ALIB" if test -d /opt/audio/include; then CPPFLAGS="$CPPFLAGS -I/opt/audio/include" fi if test -d /opt/audio/lib; then EXTRALIBS="$EXTRALIBS -L/opt/audio/lib" fi EXTRALIBS="$EXTRALIBS -lAlib" else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi echo "$as_me:$LINENO: checking enable_audio=nas" >&5 echo $ECHO_N "checking enable_audio=nas... $ECHO_C" >&6 if test "x$au_enable_nas" = xyes; then if test "x$with_x" != xyes; then { { echo "$as_me:$LINENO: error: nas: --with-x option must be specified" >&5 echo "$as_me: error: nas: --with-x option must be specified" >&2;} { (exit 1); exit 1; }; } fi EXTRADEFS="$EXTRADEFS -DAU_NAS" SYSEXTRAS="$SYSEXTRAS nas_a.c" if test "x$with_nas_library" != x; then echo "$as_me:$LINENO: result: $with_nas_library" >&5 echo "${ECHO_T}$with_nas_library" >&6; EXTRALIBS="$EXTRALIBS $with_nas_library" else echo "$as_me:$LINENO: result: " >&5 echo "${ECHO_T}" >&6 echo "$as_me:$LINENO: checking for library containing AuOpenServer" >&5 echo $ECHO_N "checking for library containing AuOpenServer... $ECHO_C" >&6 if test "${timidity_cv_search_AuOpenServer+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_func_search_save_LIBS="$LIBS" timidity_cv_search_AuOpenServer="no" for i in $x_libraries/libaudio.a \ /usr/lib/libaudio.so \ /usr/lib/libaudio.a ; do LIBS="$i $ac_func_search_save_LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char AuOpenServer (); int main () { AuOpenServer (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then timidity_cv_search_AuOpenServer="$i"; break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext done LIBS="$ac_func_search_save_LIBS" fi echo "$as_me:$LINENO: result: $timidity_cv_search_AuOpenServer" >&5 echo "${ECHO_T}$timidity_cv_search_AuOpenServer" >&6 if test "$timidity_cv_search_AuOpenServer" != "no"; then echo "$as_me:$LINENO: result: NAS: $timidity_cv_search_AuOpenServer" >&5 echo "${ECHO_T}NAS: $timidity_cv_search_AuOpenServer" >&6 EXTRALIBS="$EXTRALIBS $timidity_cv_search_AuOpenServer" else : { echo "$as_me:$LINENO: WARNING: NAS library is not found." >&5 echo "$as_me: WARNING: NAS library is not found." >&2;} fi fi test "x$with_nas_includes" != x && CPPFLAGS="$CPPFLAGS -I$with_nas_includes" lib_xt_opt=-lXt if test "x$have_xext" = xyes; then lib_xext_opt=-lXext fi if test "x$have_xprelibs" = xyes; then lib_xprelibs_opt='-lSM -lICE' fi else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi echo "$as_me:$LINENO: checking enable_audio=arts" >&5 echo $ECHO_N "checking enable_audio=arts... $ECHO_C" >&6 if test "x$au_enable_arts" = xyes; then echo "$as_me:$LINENO: result: yes, configuring aRts" >&5 echo "${ECHO_T}yes, configuring aRts" >&6 KEEPCFLAGS=$CFLAGS KEEPLIBS=$LIBS KEEPLDFLAGS=$LDFLAGS # Check whether --with-arts-prefix or --without-arts-prefix was given. if test "${with_arts_prefix+set}" = set; then withval="$with_arts_prefix" arts_prefix="$withval" else arts_prefix="" fi; # Check whether --enable-artstest or --disable-artstest was given. if test "${enable_artstest+set}" = set; then enableval="$enable_artstest" else enable_artstest=yes fi; if test x$arts_prefix != x ; then arts_args="$arts_args --prefix=$arts_prefix" if test x${ARTS_CONFIG+set} != xset ; then ARTS_CONFIG=$arts_prefix/bin/artsc-config fi fi # Extract the first word of "artsc-config", so it can be a program name with args. set dummy artsc-config; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_path_ARTS_CONFIG+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case $ARTS_CONFIG in [\\/]* | ?:[\\/]*) ac_cv_path_ARTS_CONFIG="$ARTS_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_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_ARTS_CONFIG="$as_dir/$ac_word$ac_exec_ext" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_path_ARTS_CONFIG" && ac_cv_path_ARTS_CONFIG="no" ;; esac fi ARTS_CONFIG=$ac_cv_path_ARTS_CONFIG if test -n "$ARTS_CONFIG"; then echo "$as_me:$LINENO: result: $ARTS_CONFIG" >&5 echo "${ECHO_T}$ARTS_CONFIG" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi min_arts_version=0.9.5 echo "$as_me:$LINENO: checking for ARTS - version >= $min_arts_version" >&5 echo $ECHO_N "checking for ARTS - version >= $min_arts_version... $ECHO_C" >&6 no_arts="" if test "$ARTS_CONFIG" = "no" ; then no_arts=yes else ARTS_CFLAGS=`$ARTS_CONFIG $artsconf_args --cflags` ARTS_LIBS=`$ARTS_CONFIG $artsconf_args --libs` arts_major_version=`$ARTS_CONFIG $arts_args --version | \ sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\1/'` arts_minor_version=`$ARTS_CONFIG $arts_args --version | \ sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\2/'` arts_micro_version=`$ARTS_CONFIG $arts_config_args --version | \ sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\3/'` if test "x$enable_artstest" = "xyes" ; then ac_save_CFLAGS="$CFLAGS" ac_save_LIBS="$LIBS" CFLAGS="$CFLAGS $ARTS_CFLAGS" LIBS="$LIBS $ARTS_LIBS" rm -f conf.artstest if test "$cross_compiling" = yes; then echo $ac_n "cross compiling; assumed OK... $ac_c" else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include char* my_strdup (char *str) { char *new_str; if (str) { new_str = malloc ((strlen (str) + 1) * sizeof(char)); strcpy (new_str, str); } else new_str = NULL; return new_str; } int main () { int major, minor, micro; char *tmp_version; system ("touch conf.artstest"); /* HP/UX 9 (%@#!) writes to sscanf strings */ tmp_version = my_strdup("$min_arts_version"); if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { printf("%s, bad version string\n", "$min_arts_version"); exit(1); } if (($arts_major_version > major) || (($arts_major_version == major) && ($arts_minor_version > minor)) || (($arts_major_version == major) && ($arts_minor_version == minor) && ($arts_micro_version >= micro))) { return 0; } else { printf("\n*** 'artsc-config --version' returned %d.%d.%d, but the minimum version\n", $arts_major_version, $arts_minor_version, $arts_micro_version); printf("*** of ARTS required is %d.%d.%d. If artsc-config is correct, then it is\n", major, minor, micro); printf("*** best to upgrade to the required version.\n"); printf("*** If artsc-config was wrong, set the environment variable ARTS_CONFIG\n"); printf("*** to point to the correct copy of artsc-config, and remove the file\n"); printf("*** config.cache before re-running configure\n"); return 1; } } _ACEOF rm -f conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) no_arts=yes fi rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi CFLAGS="$ac_save_CFLAGS" LIBS="$ac_save_LIBS" fi fi if test "x$no_arts" = x ; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 : else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 if test "$ARTS_CONFIG" = "no" ; then echo "*** The artsc-config script installed by ARTS could not be found" echo "*** If ARTS was installed in PREFIX, make sure PREFIX/bin is in" echo "*** your path, or set the ARTS_CONFIG environment variable to the" echo "*** full path to artsc-config." else if test -f conf.artstest ; then : else echo "*** Could not run ARTS test program, checking why..." CFLAGS="$CFLAGS $ARTS_CFLAGS" LIBS="$LIBS $ARTS_LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include int main () { return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then echo "*** The test program compiled, but did not run. This usually means" echo "*** that the run-time linker is not finding ARTS or finding the wrong" echo "*** version of ARTS. If it is not finding ARTS, you'll need to set your" echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" echo "*** to the installed location Also, make sure you have run ldconfig if that" echo "*** is required on your system" echo "***" echo "*** If you have an old version installed, it is best to remove it, although" echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 echo "*** The test program failed to compile or link. See the file config.log for the" echo "*** exact error that occured. This usually means ARTS was incorrectly installed" echo "*** or that you have moved ARTS since it was installed. In the latter case, you" echo "*** may want to edit the arts-config script: $ARTS_CONFIG" fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext CFLAGS="$ac_save_CFLAGS" LIBS="$ac_save_LIBS" fi fi ARTS_CFLAGS="" ARTS_LIBS="" : fi rm -f conf.artstest CFLAGS=$KEEPCFLAGS LIBS=$KEEPLIBS LDFLAGS=$KEEPLDFLAGS if test "x$no_arts" = x; then EXTRADEFS="$EXTRADEFS -DAU_ARTS" SYSEXTRAS="$SYSEXTRAS aRts_a.c" for f in $ARTS_CFLAGS; do case ".$f" in .-I?*|.-D?*) CPPFLAGS="$CPPFLAGS $f" ;; *) CFLAGS="$CPPFLAGS $f" ;; esac done LIBS="$LIBS $ARTS_LIBS" else { echo "$as_me:$LINENO: WARNING: aRts: Couldn't configure" >&5 echo "$as_me: WARNING: aRts: Couldn't configure" >&2;} fi else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi echo "$as_me:$LINENO: checking enable_audio=esd" >&5 echo $ECHO_N "checking enable_audio=esd... $ECHO_C" >&6 if test "x$au_enable_esd" = xyes; then echo "$as_me:$LINENO: result: yes, configuring esd" >&5 echo "${ECHO_T}yes, configuring esd" >&6 KEEPCFLAGS=$CFLAGS KEEPLIBS=$LIBS KEEPLDFLAGS=$LDFLAGS # Check whether --with-esd-prefix or --without-esd-prefix was given. if test "${with_esd_prefix+set}" = set; then withval="$with_esd_prefix" esd_prefix="$withval" else esd_prefix="" fi; # Check whether --with-esd-exec-prefix or --without-esd-exec-prefix was given. if test "${with_esd_exec_prefix+set}" = set; then withval="$with_esd_exec_prefix" esd_exec_prefix="$withval" else esd_exec_prefix="" fi; # Check whether --enable-esdtest or --disable-esdtest was given. if test "${enable_esdtest+set}" = set; then enableval="$enable_esdtest" else enable_esdtest=yes fi; if test x$esd_exec_prefix != x ; then esd_args="$esd_args --exec-prefix=$esd_exec_prefix" if test x${ESD_CONFIG+set} != xset ; then ESD_CONFIG=$esd_exec_prefix/bin/esd-config fi fi if test x$esd_prefix != x ; then esd_args="$esd_args --prefix=$esd_prefix" if test x${ESD_CONFIG+set} != xset ; then ESD_CONFIG=$esd_prefix/bin/esd-config fi fi # Extract the first word of "esd-config", so it can be a program name with args. set dummy esd-config; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_path_ESD_CONFIG+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case $ESD_CONFIG in [\\/]* | ?:[\\/]*) ac_cv_path_ESD_CONFIG="$ESD_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_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_ESD_CONFIG="$as_dir/$ac_word$ac_exec_ext" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_path_ESD_CONFIG" && ac_cv_path_ESD_CONFIG="no" ;; esac fi ESD_CONFIG=$ac_cv_path_ESD_CONFIG if test -n "$ESD_CONFIG"; then echo "$as_me:$LINENO: result: $ESD_CONFIG" >&5 echo "${ECHO_T}$ESD_CONFIG" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi min_esd_version=0.2.7 echo "$as_me:$LINENO: checking for ESD - version >= $min_esd_version" >&5 echo $ECHO_N "checking for ESD - version >= $min_esd_version... $ECHO_C" >&6 no_esd="" if test "$ESD_CONFIG" = "no" ; then no_esd=yes else 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 ESD_CFLAGS=`$ESD_CONFIG $esdconf_args --cflags` ESD_LIBS=`$ESD_CONFIG $esdconf_args --libs` esd_major_version=`$ESD_CONFIG $esd_args --version | \ sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\1/'` esd_minor_version=`$ESD_CONFIG $esd_args --version | \ sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\2/'` esd_micro_version=`$ESD_CONFIG $esd_config_args --version | \ sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\3/'` if test "x$enable_esdtest" = "xyes" ; then ac_save_CFLAGS="$CFLAGS" ac_save_LIBS="$LIBS" CFLAGS="$CFLAGS $ESD_CFLAGS" LIBS="$LIBS $ESD_LIBS" rm -f conf.esdtest if test "$cross_compiling" = yes; then echo $ac_n "cross compiling; assumed OK... $ac_c" else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include char* my_strdup (char *str) { char *new_str; if (str) { new_str = malloc ((strlen (str) + 1) * sizeof(char)); strcpy (new_str, str); } else new_str = NULL; return new_str; } int main () { int major, minor, micro; char *tmp_version; system ("touch conf.esdtest"); /* HP/UX 9 (%@#!) writes to sscanf strings */ tmp_version = my_strdup("$min_esd_version"); if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { printf("%s, bad version string\n", "$min_esd_version"); exit(1); } if (($esd_major_version > major) || (($esd_major_version == major) && ($esd_minor_version > minor)) || (($esd_major_version == major) && ($esd_minor_version == minor) && ($esd_micro_version >= micro))) { return 0; } else { printf("\n*** 'esd-config --version' returned %d.%d.%d, but the minimum version\n", $esd_major_version, $esd_minor_version, $esd_micro_version); printf("*** of ESD required is %d.%d.%d. If esd-config is correct, then it is\n", major, minor, micro); printf("*** best to upgrade to the required version.\n"); printf("*** If esd-config was wrong, set the environment variable ESD_CONFIG\n"); printf("*** to point to the correct copy of esd-config, and remove the file\n"); printf("*** config.cache before re-running configure\n"); return 1; } } _ACEOF rm -f conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) no_esd=yes fi rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi CFLAGS="$ac_save_CFLAGS" LIBS="$ac_save_LIBS" 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 fi if test "x$no_esd" = x ; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 : else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 if test "$ESD_CONFIG" = "no" ; then echo "*** The esd-config script installed by ESD could not be found" echo "*** If ESD was installed in PREFIX, make sure PREFIX/bin is in" echo "*** your path, or set the ESD_CONFIG environment variable to the" echo "*** full path to esd-config." else if test -f conf.esdtest ; then : else echo "*** Could not run ESD test program, checking why..." CFLAGS="$CFLAGS $ESD_CFLAGS" LIBS="$LIBS $ESD_LIBS" 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 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include int main () { return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then echo "*** The test program compiled, but did not run. This usually means" echo "*** that the run-time linker is not finding ESD or finding the wrong" echo "*** version of ESD. If it is not finding ESD, you'll need to set your" echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" echo "*** to the installed location Also, make sure you have run ldconfig if that" echo "*** is required on your system" echo "***" echo "*** If you have an old version installed, it is best to remove it, although" echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 echo "*** The test program failed to compile or link. See the file config.log for the" echo "*** exact error that occured. This usually means ESD was incorrectly installed" echo "*** or that you have moved ESD since it was installed. In the latter case, you" echo "*** may want to edit the esd-config script: $ESD_CONFIG" fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext CFLAGS="$ac_save_CFLAGS" LIBS="$ac_save_LIBS" 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 fi ESD_CFLAGS="" ESD_LIBS="" : fi rm -f conf.esdtest CFLAGS=$KEEPCFLAGS LIBS=$KEEPLIBS LDFLAGS=$KEEPLDFLAGS if test "x$no_esd" = x; then EXTRADEFS="$EXTRADEFS -DAU_ESD" SYSEXTRAS="$SYSEXTRAS esd_a.c" for f in $ESD_CFLAGS; do case ".$f" in .-I?*|.-D?*) CPPFLAGS="$CPPFLAGS $f" ;; *) CFLAGS="$CPPFLAGS $f" ;; esac done LIBS="$LIBS $ESD_LIBS" else { echo "$as_me:$LINENO: WARNING: EsounD: Couldn't configure" >&5 echo "$as_me: WARNING: EsounD: Couldn't configure" >&2;} fi else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi echo "$as_me:$LINENO: checking enable_audio=portaudio" >&5 echo $ECHO_N "checking enable_audio=portaudio... $ECHO_C" >&6 if test "x$au_enable_portaudio" = xyes; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 if test "x$CYGNUS" = xyes ||test "x$MSYS" = xyes; then SYSEXTRAS="$SYSEXTRAS portaudio_a.c w32_portaudio_dll.c" EXTRALIBS="$EXTRALIBS -lportaudio" EXTRADEFS="$EXTRADEFS -DAU_PORTAUDIO -DAU_PORTAUDIO_DLL" else SYSEXTRAS="$SYSEXTRAS portaudio_a.c" EXTRALIBS="$EXTRALIBS -lportaudio" EXTRADEFS="$EXTRADEFS -DAU_PORTAUDIO" fi else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi echo "$as_me:$LINENO: checking enable_audio=jack" >&5 echo $ECHO_N "checking enable_audio=jack... $ECHO_C" >&6 if test "x$au_enable_jack" = xyes; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 SYSEXTRAS="$SYSEXTRAS jack_a.c" EXTRALIBS="$EXTRALIBS $(pkg-config --libs jack)" EXTRADEFS="$EXTRADEFS -DAU_JACK $(pkg-config --cflags jack)" else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi echo "$as_me:$LINENO: checking enable_audio=ao" >&5 echo $ECHO_N "checking enable_audio=ao... $ECHO_C" >&6 if test "x$au_enable_ao" = xyes; then echo "$as_me:$LINENO: result: yes, configuring ao" >&5 echo "${ECHO_T}yes, configuring ao" >&6 # Check whether --with-ao or --without-ao was given. if test "${with_ao+set}" = set; then withval="$with_ao" ao_prefix="$withval" else ao_prefix="" fi; # Check whether --with-ao-libraries or --without-ao-libraries was given. if test "${with_ao_libraries+set}" = set; then withval="$with_ao_libraries" ao_libraries="$withval" else ao_libraries="" fi; # Check whether --with-ao-includes or --without-ao-includes was given. if test "${with_ao_includes+set}" = set; then withval="$with_ao_includes" ao_includes="$withval" else ao_includes="" fi; # Check whether --enable-aotest or --disable-aotest was given. if test "${enable_aotest+set}" = set; then enableval="$enable_aotest" else enable_aotest=yes fi; if test "x$ao_libraries" != "x" ; then AO_LIBS="-L$ao_libraries" elif test "x$ao_prefix" != "x"; then AO_LIBS="-L$ao_prefix/lib" elif test "x$prefix" != "xNONE"; then AO_LIBS="-L$prefix/lib" fi if test "x$ao_includes" != "x" ; then AO_CFLAGS="-I$ao_includes" elif test "x$ao_prefix" != "x"; then AO_CFLAGS="-I$ao_prefix/include" elif test "x$prefix" != "xNONE"; then AO_CFLAGS="-I$prefix/include" fi # see where dl* and friends live for ac_func in dlopen do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` echo "$as_me:$LINENO: checking for $ac_func" >&5 echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 if eval "test \"\${$as_ac_var+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define $ac_func to an innocuous variant, in case declares $ac_func. For example, HP-UX 11i declares gettimeofday. */ #define $ac_func innocuous_$ac_func /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $ac_func /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" { #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char $ac_func (); /* 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_$ac_func) || defined (__stub___$ac_func) choke me #else char (*f) () = $ac_func; #endif #ifdef __cplusplus } #endif int main () { return f != $ac_func; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then eval "$as_ac_var=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 if test `eval echo '${'$as_ac_var'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF AO_DL_LIBS="" else echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6 if test "${ac_cv_lib_dl_dlopen+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char dlopen (); int main () { dlopen (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_dl_dlopen=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_dl_dlopen=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6 if test $ac_cv_lib_dl_dlopen = yes; then AO_DL_LIBS="-ldl" else { echo "$as_me:$LINENO: WARNING: could not find dlopen() needed by libao sound drivers your system may not be supported." >&5 echo "$as_me: WARNING: could not find dlopen() needed by libao sound drivers your system may not be supported." >&2;} fi fi done AO_LIBS="$AO_LIBS -lao $AO_DL_LIBS" echo "$as_me:$LINENO: checking for ao" >&5 echo $ECHO_N "checking for ao... $ECHO_C" >&6 no_ao="" if test "x$enable_aotest" = "xyes" ; then ac_save_CFLAGS="$CFLAGS" ac_save_LIBS="$LIBS" CFLAGS="$CFLAGS $AO_CFLAGS" LIBS="$LIBS $AO_LIBS" rm -f conf.aotest if test "$cross_compiling" = yes; then echo $ac_n "cross compiling; assumed OK... $ac_c" else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include int main () { system("touch conf.aotest"); return 0; } _ACEOF rm -f conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) no_ao=yes fi rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi CFLAGS="$ac_save_CFLAGS" LIBS="$ac_save_LIBS" fi if test "x$no_ao" = "x" ; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 : else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 if test -f conf.aotest ; then : else echo "*** Could not run ao test program, checking why..." CFLAGS="$CFLAGS $AO_CFLAGS" LIBS="$LIBS $AO_LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include int main () { return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then echo "*** The test program compiled, but did not run. This usually means" echo "*** that the run-time linker is not finding ao or finding the wrong" echo "*** version of ao. If it is not finding ao, you'll need to set your" echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" echo "*** to the installed location Also, make sure you have run ldconfig if that" echo "*** is required on your system" echo "***" echo "*** If you have an old version installed, it is best to remove it, although" echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 echo "*** The test program failed to compile or link. See the file config.log for the" echo "*** exact error that occured. This usually means ao was incorrectly installed" echo "*** or that you have moved ao since it was installed." fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext CFLAGS="$ac_save_CFLAGS" LIBS="$ac_save_LIBS" fi AO_CFLAGS="" AO_LIBS="" : fi rm -f conf.aotest if test "x$no_ao" = "x" ; then # AC_MSG_RESULT(yes) EXTRADEFS="$EXTRADEFS -DAU_AO" SYSEXTRAS="$SYSEXTRAS ao_a.c" for f in $AO_CFLAGS; do case ".$f" in .-I?*|.-D?*) CPPFLAGS="$CPPFLAGS $f" ;; *) CFLAGS="$CPPFLAGS $f" ;; esac done LIBS="$LIBS $AO_LIBS" else { echo "$as_me:$LINENO: WARNING: Couldn't configure libao." >&5 echo "$as_me: WARNING: Couldn't configure libao." >&2;} fi else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi echo "$as_me:$LINENO: checking enable_audio=vorbis" >&5 echo $ECHO_N "checking enable_audio=vorbis... $ECHO_C" >&6 if test "x$au_enable_vorbis" = xyes; then echo "$as_me:$LINENO: result: yes, configuring vorbis" >&5 echo "${ECHO_T}yes, configuring vorbis" >&6 # Check whether --with-ogg or --without-ogg was given. if test "${with_ogg+set}" = set; then withval="$with_ogg" ogg_prefix="$withval" else ogg_prefix="" fi; # Check whether --with-ogg-libraries or --without-ogg-libraries was given. if test "${with_ogg_libraries+set}" = set; then withval="$with_ogg_libraries" ogg_libraries="$withval" else ogg_libraries="" fi; # Check whether --with-ogg-includes or --without-ogg-includes was given. if test "${with_ogg_includes+set}" = set; then withval="$with_ogg_includes" ogg_includes="$withval" else ogg_includes="" fi; # Check whether --enable-oggtest or --disable-oggtest was given. if test "${enable_oggtest+set}" = set; then enableval="$enable_oggtest" else enable_oggtest=yes fi; if test "x$ogg_libraries" != "x" ; then OGG_LIBS="-L$ogg_libraries" elif test "x$ogg_prefix" != "x" ; then OGG_LIBS="-L$ogg_prefix/lib" elif test "x$prefix" != "xNONE" ; then OGG_LIBS="-L$prefix/lib" fi OGG_LIBS="$OGG_LIBS -logg" if test "x$ogg_includes" != "x" ; then OGG_CFLAGS="-I$ogg_includes" elif test "x$ogg_prefix" != "x" ; then OGG_CFLAGS="-I$ogg_prefix/include" elif test "x$prefix" != "xNONE"; then OGG_CFLAGS="-I$prefix/include" fi echo "$as_me:$LINENO: checking for Ogg" >&5 echo $ECHO_N "checking for Ogg... $ECHO_C" >&6 no_ogg="" if test "x$enable_oggtest" = "xyes" ; then ac_save_CFLAGS="$CFLAGS" ac_save_LIBS="$LIBS" CFLAGS="$CFLAGS $OGG_CFLAGS" LIBS="$LIBS $OGG_LIBS" rm -f conf.oggtest if test "$cross_compiling" = yes; then echo $ac_n "cross compiling; assumed OK... $ac_c" else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include int main () { system("touch conf.oggtest"); return 0; } _ACEOF rm -f conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) no_ogg=yes fi rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi CFLAGS="$ac_save_CFLAGS" LIBS="$ac_save_LIBS" fi if test "x$no_ogg" = "x" ; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 # Check whether --with-vorbis or --without-vorbis was given. if test "${with_vorbis+set}" = set; then withval="$with_vorbis" vorbis_prefix="$withval" else vorbis_prefix="" fi; # Check whether --with-vorbis-libraries or --without-vorbis-libraries was given. if test "${with_vorbis_libraries+set}" = set; then withval="$with_vorbis_libraries" vorbis_libraries="$withval" else vorbis_libraries="" fi; # Check whether --with-vorbis-includes or --without-vorbis-includes was given. if test "${with_vorbis_includes+set}" = set; then withval="$with_vorbis_includes" vorbis_includes="$withval" else vorbis_includes="" fi; # Check whether --enable-vorbistest or --disable-vorbistest was given. if test "${enable_vorbistest+set}" = set; then enableval="$enable_vorbistest" else enable_vorbistest=yes fi; if test "x$vorbis_libraries" != "x" ; then VORBIS_LIBS="-L$vorbis_libraries" elif test "x$vorbis_prefix" != "x" ; then VORBIS_LIBS="-L$vorbis_prefix/lib" elif test "x$prefix" != "xNONE"; then VORBIS_LIBS="-L$prefix/lib" fi VORBIS_LIBS="$VORBIS_LIBS -lvorbis -lm" VORBISFILE_LIBS="-lvorbisfile" VORBISENC_LIBS="-lvorbisenc" if test "x$vorbis_includes" != "x" ; then VORBIS_CFLAGS="-I$vorbis_includes" elif test "x$vorbis_prefix" != "x" ; then VORBIS_CFLAGS="-I$vorbis_prefix/include" elif test "x$prefix" != "xNONE"; then VORBIS_CFLAGS="-I$prefix/include" fi echo "$as_me:$LINENO: checking for Vorbis" >&5 echo $ECHO_N "checking for Vorbis... $ECHO_C" >&6 no_vorbis="" if test "x$enable_vorbistest" = "xyes" ; then ac_save_CFLAGS="$CFLAGS" ac_save_LIBS="$LIBS" CFLAGS="$CFLAGS $VORBIS_CFLAGS $OGG_CFLAGS" LIBS="$LIBS $VORBIS_LIBS $OGG_LIBS" rm -f conf.vorbistest if test "$cross_compiling" = yes; then echo $ac_n "cross compiling; assumed OK... $ac_c" else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include int main () { system("touch conf.vorbistest"); return 0; } _ACEOF rm -f conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) no_vorbis=yes fi rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi CFLAGS="$ac_save_CFLAGS" LIBS="$ac_save_LIBS" fi if test "x$no_vorbis" = "x" ; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 have_vorbis=yes SYSEXTRAS="$SYSEXTRAS vorbis_a.c" EXTRADEFS="$EXTRADEFS -DAU_VORBIS $OGG_CFLAGS $VORBIS_CFLAGS" EXTRALIBS="$EXTRALIBS $VORBIS_LIBS $VORBISENC_LIBS $OGG_LIBS" if test "x$CYGNUS" = "xyes"; then EXTRADEFS="-DAU_VORBIS_DLL $EXTRADEFS" SYSEXTRAS="$SYSEXTRAS w32g_vorbisenc_dll.c w32g_vorbis_dll.c w32g_ogg_dll.c" fi if test "x$MSYS" = "xyes"; then EXTRADEFS="-DAU_VORBIS_DLL $EXTRADEFS" SYSEXTRAS="$SYSEXTRAS w32g_vorbisenc_dll.c w32g_vorbis_dll.c w32g_ogg_dll.c" fi else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 if test -f conf.vorbistest ; then : else echo "*** Could not run Vorbis test program, checking why..." CFLAGS="$CFLAGS $VORBIS_CFLAGS" LIBS="$LIBS $VORBIS_LIBS $OGG_LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include int main () { return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then echo "*** The test program compiled, but did not run. This usually means" echo "*** that the run-time linker is not finding Vorbis or finding the wrong" echo "*** version of Vorbis. If it is not finding Vorbis, you'll need to set your" echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" echo "*** to the installed location Also, make sure you have run ldconfig if that" echo "*** is required on your system" echo "***" echo "*** If you have an old version installed, it is best to remove it, although" echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 echo "*** The test program failed to compile or link. See the file config.log for the" echo "*** exact error that occured. This usually means Vorbis was incorrectly installed" echo "*** or that you have moved Vorbis since it was installed." fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext CFLAGS="$ac_save_CFLAGS" LIBS="$ac_save_LIBS" fi VORBIS_CFLAGS="" VORBIS_LIBS="" VORBISFILE_LIBS="" VORBISENC_LIBS="" { echo "$as_me:$LINENO: WARNING: Unable to configure vorbis, but ogg is there (???)" >&5 echo "$as_me: WARNING: Unable to configure vorbis, but ogg is there (???)" >&2;} fi rm -f conf.vorbistest else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 if test -f conf.oggtest ; then : else echo "*** Could not run Ogg test program, checking why..." CFLAGS="$CFLAGS $OGG_CFLAGS" LIBS="$LIBS $OGG_LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include int main () { return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then echo "*** The test program compiled, but did not run. This usually means" echo "*** that the run-time linker is not finding Ogg or finding the wrong" echo "*** version of Ogg. If it is not finding Ogg, you'll need to set your" echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" echo "*** to the installed location Also, make sure you have run ldconfig if that" echo "*** is required on your system" echo "***" echo "*** If you have an old version installed, it is best to remove it, although" echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 echo "*** The test program failed to compile or link. See the file config.log for the" echo "*** exact error that occured. This usually means Ogg was incorrectly installed" echo "*** or that you have moved Ogg since it was installed. In the latter case, you" echo "*** may want to edit the ogg-config script: $OGG_CONFIG" fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext CFLAGS="$ac_save_CFLAGS" LIBS="$ac_save_LIBS" fi OGG_CFLAGS="" OGG_LIBS="" { echo "$as_me:$LINENO: WARNING: Unable to configure vorbis!" >&5 echo "$as_me: WARNING: Unable to configure vorbis!" >&2;} have_vorbis=no fi rm -f conf.oggtest else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi if test "x$CYGNUS" = xyes || test "x$MSYS" = xyes ; then echo "$as_me:$LINENO: checking enable_audio=flac" >&5 echo $ECHO_N "checking enable_audio=flac... $ECHO_C" >&6 if test "x$au_enable_flac" = xyes; then echo "$as_me:$LINENO: result: yes, configuring flac" >&5 echo "${ECHO_T}yes, configuring flac" >&6 SYSEXTRAS="$SYSEXTRAS flac_a.c w32_libFLAC_dll.c w32_libOggFLAC_dll.c" # Check whether --with-libFLAC or --without-libFLAC was given. if test "${with_libFLAC+set}" = set; then withval="$with_libFLAC" libFLAC_prefix="$withval" else libFLAC_prefix="" fi; # Check whether --with-libFLAC-libraries or --without-libFLAC-libraries was given. if test "${with_libFLAC_libraries+set}" = set; then withval="$with_libFLAC_libraries" libFLAC_libraries="$withval" else libFLAC_libraries="" fi; # Check whether --with-libFLAC-includes or --without-libFLAC-includes was given. if test "${with_libFLAC_includes+set}" = set; then withval="$with_libFLAC_includes" libFLAC_includes="$withval" else libFLAC_includes="" fi; # Check whether --enable-libFLACtest or --disable-libFLACtest was given. if test "${enable_libFLACtest+set}" = set; then enableval="$enable_libFLACtest" else enable_libFLACtest=yes fi; if test "x$libFLAC_libraries" != "x" ; then LIBFLAC_LIBS="-L$libFLAC_libraries" elif test "x$libFLAC_prefix" != "x" ; then LIBFLAC_LIBS="-L$libFLAC_prefix/lib" elif test "x$prefix" != "xNONE" ; then LIBFLAC_LIBS="-L$prefix/lib" fi LIBFLAC_LIBS="$LIBFLAC_LIBS -lFLAC -lm" if test "x$libFLAC_includes" != "x" ; then LIBFLAC_CFLAGS="-I$libFLAC_includes" elif test "x$libFLAC_prefix" != "x" ; then LIBFLAC_CFLAGS="-I$libFLAC_prefix/include" elif test "$prefix" != "xNONE"; then LIBFLAC_CFLAGS="-I$prefix/include" fi echo "$as_me:$LINENO: checking for libFLAC" >&5 echo $ECHO_N "checking for libFLAC... $ECHO_C" >&6 no_libFLAC="" if test "x$enable_libFLACtest" = "xyes" ; then ac_save_CFLAGS="$CFLAGS" ac_save_CXXFLAGS="$CXXFLAGS" ac_save_LIBS="$LIBS" CFLAGS="$CFLAGS $LIBFLAC_CFLAGS" CXXFLAGS="$CXXFLAGS $LIBFLAC_CFLAGS" LIBS="$LIBS $LIBFLAC_LIBS" rm -f conf.libFLACtest if test "$cross_compiling" = yes; then echo $ac_n "cross compiling; assumed OK... $ac_c" else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include int main () { system("touch conf.libFLACtest"); return 0; } _ACEOF rm -f conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) no_libFLAC=yes fi rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi CFLAGS="$ac_save_CFLAGS" LIBS="$ac_save_LIBS" fi if test "x$no_libFLAC" = "x" ; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 EXTRADEFS="$EXTRADEFS -DAU_FLAC -DAU_FLAC_DLL" for f in $LIBFLAC_CFLAGS; do case ".$f" in .-I?*|.-D?*) CPPFLAGS="$CPPFLAGS $f" ;; *) CFLAGS="$CPPFLAGS $f" ;; esac done LIBS="$LIBS $LIBFLAC_LIBS" else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 if test -f conf.libFLACtest ; then : else echo "*** Could not run libFLAC test program, checking why..." CFLAGS="$CFLAGS $LIBFLAC_CFLAGS" LIBS="$LIBS $LIBFLAC_LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include int main () { return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then echo "*** The test program compiled, but did not run. This usually means" echo "*** that the run-time linker is not finding libFLAC or finding the wrong" echo "*** version of libFLAC. If it is not finding libFLAC, you'll need to set your" echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" echo "*** to the installed location Also, make sure you have run ldconfig if that" echo "*** is required on your system" echo "***" echo "*** If you have an old version installed, it is best to remove it, although" echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 echo "*** The test program failed to compile or link. See the file config.log for the" echo "*** exact error that occured. This usually means libFLAC was incorrectly installed" echo "*** or that you have moved libFLAC since it was installed. In the latter case, you" echo "*** may want to edit the libFLAC-config script: $LIBFLAC_CONFIG" fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext CFLAGS="$ac_save_CFLAGS" LIBS="$ac_save_LIBS" fi LIBFLAC_CFLAGS="" LIBFLAC_LIBS="" : fi rm -f conf.libFLACtest # Check whether --with-libOggFLAC or --without-libOggFLAC was given. if test "${with_libOggFLAC+set}" = set; then withval="$with_libOggFLAC" libOggFLAC_prefix="$withval" else libOggFLAC_prefix="" fi; # Check whether --with-libOggFLAC-libraries or --without-libOggFLAC-libraries was given. if test "${with_libOggFLAC_libraries+set}" = set; then withval="$with_libOggFLAC_libraries" libOggFLAC_libraries="$withval" else libOggFLAC_libraries="" fi; # Check whether --with-libOggFLAC-includes or --without-libOggFLAC-includes was given. if test "${with_libOggFLAC_includes+set}" = set; then withval="$with_libOggFLAC_includes" libOggFLAC_includes="$withval" else libOggFLAC_includes="" fi; # Check whether --enable-libOggFLACtest or --disable-libOggFLACtest was given. if test "${enable_libOggFLACtest+set}" = set; then enableval="$enable_libOggFLACtest" else enable_libOggFLACtest=yes fi; if test "x$libOggFLAC_libraries" != "x" ; then LIBOGGFLAC_LIBS="-L$libOggFLAC_libraries" elif test "x$libOggFLAC_prefix" != "x" ; then LIBOGGFLAC_LIBS="-L$libOggFLAC_prefix/lib" elif test "x$prefix" != "xNONE" ; then LIBOGGFLAC_LIBS="-L$prefix/lib" fi LIBOGGFLAC_LIBS="$LIBOGGFLAC_LIBS -lOggFLAC -lFLAC -lm" if test "x$libOggFLAC_includes" != "x" ; then LIBOGGFLAC_CFLAGS="-I$libOggFLAC_includes" elif test "x$libOggFLAC_prefix" != "x" ; then LIBOGGFLAC_CFLAGS="-I$libOggFLAC_prefix/include" elif test "$prefix" != "xNONE"; then LIBOGGFLAC_CFLAGS="-I$prefix/include" fi echo "$as_me:$LINENO: checking for libOggFLAC" >&5 echo $ECHO_N "checking for libOggFLAC... $ECHO_C" >&6 no_libOggFLAC="" if test "x$enable_libOggFLACtest" = "xyes" ; then ac_save_CFLAGS="$CFLAGS" ac_save_CXXFLAGS="$CXXFLAGS" ac_save_LIBS="$LIBS" CFLAGS="$CFLAGS $LIBOGGFLAC_CFLAGS" CXXFLAGS="$CXXFLAGS $LIBOGGFLAC_CFLAGS" LIBS="$LIBS $LIBOGGFLAC_LIBS" rm -f conf.libOggFLACtest if test "$cross_compiling" = yes; then echo $ac_n "cross compiling; assumed OK... $ac_c" else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include int main () { system("touch conf.libOggFLACtest"); return 0; } _ACEOF rm -f conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) no_libOggFLAC=yes fi rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi CFLAGS="$ac_save_CFLAGS" LIBS="$ac_save_LIBS" fi if test "x$no_libOggFLAC" = "x" ; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 EXTRADEFS="$EXTRADEFS -DAU_OGGFLAC -DAU_OGGFLAC_DLL" for f in $LIBOGGFLAC_CFLAGS; do case ".$f" in .-I?*|.-D?*) CPPFLAGS="$CPPFLAGS $f" ;; *) CFLAGS="$CPPFLAGS $f" ;; esac done LIBS="$LIBS $LIBOGGFLAC_LIBS" else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 if test -f conf.libOggFLACtest ; then : else echo "*** Could not run libOggFLAC test program, checking why..." CFLAGS="$CFLAGS $LIBOGGFLAC_CFLAGS" LIBS="$LIBS $LIBOGGFLAC_LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include int main () { return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then echo "*** The test program compiled, but did not run. This usually means" echo "*** that the run-time linker is not finding libOggFLAC or finding the wrong" echo "*** version of libOggFLAC. If it is not finding libOggFLAC, you'll need to set your" echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" echo "*** to the installed location Also, make sure you have run ldconfig if that" echo "*** is required on your system" echo "***" echo "*** If you have an old version installed, it is best to remove it, although" echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 echo "*** The test program failed to compile or link. See the file config.log for the" echo "*** exact error that occured. This usually means libOggFLAC was incorrectly installed" echo "*** or that you have moved libOggFLAC since it was installed. In the latter case, you" echo "*** may want to edit the libOggFLAC-config script: $LIBOGGFLAC_CONFIG" fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext CFLAGS="$ac_save_CFLAGS" LIBS="$ac_save_LIBS" fi LIBOGGFLAC_CFLAGS="" LIBOGGFLAC_LIBS="" : fi rm -f conf.libOggFLACtest else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi else echo "$as_me:$LINENO: checking enable_audio=flac" >&5 echo $ECHO_N "checking enable_audio=flac... $ECHO_C" >&6 if test "x$au_enable_flac" = xyes; then echo "$as_me:$LINENO: result: yes, configuring flac" >&5 echo "${ECHO_T}yes, configuring flac" >&6 SYSEXTRAS="$SYSEXTRAS flac_a.c" # Check whether --with-libFLAC or --without-libFLAC was given. if test "${with_libFLAC+set}" = set; then withval="$with_libFLAC" libFLAC_prefix="$withval" else libFLAC_prefix="" fi; # Check whether --with-libFLAC-libraries or --without-libFLAC-libraries was given. if test "${with_libFLAC_libraries+set}" = set; then withval="$with_libFLAC_libraries" libFLAC_libraries="$withval" else libFLAC_libraries="" fi; # Check whether --with-libFLAC-includes or --without-libFLAC-includes was given. if test "${with_libFLAC_includes+set}" = set; then withval="$with_libFLAC_includes" libFLAC_includes="$withval" else libFLAC_includes="" fi; # Check whether --enable-libFLACtest or --disable-libFLACtest was given. if test "${enable_libFLACtest+set}" = set; then enableval="$enable_libFLACtest" else enable_libFLACtest=yes fi; if test "x$libFLAC_libraries" != "x" ; then LIBFLAC_LIBS="-L$libFLAC_libraries" elif test "x$libFLAC_prefix" != "x" ; then LIBFLAC_LIBS="-L$libFLAC_prefix/lib" elif test "x$prefix" != "xNONE" ; then LIBFLAC_LIBS="-L$prefix/lib" fi LIBFLAC_LIBS="$LIBFLAC_LIBS -lFLAC -lm" if test "x$libFLAC_includes" != "x" ; then LIBFLAC_CFLAGS="-I$libFLAC_includes" elif test "x$libFLAC_prefix" != "x" ; then LIBFLAC_CFLAGS="-I$libFLAC_prefix/include" elif test "$prefix" != "xNONE"; then LIBFLAC_CFLAGS="-I$prefix/include" fi echo "$as_me:$LINENO: checking for libFLAC" >&5 echo $ECHO_N "checking for libFLAC... $ECHO_C" >&6 no_libFLAC="" if test "x$enable_libFLACtest" = "xyes" ; then ac_save_CFLAGS="$CFLAGS" ac_save_CXXFLAGS="$CXXFLAGS" ac_save_LIBS="$LIBS" CFLAGS="$CFLAGS $LIBFLAC_CFLAGS" CXXFLAGS="$CXXFLAGS $LIBFLAC_CFLAGS" LIBS="$LIBS $LIBFLAC_LIBS" rm -f conf.libFLACtest if test "$cross_compiling" = yes; then echo $ac_n "cross compiling; assumed OK... $ac_c" else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include int main () { system("touch conf.libFLACtest"); return 0; } _ACEOF rm -f conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) no_libFLAC=yes fi rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi CFLAGS="$ac_save_CFLAGS" LIBS="$ac_save_LIBS" fi if test "x$no_libFLAC" = "x" ; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 EXTRADEFS="$EXTRADEFS -DAU_FLAC" for f in $LIBFLAC_CFLAGS; do case ".$f" in .-I?*|.-D?*) CPPFLAGS="$CPPFLAGS $f" ;; *) CFLAGS="$CPPFLAGS $f" ;; esac done LIBS="$LIBS $LIBFLAC_LIBS" else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 if test -f conf.libFLACtest ; then : else echo "*** Could not run libFLAC test program, checking why..." CFLAGS="$CFLAGS $LIBFLAC_CFLAGS" LIBS="$LIBS $LIBFLAC_LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include int main () { return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then echo "*** The test program compiled, but did not run. This usually means" echo "*** that the run-time linker is not finding libFLAC or finding the wrong" echo "*** version of libFLAC. If it is not finding libFLAC, you'll need to set your" echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" echo "*** to the installed location Also, make sure you have run ldconfig if that" echo "*** is required on your system" echo "***" echo "*** If you have an old version installed, it is best to remove it, although" echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 echo "*** The test program failed to compile or link. See the file config.log for the" echo "*** exact error that occured. This usually means libFLAC was incorrectly installed" echo "*** or that you have moved libFLAC since it was installed. In the latter case, you" echo "*** may want to edit the libFLAC-config script: $LIBFLAC_CONFIG" fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext CFLAGS="$ac_save_CFLAGS" LIBS="$ac_save_LIBS" fi LIBFLAC_CFLAGS="" LIBFLAC_LIBS="" : fi rm -f conf.libFLACtest # Check whether --with-libOggFLAC or --without-libOggFLAC was given. if test "${with_libOggFLAC+set}" = set; then withval="$with_libOggFLAC" libOggFLAC_prefix="$withval" else libOggFLAC_prefix="" fi; # Check whether --with-libOggFLAC-libraries or --without-libOggFLAC-libraries was given. if test "${with_libOggFLAC_libraries+set}" = set; then withval="$with_libOggFLAC_libraries" libOggFLAC_libraries="$withval" else libOggFLAC_libraries="" fi; # Check whether --with-libOggFLAC-includes or --without-libOggFLAC-includes was given. if test "${with_libOggFLAC_includes+set}" = set; then withval="$with_libOggFLAC_includes" libOggFLAC_includes="$withval" else libOggFLAC_includes="" fi; # Check whether --enable-libOggFLACtest or --disable-libOggFLACtest was given. if test "${enable_libOggFLACtest+set}" = set; then enableval="$enable_libOggFLACtest" else enable_libOggFLACtest=yes fi; if test "x$libOggFLAC_libraries" != "x" ; then LIBOGGFLAC_LIBS="-L$libOggFLAC_libraries" elif test "x$libOggFLAC_prefix" != "x" ; then LIBOGGFLAC_LIBS="-L$libOggFLAC_prefix/lib" elif test "x$prefix" != "xNONE" ; then LIBOGGFLAC_LIBS="-L$prefix/lib" fi LIBOGGFLAC_LIBS="$LIBOGGFLAC_LIBS -lOggFLAC -lFLAC -lm" if test "x$libOggFLAC_includes" != "x" ; then LIBOGGFLAC_CFLAGS="-I$libOggFLAC_includes" elif test "x$libOggFLAC_prefix" != "x" ; then LIBOGGFLAC_CFLAGS="-I$libOggFLAC_prefix/include" elif test "$prefix" != "xNONE"; then LIBOGGFLAC_CFLAGS="-I$prefix/include" fi echo "$as_me:$LINENO: checking for libOggFLAC" >&5 echo $ECHO_N "checking for libOggFLAC... $ECHO_C" >&6 no_libOggFLAC="" if test "x$enable_libOggFLACtest" = "xyes" ; then ac_save_CFLAGS="$CFLAGS" ac_save_CXXFLAGS="$CXXFLAGS" ac_save_LIBS="$LIBS" CFLAGS="$CFLAGS $LIBOGGFLAC_CFLAGS" CXXFLAGS="$CXXFLAGS $LIBOGGFLAC_CFLAGS" LIBS="$LIBS $LIBOGGFLAC_LIBS" rm -f conf.libOggFLACtest if test "$cross_compiling" = yes; then echo $ac_n "cross compiling; assumed OK... $ac_c" else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include int main () { system("touch conf.libOggFLACtest"); return 0; } _ACEOF rm -f conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) no_libOggFLAC=yes fi rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi CFLAGS="$ac_save_CFLAGS" LIBS="$ac_save_LIBS" fi if test "x$no_libOggFLAC" = "x" ; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 EXTRADEFS="$EXTRADEFS -DAU_OGGFLAC" for f in $LIBOGGFLAC_CFLAGS; do case ".$f" in .-I?*|.-D?*) CPPFLAGS="$CPPFLAGS $f" ;; *) CFLAGS="$CPPFLAGS $f" ;; esac done LIBS="$LIBS $LIBOGGFLAC_LIBS" else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 if test -f conf.libOggFLACtest ; then : else echo "*** Could not run libOggFLAC test program, checking why..." CFLAGS="$CFLAGS $LIBOGGFLAC_CFLAGS" LIBS="$LIBS $LIBOGGFLAC_LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include int main () { return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then echo "*** The test program compiled, but did not run. This usually means" echo "*** that the run-time linker is not finding libOggFLAC or finding the wrong" echo "*** version of libOggFLAC. If it is not finding libOggFLAC, you'll need to set your" echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" echo "*** to the installed location Also, make sure you have run ldconfig if that" echo "*** is required on your system" echo "***" echo "*** If you have an old version installed, it is best to remove it, although" echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 echo "*** The test program failed to compile or link. See the file config.log for the" echo "*** exact error that occured. This usually means libOggFLAC was incorrectly installed" echo "*** or that you have moved libOggFLAC since it was installed. In the latter case, you" echo "*** may want to edit the libOggFLAC-config script: $LIBOGGFLAC_CONFIG" fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext CFLAGS="$ac_save_CFLAGS" LIBS="$ac_save_LIBS" fi LIBOGGFLAC_CFLAGS="" LIBOGGFLAC_LIBS="" : fi rm -f conf.libOggFLACtest else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi echo "$as_me:$LINENO: checking enable_audio=speex" >&5 echo $ECHO_N "checking enable_audio=speex... $ECHO_C" >&6 if test "x$au_enable_speex" = xyes; then if test "${have_speex+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include int main () { SpeexBits *dummy; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then have_speex=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 have_speex=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $have_speex" >&5 echo "${ECHO_T}$have_speex" >&6 if test "x$have_speex" = xyes; then SYSEXTRAS="$SYSEXTRAS speex_a.c" EXTRALIBS="$EXTRALIBS -lspeex -logg" EXTRADEFS="$EXTRADEFS -DAU_SPEEX" fi else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi echo "$as_me:$LINENO: checking enable_audio=gogo" >&5 echo $ECHO_N "checking enable_audio=gogo... $ECHO_C" >&6 if test "x$au_enable_gogo" = xyes; then if test "x$CYGNUS" = "xyes"; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 else if test "x$MSYS" = "xyes"; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 else { echo "$as_me:$LINENO: WARNING: May be gogo is not supported. You need hack the gogo_a.c" >&5 echo "$as_me: WARNING: May be gogo is not supported. You need hack the gogo_a.c" >&2;} fi fi have_gogo=yes SYSEXTRAS="$SYSEXTRAS gogo_a.c w32_gogo.c" EXTRADEFS="$EXTRADEFS -DAU_GOGO -DAU_GOGO_DLL" EXTRALIBS="$EXTRALIBS -lgogo" else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi if test "x$au_enable_none" = xyes; then EXTRADEFS="$EXTRADEFS -DAU_NONE -DAU_AUDRIV" SYSEXTRAS="$SYSEXTRAS audriv_a.c audriv_none.c" fi echo "$as_me:$LINENO: checking default output mode" >&5 echo $ECHO_N "checking default output mode... $ECHO_C" >&6 if test "x$DEFAULT_PLAYMODE" = x; then DEFAULT_PLAYMODE=`echo $enable_audio | sed 's/,.*//'` fi case ".$DEFAULT_PLAYMODE" in .default) TIMIDITY_OUTPUT_ID=d ;; .oss) TIMIDITY_OUTPUT_ID=d ;; .alsa) TIMIDITY_OUTPUT_ID=s ;; .sun) TIMIDITY_OUTPUT_ID=d ;; .hpux) TIMIDITY_OUTPUT_ID=d ;; .irix) TIMIDITY_OUTPUT_ID=d ;; .mme) TIMIDITY_OUTPUT_ID=d ;; .sb_dsp) TIMIDITY_OUTPUT_ID=d ;; .darwin) TIMIDITY_OUTPUT_ID=d ;; .w32) TIMIDITY_OUTPUT_ID=d ;; .alib) TIMIDITY_OUTPUT_ID=A ;; .nas) TIMIDITY_OUTPUT_ID=n ;; .arts) TIMIDITY_OUTPUT_ID=R ;; .esd) TIMIDITY_OUTPUT_ID=e ;; .portaudio) TIMIDITY_OUTPUT_ID=p ;; .wav) TIMIDITY_OUTPUT_ID=w ;; .au) TIMIDITY_OUTPUT_ID=u ;; .aiff) TIMIDITY_OUTPUT_ID=a ;; .list) TIMIDITY_OUTPUT_ID=l ;; .vorbis) TIMIDITY_OUTPUT_ID=v ;; .flac) TIMIDITY_OUTPUT_ID=F ;; .speex) TIMIDITY_OUTPUT_ID=S ;; .gogo) TIMIDITY_OUTPUT_ID=g ;; .jack) TIMIDITY_OUTPUT_ID=j ;; *) TIMIDITY_OUTPUT_ID= ;; esac echo "$as_me:$LINENO: result: $DEFAULT_PLAYMODE/$TIMIDITY_OUTPUT_ID" >&5 echo "${ECHO_T}$DEFAULT_PLAYMODE/$TIMIDITY_OUTPUT_ID" >&6 # # Interface Section # interface_targets='dynamic ncurses slang motif tcltk emacs vt100 xaw xskin gtk alsaseq winsyn winsyng portmidisyng' # Check whether --enable-interface or --disable-interface was given. if test "${enable_interface+set}" = set; then enableval="$enable_interface" for i in `echo $enableval | sed 's/,/ /g'`; do eval "enable_$i=yes" done fi; # Dynamic link configuration # Check whether --enable-dynamic or --disable-dynamic was given. if test "${enable_dynamic+set}" = set; then enableval="$enable_dynamic" if test "x$enable_dynamic" = xyes; then enable_dynamic=dynamic elif test "x$enable_dynamic" != xno; then for i in `echo $enableval | sed 's/,/ /g'`; do eval "enable_$i=dynamic" done fi fi; join_targets= for i in $interface_targets; do eval "join_targets=$join_targets\$enable_$i" done case ".$join_targets" in .*dynamic*) NEEDDLOPEN=yes;; *) NEEDDLOPEN=no;; esac if test "x$GCC" = xyes; then SHCFLAGS="$SHCFLAGS -fPIC"; fi case "x$enable_ump" in xyes|xdynamic) EXTRACFLAGS="$EXTRACFLAGS -DXP_UNIX $SHCFLAGS";; esac if test "$NEEDDLOPEN" = "yes"; then have_dl=no echo "$as_me:$LINENO: checking for LoadLibrary" >&5 echo $ECHO_N "checking for LoadLibrary... $ECHO_C" >&6 if test "${wapi_cv_func_LoadLibrary+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include int main () { LoadLibrary(0); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then wapi_cv_func_LoadLibrary=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 wapi_cv_func_LoadLibrary=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi if eval "test \"`echo '$wapi_cv_func_'LoadLibrary`\" = yes"; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 have_dl=w32 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test $wapi_cv_func_LoadLibrary = yes && have_dl=w32 if test "$have_dl" = "no"; then echo "$as_me:$LINENO: checking for shl_load" >&5 echo $ECHO_N "checking for shl_load... $ECHO_C" >&6 if test "${ac_cv_func_shl_load+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define shl_load to an innocuous variant, in case declares shl_load. For example, HP-UX 11i declares gettimeofday. */ #define shl_load innocuous_shl_load /* System header to define __stub macros and hopefully few prototypes, which can conflict with char shl_load (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef shl_load /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" { #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char shl_load (); /* 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_shl_load) || defined (__stub___shl_load) choke me #else char (*f) () = shl_load; #endif #ifdef __cplusplus } #endif int main () { return f != shl_load; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_shl_load=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_shl_load=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_func_shl_load" >&5 echo "${ECHO_T}$ac_cv_func_shl_load" >&6 if test $ac_cv_func_shl_load = yes; then have_dl=hpux fi fi if test "$have_dl" = "no"; then echo "$as_me:$LINENO: checking for NSLinkModule" >&5 echo $ECHO_N "checking for NSLinkModule... $ECHO_C" >&6 if test "${ac_cv_func_NSLinkModule+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define NSLinkModule to an innocuous variant, in case declares NSLinkModule. For example, HP-UX 11i declares gettimeofday. */ #define NSLinkModule innocuous_NSLinkModule /* System header to define __stub macros and hopefully few prototypes, which can conflict with char NSLinkModule (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef NSLinkModule /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" { #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char NSLinkModule (); /* 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_NSLinkModule) || defined (__stub___NSLinkModule) choke me #else char (*f) () = NSLinkModule; #endif #ifdef __cplusplus } #endif int main () { return f != NSLinkModule; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_NSLinkModule=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_NSLinkModule=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_func_NSLinkModule" >&5 echo "${ECHO_T}$ac_cv_func_NSLinkModule" >&6 if test $ac_cv_func_NSLinkModule = yes; then have_dl=dyld fi fi if test "$have_dl" = "no" -a "x$ac_cv_lib_dl_dlopen" = xyes; then have_dl=dlopen fi if test "$have_dl" = "no"; then echo "$as_me:$LINENO: checking for dlopen" >&5 echo $ECHO_N "checking for dlopen... $ECHO_C" >&6 if test "${ac_cv_func_dlopen+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define dlopen to an innocuous variant, in case declares dlopen. For example, HP-UX 11i declares gettimeofday. */ #define dlopen innocuous_dlopen /* System header to define __stub macros and hopefully few prototypes, which can conflict with char dlopen (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef dlopen /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" { #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char dlopen (); /* 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_dlopen) || defined (__stub___dlopen) choke me #else char (*f) () = dlopen; #endif #ifdef __cplusplus } #endif int main () { return f != dlopen; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_dlopen=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_dlopen=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_func_dlopen" >&5 echo "${ECHO_T}$ac_cv_func_dlopen" >&6 if test $ac_cv_func_dlopen = yes; then have_dl=dlopen fi fi if test "$have_dl" = "no"; then echo "$as_me:$LINENO: checking for dld_init" >&5 echo $ECHO_N "checking for dld_init... $ECHO_C" >&6 if test "${ac_cv_func_dld_init+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define dld_init to an innocuous variant, in case declares dld_init. For example, HP-UX 11i declares gettimeofday. */ #define dld_init innocuous_dld_init /* System header to define __stub macros and hopefully few prototypes, which can conflict with char dld_init (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef dld_init /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" { #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char dld_init (); /* 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_dld_init) || defined (__stub___dld_init) choke me #else char (*f) () = dld_init; #endif #ifdef __cplusplus } #endif int main () { return f != dld_init; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_dld_init=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_dld_init=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_func_dld_init" >&5 echo "${ECHO_T}$ac_cv_func_dld_init" >&6 if test $ac_cv_func_dld_init = yes; then have_dl=dld fi fi if test "$have_dl" = "no"; then echo "$as_me:$LINENO: checking for dld_init in -ldld" >&5 echo $ECHO_N "checking for dld_init in -ldld... $ECHO_C" >&6 if test "${ac_cv_lib_dld_dld_init+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldld $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char dld_init (); int main () { dld_init (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_dld_dld_init=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_dld_dld_init=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_dld_dld_init" >&5 echo "${ECHO_T}$ac_cv_lib_dld_dld_init" >&6 if test $ac_cv_lib_dld_dld_init = yes; then have_dl=dld;lib_dl_opt=-ldld fi fi echo "$as_me:$LINENO: checking dynamic link method" >&5 echo $ECHO_N "checking dynamic link method... $ECHO_C" >&6 case "$have_dl" in dlopen) echo "$as_me:$LINENO: result: use dl_dlopen.c" >&5 echo "${ECHO_T}use dl_dlopen.c" >&6 SYSEXTRAS="$SYSEXTRAS dl_dlopen.c" echo "$as_me:$LINENO: checking whether your dlsym() needs a leading underscore" >&5 echo $ECHO_N "checking whether your dlsym() needs a leading underscore... $ECHO_C" >&6 if test "${timidity_cv_func_dlsym_underscore+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case "$ac_cv_header_dlfcn_h" in yes) i_dlfcn=define;; *) i_dlfcn=undef;; esac cat > dyna.c < fred.c < #$i_dlfcn I_DLFCN #ifdef I_DLFCN #include /* the dynamic linker include file for Sunos/Solaris */ #else #include #include #include #endif extern int fred() ; main() { void * handle ; void * symbol ; #ifndef RTLD_LAZY int mode = 1 ; #else int mode = RTLD_LAZY ; #endif handle = dlopen("./dyna.$so", mode) ; if (handle == NULL) { printf ("1\n") ; fflush (stdout) ; exit(0); } symbol = dlsym(handle, "fred") ; if (symbol == NULL) { /* try putting a leading underscore */ symbol = dlsym(handle, "_fred") ; if (symbol == NULL) { printf ("2\n") ; fflush (stdout) ; exit(0); } printf ("3\n") ; } else printf ("4\n") ; fflush (stdout) ; exit(0); } EOM : Call the object file tmp-dyna.o in case dlext=o. if ${CC-cc} $CFLAGS $SHCFLAGS $CPPFLAGS -c dyna.c > /dev/null 2>&1 && mv dyna.o tmp-dyna.o > /dev/null 2>&1 && $SHLD $SHLDFLAGS -o dyna.$so tmp-dyna.o > /dev/null 2>&1 && ${CC-cc} -o fred $CFLAGS $CPPFLAGS $LDFLAGS fred.c $LIBS $lib_dl_opt > /dev/null 2>&1; then xxx=`./fred` case $xxx in 1) { echo "$as_me:$LINENO: WARNING: Test program failed using dlopen. Perhaps you should not use dynamic loading." >&5 echo "$as_me: WARNING: Test program failed using dlopen. Perhaps you should not use dynamic loading." >&2;} ;; 2) { echo "$as_me:$LINENO: WARNING: Test program failed using dlsym. Perhaps you should not use dynamic loading." >&5 echo "$as_me: WARNING: Test program failed using dlsym. Perhaps you should not use dynamic loading." >&2;} ;; 3) timidity_cv_func_dlsym_underscore=yes ;; 4) timidity_cv_func_dlsym_underscore=no ;; esac else { echo "$as_me:$LINENO: WARNING: I can't compile and run the test program." >&5 echo "$as_me: WARNING: I can't compile and run the test program." >&2;} fi rm -f dyna.c dyna.o dyna.$so tmp-dyna.o fred.c fred.o fred fi case "x$timidity_cv_func_dlsym_underscore" in xyes) cat >>confdefs.h <<\_ACEOF #define DLSYM_NEEDS_UNDERSCORE 1 _ACEOF echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 ;; xno) echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 ;; esac ;; dld) echo "$as_me:$LINENO: result: use dl_dld.c" >&5 echo "${ECHO_T}use dl_dld.c" >&6 SYSEXTRAS="$SYSEXTRAS dl_dld.c" ;; hpux) echo "$as_me:$LINENO: result: use dl_hpux.c" >&5 echo "${ECHO_T}use dl_hpux.c" >&6 SYSEXTRAS="$SYSEXTRAS dl_hpux.c" LDFLAGS="$LDFLAGS -Wl,-E $LDFLAGS" ;; w32) echo "$as_me:$LINENO: result: use dl_w32.c" >&5 echo "${ECHO_T}use dl_w32.c" >&6 SYSEXTRAS="$SYSEXTRAS dl_w32.c" ;; dyld) echo "$as_me:$LINENO: result: use dl_dyld.c" >&5 echo "${ECHO_T}use dl_dyld.c" >&6 SYSEXTRAS="$SYSEXTRAS dl_dyld.c" ;; *) NEEDDLOPEN="no" { echo "$as_me:$LINENO: WARNING: no method to open a shared object" >&5 echo "$as_me: WARNING: no method to open a shared object" >&2;} ;; esac fi if test "$NEEDDLOPEN" = "yes"; then cat >> confdefs.h <>confdefs.h <<_ACEOF #define SHARED_LIB_EXT ".$so" _ACEOF test "x$GCC" = xyes -a "x$timidity_cv_ccoption_rdynamic" = xyes && timidity_LDFLAGS="-rdynamic" fi if test "$NEEDDLOPEN" = "yes"; then NEEDDLOPEN_TRUE= NEEDDLOPEN_FALSE='#' else NEEDDLOPEN_TRUE='#' NEEDDLOPEN_FALSE= fi if false; then ENABLE_NCURSES_TRUE= ENABLE_NCURSES_FALSE='#' else ENABLE_NCURSES_TRUE='#' ENABLE_NCURSES_FALSE= fi # Check whether --enable-ncurses or --disable-ncurses was given. if test "${enable_ncurses+set}" = set; then enableval="$enable_ncurses" case "x$enable_ncurses" in xyes|xdynamic) for ac_header in ncurses.h ncurses/curses.h curses.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if eval "test \"\${$as_ac_Header+set}\" = set"; then echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 else # Is the header compilable? echo "$as_me:$LINENO: checking $ac_header usability" >&5 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 # Is the header present? echo "$as_me:$LINENO: checking $ac_header presence" >&5 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6 # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ------------------------------- ## ## Report this to root@mput.dip.jp ## ## ------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 fi if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done case "$ac_cv_header_curses_h$ac_cv_header_ncurses_curses_h$ac_cv_header_ncurses_h" in *yes*);; *) for i in /usr/include /usr/local/include; do if test -f "$i/ncurses/curses.h" -a -f "$i/ncurses/unctrl.h"; then { echo "$as_me:$LINENO: WARNING: ncurses test is failure. Please check config.h and common.makefile later" >&5 echo "$as_me: WARNING: ncurses test is failure. Please check config.h and common.makefile later" >&2;} CPPFLAGS="$CPPFLAGS -I$i/ncurses" break fi done ;; esac echo "$as_me:$LINENO: checking for initscr in -lncurses" >&5 echo $ECHO_N "checking for initscr in -lncurses... $ECHO_C" >&6 if test "${ac_cv_lib_ncurses_initscr+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lncurses $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char initscr (); int main () { initscr (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_ncurses_initscr=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_ncurses_initscr=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_ncurses_initscr" >&5 echo "${ECHO_T}$ac_cv_lib_ncurses_initscr" >&6 if test $ac_cv_lib_ncurses_initscr = yes; then lib_curses_opt=-lncurses else echo "$as_me:$LINENO: checking for PDC_set_ctrl_break in -lcurses" >&5 echo $ECHO_N "checking for PDC_set_ctrl_break in -lcurses... $ECHO_C" >&6 if test "${ac_cv_lib_curses_PDC_set_ctrl_break+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lcurses $lib_user32_test $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char PDC_set_ctrl_break (); int main () { PDC_set_ctrl_break (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_curses_PDC_set_ctrl_break=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_curses_PDC_set_ctrl_break=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_curses_PDC_set_ctrl_break" >&5 echo "${ECHO_T}$ac_cv_lib_curses_PDC_set_ctrl_break" >&6 if test $ac_cv_lib_curses_PDC_set_ctrl_break = yes; then lib_curses_opt=-lcurses cat >>confdefs.h <<\_ACEOF #define USE_PDCURSES 1 _ACEOF lib_user32_opt="$lib_user32_test" else echo "$as_me:$LINENO: checking for PDC_set_ctrl_break in -lpdcurses" >&5 echo $ECHO_N "checking for PDC_set_ctrl_break in -lpdcurses... $ECHO_C" >&6 if test "${ac_cv_lib_pdcurses_PDC_set_ctrl_break+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lpdcurses $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char PDC_set_ctrl_break (); int main () { PDC_set_ctrl_break (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_pdcurses_PDC_set_ctrl_break=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_pdcurses_PDC_set_ctrl_break=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_pdcurses_PDC_set_ctrl_break" >&5 echo "${ECHO_T}$ac_cv_lib_pdcurses_PDC_set_ctrl_break" >&6 if test $ac_cv_lib_pdcurses_PDC_set_ctrl_break = yes; then lib_curses_opt=-lpdcurses cat >>confdefs.h <<\_ACEOF #define USE_PDCURSES 1 _ACEOF lib_user32_opt="$lib_user32_test" else case "$target" in *openbsd*) echo "$as_me:$LINENO: checking for initscr in -lcurses" >&5 echo $ECHO_N "checking for initscr in -lcurses... $ECHO_C" >&6 if test "${ac_cv_lib_curses_initscr+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lcurses $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char initscr (); int main () { initscr (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_curses_initscr=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_curses_initscr=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_curses_initscr" >&5 echo "${ECHO_T}$ac_cv_lib_curses_initscr" >&6 if test $ac_cv_lib_curses_initscr = yes; then lib_curses_opt=-lcurses else { echo "$as_me:$LINENO: WARNING: ncurses interface is not enabled" >&5 echo "$as_me: WARNING: ncurses interface is not enabled" >&2;} enable_ncurses=no fi ;; *) if test "x$VCPP" = xyes || test "x$BORLANDC" = xyes || test "x$WATCOM_C" = xyes; then lib_curses_opt=libpdcurses.lib cat >>confdefs.h <<\_ACEOF #define USE_PDCURSES 1 _ACEOF else { echo "$as_me:$LINENO: WARNING: ncurses interface is not enabled" >&5 echo "$as_me: WARNING: ncurses interface is not enabled" >&2;} enable_ncurses=no fi ;; esac fi fi fi ;; esac fi; case "x$enable_ncurses" in xyes) cat >> confdefs.h <&5 echo $ECHO_N "checking for SLang_init_tty in -lslang... $ECHO_C" >&6 if test "${ac_cv_lib_slang_SLang_init_tty+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lslang $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char SLang_init_tty (); int main () { SLang_init_tty (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_slang_SLang_init_tty=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_slang_SLang_init_tty=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_slang_SLang_init_tty" >&5 echo "${ECHO_T}$ac_cv_lib_slang_SLang_init_tty" >&6 if test $ac_cv_lib_slang_SLang_init_tty = yes; then : else enable_slang=no { echo "$as_me:$LINENO: WARNING: slang interface is not enabled" >&5 echo "$as_me: WARNING: slang interface is not enabled" >&2;} fi for ac_header in slang/slang.h slang.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if eval "test \"\${$as_ac_Header+set}\" = set"; then echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 else # Is the header compilable? echo "$as_me:$LINENO: checking $ac_header usability" >&5 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 # Is the header present? echo "$as_me:$LINENO: checking $ac_header presence" >&5 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6 # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ------------------------------- ## ## Report this to root@mput.dip.jp ## ## ------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 fi if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done ;; esac fi; case "x$enable_slang" in xyes) cat >> confdefs.h <&5 echo $ECHO_N "checking for initscr in -ltermcap... $ECHO_C" >&6 if test "${ac_cv_lib_termcap_initscr+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ltermcap $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char initscr (); int main () { initscr (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_termcap_initscr=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_termcap_initscr=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_termcap_initscr" >&5 echo "${ECHO_T}$ac_cv_lib_termcap_initscr" >&6 if test $ac_cv_lib_termcap_initscr = yes; then s_so_libs="$s_so_libs -ltermcap" fi ;; *) ;; esac if false; then ENABLE_MOTIF_TRUE= ENABLE_MOTIF_FALSE='#' else ENABLE_MOTIF_TRUE='#' ENABLE_MOTIF_FALSE= fi # Check whether --enable-motif or --disable-motif was given. if test "${enable_motif+set}" = set; then enableval="$enable_motif" case "x$enable_motif" in xyes|xdynamic) if test "x$with_x" != xyes; then { { echo "$as_me:$LINENO: error: motif: --with-x option must be specified" >&5 echo "$as_me: error: motif: --with-x option must be specified" >&2;} { (exit 1); exit 1; }; } fi if test "x$have_xm" != xyes; then { echo "$as_me:$LINENO: WARNING: Motif library is not found." >&5 echo "$as_me: WARNING: Motif library is not found." >&2;} enable_motif=no fi ;; esac fi; case "x$enable_motif" in xyes) cat >> confdefs.h <&5 echo "$as_me: error: tcltk: --with-x option must be specified" >&2;} { (exit 1); exit 1; }; } fi KEEPCPPFLAGS=$CPPFLAGS KEEPLDFLAGS=$LDFLAGS KEEPLIBS=$LIBS CPPFLAGS="$tcl_include_dir $tk_includes $CPPFLAGS" LDFLAGS="$tcl_libdir $tk_libdir $LDFLAGS" LIBS="$LIBS $lib_dl_opt" tcl_lib= tk_lib= for l in tcl tcl8.4 tcl8.3 tcl8.0jp tcl7.6jp tcl80jp tcl76jp tcl8.0 tcl7.6 tcl80 tcl76; do case "x$tcl_lib" in x) as_ac_Lib=`echo "ac_cv_lib_$l''_Tcl_Init" | $as_tr_sh` echo "$as_me:$LINENO: checking for Tcl_Init in -l$l" >&5 echo $ECHO_N "checking for Tcl_Init in -l$l... $ECHO_C" >&6 if eval "test \"\${$as_ac_Lib+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-l$l $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char Tcl_Init (); int main () { Tcl_Init (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then eval "$as_ac_Lib=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_Lib=no" fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Lib'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Lib'}'`" >&6 if test `eval echo '${'$as_ac_Lib'}'` = yes; then tcl_lib=-l$l fi ;; esac done LIBS="$LIBS $tcl_lib" for l in tk tk8.4 tk8.3 tk8.0jp tk4.2jp tk80jp tk42jp tk8.0 tk4.2 tk80 tk42; do case "x$tk_lib" in x) as_ac_Lib=`echo "ac_cv_lib_$l''_Tk_Init" | $as_tr_sh` echo "$as_me:$LINENO: checking for Tk_Init in -l$l" >&5 echo $ECHO_N "checking for Tk_Init in -l$l... $ECHO_C" >&6 if eval "test \"\${$as_ac_Lib+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-l$l $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char Tk_Init (); int main () { Tk_Init (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then eval "$as_ac_Lib=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_Lib=no" fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Lib'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Lib'}'`" >&6 if test `eval echo '${'$as_ac_Lib'}'` = yes; then tk_lib=-l$l fi ;; esac done LIBS=$KEEPLIBS if test "x$tcl_lib" = x -o "x$tk_lib" = x; then CPPFLAGS=$KEEPCPPFLAGS LDFLAGS=$KEEPLDFLAGS enable_tcltk=no { echo "$as_me:$LINENO: WARNING: tcl/tk is not enable" >&5 echo "$as_me: WARNING: tcl/tk is not enable" >&2;} else tcltk_dep='tclIndex' fi ;; esac fi; case "x$enable_tcltk" in xyes) cat >> confdefs.h <> confdefs.h <> confdefs.h <&5 echo "$as_me: error: xaw: --with-x option must be specified" >&2;} { (exit 1); exit 1; }; } fi if test "x$have_xaw" != "xyes" -a "x$have_xaw" != "x3d"; then { echo "$as_me:$LINENO: WARNING: X Athena Widget library is not found." >&5 echo "$as_me: WARNING: X Athena Widget library is not found." >&2;} enable_xaw=no fi ;; esac fi; case "x$enable_xaw" in xyes) cat >> confdefs.h <>confdefs.h <<\_ACEOF #define XAW3D 1 _ACEOF lib_xaw_opt=-lXaw3d else lib_xaw_opt=-lXaw fi INTERFACE_SRCS="$INTERFACE_SRCS xaw_c.c xaw_i.c" ;; xdynamic) dynamic_targets="$dynamic_targets interface_a.\$(so)" if test "x$have_xext" = xyes; then a_so_libs="-lXext -lX11" else a_so_libs="-lX11" fi case "$target" in *darwin*) a_so_libs="$a_so_libs -lcc_dynamic" ;; esac if test "x$have_xprelibs" = xyes; then a_so_libs="-lSM -lICE $a_so_libs" fi if test "x$have_xaw" = xyes; then a_so_libs="-lXaw -lXmu -lXt $a_so_libs" elif test "x$have_xaw" = x3d; then cat >>confdefs.h <<\_ACEOF #define XAW3D 1 _ACEOF a_so_libs="-lXaw3d -lXmu -lXt $a_so_libs" fi a_so_libs="$ldflags_x_opt $a_so_libs" ;; *) ;; esac if test "x$enable_xaw" = "xdynamic"; then ENABLE_DYNAMIC_XAW_TRUE= ENABLE_DYNAMIC_XAW_FALSE='#' else ENABLE_DYNAMIC_XAW_TRUE='#' ENABLE_DYNAMIC_XAW_FALSE= fi if false; then ENABLE_XSKIN_TRUE= ENABLE_XSKIN_FALSE='#' else ENABLE_XSKIN_TRUE='#' ENABLE_XSKIN_FALSE= fi # Check whether --enable-xskin or --disable-xskin was given. if test "${enable_xskin+set}" = set; then enableval="$enable_xskin" case "x$enable_xskin" in xyes|xdynamic) if test "x$with_x" != xyes; then { { echo "$as_me:$LINENO: error: xskin: --with-x option must be specified" >&5 echo "$as_me: error: xskin: --with-x option must be specified" >&2;} { (exit 1); exit 1; }; } fi ;; esac fi; case "x$enable_xskin" in xyes) cat >> confdefs.h <&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_path_PKG_CONFIG+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&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_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_path_PKG_CONFIG" && ac_cv_path_PKG_CONFIG="no" ;; esac fi PKG_CONFIG=$ac_cv_path_PKG_CONFIG if test -n "$PKG_CONFIG"; then echo "$as_me:$LINENO: result: $PKG_CONFIG" >&5 echo "${ECHO_T}$PKG_CONFIG" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi if test x$PKG_CONFIG != xno ; then if pkg-config --atleast-pkgconfig-version 0.7 ; then : else echo *** pkg-config too old; version 0.7 or better required. no_gtk=yes PKG_CONFIG=no fi else no_gtk=yes fi min_gtk_version=2.0.0 echo "$as_me:$LINENO: checking for GTK+ - version >= $min_gtk_version" >&5 echo $ECHO_N "checking for GTK+ - version >= $min_gtk_version... $ECHO_C" >&6 if test x$PKG_CONFIG != xno ; then ## don't try to run the test against uninstalled libtool libs if $PKG_CONFIG --uninstalled $pkg_config_args; then echo "Will use uninstalled version of GTK+ found in PKG_CONFIG_PATH" enable_gtktest=no fi if $PKG_CONFIG --atleast-version $min_gtk_version $pkg_config_args; then : else no_gtk=yes fi fi if test x"$no_gtk" = x ; then GTK_CFLAGS=`$PKG_CONFIG $pkg_config_args --cflags` GTK_LIBS=`$PKG_CONFIG $pkg_config_args --libs` gtk_config_major_version=`$PKG_CONFIG --modversion gtk+-2.0 | \ sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\1/'` gtk_config_minor_version=`$PKG_CONFIG --modversion gtk+-2.0 | \ sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\2/'` gtk_config_micro_version=`$PKG_CONFIG --modversion gtk+-2.0 | \ sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\3/'` if test "x$enable_gtktest" = "xyes" ; then ac_save_CFLAGS="$CFLAGS" ac_save_LIBS="$LIBS" CFLAGS="$CFLAGS $GTK_CFLAGS" LIBS="$GTK_LIBS $LIBS" rm -f conf.gtktest if test "$cross_compiling" = yes; then echo $ac_n "cross compiling; assumed OK... $ac_c" else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include int main () { int major, minor, micro; char *tmp_version; system ("touch conf.gtktest"); /* HP/UX 9 (%@#!) writes to sscanf strings */ tmp_version = g_strdup("$min_gtk_version"); if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { printf("%s, bad version string\n", "$min_gtk_version"); exit(1); } if ((gtk_major_version != $gtk_config_major_version) || (gtk_minor_version != $gtk_config_minor_version) || (gtk_micro_version != $gtk_config_micro_version)) { printf("\n*** 'pkg-config --modversion gtk+-2.0' returned %d.%d.%d, but GTK+ (%d.%d.%d)\n", $gtk_config_major_version, $gtk_config_minor_version, $gtk_config_micro_version, gtk_major_version, gtk_minor_version, gtk_micro_version); printf ("*** was found! If pkg-config was correct, then it is best\n"); printf ("*** to remove the old version of GTK+. You may also be able to fix the error\n"); printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n"); printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n"); printf("*** required on your system.\n"); printf("*** If pkg-config was wrong, set the environment variable PKG_CONFIG_PATH\n"); printf("*** to point to the correct configuration files\n"); } else if ((gtk_major_version != GTK_MAJOR_VERSION) || (gtk_minor_version != GTK_MINOR_VERSION) || (gtk_micro_version != GTK_MICRO_VERSION)) { printf("*** GTK+ header files (version %d.%d.%d) do not match\n", GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION); printf("*** library (version %d.%d.%d)\n", gtk_major_version, gtk_minor_version, gtk_micro_version); } else { if ((gtk_major_version > major) || ((gtk_major_version == major) && (gtk_minor_version > minor)) || ((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_micro_version >= micro))) { return 0; } else { printf("\n*** An old version of GTK+ (%d.%d.%d) was found.\n", gtk_major_version, gtk_minor_version, gtk_micro_version); printf("*** You need a version of GTK+ newer than %d.%d.%d. The latest version of\n", major, minor, micro); printf("*** GTK+ is always available from ftp://ftp.gtk.org.\n"); printf("***\n"); printf("*** If you have already installed a sufficiently new version, this error\n"); printf("*** probably means that the wrong copy of the pkg-config shell script is\n"); printf("*** being found. The easiest way to fix this is to remove the old version\n"); printf("*** of GTK+, but you can also set the PKG_CONFIG environment to point to the\n"); printf("*** correct copy of pkg-config. (In this case, you will have to\n"); printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n"); printf("*** so that the correct libraries are found at run-time))\n"); } } return 1; } _ACEOF rm -f conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) no_gtk=yes fi rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi CFLAGS="$ac_save_CFLAGS" LIBS="$ac_save_LIBS" fi fi if test "x$no_gtk" = x ; then echo "$as_me:$LINENO: result: yes (version $gtk_config_major_version.$gtk_config_minor_version.$gtk_config_micro_version)" >&5 echo "${ECHO_T}yes (version $gtk_config_major_version.$gtk_config_minor_version.$gtk_config_micro_version)" >&6 cat >>confdefs.h <<\_ACEOF #define HAVE_GTK_2 1 _ACEOF else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 if test "$PKG_CONFIG" = "no" ; then echo "*** A new enough version of pkg-config was not found." echo "*** See http://pkgconfig.sourceforge.net" else if test -f conf.gtktest ; then : else echo "*** Could not run GTK+ test program, checking why..." ac_save_CFLAGS="$CFLAGS" ac_save_LIBS="$LIBS" CFLAGS="$CFLAGS $GTK_CFLAGS" LIBS="$LIBS $GTK_LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include int main () { return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version)); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then echo "*** The test program compiled, but did not run. This usually means" echo "*** that the run-time linker is not finding GTK+ or finding the wrong" echo "*** version of GTK+. If it is not finding GTK+, you'll need to set your" echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" echo "*** to the installed location Also, make sure you have run ldconfig if that" echo "*** is required on your system" echo "***" echo "*** If you have an old version installed, it is best to remove it, although" echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 echo "*** The test program failed to compile or link. See the file config.log for the" echo "*** exact error that occured. This usually means GTK+ is incorrectly installed." fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext CFLAGS="$ac_save_CFLAGS" LIBS="$ac_save_LIBS" fi fi GTK_CFLAGS="" GTK_LIBS="" # Check whether --with-gtk-prefix or --without-gtk-prefix was given. if test "${with_gtk_prefix+set}" = set; then withval="$with_gtk_prefix" gtk_config_prefix="$withval" else gtk_config_prefix="" fi; # Check whether --with-gtk-exec-prefix or --without-gtk-exec-prefix was given. if test "${with_gtk_exec_prefix+set}" = set; then withval="$with_gtk_exec_prefix" gtk_config_exec_prefix="$withval" else gtk_config_exec_prefix="" fi; # Check whether --enable-gtktest or --disable-gtktest was given. if test "${enable_gtktest+set}" = set; then enableval="$enable_gtktest" else enable_gtktest=yes fi; for module in . do case "$module" in gthread) gtk_config_args="$gtk_config_args gthread" ;; esac done if test x$gtk_config_exec_prefix != x ; then gtk_config_args="$gtk_config_args --exec-prefix=$gtk_config_exec_prefix" if test x${GTK_CONFIG+set} != xset ; then GTK_CONFIG=$gtk_config_exec_prefix/bin/gtk-config fi fi if test x$gtk_config_prefix != x ; then gtk_config_args="$gtk_config_args --prefix=$gtk_config_prefix" if test x${GTK_CONFIG+set} != xset ; then GTK_CONFIG=$gtk_config_prefix/bin/gtk-config fi fi # Extract the first word of "gtk-config", so it can be a program name with args. set dummy gtk-config; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_path_GTK_CONFIG+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case $GTK_CONFIG in [\\/]* | ?:[\\/]*) ac_cv_path_GTK_CONFIG="$GTK_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_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_GTK_CONFIG="$as_dir/$ac_word$ac_exec_ext" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_path_GTK_CONFIG" && ac_cv_path_GTK_CONFIG="no" ;; esac fi GTK_CONFIG=$ac_cv_path_GTK_CONFIG if test -n "$GTK_CONFIG"; then echo "$as_me:$LINENO: result: $GTK_CONFIG" >&5 echo "${ECHO_T}$GTK_CONFIG" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi min_gtk_version=1.1.3 echo "$as_me:$LINENO: checking for GTK - version >= $min_gtk_version" >&5 echo $ECHO_N "checking for GTK - version >= $min_gtk_version... $ECHO_C" >&6 no_gtk="" if test "$GTK_CONFIG" = "no" ; then no_gtk=yes else GTK_CFLAGS=`$GTK_CONFIG $gtk_config_args --cflags` GTK_LIBS=`$GTK_CONFIG $gtk_config_args --libs` gtk_config_major_version=`$GTK_CONFIG $gtk_config_args --version | \ sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\1/'` gtk_config_minor_version=`$GTK_CONFIG $gtk_config_args --version | \ sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\2/'` gtk_config_micro_version=`$GTK_CONFIG $gtk_config_args --version | \ sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\3/'` if test "x$enable_gtktest" = "xyes" ; then ac_save_CFLAGS="$CFLAGS" ac_save_LIBS="$LIBS" CFLAGS="$CFLAGS $GTK_CFLAGS" LIBS="$GTK_LIBS $LIBS" rm -f conf.gtktest if test "$cross_compiling" = yes; then echo $ac_n "cross compiling; assumed OK... $ac_c" else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include int main () { int major, minor, micro; char *tmp_version; system ("touch conf.gtktest"); /* HP/UX 9 (%@#!) writes to sscanf strings */ tmp_version = g_strdup("$min_gtk_version"); if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { printf("%s, bad version string\n", "$min_gtk_version"); exit(1); } if ((gtk_major_version != $gtk_config_major_version) || (gtk_minor_version != $gtk_config_minor_version) || (gtk_micro_version != $gtk_config_micro_version)) { printf("\n*** 'gtk-config --version' returned %d.%d.%d, but GTK+ (%d.%d.%d)\n", $gtk_config_major_version, $gtk_config_minor_version, $gtk_config_micro_version, gtk_major_version, gtk_minor_version, gtk_micro_version); printf ("*** was found! If gtk-config was correct, then it is best\n"); printf ("*** to remove the old version of GTK+. You may also be able to fix the error\n"); printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n"); printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n"); printf("*** required on your system.\n"); printf("*** If gtk-config was wrong, set the environment variable GTK_CONFIG\n"); printf("*** to point to the correct copy of gtk-config, and remove the file config.cache\n"); printf("*** before re-running configure\n"); } #if defined (GTK_MAJOR_VERSION) && defined (GTK_MINOR_VERSION) && defined (GTK_MICRO_VERSION) else if ((gtk_major_version != GTK_MAJOR_VERSION) || (gtk_minor_version != GTK_MINOR_VERSION) || (gtk_micro_version != GTK_MICRO_VERSION)) { printf("*** GTK+ header files (version %d.%d.%d) do not match\n", GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION); printf("*** library (version %d.%d.%d)\n", gtk_major_version, gtk_minor_version, gtk_micro_version); } #endif /* defined (GTK_MAJOR_VERSION) ... */ else { if ((gtk_major_version > major) || ((gtk_major_version == major) && (gtk_minor_version > minor)) || ((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_micro_version >= micro))) { return 0; } else { printf("\n*** An old version of GTK+ (%d.%d.%d) was found.\n", gtk_major_version, gtk_minor_version, gtk_micro_version); printf("*** You need a version of GTK+ newer than %d.%d.%d. The latest version of\n", major, minor, micro); printf("*** GTK+ is always available from ftp://ftp.gtk.org.\n"); printf("***\n"); printf("*** If you have already installed a sufficiently new version, this error\n"); printf("*** probably means that the wrong copy of the gtk-config shell script is\n"); printf("*** being found. The easiest way to fix this is to remove the old version\n"); printf("*** of GTK+, but you can also set the GTK_CONFIG environment to point to the\n"); printf("*** correct copy of gtk-config. (In this case, you will have to\n"); printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n"); printf("*** so that the correct libraries are found at run-time))\n"); } } return 1; } _ACEOF rm -f conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) no_gtk=yes fi rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi CFLAGS="$ac_save_CFLAGS" LIBS="$ac_save_LIBS" fi fi if test "x$no_gtk" = x ; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 : else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 if test "$GTK_CONFIG" = "no" ; then echo "*** The gtk-config script installed by GTK could not be found" echo "*** If GTK was installed in PREFIX, make sure PREFIX/bin is in" echo "*** your path, or set the GTK_CONFIG environment variable to the" echo "*** full path to gtk-config." else if test -f conf.gtktest ; then : else echo "*** Could not run GTK test program, checking why..." CFLAGS="$CFLAGS $GTK_CFLAGS" LIBS="$LIBS $GTK_LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include int main () { return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version)); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then echo "*** The test program compiled, but did not run. This usually means" echo "*** that the run-time linker is not finding GTK or finding the wrong" echo "*** version of GTK. If it is not finding GTK, you'll need to set your" echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" echo "*** to the installed location Also, make sure you have run ldconfig if that" echo "*** is required on your system" echo "***" echo "*** If you have an old version installed, it is best to remove it, although" echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" echo "***" echo "*** If you have a RedHat 5.0 system, you should remove the GTK package that" echo "*** came with the system with the command" echo "***" echo "*** rpm --erase --nodeps gtk gtk-devel" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 echo "*** The test program failed to compile or link. See the file config.log for the" echo "*** exact error that occured. This usually means GTK was incorrectly installed" echo "*** or that you have moved GTK since it was installed. In the latter case, you" echo "*** may want to edit the gtk-config script: $GTK_CONFIG" fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext CFLAGS="$ac_save_CFLAGS" LIBS="$ac_save_LIBS" fi fi GTK_CFLAGS="" GTK_LIBS="" enable_gtk=no fi rm -f conf.gtktest fi rm -f conf.gtktest ;; esac fi; case "x$enable_gtk" in xyes) cat >> confdefs.h <> confdefs.h <&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 else # Is the header compilable? echo "$as_me:$LINENO: checking $ac_header usability" >&5 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 # Is the header present? echo "$as_me:$LINENO: checking $ac_header presence" >&5 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6 # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ------------------------------- ## ## Report this to root@mput.dip.jp ## ## ------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 fi if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done ;; xdynamic) dynamic_targets="$dynamic_targets interface_r.\$(so)" ;; *) ;; esac if false; then ENABLE_ALSASEQ_TRUE= ENABLE_ALSASEQ_FALSE='#' else ENABLE_ALSASEQ_TRUE='#' ENABLE_ALSASEQ_FALSE= fi # Check whether --enable-alsaseq or --disable-alsaseq was given. if test "${enable_alsaseq+set}" = set; then enableval="$enable_alsaseq" case "x$enable_alsaseq" in xyes|xdynamic) ;; esac fi; case "x$enable_alsaseq" in xyes) cat >> confdefs.h <&5 echo $ECHO_N "checking for ALSA CFLAGS... $ECHO_C" >&6 if test "$alsa_inc_prefix" != "" ; then ALSA_CFLAGS="$ALSA_CFLAGS -I$alsa_inc_prefix" CFLAGS="$CFLAGS -I$alsa_inc_prefix" fi echo "$as_me:$LINENO: result: $ALSA_CFLAGS" >&5 echo "${ECHO_T}$ALSA_CFLAGS" >&6 echo "$as_me:$LINENO: checking for ALSA LDFLAGS" >&5 echo $ECHO_N "checking for ALSA LDFLAGS... $ECHO_C" >&6 if test "$alsa_prefix" != "" ; then ALSA_LIBS="$ALSA_LIBS -L$alsa_prefix" LDFLAGS="$LDFLAGS $ALSA_LIBS" fi ALSA_LIBS="$ALSA_LIBS -lasound -lm -ldl -lpthread" LIBS=`echo $LIBS | sed 's/-lm//'` LIBS=`echo $LIBS | sed 's/-ldl//'` LIBS=`echo $LIBS | sed 's/-lpthread//'` LIBS=`echo $LIBS | sed 's/ //'` LIBS="$ALSA_LIBS $LIBS" echo "$as_me:$LINENO: result: $ALSA_LIBS" >&5 echo "${ECHO_T}$ALSA_LIBS" >&6 min_alsa_version=0.1.1 echo "$as_me:$LINENO: checking for libasound headers version >= $min_alsa_version" >&5 echo $ECHO_N "checking for libasound headers version >= $min_alsa_version... $ECHO_C" >&6 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_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 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* 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 rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then echo "$as_me:$LINENO: result: found." >&5 echo "${ECHO_T}found." >&6 else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* 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 rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then echo "$as_me:$LINENO: result: found." >&5 echo "${ECHO_T}found." >&6 else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 echo "$as_me:$LINENO: result: not present." >&5 echo "${ECHO_T}not present." >&6 echo "$as_me:$LINENO: result: libasound was not found anywhere." >&5 echo "${ECHO_T}libasound was not found anywhere." >&6 alsa_found=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: Sufficiently new version of libasound not found." >&5 echo "${ECHO_T}Sufficiently new version of libasound not found." >&6 fi rm -f 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 echo "$as_me:$LINENO: checking for snd_ctl_open in -lasound" >&5 echo $ECHO_N "checking for snd_ctl_open in -lasound... $ECHO_C" >&6 if test "${ac_cv_lib_asound_snd_ctl_open+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lasound $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char snd_ctl_open (); int main () { snd_ctl_open (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_asound_snd_ctl_open=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_asound_snd_ctl_open=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_asound_snd_ctl_open" >&5 echo "${ECHO_T}$ac_cv_lib_asound_snd_ctl_open" >&6 if test $ac_cv_lib_asound_snd_ctl_open = yes; then cat >>confdefs.h <<_ACEOF #define HAVE_LIBASOUND 1 _ACEOF LIBS="-lasound $LIBS" else echo "$as_me:$LINENO: result: No linkable libasound was found." >&5 echo "${ECHO_T}No linkable libasound was found." >&6 alsa_found=no fi if test "x$alsa_found" = "xyes" ; then : LIBS=`echo $LIBS | sed 's/-lasound//g'` LIBS=`echo $LIBS | sed 's/ //'` LIBS="-lasound $LIBS" else : CFLAGS="$alsa_save_CFLAGS" LDFLAGS="$alsa_save_LDFLAGS" LIBS="$alsa_save_LIBS" ALSA_CFLAGS="" ALSA_LIBS="" fi ;; xdynamic) dynamic_targets="$dynamic_targets interface_A.\$(so)" ;; *) ;; esac if false; then ENABLE_WINSYN_TRUE= ENABLE_WINSYN_FALSE='#' else ENABLE_WINSYN_TRUE='#' ENABLE_WINSYN_FALSE= fi # Check whether --enable-winsyn or --disable-winsyn was given. if test "${enable_winsyn+set}" = set; then enableval="$enable_winsyn" case "x$enable_winsyn" in xyes|xdynamic) ;; esac fi; case "x$enable_winsyn" in xyes) cat >> confdefs.h <> confdefs.h <> confdefs.h <> confdefs.h <&5 echo "$as_me: error: UMP Package is not exists. Can't configure it." >&2;} { (exit 1); exit 1; }; } fi if test "${ac_cv_header_X11_xpm_h+set}" = set; then echo "$as_me:$LINENO: checking for X11/xpm.h" >&5 echo $ECHO_N "checking for X11/xpm.h... $ECHO_C" >&6 if test "${ac_cv_header_X11_xpm_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi echo "$as_me:$LINENO: result: $ac_cv_header_X11_xpm_h" >&5 echo "${ECHO_T}$ac_cv_header_X11_xpm_h" >&6 else # Is the header compilable? echo "$as_me:$LINENO: checking X11/xpm.h usability" >&5 echo $ECHO_N "checking X11/xpm.h usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 # Is the header present? echo "$as_me:$LINENO: checking X11/xpm.h presence" >&5 echo $ECHO_N "checking X11/xpm.h presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6 # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: X11/xpm.h: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: X11/xpm.h: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: X11/xpm.h: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: X11/xpm.h: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: X11/xpm.h: present but cannot be compiled" >&5 echo "$as_me: WARNING: X11/xpm.h: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: X11/xpm.h: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: X11/xpm.h: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: X11/xpm.h: see the Autoconf documentation" >&5 echo "$as_me: WARNING: X11/xpm.h: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: X11/xpm.h: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: X11/xpm.h: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: X11/xpm.h: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: X11/xpm.h: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: X11/xpm.h: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: X11/xpm.h: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ------------------------------- ## ## Report this to root@mput.dip.jp ## ## ------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac echo "$as_me:$LINENO: checking for X11/xpm.h" >&5 echo $ECHO_N "checking for X11/xpm.h... $ECHO_C" >&6 if test "${ac_cv_header_X11_xpm_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_header_X11_xpm_h=$ac_header_preproc fi echo "$as_me:$LINENO: result: $ac_cv_header_X11_xpm_h" >&5 echo "${ECHO_T}$ac_cv_header_X11_xpm_h" >&6 fi if test $ac_cv_header_X11_xpm_h = yes; then : else { { echo "$as_me:$LINENO: error: UMP Package needs xpm.h, but could not find it." >&5 echo "$as_me: error: UMP Package needs xpm.h, but could not find it." >&2;} { (exit 1); exit 1; }; } fi echo "$as_me:$LINENO: checking for XpmCreatePixmapFromData in -lXpm" >&5 echo $ECHO_N "checking for XpmCreatePixmapFromData in -lXpm... $ECHO_C" >&6 if test "${ac_cv_lib_Xpm_XpmCreatePixmapFromData+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lXpm $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char XpmCreatePixmapFromData (); int main () { XpmCreatePixmapFromData (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_Xpm_XpmCreatePixmapFromData=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_Xpm_XpmCreatePixmapFromData=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_Xpm_XpmCreatePixmapFromData" >&5 echo "${ECHO_T}$ac_cv_lib_Xpm_XpmCreatePixmapFromData" >&6 if test $ac_cv_lib_Xpm_XpmCreatePixmapFromData = yes; then : else { { echo "$as_me:$LINENO: error: UMP Package needs libXpm.a, but could not find it." >&5 echo "$as_me: error: UMP Package needs libXpm.a, but could not find it." >&2;} { (exit 1); exit 1; }; } fi if test "x$have_xext" = xyes; then lib_xext_opt=-lXext fi if test "x$have_xprelibs" = xyes; then lib_xprelibs_opt='-lSM -lICE' fi lib_xmu_opt=-lXmu lib_xt_opt=-lXt ;; esac fi; case "x$enable_ump" in xyes) cat >> confdefs.h <&5 echo $ECHO_N "checking for DndInitialize in -lDnd... $ECHO_C" >&6 if test "${ac_cv_lib_Dnd_DndInitialize+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lDnd $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char DndInitialize (); int main () { DndInitialize (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_Dnd_DndInitialize=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_Dnd_DndInitialize=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_Dnd_DndInitialize" >&5 echo "${ECHO_T}$ac_cv_lib_Dnd_DndInitialize" >&6 if test $ac_cv_lib_Dnd_DndInitialize = yes; then LIBS=$KEEPLIBS lib_offix_opt="-lDnd" cat >>confdefs.h <<\_ACEOF #define OFFIX 1 _ACEOF else LDFLAGS=$KEEPLDFLAGS CPPFLAGS=$KEEPCPPFLAGS LIBS=$KEEPLIBS fi fi fi; # Check whether --enable-network or --disable-network was given. if test "${enable_network+set}" = set; then enableval="$enable_network" if test "$enableval" = "yes"; then cat >>confdefs.h <<\_ACEOF #define SUPPORT_SOCKET 1 _ACEOF fi fi; if test "x$enable_network" = "xyes"; then ENABLE_NETWORK_TRUE= ENABLE_NETWORK_FALSE='#' else ENABLE_NETWORK_TRUE='#' ENABLE_NETWORK_FALSE= fi # Check whether --enable-spectrogram or --disable-spectrogram was given. if test "${enable_spectrogram+set}" = set; then enableval="$enable_spectrogram" if test "$enableval" = "yes"; then if test "x$with_x" != xyes; then { { echo "$as_me:$LINENO: error: spectrogram: --with-x option must be specified" >&5 echo "$as_me: error: spectrogram: --with-x option must be specified" >&2;} { (exit 1); exit 1; }; } fi cat >>confdefs.h <<\_ACEOF #define SUPPORT_SOUNDSPEC 1 _ACEOF fi fi; if test "x$enable_spectrogram" = "xyes"; then ENABLE_SOUND_SPEC_TRUE= ENABLE_SOUND_SPEC_FALSE='#' else ENABLE_SOUND_SPEC_TRUE='#' ENABLE_SOUND_SPEC_FALSE= fi # Check whether --enable-spline or --disable-spline was given. if test "${enable_spline+set}" = set; then enableval="$enable_spline" case "x$enableval" in xlinear) cat >>confdefs.h <<\_ACEOF #define DEFAULT_RESAMPLATION resample_linear _ACEOF ;; xcubic) cat >>confdefs.h <<\_ACEOF #define DEFAULT_RESAMPLATION resample_cspline _ACEOF ;; xlagrange) cat >>confdefs.h <<\_ACEOF #define DEFAULT_RESAMPLATION resample_lagrange _ACEOF ;; xnewton) cat >>confdefs.h <<\_ACEOF #define DEFAULT_RESAMPLATION resample_newton _ACEOF ;; xgauss) cat >>confdefs.h <<\_ACEOF #define DEFAULT_RESAMPLATION resample_gauss _ACEOF ;; xno) cat >>confdefs.h <<\_ACEOF #define DEFAULT_RESAMPLATION resample_none _ACEOF ;; *) { { echo "$as_me:$LINENO: error: Invalid method of --enable-spline" >&5 echo "$as_me: error: Invalid method of --enable-spline" >&2;} { (exit 1); exit 1; }; } ;; esac fi; # Check whether --enable-wrd or --disable-wrd was given. if test "${enable_wrd+set}" = set; then enableval="$enable_wrd" if test "$enableval" = "yes"; then if test "x$with_x" != xyes; then { { echo "$as_me:$LINENO: error: wrd: --with-x option must be specified" >&5 echo "$as_me: error: wrd: --with-x option must be specified" >&2;} { (exit 1); exit 1; }; } fi cat >>confdefs.h <<\_ACEOF #define WRDT_X 1 _ACEOF enable_sherry_wrd=yes echo "$as_me:$LINENO: checking for zlibVersion in -lz" >&5 echo $ECHO_N "checking for zlibVersion in -lz... $ECHO_C" >&6 if test "${ac_cv_lib_z_zlibVersion+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lz $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char zlibVersion (); int main () { zlibVersion (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_z_zlibVersion=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_z_zlibVersion=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_z_zlibVersion" >&5 echo "${ECHO_T}$ac_cv_lib_z_zlibVersion" >&6 if test $ac_cv_lib_z_zlibVersion = yes; then : else enable_sherry_wrd=no fi if test "${ac_cv_header_png_h+set}" = set; then echo "$as_me:$LINENO: checking for png.h" >&5 echo $ECHO_N "checking for png.h... $ECHO_C" >&6 if test "${ac_cv_header_png_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi echo "$as_me:$LINENO: result: $ac_cv_header_png_h" >&5 echo "${ECHO_T}$ac_cv_header_png_h" >&6 else # Is the header compilable? echo "$as_me:$LINENO: checking png.h usability" >&5 echo $ECHO_N "checking png.h usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 # Is the header present? echo "$as_me:$LINENO: checking png.h presence" >&5 echo $ECHO_N "checking png.h presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6 # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: png.h: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: png.h: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: png.h: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: png.h: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: png.h: present but cannot be compiled" >&5 echo "$as_me: WARNING: png.h: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: png.h: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: png.h: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: png.h: see the Autoconf documentation" >&5 echo "$as_me: WARNING: png.h: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: png.h: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: png.h: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: png.h: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: png.h: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: png.h: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: png.h: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ------------------------------- ## ## Report this to root@mput.dip.jp ## ## ------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac echo "$as_me:$LINENO: checking for png.h" >&5 echo $ECHO_N "checking for png.h... $ECHO_C" >&6 if test "${ac_cv_header_png_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_header_png_h=$ac_header_preproc fi echo "$as_me:$LINENO: result: $ac_cv_header_png_h" >&5 echo "${ECHO_T}$ac_cv_header_png_h" >&6 fi if test $ac_cv_header_png_h = yes; then : else enable_sherry_wrd=no fi echo "$as_me:$LINENO: checking for png_init_io in -lpng" >&5 echo $ECHO_N "checking for png_init_io in -lpng... $ECHO_C" >&6 if test "${ac_cv_lib_png_png_init_io+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lpng -lz $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char png_init_io (); int main () { png_init_io (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_png_png_init_io=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_png_png_init_io=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_png_png_init_io" >&5 echo "${ECHO_T}$ac_cv_lib_png_png_init_io" >&6 if test $ac_cv_lib_png_png_init_io = yes; then : else enable_sherry_wrd=no fi if test "$enable_sherry_wrd" = yes; then cat >>confdefs.h <<\_ACEOF #define ENABLE_SHERRY 1 _ACEOF lib_zip_opt=-lz lib_png_opt=-lpng else { echo "$as_me:$LINENO: WARNING: Sherry WRD is disabled: png.h, libpng.a, libz.a are required" >&5 echo "$as_me: WARNING: Sherry WRD is disabled: png.h, libpng.a, libz.a are required" >&2;} fi if test "x$have_xext" = xyes; then lib_xext_opt=-lXext fi fi fi; # # Finish up # if test "x$enable_wrd" = "xyes"; then ENABLE_WRD_TRUE= ENABLE_WRD_FALSE='#' else ENABLE_WRD_TRUE='#' ENABLE_WRD_FALSE= fi if test "x$CYGNUS" = xyes; then CYGNUS_TRUE= CYGNUS_FALSE='#' else CYGNUS_TRUE='#' CYGNUS_FALSE= fi if test "x$MSYS" = xyes; then MSYS_TRUE= MSYS_FALSE='#' else MSYS_TRUE='#' MSYS_FALSE= fi if test "x$VCPP" = xyes; then VCPP_TRUE= VCPP_FALSE='#' else VCPP_TRUE='#' VCPP_FALSE= fi if test "x$BORLANDC" = xyes; then BORLANDC_TRUE= BORLANDC_FALSE='#' else BORLANDC_TRUE='#' BORLANDC_FALSE= fi if test "x$WATCOM_C" = xyes; then WATCOM_C_TRUE= WATCOM_C_FALSE='#' else WATCOM_C_TRUE='#' WATCOM_C_FALSE= fi if test "x$W32READDIR" = "xyes"; then W32READDIR_TRUE= W32READDIR_FALSE='#' else W32READDIR_TRUE='#' W32READDIR_FALSE= fi rm -f wordtmp >/dev/null 2>&1 val='' for f in $LDFLAGS; do if $contains "^$f"'$' wordtmp >/dev/null 2>&1; then : else echo $f >>wordtmp; val="$val $f" fi done LDFLAGS="$val" rm -f wordtmp >/dev/null 2>&1 rm -f wordtmp >/dev/null 2>&1 val='' for f in $SHLDFLAGS; do if $contains "^$f"'$' wordtmp >/dev/null 2>&1; then : else echo $f >>wordtmp; val="$val $f" fi done SHLDFLAGS="$val" rm -f wordtmp >/dev/null 2>&1 rm -f wordtmp >/dev/null 2>&1 val='' for f in $EXTRACFLAGS $CFLAGS; do if $contains "^$f"'$' wordtmp >/dev/null 2>&1; then : else echo $f >>wordtmp; val="$val $f" fi done CFLAGS="$val" rm -f wordtmp >/dev/null 2>&1 rm -f wordtmp >/dev/null 2>&1 val='' for f in $CPPFLAGS $EXTRADEFS; do if $contains "^$f"'$' wordtmp >/dev/null 2>&1; then : else echo $f >>wordtmp; val="$val $f" fi done CPPFLAGS="$val" rm -f wordtmp >/dev/null 2>&1 if test "x$oss_device" != x; then cat >>confdefs.h <<_ACEOF #define OSS_DEVICE "$oss_device" _ACEOF fi if test "x$TIMIDITY_OUTPUT_ID" != x; then cat >>confdefs.h <<_ACEOF #define TIMIDITY_OUTPUT_ID "$TIMIDITY_OUTPUT_ID" _ACEOF fi if test "x$with_x" = xyes; then LIBS=`echo $LIBS | sed "s/-lX11/$lib_offix_opt $lib_xm_opt $lib_xaw_opt $lib_xmu_opt $lib_xt_opt $lib_xprelibs_opt $lib_xext_opt -lX11/"` fi LIBS="$LIBS $lib_dl_opt $lib_png_opt $lib_zip_opt $lib_user32_opt $lib_w32gui_opt $EXTRALIBS" SHLD="$SHLD $SHLDFLAGS" ac_config_files="$ac_config_files Makefile autoconf/Makefile common.makefile configs/Makefile doc/Makefile doc/C/Makefile doc/ja_JP.eucJP/Makefile interface/Makefile interface/motif_bitmaps/Makefile interface/bitmaps/Makefile interface/pixmaps/Makefile libarc/Makefile libunimod/Makefile timidity/Makefile utils/Makefile script/Makefile TiMidity.ad TiMidity-uj.ad" 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, don't put newlines in cache variables' values. # 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. { (set) 2>&1 | case `(ac_space=' '; set | grep ac_space) 2>&1` in *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 \ "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" ;; esac; } | sed ' t clear : clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ : end' >>confcache if diff $cache_file confcache >/dev/null 2>&1; then :; else if test -w $cache_file; then test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file" cat confcache >$cache_file else echo "not updating unwritable cache $cache_file" 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}' # VPATH may cause trouble with some makes, so we remove $(srcdir), # ${srcdir} and @srcdir@ 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[ ]*=/{ s/:*\$(srcdir):*/:/; s/:*\${srcdir}:*/:/; s/:*@srcdir@:*/:/; s/^\([^=]*=[ ]*\):*/\1/; s/:*$//; s/^[^=]*=[ ]*$//; }' fi DEFS=-DHAVE_CONFIG_H ac_libobjs= ac_ltlibobjs= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_i=`echo "$ac_i" | sed 's/\$U\././;s/\.o$//;s/\.obj$//'` # 2. Add them. ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext" ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"MAINTAINER_MODE\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"MAINTAINER_MODE\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"AMDEP\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"AMDEP\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${NEEDGETOPT_TRUE}" && test -z "${NEEDGETOPT_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"NEEDGETOPT\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"NEEDGETOPT\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${NEEDDLOPEN_TRUE}" && test -z "${NEEDDLOPEN_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"NEEDDLOPEN\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"NEEDDLOPEN\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${ENABLE_NCURSES_TRUE}" && test -z "${ENABLE_NCURSES_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"ENABLE_NCURSES\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"ENABLE_NCURSES\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${ENABLE_NCURSES_TRUE}" && test -z "${ENABLE_NCURSES_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"ENABLE_NCURSES\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"ENABLE_NCURSES\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${ENABLE_SLANG_TRUE}" && test -z "${ENABLE_SLANG_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"ENABLE_SLANG\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"ENABLE_SLANG\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${ENABLE_SLANG_TRUE}" && test -z "${ENABLE_SLANG_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"ENABLE_SLANG\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"ENABLE_SLANG\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${ENABLE_MOTIF_TRUE}" && test -z "${ENABLE_MOTIF_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"ENABLE_MOTIF\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"ENABLE_MOTIF\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${ENABLE_MOTIF_TRUE}" && test -z "${ENABLE_MOTIF_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"ENABLE_MOTIF\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"ENABLE_MOTIF\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${ENABLE_TCLTK_TRUE}" && test -z "${ENABLE_TCLTK_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"ENABLE_TCLTK\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"ENABLE_TCLTK\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${ENABLE_TCLTK_TRUE}" && test -z "${ENABLE_TCLTK_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"ENABLE_TCLTK\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"ENABLE_TCLTK\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${ENABLE_DYNAMIC_TCLTK_TRUE}" && test -z "${ENABLE_DYNAMIC_TCLTK_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"ENABLE_DYNAMIC_TCLTK\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"ENABLE_DYNAMIC_TCLTK\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${ENABLE_EMACS_TRUE}" && test -z "${ENABLE_EMACS_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"ENABLE_EMACS\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"ENABLE_EMACS\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${ENABLE_EMACS_TRUE}" && test -z "${ENABLE_EMACS_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"ENABLE_EMACS\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"ENABLE_EMACS\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${ENABLE_VT100_TRUE}" && test -z "${ENABLE_VT100_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"ENABLE_VT100\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"ENABLE_VT100\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${ENABLE_VT100_TRUE}" && test -z "${ENABLE_VT100_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"ENABLE_VT100\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"ENABLE_VT100\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${ENABLE_XAW_TRUE}" && test -z "${ENABLE_XAW_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"ENABLE_XAW\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"ENABLE_XAW\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${ENABLE_XAW_TRUE}" && test -z "${ENABLE_XAW_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"ENABLE_XAW\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"ENABLE_XAW\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${ENABLE_DYNAMIC_XAW_TRUE}" && test -z "${ENABLE_DYNAMIC_XAW_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"ENABLE_DYNAMIC_XAW\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"ENABLE_DYNAMIC_XAW\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${ENABLE_XSKIN_TRUE}" && test -z "${ENABLE_XSKIN_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"ENABLE_XSKIN\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"ENABLE_XSKIN\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${ENABLE_XSKIN_TRUE}" && test -z "${ENABLE_XSKIN_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"ENABLE_XSKIN\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"ENABLE_XSKIN\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${ENABLE_GTK_TRUE}" && test -z "${ENABLE_GTK_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"ENABLE_GTK\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"ENABLE_GTK\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${ENABLE_GTK_TRUE}" && test -z "${ENABLE_GTK_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"ENABLE_GTK\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"ENABLE_GTK\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${ENABLE_SERVER_TRUE}" && test -z "${ENABLE_SERVER_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"ENABLE_SERVER\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"ENABLE_SERVER\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${ENABLE_SERVER_TRUE}" && test -z "${ENABLE_SERVER_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"ENABLE_SERVER\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"ENABLE_SERVER\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${ENABLE_ALSASEQ_TRUE}" && test -z "${ENABLE_ALSASEQ_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"ENABLE_ALSASEQ\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"ENABLE_ALSASEQ\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${ENABLE_ALSASEQ_TRUE}" && test -z "${ENABLE_ALSASEQ_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"ENABLE_ALSASEQ\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"ENABLE_ALSASEQ\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${ENABLE_WINSYN_TRUE}" && test -z "${ENABLE_WINSYN_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"ENABLE_WINSYN\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"ENABLE_WINSYN\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${ENABLE_WINSYN_TRUE}" && test -z "${ENABLE_WINSYN_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"ENABLE_WINSYN\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"ENABLE_WINSYN\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${ENABLE_PORTMIDISYN_TRUE}" && test -z "${ENABLE_PORTMIDISYN_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"ENABLE_PORTMIDISYN\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"ENABLE_PORTMIDISYN\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${ENABLE_PORTMIDISYN_TRUE}" && test -z "${ENABLE_PORTMIDISYN_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"ENABLE_PORTMIDISYN\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"ENABLE_PORTMIDISYN\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${ENABLE_W32G_SYN_TRUE}" && test -z "${ENABLE_W32G_SYN_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"ENABLE_W32G_SYN\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"ENABLE_W32G_SYN\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${ENABLE_W32G_SYN_TRUE}" && test -z "${ENABLE_W32G_SYN_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"ENABLE_W32G_SYN\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"ENABLE_W32G_SYN\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${ENABLE_W32GUI_TRUE}" && test -z "${ENABLE_W32GUI_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"ENABLE_W32GUI\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"ENABLE_W32GUI\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${ENABLE_W32GUI_TRUE}" && test -z "${ENABLE_W32GUI_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"ENABLE_W32GUI\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"ENABLE_W32GUI\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${ENABLE_PLUGIN_TRUE}" && test -z "${ENABLE_PLUGIN_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"ENABLE_PLUGIN\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"ENABLE_PLUGIN\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${ENABLE_PLUGIN_TRUE}" && test -z "${ENABLE_PLUGIN_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"ENABLE_PLUGIN\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"ENABLE_PLUGIN\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${ENABLE_NETWORK_TRUE}" && test -z "${ENABLE_NETWORK_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"ENABLE_NETWORK\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"ENABLE_NETWORK\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${ENABLE_SOUND_SPEC_TRUE}" && test -z "${ENABLE_SOUND_SPEC_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"ENABLE_SOUND_SPEC\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"ENABLE_SOUND_SPEC\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${ENABLE_WRD_TRUE}" && test -z "${ENABLE_WRD_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"ENABLE_WRD\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"ENABLE_WRD\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${CYGNUS_TRUE}" && test -z "${CYGNUS_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"CYGNUS\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"CYGNUS\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${MSYS_TRUE}" && test -z "${MSYS_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"MSYS\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"MSYS\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${VCPP_TRUE}" && test -z "${VCPP_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"VCPP\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"VCPP\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${BORLANDC_TRUE}" && test -z "${BORLANDC_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"BORLANDC\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"BORLANDC\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${WATCOM_C_TRUE}" && test -z "${WATCOM_C_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"WATCOM_C\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"WATCOM_C\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${W32READDIR_TRUE}" && test -z "${W32READDIR_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"W32READDIR\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"W32READDIR\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi : ${CONFIG_STATUS=./config.status} ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 echo "$as_me: creating $CONFIG_STATUS" >&6;} cat >$CONFIG_STATUS <<_ACEOF #! $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} _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF ## --------------------- ## ## M4sh Initialization. ## ## --------------------- ## # Be Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then set -o posix fi DUALCASE=1; export DUALCASE # for MKS sh # Support unset when possible. if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # Work around bugs in pre-3.0 UWIN ksh. $as_unset ENV MAIL MAILPATH PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. for as_var in \ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ LC_TELEPHONE LC_TIME do if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then eval $as_var=C; export $as_var else $as_unset $as_var fi done # Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1; 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 # Name of the executable. as_me=`$as_basename "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)$' \| \ . : '\(.\)' 2>/dev/null || echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } /^X\/\(\/\/\)$/{ s//\1/; q; } /^X\/\(\/\).*/{ s//\1/; q; } s/.*/./; q'` # PATH needs CR, and LINENO needs CR and PATH. # 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 # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then echo "#! /bin/sh" >conf$$.sh echo "exit 0" >>conf$$.sh chmod +x conf$$.sh if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: fi rm -f conf$$.sh fi as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" || { # Find who we are. Look in the path if we contain no path at all # relative or not. 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 ;; 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 { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5 echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;} { (exit 1); exit 1; }; } fi case $CONFIG_SHELL in '') as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for as_base in sh bash ksh sh5; do case $as_dir in /*) if ("$as_dir/$as_base" -c ' as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } CONFIG_SHELL=$as_dir/$as_base export CONFIG_SHELL exec "$CONFIG_SHELL" "$0" ${1+"$@"} fi;; esac done done ;; esac # Create $as_me.lineno as a copy of $as_myself, but with $LINENO # uniformly replaced by the line number. The first 'sed' inserts a # line-number line before each line; the second 'sed' does the real # work. The second script uses 'N' to pair each line-number line # with the numbered line, and appends trailing '-' during # substitution so that $LINENO is not a special case at line end. # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) sed '=' <$as_myself | sed ' N s,$,-, : loop s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, t loop s,-$,, s,^['$as_cr_digits']*\n,, ' >$as_me.lineno && chmod +x $as_me.lineno || { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5 echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;} { (exit 1); exit 1; }; } # 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 sensible to this). . ./$as_me.lineno # Exit status is that of the last command. exit } case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in *c*,-n*) ECHO_N= ECHO_C=' ' ECHO_T=' ' ;; *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; *) ECHO_N= ECHO_C='\c' ECHO_T= ;; esac if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file echo >conf$$.file if ln -s conf$$.file conf$$ 2>/dev/null; then # We could just check for DJGPP; but this test a) works b) is more generic # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). if test -f conf$$.exe; then # Don't use ln at all; we don't have any links as_ln_s='cp -p' else as_ln_s='ln -s' fi elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.file if mkdir -p . 2>/dev/null; then as_mkdir_p=: else test -d ./-p && rmdir ./-p as_mkdir_p=false fi as_executable_p="test -f" # 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'" # IFS # We need space, tab and new line, in precisely that order. as_nl=' ' IFS=" $as_nl" # CDPATH. $as_unset CDPATH exec 6>&1 # Open the log real soon, to keep \$[0] and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. Logging --version etc. is OK. exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX } >&5 cat >&5 <<_CSEOF This file was extended by TiMidity++ $as_me 2.13.2, which was generated by GNU Autoconf 2.59. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ _CSEOF echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5 echo >&5 _ACEOF # Files that config.status was made for. if test -n "$ac_config_files"; then echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS fi if test -n "$ac_config_headers"; then echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS fi if test -n "$ac_config_links"; then echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS fi if test -n "$ac_config_commands"; then echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS fi cat >>$CONFIG_STATUS <<\_ACEOF ac_cs_usage="\ \`$as_me' instantiates files from templates according to the current configuration. Usage: $0 [OPTIONS] [FILE]... -h, --help print this help, then exit -V, --version print version number, then exit -q, --quiet 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 ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ TiMidity++ config.status 2.13.2 configured by $0, generated by GNU Autoconf 2.59, with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" Copyright (C) 2003 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." srcdir=$srcdir INSTALL="$INSTALL" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # If no file are specified by the user, then we need to provide default # value. By we need to know if files were specified by the user. 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=$1 ac_optarg=$2 ac_shift=shift ;; *) # This is not an option, so the user has probably given explicit # arguments. ac_option=$1 ac_need_defaults=false;; esac case $ac_option in # Handling of the options. _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --vers* | -V ) echo "$ac_cs_version"; exit 0 ;; --he | --h) # Conflict between --help and --header { { echo "$as_me:$LINENO: error: ambiguous option: $1 Try \`$0 --help' for more information." >&5 echo "$as_me: error: ambiguous option: $1 Try \`$0 --help' for more information." >&2;} { (exit 1); exit 1; }; };; --help | --hel | -h ) echo "$ac_cs_usage"; exit 0 ;; --debug | --d* | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift CONFIG_FILES="$CONFIG_FILES $ac_optarg" ac_need_defaults=false;; --header | --heade | --head | --hea ) $ac_shift CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg" ac_need_defaults=false;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1 Try \`$0 --help' for more information." >&5 echo "$as_me: error: unrecognized option: $1 Try \`$0 --help' for more information." >&2;} { (exit 1); exit 1; }; } ;; *) ac_config_targets="$ac_config_targets $1" ;; 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 if \$ac_cs_recheck; then echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF # # INIT-COMMANDS section. # AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF for ac_config_target in $ac_config_targets do case "$ac_config_target" in # Handling of arguments. "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;; "autoconf/Makefile" ) CONFIG_FILES="$CONFIG_FILES autoconf/Makefile" ;; "common.makefile" ) CONFIG_FILES="$CONFIG_FILES common.makefile" ;; "configs/Makefile" ) CONFIG_FILES="$CONFIG_FILES configs/Makefile" ;; "doc/Makefile" ) CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;; "doc/C/Makefile" ) CONFIG_FILES="$CONFIG_FILES doc/C/Makefile" ;; "doc/ja_JP.eucJP/Makefile" ) CONFIG_FILES="$CONFIG_FILES doc/ja_JP.eucJP/Makefile" ;; "interface/Makefile" ) CONFIG_FILES="$CONFIG_FILES interface/Makefile" ;; "interface/motif_bitmaps/Makefile" ) CONFIG_FILES="$CONFIG_FILES interface/motif_bitmaps/Makefile" ;; "interface/bitmaps/Makefile" ) CONFIG_FILES="$CONFIG_FILES interface/bitmaps/Makefile" ;; "interface/pixmaps/Makefile" ) CONFIG_FILES="$CONFIG_FILES interface/pixmaps/Makefile" ;; "libarc/Makefile" ) CONFIG_FILES="$CONFIG_FILES libarc/Makefile" ;; "libunimod/Makefile" ) CONFIG_FILES="$CONFIG_FILES libunimod/Makefile" ;; "timidity/Makefile" ) CONFIG_FILES="$CONFIG_FILES timidity/Makefile" ;; "utils/Makefile" ) CONFIG_FILES="$CONFIG_FILES utils/Makefile" ;; "script/Makefile" ) CONFIG_FILES="$CONFIG_FILES script/Makefile" ;; "TiMidity.ad" ) CONFIG_FILES="$CONFIG_FILES TiMidity.ad" ;; "TiMidity-uj.ad" ) CONFIG_FILES="$CONFIG_FILES TiMidity-uj.ad" ;; "depfiles" ) CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; "config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; "interface.h" ) CONFIG_HEADERS="$CONFIG_HEADERS interface.h" ;; *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 echo "$as_me: error: invalid argument: $ac_config_target" >&2;} { (exit 1); exit 1; }; };; 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 to put it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Create a temporary directory, and hook for its removal unless debugging. $debug || { trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0 trap '{ (exit 1); exit 1; }' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" } || { tmp=./confstat$$-$RANDOM (umask 077 && mkdir $tmp) } || { echo "$me: cannot create a temporary directory in ." >&2 { (exit 1); exit 1; } } _ACEOF cat >>$CONFIG_STATUS <<_ACEOF # # CONFIG_FILES section. # # No need to generate the scripts if there are no CONFIG_FILES. # This happens for instance when ./config.status config.h if test -n "\$CONFIG_FILES"; then # Protect against being on the right side of a sed subst in config.status. sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g; s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF s,@SHELL@,$SHELL,;t t s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t s,@exec_prefix@,$exec_prefix,;t t s,@prefix@,$prefix,;t t s,@program_transform_name@,$program_transform_name,;t t s,@bindir@,$bindir,;t t s,@sbindir@,$sbindir,;t t s,@libexecdir@,$libexecdir,;t t s,@datadir@,$datadir,;t t s,@sysconfdir@,$sysconfdir,;t t s,@sharedstatedir@,$sharedstatedir,;t t s,@localstatedir@,$localstatedir,;t t s,@libdir@,$libdir,;t t s,@includedir@,$includedir,;t t s,@oldincludedir@,$oldincludedir,;t t s,@infodir@,$infodir,;t t s,@mandir@,$mandir,;t t s,@build_alias@,$build_alias,;t t s,@host_alias@,$host_alias,;t t s,@target_alias@,$target_alias,;t t s,@DEFS@,$DEFS,;t t s,@ECHO_C@,$ECHO_C,;t t s,@ECHO_N@,$ECHO_N,;t t s,@ECHO_T@,$ECHO_T,;t t s,@LIBS@,$LIBS,;t t s,@build@,$build,;t t s,@build_cpu@,$build_cpu,;t t s,@build_vendor@,$build_vendor,;t t s,@build_os@,$build_os,;t t s,@host@,$host,;t t s,@host_cpu@,$host_cpu,;t t s,@host_vendor@,$host_vendor,;t t s,@host_os@,$host_os,;t t s,@target@,$target,;t t s,@target_cpu@,$target_cpu,;t t s,@target_vendor@,$target_vendor,;t t s,@target_os@,$target_os,;t t s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t s,@INSTALL_DATA@,$INSTALL_DATA,;t t s,@CYGPATH_W@,$CYGPATH_W,;t t s,@PACKAGE@,$PACKAGE,;t t s,@VERSION@,$VERSION,;t t s,@ACLOCAL@,$ACLOCAL,;t t s,@AUTOCONF@,$AUTOCONF,;t t s,@AUTOMAKE@,$AUTOMAKE,;t t s,@AUTOHEADER@,$AUTOHEADER,;t t s,@MAKEINFO@,$MAKEINFO,;t t s,@AMTAR@,$AMTAR,;t t s,@install_sh@,$install_sh,;t t s,@STRIP@,$STRIP,;t t s,@ac_ct_STRIP@,$ac_ct_STRIP,;t t s,@INSTALL_STRIP_PROGRAM@,$INSTALL_STRIP_PROGRAM,;t t s,@AWK@,$AWK,;t t s,@SET_MAKE@,$SET_MAKE,;t t s,@am__leading_dot@,$am__leading_dot,;t t s,@MAINTAINER_MODE_TRUE@,$MAINTAINER_MODE_TRUE,;t t s,@MAINTAINER_MODE_FALSE@,$MAINTAINER_MODE_FALSE,;t t s,@MAINT@,$MAINT,;t t s,@EMACS@,$EMACS,;t t s,@lispdir@,$lispdir,;t t s,@CC@,$CC,;t t s,@CFLAGS@,$CFLAGS,;t t s,@LDFLAGS@,$LDFLAGS,;t t s,@CPPFLAGS@,$CPPFLAGS,;t t s,@ac_ct_CC@,$ac_ct_CC,;t t s,@EXEEXT@,$EXEEXT,;t t s,@OBJEXT@,$OBJEXT,;t t s,@DEPDIR@,$DEPDIR,;t t s,@am__include@,$am__include,;t t s,@am__quote@,$am__quote,;t t s,@AMDEP_TRUE@,$AMDEP_TRUE,;t t s,@AMDEP_FALSE@,$AMDEP_FALSE,;t t s,@AMDEPBACKSLASH@,$AMDEPBACKSLASH,;t t s,@CCDEPMODE@,$CCDEPMODE,;t t s,@am__fastdepCC_TRUE@,$am__fastdepCC_TRUE,;t t s,@am__fastdepCC_FALSE@,$am__fastdepCC_FALSE,;t t s,@CPP@,$CPP,;t t s,@EGREP@,$EGREP,;t t s,@RANLIB@,$RANLIB,;t t s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t s,@LN_S@,$LN_S,;t t s,@X_CFLAGS@,$X_CFLAGS,;t t s,@X_PRE_LIBS@,$X_PRE_LIBS,;t t s,@X_LIBS@,$X_LIBS,;t t s,@X_EXTRA_LIBS@,$X_EXTRA_LIBS,;t t s,@LIBOBJS@,$LIBOBJS,;t t s,@NEEDGETOPT_TRUE@,$NEEDGETOPT_TRUE,;t t s,@NEEDGETOPT_FALSE@,$NEEDGETOPT_FALSE,;t t s,@ALSA_CFLAGS@,$ALSA_CFLAGS,;t t s,@ALSA_LIBS@,$ALSA_LIBS,;t t s,@ARTS_CONFIG@,$ARTS_CONFIG,;t t s,@ARTS_CFLAGS@,$ARTS_CFLAGS,;t t s,@ARTS_LIBS@,$ARTS_LIBS,;t t s,@ESD_CONFIG@,$ESD_CONFIG,;t t s,@ESD_CFLAGS@,$ESD_CFLAGS,;t t s,@ESD_LIBS@,$ESD_LIBS,;t t s,@AO_CFLAGS@,$AO_CFLAGS,;t t s,@AO_LIBS@,$AO_LIBS,;t t s,@VORBIS_CFLAGS@,$VORBIS_CFLAGS,;t t s,@VORBIS_LIBS@,$VORBIS_LIBS,;t t s,@VORBISFILE_LIBS@,$VORBISFILE_LIBS,;t t s,@VORBISENC_LIBS@,$VORBISENC_LIBS,;t t s,@OGG_CFLAGS@,$OGG_CFLAGS,;t t s,@OGG_LIBS@,$OGG_LIBS,;t t s,@LIBFLAC_CFLAGS@,$LIBFLAC_CFLAGS,;t t s,@LIBFLAC_LIBS@,$LIBFLAC_LIBS,;t t s,@LIBOGGFLAC_CFLAGS@,$LIBOGGFLAC_CFLAGS,;t t s,@LIBOGGFLAC_LIBS@,$LIBOGGFLAC_LIBS,;t t s,@NEEDDLOPEN_TRUE@,$NEEDDLOPEN_TRUE,;t t s,@NEEDDLOPEN_FALSE@,$NEEDDLOPEN_FALSE,;t t s,@ENABLE_NCURSES_TRUE@,$ENABLE_NCURSES_TRUE,;t t s,@ENABLE_NCURSES_FALSE@,$ENABLE_NCURSES_FALSE,;t t s,@n_so_libs@,$n_so_libs,;t t s,@ENABLE_SLANG_TRUE@,$ENABLE_SLANG_TRUE,;t t s,@ENABLE_SLANG_FALSE@,$ENABLE_SLANG_FALSE,;t t s,@s_so_libs@,$s_so_libs,;t t s,@ENABLE_MOTIF_TRUE@,$ENABLE_MOTIF_TRUE,;t t s,@ENABLE_MOTIF_FALSE@,$ENABLE_MOTIF_FALSE,;t t s,@m_so_libs@,$m_so_libs,;t t s,@ENABLE_TCLTK_TRUE@,$ENABLE_TCLTK_TRUE,;t t s,@ENABLE_TCLTK_FALSE@,$ENABLE_TCLTK_FALSE,;t t s,@k_so_libs@,$k_so_libs,;t t s,@ENABLE_DYNAMIC_TCLTK_TRUE@,$ENABLE_DYNAMIC_TCLTK_TRUE,;t t s,@ENABLE_DYNAMIC_TCLTK_FALSE@,$ENABLE_DYNAMIC_TCLTK_FALSE,;t t s,@ENABLE_EMACS_TRUE@,$ENABLE_EMACS_TRUE,;t t s,@ENABLE_EMACS_FALSE@,$ENABLE_EMACS_FALSE,;t t s,@e_so_libs@,$e_so_libs,;t t s,@ENABLE_VT100_TRUE@,$ENABLE_VT100_TRUE,;t t s,@ENABLE_VT100_FALSE@,$ENABLE_VT100_FALSE,;t t s,@T_so_libs@,$T_so_libs,;t t s,@ENABLE_XAW_TRUE@,$ENABLE_XAW_TRUE,;t t s,@ENABLE_XAW_FALSE@,$ENABLE_XAW_FALSE,;t t s,@a_so_libs@,$a_so_libs,;t t s,@ENABLE_DYNAMIC_XAW_TRUE@,$ENABLE_DYNAMIC_XAW_TRUE,;t t s,@ENABLE_DYNAMIC_XAW_FALSE@,$ENABLE_DYNAMIC_XAW_FALSE,;t t s,@ENABLE_XSKIN_TRUE@,$ENABLE_XSKIN_TRUE,;t t s,@ENABLE_XSKIN_FALSE@,$ENABLE_XSKIN_FALSE,;t t s,@i_so_libs@,$i_so_libs,;t t s,@ENABLE_GTK_TRUE@,$ENABLE_GTK_TRUE,;t t s,@ENABLE_GTK_FALSE@,$ENABLE_GTK_FALSE,;t t s,@PKG_CONFIG@,$PKG_CONFIG,;t t s,@GTK_CONFIG@,$GTK_CONFIG,;t t s,@GTK_CFLAGS@,$GTK_CFLAGS,;t t s,@GTK_LIBS@,$GTK_LIBS,;t t s,@g_so_libs@,$g_so_libs,;t t s,@ENABLE_SERVER_TRUE@,$ENABLE_SERVER_TRUE,;t t s,@ENABLE_SERVER_FALSE@,$ENABLE_SERVER_FALSE,;t t s,@r_so_libs@,$r_so_libs,;t t s,@ENABLE_ALSASEQ_TRUE@,$ENABLE_ALSASEQ_TRUE,;t t s,@ENABLE_ALSASEQ_FALSE@,$ENABLE_ALSASEQ_FALSE,;t t s,@A_so_libs@,$A_so_libs,;t t s,@ENABLE_WINSYN_TRUE@,$ENABLE_WINSYN_TRUE,;t t s,@ENABLE_WINSYN_FALSE@,$ENABLE_WINSYN_FALSE,;t t s,@W_so_libs@,$W_so_libs,;t t s,@ENABLE_PORTMIDISYN_TRUE@,$ENABLE_PORTMIDISYN_TRUE,;t t s,@ENABLE_PORTMIDISYN_FALSE@,$ENABLE_PORTMIDISYN_FALSE,;t t s,@P_so_libs@,$P_so_libs,;t t s,@ENABLE_W32G_SYN_TRUE@,$ENABLE_W32G_SYN_TRUE,;t t s,@ENABLE_W32G_SYN_FALSE@,$ENABLE_W32G_SYN_FALSE,;t t s,@ENABLE_W32GUI_TRUE@,$ENABLE_W32GUI_TRUE,;t t s,@ENABLE_W32GUI_FALSE@,$ENABLE_W32GUI_FALSE,;t t s,@w_so_libs@,$w_so_libs,;t t s,@ENABLE_PLUGIN_TRUE@,$ENABLE_PLUGIN_TRUE,;t t s,@ENABLE_PLUGIN_FALSE@,$ENABLE_PLUGIN_FALSE,;t t s,@p_so_libs@,$p_so_libs,;t t s,@ENABLE_NETWORK_TRUE@,$ENABLE_NETWORK_TRUE,;t t s,@ENABLE_NETWORK_FALSE@,$ENABLE_NETWORK_FALSE,;t t s,@ENABLE_SOUND_SPEC_TRUE@,$ENABLE_SOUND_SPEC_TRUE,;t t s,@ENABLE_SOUND_SPEC_FALSE@,$ENABLE_SOUND_SPEC_FALSE,;t t s,@ENABLE_WRD_TRUE@,$ENABLE_WRD_TRUE,;t t s,@ENABLE_WRD_FALSE@,$ENABLE_WRD_FALSE,;t t s,@CYGNUS_TRUE@,$CYGNUS_TRUE,;t t s,@CYGNUS_FALSE@,$CYGNUS_FALSE,;t t s,@MSYS_TRUE@,$MSYS_TRUE,;t t s,@MSYS_FALSE@,$MSYS_FALSE,;t t s,@VCPP_TRUE@,$VCPP_TRUE,;t t s,@VCPP_FALSE@,$VCPP_FALSE,;t t s,@BORLANDC_TRUE@,$BORLANDC_TRUE,;t t s,@BORLANDC_FALSE@,$BORLANDC_FALSE,;t t s,@WATCOM_C_TRUE@,$WATCOM_C_TRUE,;t t s,@WATCOM_C_FALSE@,$WATCOM_C_FALSE,;t t s,@W32READDIR_TRUE@,$W32READDIR_TRUE,;t t s,@W32READDIR_FALSE@,$W32READDIR_FALSE,;t t s,@BORLANDC_START@,$BORLANDC_START,;t t s,@BORLANDC_LDFLAGS@,$BORLANDC_LDFLAGS,;t t s,@timidity_LDFLAGS@,$timidity_LDFLAGS,;t t s,@WATCOM_LDFLAGS@,$WATCOM_LDFLAGS,;t t s,@VCPP_LDFLAGS@,$VCPP_LDFLAGS,;t t s,@SYSEXTRAS@,$SYSEXTRAS,;t t s,@EXTRALIBS@,$EXTRALIBS,;t t s,@NETSRCS@,$NETSRCS,;t t s,@ELFILES@,$ELFILES,;t t s,@SHLD@,$SHLD,;t t s,@SHCFLAGS@,$SHCFLAGS,;t t s,@dynamic_targets@,$dynamic_targets,;t t s,@so@,$so,;t t s,@WISH@,$WISH,;t t s,@tcltk_dep@,$tcltk_dep,;t t s,@INTERFACE_SRCS@,$INTERFACE_SRCS,;t t s,@pkgdatadir@,$pkgdatadir,;t t s,@pkglibdir@,$pkglibdir,;t t s,@LTLIBOBJS@,$LTLIBOBJS,;t t CEOF _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # Split the substitutions into bite-sized pieces for seds with # small command number limits, like on Digital OSF/1 and HP-UX. ac_max_sed_lines=48 ac_sed_frag=1 # Number of current file. ac_beg=1 # First line for current file. ac_end=$ac_max_sed_lines # Line after last line for current file. ac_more_lines=: ac_sed_cmds= while $ac_more_lines; do if test $ac_beg -gt 1; then sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag else sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag fi if test ! -s $tmp/subs.frag; then ac_more_lines=false else # The purpose of the label and of the branching condition is to # speed up the sed processing (if there are no `@' at all, there # is no need to browse any of the substitutions). # These are the two extra sed commands mentioned above. (echo ':t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed if test -z "$ac_sed_cmds"; then ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" else ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" fi ac_sed_frag=`expr $ac_sed_frag + 1` ac_beg=$ac_end ac_end=`expr $ac_end + $ac_max_sed_lines` fi done if test -z "$ac_sed_cmds"; then ac_sed_cmds=cat fi fi # test -n "$CONFIG_FILES" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". case $ac_file in - | *:- | *:-:* ) # input from stdin cat >$tmp/stdin ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; * ) ac_file_in=$ac_file.in ;; esac # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. ac_dir=`(dirname "$ac_file") 2>/dev/null || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` { if $as_mkdir_p; then mkdir -p "$ac_dir" else as_dir="$ac_dir" as_dirs= while test ! -d "$as_dir"; do as_dirs="$as_dir $as_dirs" as_dir=`(dirname "$as_dir") 2>/dev/null || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` done test ! -n "$as_dirs" || mkdir $as_dirs fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} { (exit 1); exit 1; }; }; } ac_builddir=. if test "$ac_dir" != .; then ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A "../" for each directory in $ac_dir_suffix. ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` else ac_dir_suffix= ac_top_builddir= fi case $srcdir in .) # No --srcdir option. We are building in place. ac_srcdir=. if test -z "$ac_top_builddir"; then ac_top_srcdir=. else ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` fi ;; [\\/]* | ?:[\\/]* ) # Absolute path. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ;; *) # Relative path. ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_builddir$srcdir ;; esac # Do not use `cd foo && pwd` to compute absolute paths, because # the directories may not exist. case `pwd` in .) ac_abs_builddir="$ac_dir";; *) case "$ac_dir" in .) ac_abs_builddir=`pwd`;; [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; *) ac_abs_builddir=`pwd`/"$ac_dir";; esac;; esac case $ac_abs_builddir in .) ac_abs_top_builddir=${ac_top_builddir}.;; *) case ${ac_top_builddir}. in .) ac_abs_top_builddir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; esac;; esac case $ac_abs_builddir in .) ac_abs_srcdir=$ac_srcdir;; *) case $ac_srcdir in .) ac_abs_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; esac;; esac case $ac_abs_builddir in .) ac_abs_top_srcdir=$ac_top_srcdir;; *) case $ac_top_srcdir in .) ac_abs_top_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; esac;; esac case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; *) ac_INSTALL=$ac_top_builddir$INSTALL ;; esac if test x"$ac_file" != x-; then { echo "$as_me:$LINENO: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} rm -f "$ac_file" fi # 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. */ if test x"$ac_file" = x-; then configure_input= else configure_input="$ac_file. " fi configure_input=$configure_input"Generated from `echo $ac_file_in | sed 's,.*/,,'` by configure." # First look for the input files in the build tree, otherwise in the # src tree. ac_file_inputs=`IFS=: for f in $ac_file_in; do case $f in -) echo $tmp/stdin ;; [\\/$]*) # Absolute (can't be DOS-style, as IFS=:) test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } echo "$f";; *) # Relative if test -f "$f"; then # Build tree echo "$f" elif test -f "$srcdir/$f"; then # Source tree echo "$srcdir/$f" else # /dev/null tree { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } fi;; esac done` || { (exit 1); exit 1; } _ACEOF cat >>$CONFIG_STATUS <<_ACEOF sed "$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s,@configure_input@,$configure_input,;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,@top_builddir@,$ac_top_builddir,;t t s,@abs_top_builddir@,$ac_abs_top_builddir,;t t s,@INSTALL@,$ac_INSTALL,;t t " $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out rm -f $tmp/stdin if test x"$ac_file" != x-; then mv $tmp/out $ac_file else cat $tmp/out rm -f $tmp/out fi done _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # # CONFIG_HEADER section. # # These sed commands are passed to sed as "A NAME B NAME C VALUE D", where # NAME is the cpp macro being defined and VALUE is the value it is being given. # # ac_d sets the value in "#define NAME VALUE" lines. ac_dA='s,^\([ ]*\)#\([ ]*define[ ][ ]*\)' ac_dB='[ ].*$,\1#\2' ac_dC=' ' ac_dD=',;t' # ac_u turns "#undef NAME" without trailing blanks into "#define NAME VALUE". ac_uA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' ac_uB='$,\1#\2define\3' ac_uC=' ' ac_uD=',;t' for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". case $ac_file in - | *:- | *:-:* ) # input from stdin cat >$tmp/stdin ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; * ) ac_file_in=$ac_file.in ;; esac test x"$ac_file" != x- && { echo "$as_me:$LINENO: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} # First look for the input files in the build tree, otherwise in the # src tree. ac_file_inputs=`IFS=: for f in $ac_file_in; do case $f in -) echo $tmp/stdin ;; [\\/$]*) # Absolute (can't be DOS-style, as IFS=:) test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } # Do quote $f, to prevent DOS paths from being IFS'd. echo "$f";; *) # Relative if test -f "$f"; then # Build tree echo "$f" elif test -f "$srcdir/$f"; then # Source tree echo "$srcdir/$f" else # /dev/null tree { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } fi;; esac done` || { (exit 1); exit 1; } # Remove the trailing spaces. sed 's/[ ]*$//' $ac_file_inputs >$tmp/in _ACEOF # Transform confdefs.h into two sed scripts, `conftest.defines' and # `conftest.undefs', that substitutes the proper values into # config.h.in to produce config.h. The first handles `#define' # templates, and the second `#undef' templates. # And first: Protect against being on the right side of a sed subst in # config.status. Protect against being in an unquoted here document # in config.status. rm -f conftest.defines conftest.undefs # Using a here document instead of a string reduces the quoting nightmare. # Putting comments in sed scripts is not portable. # # `end' is used to avoid that the second main sed command (meant for # 0-ary CPP macros) applies to n-ary macro definitions. # See the Autoconf documentation for `clear'. cat >confdef2sed.sed <<\_ACEOF s/[\\&,]/\\&/g s,[\\$`],\\&,g t clear : clear s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*\)\(([^)]*)\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1\2${ac_dC}\3${ac_dD},gp t end s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp : end _ACEOF # If some macros were called several times there might be several times # the same #defines, which is useless. Nevertheless, we may not want to # sort them, since we want the *last* AC-DEFINE to be honored. uniq confdefs.h | sed -n -f confdef2sed.sed >conftest.defines sed 's/ac_d/ac_u/g' conftest.defines >conftest.undefs rm -f confdef2sed.sed # This sed command replaces #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. cat >>conftest.undefs <<\_ACEOF s,^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */, _ACEOF # Break up conftest.defines because some shells have a limit on the size # of here documents, and old seds have small limits too (100 cmds). echo ' # Handle all the #define templates only if necessary.' >>$CONFIG_STATUS echo ' if grep "^[ ]*#[ ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS echo ' # If there are no defines, we may have an empty if/fi' >>$CONFIG_STATUS echo ' :' >>$CONFIG_STATUS rm -f conftest.tail while grep . conftest.defines >/dev/null do # Write a limited-size here document to $tmp/defines.sed. echo ' cat >$tmp/defines.sed <>$CONFIG_STATUS # Speed up: don't consider the non `#define' lines. echo '/^[ ]*#[ ]*define/!b' >>$CONFIG_STATUS # Work around the forget-to-reset-the-flag bug. echo 't clr' >>$CONFIG_STATUS echo ': clr' >>$CONFIG_STATUS sed ${ac_max_here_lines}q conftest.defines >>$CONFIG_STATUS echo 'CEOF sed -f $tmp/defines.sed $tmp/in >$tmp/out rm -f $tmp/in mv $tmp/out $tmp/in ' >>$CONFIG_STATUS sed 1,${ac_max_here_lines}d conftest.defines >conftest.tail rm -f conftest.defines mv conftest.tail conftest.defines done rm -f conftest.defines echo ' fi # grep' >>$CONFIG_STATUS echo >>$CONFIG_STATUS # Break up conftest.undefs because some shells have a limit on the size # of here documents, and old seds have small limits too (100 cmds). echo ' # Handle all the #undef templates' >>$CONFIG_STATUS rm -f conftest.tail while grep . conftest.undefs >/dev/null do # Write a limited-size here document to $tmp/undefs.sed. echo ' cat >$tmp/undefs.sed <>$CONFIG_STATUS # Speed up: don't consider the non `#undef' echo '/^[ ]*#[ ]*undef/!b' >>$CONFIG_STATUS # Work around the forget-to-reset-the-flag bug. echo 't clr' >>$CONFIG_STATUS echo ': clr' >>$CONFIG_STATUS sed ${ac_max_here_lines}q conftest.undefs >>$CONFIG_STATUS echo 'CEOF sed -f $tmp/undefs.sed $tmp/in >$tmp/out rm -f $tmp/in mv $tmp/out $tmp/in ' >>$CONFIG_STATUS sed 1,${ac_max_here_lines}d conftest.undefs >conftest.tail rm -f conftest.undefs mv conftest.tail conftest.undefs done rm -f conftest.undefs cat >>$CONFIG_STATUS <<\_ACEOF # 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. */ if test x"$ac_file" = x-; then echo "/* Generated by configure. */" >$tmp/config.h else echo "/* $ac_file. Generated by configure. */" >$tmp/config.h fi cat $tmp/in >>$tmp/config.h rm -f $tmp/in if test x"$ac_file" != x-; then if diff $ac_file $tmp/config.h >/dev/null 2>&1; then { echo "$as_me:$LINENO: $ac_file is unchanged" >&5 echo "$as_me: $ac_file is unchanged" >&6;} else ac_dir=`(dirname "$ac_file") 2>/dev/null || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` { if $as_mkdir_p; then mkdir -p "$ac_dir" else as_dir="$ac_dir" as_dirs= while test ! -d "$as_dir"; do as_dirs="$as_dir $as_dirs" as_dir=`(dirname "$as_dir") 2>/dev/null || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` done test ! -n "$as_dirs" || mkdir $as_dirs fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} { (exit 1); exit 1; }; }; } rm -f $ac_file mv $tmp/config.h $ac_file fi else cat $tmp/config.h rm -f $tmp/config.h fi # Compute $ac_file's index in $config_headers. _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $ac_file | $ac_file:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $ac_file" >`(dirname $ac_file) 2>/dev/null || $as_expr X$ac_file : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X$ac_file : 'X\(//\)[^/]' \| \ X$ac_file : 'X\(//\)$' \| \ X$ac_file : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X$ac_file | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'`/stamp-h$_am_stamp_count done _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # # CONFIG_COMMANDS section. # for ac_file in : $CONFIG_COMMANDS; do test "x$ac_file" = x: && continue ac_dest=`echo "$ac_file" | sed 's,:.*,,'` ac_source=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_dir=`(dirname "$ac_dest") 2>/dev/null || $as_expr X"$ac_dest" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_dest" : 'X\(//\)[^/]' \| \ X"$ac_dest" : 'X\(//\)$' \| \ X"$ac_dest" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$ac_dest" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` { if $as_mkdir_p; then mkdir -p "$ac_dir" else as_dir="$ac_dir" as_dirs= while test ! -d "$as_dir"; do as_dirs="$as_dir $as_dirs" as_dir=`(dirname "$as_dir") 2>/dev/null || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` done test ! -n "$as_dirs" || mkdir $as_dirs fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} { (exit 1); exit 1; }; }; } ac_builddir=. if test "$ac_dir" != .; then ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A "../" for each directory in $ac_dir_suffix. ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` else ac_dir_suffix= ac_top_builddir= fi case $srcdir in .) # No --srcdir option. We are building in place. ac_srcdir=. if test -z "$ac_top_builddir"; then ac_top_srcdir=. else ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` fi ;; [\\/]* | ?:[\\/]* ) # Absolute path. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ;; *) # Relative path. ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_builddir$srcdir ;; esac # Do not use `cd foo && pwd` to compute absolute paths, because # the directories may not exist. case `pwd` in .) ac_abs_builddir="$ac_dir";; *) case "$ac_dir" in .) ac_abs_builddir=`pwd`;; [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; *) ac_abs_builddir=`pwd`/"$ac_dir";; esac;; esac case $ac_abs_builddir in .) ac_abs_top_builddir=${ac_top_builddir}.;; *) case ${ac_top_builddir}. in .) ac_abs_top_builddir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; esac;; esac case $ac_abs_builddir in .) ac_abs_srcdir=$ac_srcdir;; *) case $ac_srcdir in .) ac_abs_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; esac;; esac case $ac_abs_builddir in .) ac_abs_top_srcdir=$ac_top_srcdir;; *) case $ac_top_srcdir in .) ac_abs_top_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; esac;; esac { echo "$as_me:$LINENO: executing $ac_dest commands" >&5 echo "$as_me: executing $ac_dest commands" >&6;} case $ac_dest in depfiles ) test x"$AMDEP_TRUE" != x"" || for mf in $CONFIG_FILES; do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. # We used to match only the files named `Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. # So let's grep whole file. if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then dirpart=`(dirname "$mf") 2>/dev/null || $as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$mf" : 'X\(//\)[^/]' \| \ X"$mf" : 'X\(//\)$' \| \ X"$mf" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$mf" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` else continue fi grep '^DEP_FILES *= *[^ #]' < "$mf" > /dev/null || continue # Extract the definition of DEP_FILES from the Makefile without # running `make'. DEPDIR=`sed -n -e '/^DEPDIR = / s///p' < "$mf"` test -z "$DEPDIR" && continue # When using ansi2knr, U may be empty or an underscore; expand it U=`sed -n -e '/^U = / s///p' < "$mf"` test -d "$dirpart/$DEPDIR" || mkdir "$dirpart/$DEPDIR" # We invoke sed twice because it is the simplest approach to # changing $(DEPDIR) to its actual value in the expansion. for file in `sed -n -e ' /^DEP_FILES = .*\\\\$/ { s/^DEP_FILES = // :loop s/\\\\$// p n /\\\\$/ b loop p } /^DEP_FILES = / s/^DEP_FILES = //p' < "$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`(dirname "$file") 2>/dev/null || $as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$file" : 'X\(//\)[^/]' \| \ X"$file" : 'X\(//\)$' \| \ X"$file" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` { if $as_mkdir_p; then mkdir -p $dirpart/$fdir else as_dir=$dirpart/$fdir as_dirs= while test ! -d "$as_dir"; do as_dirs="$as_dir $as_dirs" as_dir=`(dirname "$as_dir") 2>/dev/null || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` done test ! -n "$as_dirs" || mkdir $as_dirs fi || { { echo "$as_me:$LINENO: error: cannot create directory $dirpart/$fdir" >&5 echo "$as_me: error: cannot create directory $dirpart/$fdir" >&2;} { (exit 1); exit 1; }; }; } # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done ;; esac done _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF { (exit 0); exit 0; } _ACEOF chmod +x $CONFIG_STATUS ac_clean_files=$ac_clean_files_save # 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 || { (exit 1); exit 1; } fi TiMidity++-2.13.2/configure.in0100644004711200001440000016215210127771430015217 0ustar tamukiusersdnl TiMidity++ -- MIDI to WAVE converter and player dnl Copyright (C) 1999-2002 Masanao Izumo dnl Copyright (C) 1995 Tuukka Toivonen 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, dnl but WITHOUT ANY WARRANTY; without even the implied warranty of dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the dnl GNU 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 02111-1307 USA dnl configure.in created from configure.scan dnl by URABE, Shyouhei on 2002.07.06 dnl variable note: dnl CFLAGS - Flags for compile. dnl CPPFLAGS - Flags for cpp dnl LDFLAGS - Flags for linker dnl ac_cpp: $CPP $CPPFLAGS dnl ac_compile: ${CC-cc} -c $CFLAGS $CPPFLAGS dnl ac_link: ${CC-cc} -o * $CFLAGS $CPPFLAGS $LDFLAGS *.c $LIBS dnl EXTRACFLAGS - Extra flags to compile. Adds to CFLAGS. dnl EXTRADEFS - Extra define macros. Adds to CPPFLAGS. dnl EXTRALIBS - Extra libraries Adds to LIBS. dnl SYSEXTRAS - Additional source codes to compile. dnl lib_*_opt - Optional libraries. Adds to LIBS. dnl LIBRARY_PATH dnl - add to -L LDFLAGS dnl C_INCLUDE_PATH dnl - add to -I CPPFLAGS dnl CYGNUS - `yes' if cygnus windows environment. dnl MSYS - `yes' if Mingw windows environment. dnl WISH - wish dnl LN_S - ln -s dnl tcltk_dep - make dependencies for tcl/tk interface dnl dnl so - File extension of shared object library. dnl SHLD - Linker to make shared object library. dnl SHLDFLAGS - Link flags to link shared object library. dnl SHCFLAGS - Additional flags to compile shared object library. dnl (such as -fPIC) # This is a autoscan-generated configure.scan. # AC_PREREQ(2.56) # "AC_INIT(timidity/timidity.c)" is obsolate yet. AC_INIT([TiMidity++],[2.13.2],[root@mput.dip.jp],[TiMidity++]) AC_CONFIG_AUX_DIR([autoconf]) AC_CANONICAL_TARGET AM_INIT_AUTOMAKE([gnu dist-bzip2]) AC_CONFIG_SRCDIR([timidity/timidity.c]) AC_CONFIG_HEADERS([config.h interface.h]) AM_MAINTAINER_MODE SHELL=${CONFIG_SHELL-"/bin/sh"} WISH=${WISH-"wish"} dnl to use contains() macro (see autoconf/acinclude.m4) CONTAINS_INIT # Check for compiler options -- such as debug flags. dnl "--enable-debug" turnes -g on. AC_MSG_CHECKING(if --enable-debug option specified) AC_ARG_ENABLE(debug, [ --enable-debug Build a debugging version.], [timidity_cv_debug="yes"], [timidity_cv_debug="no"]) if test "x$timidity_cv_debug" = "xyes"; then AC_DEFINE(DEBUG,1,Define to 1 if you are in debug mode) CFLAGS=${CFLAGS-"-g"} fi if test "x$timidity_cv_debug" = "xno"; then AC_DEFINE(NDEBUG,1,Define to 1 if you are NOT in debug mode) fi AC_MSG_RESULT($timidity_cv_debug) CFLAGS=${CFLAGS-"-O2"} dnl --with-x turns on if `--with-x' is NOT specified. if test "x$with_x" = x; then with_x=yes else x_config_flag=yes fi # Checking gcc environment for i in `echo $LIBRARY_PATH|sed -e 's,:, ,g'`; do LDFLAGS="$LDFLAGS -L${i}" done for i in `echo $C_INCLUDE_PATH|sed -e 's,:, ,g'`; do CPPFLAGS="$CPPFLAGS -I${i}" done # add $prefix if specified. if test "x$prefix" != xNONE -a "x$prefix" != "x$ac_default_prefix" -a "x$prefix" != "x/usr"; then LDFLAGS="-L$prefix/lib $LDFLAGS" SHLDFLAGS="-L$prefix/lib $SHLDFLAGS" CPPFLAGS="-I$prefix/include $CPPFLAGS" fi dnl add --with-includes, --with-libraries AC_ARG_WITH(includes, [ --with-includes=DIR Specify include directories (colon separated)], [ j=' ' for i in `echo "$withval"|sed -e 's,:, ,g'`; do j="${j}-I${i} " done CPPFLAGS="$j$CPPFLAGS" ]) AC_ARG_WITH(libraries, [ --with-libraries=DIR Specify library directories (colon separated)], [ j=' ' for i in `echo "$withval"|sed -e 's,:, ,g'`; do j="${j}-L${i} " done LDFLAGS="$j$LDFLAGS" ]) dnl a bit hairly yet.(20020718:mput) dnl CPPFLAGS="$CPPFLAGS \$(DEF_PKGDATADIR) \$(DEF_PKGLIBDIR) \$(DEF_DEFAULT_PATH)" AC_ARG_WITH(default-path, [ --with-default-path=DIR Where timidity.cfg is (PREFIX/share/timidity)], [pkgdatadir=$withval], [ if test "x$prefix" != "xNONE"; then pkgdatadir='${prefix}/share/timidity' else pkgdatadir='/usr/local/share/timidity' fi ]) tmpdefpath="`eval \"echo ${pkgdatadir}\"`" AC_DEFINE_UNQUOTED(DEFAULT_PATH,"$tmpdefpath",place to install patches) AC_DEFINE(PKGDATADIR,DEFAULT_PATH,a compatibility matter. ignore it.) AC_ARG_WITH(module-dir, [ --with-module-dir=DIR Where to install interfaces (PREFIX/lib/timidity)], [pkglibdir=$withval], [ if test "x$prefix" != "xNONE"; then pkglibdir='${prefix}/lib/timidity' else pkglibdir='/usr/local/lib/timidity' fi ]) tmplibdir="`eval \"echo ${pkglibdir}\"`" AC_DEFINE_UNQUOTED(PKGLIBDIR,"$tmplibdir",place to install modules) # Checks for programs. AM_PATH_LISPDIR AC_PROG_CC AC_PROG_GCC_TRADITIONAL AC_PROG_INSTALL AC_PROG_AWK AC_PROG_RANLIB AC_PROG_LN_S CHECK_COMPILER_OPTION(rdynamic) # Checks for target dependencies AC_ARG_WITH(elf, [ --with-elf create ELF shared object instead of AOUT ], [ ELFFORMAT=$withval ], [ ELFFORMAT="yes" ]) # AC_ARG_WITH(simd, # [ --with-simd create SIMD friendly binary (default is no) ], # [ SIMD=$withval ], [ SIMD="no" ]) case "$target" in *-*-hpux*) EXTRADEFS="-DHPUX" test -n "$SHLD" || SHLD="ld -b" so="sl" ;; *-sgi-irix*) dnl IRIX cc needs -signed option case ".$CC" in .cc*) EXTRACFLAGS="-signed";; esac test -n "$SHLD" || SHLD="cc -shared -all" so="so" ;; *-*-netbsd*) test -n "$SHLD" || SHLD="$CC -shared -nostartfiles" so="so" ;; *-*-freebsd2*) dnl EXTRALIBS="$EXTRALIBS -lxpg4" test -n "$SHLD" || SHLD="ld -Bshareable" so="so" ;; *-*-freebsd*) if test "$ELFFORMAT" = yes; then test -n "$SHLD" || SHLD="ld -Bshareable" else SHCFLAGS=-aou SHLDFLAGS="-L/usr/X11R6/lib/aout $SHLDFLAGS" test -n "$SHLD" || SHLD="env OBJFORMAT=aout ld -shared" fi dnl EXTRALIBS="$EXTRALIBS -lxpg4" so="so" ;; # *-*-freebsd*) # EXTRALIBS="$EXTRALIBS -lxpg4" # test -n "$SHLD" || SHLD="ld -Bshareable" # so="so" # ;; *-*-cygwin*) EXTRADEFS="-D__W32__" # ?? case "x${CC} " in "xbcc32 "*) # test -n "$SHLD" || SHLD="tlink32 -Tpd" test -n "$SHLD" || SHLD="BCC32 -WD" BORLANDC=yes BORLANDC_LDFLAGS="kernel32.lib winspool.lib comdlg32.lib advapi32.lib oleaut32.lib uuid.lib odbc32.lib wsock32.lib user32.lib shell32.lib cw32mt.lib" BORLANDC_START='C0X32.OBJ' CFLAGS="$CFLAGS -tWM -VM" EXTRADEFS="$EXTRADEFS -D_WINDOWS -DWIN32" ;; "xwcc386_w.sh "*) WATCOM_C=yes CFLAGS="$CFLAGS -br -5s -zk0 -bm -zp=16 -w=4 -D_WINDOWS -DWIN32 -DINCLUDE_WINDOWS_H" WATCOM_LDFLAGS= EXTRALIBS="$EXTRALIBS kernel32.lib winspool.lib comdlg32.lib advapi32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib user32.lib shell32.lib libcmt.lib" ;; "xcl "*) test -n "$SHLD" || SHLD="link -dll" VCPP_LDFLAGS="-nologo -incremental:no -nodefaultlib:libc.lib -nodefaultlib:msvcrt.lib kernel32.lib winspool.lib comdlg32.lib advapi32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib user32.lib shell32.lib libcmt.lib" CFLAGS="$CFLAGS -nologo -Zp16 -MT -W3 -GX -Ob2" EXTRADEFS="$EXTRADEFS -DNDEBUG -D_WINDOWS -DWIN32 -DMBCS -D_MT -YX -FD -c" VCPP=yes ;; "xgcc"*) test -n "$SHLD" || SHLD="gcc -mdll" ;; *) test -n "$SHLD" || SHLD="unknown" ;; esac so="dll" CYGNUS=yes lib_user32_test=-luser32 ;; *-*-mingw*) EXTRADEFS="-D__W32__" # ?? case "x${CC} " in "xbcc32 "*) # test -n "$SHLD" || SHLD="tlink32 -Tpd" test -n "$SHLD" || SHLD="BCC32 -WD" BORLANDC=yes BORLANDC_LDFLAGS="kernel32.lib winspool.lib comdlg32.lib advapi32.lib oleaut32.lib uuid.lib odbc32.lib wsock32.lib user32.lib shell32.lib cw32mt.lib" BORLANDC_START='C0X32.OBJ' CFLAGS="$CFLAGS -tWM -VM" EXTRADEFS="$EXTRADEFS -D_WINDOWS -DWIN32" ;; "xwcc386_w.sh "*) WATCOM_C=yes CFLAGS="$CFLAGS -br -5s -zk0 -bm -zp=16 -w=4 -D_WINDOWS -DWIN32 -DINCLUDE_WINDOWS_H" WATCOM_LDFLAGS= EXTRALIBS="$EXTRALIBS kernel32.lib winspool.lib comdlg32.lib advapi32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib user32.lib shell32.lib libcmt.lib" ;; "xcl "*) test -n "$SHLD" || SHLD="link -dll" VCPP=yes VCPP_LDFLAGS="-nologo -incremental:no -nodefaultlib:libc.lib -nodefaultlib:msvcrt.lib kernel32.lib winspool.lib comdlg32.lib advapi32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib user32.lib shell32.lib libcmt.lib" CFLAGS="$CFLAGS -nologo -Zp16 -MT -W3 -GX -Ob2" EXTRADEFS="$EXTRADEFS -DNDEBUG -D_WINDOWS -DWIN32 -DMBCS -D_MT -YX -FD -c" ;; "xgcc"*) test -n "$SHLD" || SHLD="gcc -mdll" ;; *) test -n "$SHLD" || SHLD="unknown" ;; esac so="dll" MSYS=yes lib_user32_test=-luser32 ;; *-dec-*) EXTRADEFS="-DDEC" test -n "$SHLD" || SHLD="ld -Bdynamic -G" so="so" ;; *-*-solaris*) EXTRADEFS="-DSOLARIS" test -n "$SHLD" || SHLD="/usr/ccs/bin/ld -G" so="so" ;; *-*-nextstep*) test -n "$SHLD" || SHLD="/usr/ccs/bin/ld -G" so="so" ;; *-*-darwin*) if test "x$SIMD" = "xyes"; then AC_DEFINE(USE_ALTIVEC,1,Define to 1 if you use altivec) # EXTRACFLAGS="$EXTRACFLAGS -faltivec -mabi=altivec -maltivec" # for GCC3. EXTRACFLAGS="$EXTRACFLAGS -faltivec" else AC_DEFINE(USE_ALTIVEC,0,Define to 1 if you use altivec) fi CPPFLAGS="$CPPFLAGS -no-cpp-precomp" LDOPTS="-dynamic -undefined suppress -flat_namespace $LDOPTS" test -n "$SHLD" || SHLD="$CC -dynamic -bundle -undefined suppress -flat_namespace $LDFLAGS" so="bundle" ;; *) test -n "$SHLD" || \ if test "x$GCC" = xyes; then SHLD="$CC -shared" else SHLD="ld -Bdynamic -G" fi so="so" ;; esac dnl For .exe dnl AC_EXEEX # obsolate # Checks for libraries. AC_CHECK_LIB(m,sqrt) AC_CHECK_LIB(socket,socket) AC_CHECK_LIB(dl,dlopen,lib_dl_opt=-ldl) AC_CHECK_LIB(objc,NSLinkModule,lib_dl_opt=-lobjc) # Mac OS X need this. if test "x$VCPP" != "xyes" && test "x$BORLANDC" != "xyes" && test "x$WATCOM_C" != "xyes"; then AC_CHECK_LIB(xpg4,setlocale) # Mac OS X (and maybe NetBSD) need this. fi AC_CHECK_FUNCS(gethostbyname,,[ AC_CHECK_LIB(nsl,gethostbyname) ]) AC_PATH_XTRA # Checks for X if test "x$with_x" = xyes; then if test "x$have_x" = xno; then if test "x$x_config_flag" = xyes; then AC_MSG_ERROR(Could not configure X) else AC_MSG_WARN(Could not configure X) fi fi fi if test "x$with_x" = xyes -a "x$have_x" = xyes; then if test "x$x_libraries" != x; then ldflags_x_opt="-L$x_libraries" LDFLAGS="$LDFLAGS $ldflags_x_opt" SHLDFLAGS="$SHLDFLAGS $ldflags_x_opt" else ldflags_x_opt= fi if test "x$x_includes" != x; then CPPFLAGS="$CPPFLAGS -I$x_includes" fi AC_CHECK_LIB(X11,XOpenDisplay) AC_MSG_CHECKING(X11 version 6) AC_CACHE_VAL(timidity_cv_x11_version_6, AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include ]], [[ #if XlibSpecificationRelease < 6 fail; #endif ]])],[timidity_cv_x11_version_6=yes],[timidity_cv_x11_version_6=no])) if test "$timidity_cv_x11_version_6" = "yes"; then AC_MSG_RESULT(6 or newer) dnl AC_DEFINE(HAVE_X11R6) else AC_MSG_RESULT(before 6) fi dnl checking order required KEEPLIBS=$LIBS AC_CHECK_LIB(Xext,XShapeCombineMask,have_xext=yes; LIBS="-lXext $LIBS",have_xext=no) AC_CHECK_LIB(ICE,IceConnectionNumber) AC_CHECK_LIB(SM,SmcOpenConnection,have_xprelibs=yes; LIBS="-lSM $LIBS",have_xprelibs=no) AC_CHECK_LIB(Xt,XtVaAppInitialize,have_xt=yes; LIBS="-lXt $LIBS",have_xt=no) AC_CHECK_LIB(Xmu,XmuInternAtom,LIBS="-lXmu $LIBS") AC_CHECK_FUNCS(XmuRegisterExternalAgent) AC_CHECK_LIB(Xaw3d,XawInitializeWidgetSet,have_xaw=3d, [ AC_CHECK_LIB(Xaw,XawInitializeWidgetSet,have_xaw=yes,have_xaw=no) ]) AC_CHECK_LIB(Xm,XmCreateForm,have_xm=yes,have_xm=no) AC_CHECK_FUNCS(XShmCreatePixmap) LIBS=$KEEPLIBS fi dnl End of X configure # Checks for header files. AC_HEADER_STDC AC_HEADER_STDBOOL AC_HEADER_SYS_WAIT if test "x$WATCOM_C" != xyes ; then AC_HEADER_TIME fi AC_HEADER_DIRENT AC_CHECK_HEADERS( \ [arpa/inet.h \ errno.h \ getopt.h \ glob.h \ dlfcn.h \ fcntl.h \ inttypes.h \ limits.h \ machine/endian.h \ malloc.h \ memory.h \ netdb.h \ netinet/in.h \ nlist.h \ stddef.h \ stdlib.h \ stdint.h \ string.h \ strings.h \ stropts.h \ soundcard.h \ alsa/asoundlib.h \ sys/asoundlib.h \ sys/audioio.h \ sys/awe_voice.h\ sys/ioctl.h \ sys/ipc.h \ sys/param.h \ sys/shm.h \ sys/socket.h \ sys/soundcard.h \ sys/param.h \ sys/time.h \ sys/types.h \ sys/sysctl.h \ termios.h \ unistd.h \ X11/Xlib.h]) AC_CHECK_HEADERS(\ [X11/extensions/XShm.h X11/Xmu/ExtAgent.h],[],[],[ #ifdef HAVE_X11_XLIB_H #include #endif ]) AC_CHECK_HEADER(string.h,, [ AC_DEFINE(NO_STRING_H,1,Define to 1 if you do not have .)]) # Checks for typedefs, structures, and compiler characteristics. if test "x$WATCOM_C" != xyes ; then AC_C_BIGENDIAN fi AC_C_CHAR_UNSIGNED AC_C_CONST AC_C_INLINE AC_C_VOLATILE AC_C_STRINGIZE AC_C_PROTOTYPES AC_STRUCT_TM AC_TYPE_SIZE_T AC_TYPE_OFF_T AC_TYPE_PID_T dnl keyword "volatile" check AC_CACHE_CHECK(volatile declaration,timidity_cv_type_volatile, AC_COMPILE_IFELSE([AC_LANG_PROGRAM(, [[volatile int x]])],[timidity_cv_type_volatile=yes],[timidity_cv_type_volatile=no])) if test $timidity_cv_type_volatile = no; then AC_DEFINE(NO_VOLATILE,1,Define to 1 if you cannot use volatile keyword) fi dnl union usenum check AC_CACHE_CHECK(union semun declaration,timidity_cv_type_union_semun, AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include #include #include ]], [[union semun x]])],[timidity_cv_type_union_semun=yes],[timidity_cv_type_union_semun=no])) if test $timidity_cv_type_union_semun = yes; then AC_DEFINE(HAVE_UNION_SEMUN,1,Define to 1 if you use semun keyword) fi dnl Cygnus and Mingw memory struct optiontest if test "x$CYGNUS" = xyes || test "x$MSYS" = xyes; then case "x${CC}" in "xgcc"*) msnative_struct='' AC_MSG_CHECKING([how to get MSVC-compatible struct packing]) if test -z "$ac_cv_prog_CC"; then our_gcc="$CC" else our_gcc="$ac_cv_prog_CC" fi case `$our_gcc --version | sed -e 's,\..*,.,' -e q` in 2.) if $our_gcc -v --help 2>/dev/null | grep fnative-struct >/dev/null; then msnative_struct='-fnative-struct' fi ;; *) if $our_gcc -v --help 2>/dev/null | grep ms-bitfields >/dev/null; then msnative_struct='-mms-bitfields' fi ;; esac if test x"$msnative_struct" = x ; then AC_MSG_RESULT([no way]) AC_MSG_WARN([produced binary will be incompatible with windows' GUI ]) else CFLAGS="$CFLAGS $msnative_struct" CPPFLAGS="$CPPFLAGS $msnative_struct" AC_MSG_RESULT([${msnative_struct}]) fi ;; *) ;; esac fi dnl Cygnus Mingw32 mmsystem check if test "x$CYGNUS" = xyes || test "x$MSYS" = xyes; then AC_CACHE_CHECK(Cygwin new mmsystem,timidity_cv_header_new_mmsystem, AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include #include ]], [[return WOM_OPEN != 0x3BB]])],[timidity_cv_header_new_mmsystem=yes],[timidity_cv_header_new_mmsystem=no])) if test $timidity_cv_header_new_mmsystem = yes; then AC_DEFINE(HAVE_NEW_MMSYSTEM,1,Define to 1 if you have file) fi fi # Checks for library functions. AC_FUNC_ERROR_AT_LINE AC_FUNC_FORK AC_FUNC_MEMCMP AC_FUNC_MMAP AC_FUNC_SETVBUF_REVERSED AC_TYPE_SIGNAL if test "x$VCPP" != xyes && test "x$BORLANDC" != xyes && test "x$WATCOM_C" != "xyes"; then AC_FUNC_VPRINTF fi AC_CHECK_FUNCS( \ [alarm \ dup2 \ floor \ getcwd \ getopt \ gethostbyname \ gettimeofday \ getwd \ isatty \ memchr \ memmove \ memset \ modf \ munmap \ popen \ pow \ select \ signal \ socket \ sleep \ vsnprintf \ snprintf \ sqrt \ strchr \ strdup \ strstr \ strerror \ strcasecmp \ strncasecmp \ strrchr \ strstr \ strtol \ strlcat \ strlcpy \ usleep]) if test "x$VCPP" = xyes; then AC_DEFINE(RETSIGTYPE,int) AC_DEFINE(HAVE_GETCWD,int) fi if test "x$VCPP" = xyes || test "x$BORLANDC" = xyes || test "x$WATCOM_C" = xyes; then AC_DEFINE(HAVE_GETHOSTBYNAME,1) AC_DEFINE(HAVE_POPEN,1) AC_DEFINE(popen,_popen,[for VC]) AC_DEFINE(pclose,_pclose,[for VC]) AC_DEFINE(HAVE_SELECT,1) AC_DEFINE(HAVE_SNPRINTF,1) AC_DEFINE(HAVE_STRDUP,1) AC_DEFINE(HAVE_STRERROR,1) AC_DEFINE(HAVE_STRNCASECMP,1) AC_DEFINE(HAVE_STRSTR,1) AC_DEFINE(snprintf,_snprintf,[for VC]) AC_DEFINE(HAVE_SOCKET,1) AC_DEFINE(HAVE_VSNPRINTF,1) AC_DEFINE(vsnprintf,_vsnprintf,[for VC]) AC_DEFINE(TIMID_VERSION,[$(PACKAGE_VERSION)],[for windows gui]) fi AC_CHECK_FUNC(getopt_long, AC_DEFINE([HAVE_GETOPT_LONG],1,[Define to 1 if you have `getopt_long function']) tm_cv_needgetopt="no", tm_cv_needgetopt="yes") AM_CONDITIONAL([NEEDGETOPT], test "x$tm_cv_needgetopt" = "xyes") # Checks on cygnus and MYSYS if test "x$CYGNUS" = xyes || test "x$MSYS" = xyes; then case "$ac_cv_header_dirent_dirent_h$ac_cv_header_dirent_sys_ndir_h$ac_cv_header_dirent_sys_dir_h$ac_cv_header_dirent_ndir_h" in *yes*) AC_CHECK_FUNC(opendir,, [ EXTRADEFS="$EXTRADEFS -D__W32READDIR__" W32READDIR=yes ]) ;; *)EXTRADEFS="$EXTRADEFS -D__W32READDIR__" W32READDIR=yes ;; esac if test "x$enable_network" = "xyes"; then if test "x$VCPP" = xyes || test "x$BORLANDC" = xyes || test "x$WATCOM_C" = xyes; then EXTRALIBS="$EXTRALIBS wsock32.lib" EXTRADEFS="$EXTRADEFS -DWINSOCK" else AC_CHECK_FUNC(socket,, WAPI_CHECK_LIB(wsock32,WSAStartup, [#include ], [WSAStartup(0,0);], [ EXTRALIBS="$EXTRALIBS -lwsock32" EXTRADEFS="$EXTRADEFS -DWINSOCK" ] ) ) fi fi fi # Checks on extra paths dnl tcltk paths AC_ARG_WITH(tcl-includes, [ --with-tcl-includes=DIR Tcl include file path ], [ if test ! -d $withval; then AC_MSG_WARN($withval is not found.) fi tcl_include_dir="-I$withval" ]) AC_ARG_WITH(tcl-libs, [ --with-tcl-libs=DIR Tcl library file path ], [ if test ! -d $withval; then AC_MSG_WARN($withval is not found.) fi tcl_libdir="-L$withval" ]) AC_ARG_WITH(tk-includes, [ --with-tk-includes=DIR Tk include file path ], [ if test ! -d $withval; then AC_MSG_WARN($withval is not found.) fi tk_includes="-I$withval" ]) AC_ARG_WITH(tk-libs, [ --with-tk-libs=DIR Tk library file path ], [ if test ! -d $withval; then AC_MSG_WARN($withval is not found.) fi tk_libdir="-L$withval" ]) dnl offix paths AC_ARG_WITH(offix-includes, [ --with-offix-includes=DIR Offix include file path ], [ if test ! -d $withval; then AC_MSG_WARN($withval is not found.) fi offix_include_dir="-I$withval" ]) AC_ARG_WITH(offix-libs, [ --with-offix-libs=DIR Offix include file path ], [ if test ! -d $withval; then AC_MSG_WARN($withval is not found.) fi offix_lib_dir="-L$withval" ]) # # audio section # dnl default(d): auto selection dnl oss(d): OSS /dev/dsp dnl alsa(d): ALSA pcm device dnl sun(d): SunOS /dev/audio dnl hpux(d): HPUX /dev/audio dnl irix(d): IRIX audio dnl mme(d): OSF/1 MME dnl sb_dsp(d): BSD/OS 2.0 /dev/sb_dsp dnl w32(d): Windows MMS dnl darwin(d): Mac OS X pcm device dnl alsa(s): ALSA pcm device dnl alib(A): HPUX network audio (Alib) dnl nas(n): Network Audio System dnl arts(R): aRts dnl esd(e): EsounD dnl portaudio(p) PortAudio dnl vorbis(v): Ogg Vorbis dnl flac(F): FLAC / OggFLAC dnl speex(S): Ogg Speex dnl gogo(g): MP3 GOGO dnl jack(j): JACK dnl ao(O): Libao audio_targets='default oss alsa sun hpux irix mme sb_dsp w32 alib nas arts esd vorbis flac gogo portaudio jack ao' AC_ARG_WITH(nas-library, [ --with-nas-library=library NAS absolute library path(Don't use -laudio)]) AC_ARG_WITH(nas-includes, [ --with-nas-includes=DIR NAS include files are in dir]) AC_ARG_ENABLE(audio, [ --enable-audio[=mode_list] Enable audio (Specify comma separated mode list): default: Automatically select audio device. oss: OSS /dev/dsp sun: SunOS /dev/audio hpux: HPUX /dev/audio irix: IRIX audio library mme: OSF/1 MME sb_dsp: BSD/OS 2.0 /dev/sb_dsp w32: Windows MMS darwin: Darwin CoreAudio alsa: ALSA pcm device alib: HPUX network audio (Alib) nas: NAS - Network Audio System arts: aRts esd: EsounD - Enlightened Sound Daemon portaudio: PortAudio jack: JACK ao: Libao vorbis: Ogg Vorbis flac: FLAC / OggFLAC speex: Ogg Speex gogo: MP3 GOGO (Only Windows is supported)], [ enable_audio=$enableval have_audio_opt=yes ], [ enable_audio=yes have_audio_opt=no ]) dnl yes -> default test "x$enable_audio" = xyes && enable_audio=default if test "x$enable_audio" != xno; then for i in `echo $enable_audio | sed 's/,/ /g'`; do eval "au_enable_$i=yes" done fi dnl Turn on default output mode DEFAULT_PLAYMODE= AC_ARG_WITH(default-output, [ --with-default-output= Specify default output mode (optional): (default|alsa|alib|arts|nas| esd|wav|au|aiff|list|vorbis|flac|speex| gogo|portaudio|jack|ao)], [ if test "$enable_audio" != no; then DEFAULT_PLAYMODE=$withval eval "au_enable_$DEFAULT_PLAYMODE=yes" else AC_MSG_WARN(--with-default-output=$withval: audio is not enabled) fi]) dnl compatibility matters. dnl AC_ARG_ENABLE(esd, dnl [ --enable-esd EsounD (Obsoleted. Use --enable-audio=esd)], dnl [ au_enable_esd=$enableval ]) dnl AC_ARG_ENABLE(nas, dnl [ --enable-nas NAS (Obsoleted. Use --enable-audio=nas)], dnl [ au_enable_nas=$enableval ]) dnl AC_ARG_ENABLE(alsa, dnl [ --enable-alsa ALSA (Obsoleted. Use --enable-audio=alsa)], dnl [ au_enable_alsa=$enableval ]) dnl target-specific defaults if test "x$au_enable_default" = xyes; then case "$target" in *-*-linux*|*-*-freebsd*) au_enable_oss=yes ;; *-*-bsdi2.0) au_enable_sb_dsp=yes ;; *-*-bsdi2.1|*-*-bsdi3.?|*-*-bsdi4.?) au_enable_oss=yes ;; *-*-hpux*) au_enable_hpux=yes ;; *-dec-*) au_enable_mme=yes ;; *irix*) au_enable_irix=yes ;; *-*-sunos4*) au_enable_sun=yes ;; *-*-solaris*) au_enable_sun=yes ;; *-*-netbsd*) au_enable_sun=yes ;; *-*-cygwin*) au_enable_w32=yes ;; *-*-mingw*) au_enable_w32=yes ;; *-*-darwin*) au_enable_darwin=yes ;; *) AC_MSG_WARN(No --enable-audio=default audio for $target) ;; esac fi # Each audio mode's configurations dnl oss AC_MSG_CHECKING(enable_audio=oss) if test "x$au_enable_oss" = xyes; then EXTRADEFS="$EXTRADEFS -DAU_OSS" SYSEXTRAS="$SYSEXTRAS oss_a.c" if test "x$ac_cv_header_sys_soundcard_h" = xyes; then AC_MSG_RESULT(yes - ) else case "$target" in *linux*|*freebsd*) dnl or AC_MSG_RESULT(yes) ;; *) if test "x$ac_cv_header_soundcard_h" = xyes; then AC_MSG_RESULT(yes - ) else AC_MSG_WARN( is not found) fi ;; esac fi AC_CHECK_LIB(ossaudio,open) dnl Why OpenBSD use /dev/audio instead of /dev/dsp for OSS case "$target" in *openbsd*) if test ! -e "/dev/dsp"; then oss_device=/dev/audio fi ;; esac else AC_MSG_RESULT(no) fi dnl SunOS's AC_MSG_CHECKING(enable_audio=sun) if test "x$au_enable_sun" = xyes; then case "$target" in *-*-sunos4*) if test -f /usr/demo/SOUND/libaudio.a; then EXTRALIBS="$EXTRALIBS /usr/demo/SOUND/libaudio.a" AC_MSG_RESULT(yes) else AC_MSG_RESULT(Notice: libaudio.a is not found [(ignore)]) fi ;; *-*-solaris*) if test -f /usr/demo/SOUND/lib/libaudio.a; then EXTRALIBS="$EXTRALIBS /usr/demo/SOUND/lib/libaudio.a" AC_MSG_RESULT(yes) else AC_MSG_RESULT(Notice: libaudio.a is not found [(ignore)]) fi ;; *) AC_MSG_RESULT(yes) ;; esac EXTRADEFS="$EXTRADEFS -DAU_SUN" SYSEXTRAS="$SYSEXTRAS sun_a.c" else AC_MSG_RESULT(no) fi dnl HP-UX's AC_MSG_CHECKING(enable_audio=hpux) if test "x$au_enable_hpux" = xyes; then case "$target" in *-*-hpux*) AC_MSG_RESULT(yes) ;; *) AC_MSG_WARN(may not work on $target) ;; esac EXTRADEFS="$EXTRADEFS -DAU_HPUX_AUDIO" SYSEXTRAS="$SYSEXTRAS hpux_d_a.c" else AC_MSG_RESULT(no) fi dnl Irix's AC_MSG_CHECKING(enable_audio=irix) if test "x$au_enable_irix" = xyes; then case "$target" in *-sgi-irix5*|*-sgi-irix6.2) EXTRADEFS="$EXTRADEFS -DAU_AUDRIV -DSGI_OLDAL" AC_MSG_RESULT(yes) ;; *-sgi-irix6*) EXTRADEFS="$EXTRADEFS -DAU_AUDRIV -DSGI_NEWAL" AC_MSG_RESULT(yes) ;; *) AC_MSG_WARN(may not work on $target) ;; esac SYSEXTRAS="$SYSEXTRAS audriv_a.c audriv_al.c" EXTRALIBS="$EXTRASLIBS -laudio" else AC_MSG_RESULT(no) fi dnl OSF/1 MME AC_MSG_CHECKING(enable_audio=mme) if test "x$au_enable_mme" = xyes; then case "$target" in *-dec-*) AC_MSG_RESULT(yes) ;; *) AC_MSG_WARN(may not work on $target) ;; esac EXTRADEFS="$EXTRADEFS -DAU_DEC -DAU_AUDRIV" SYSEXTRAS="$SYSEXTRAS audriv_a.c audriv_mme.c" CPPFLAGS="$CPPFLAGS -I/usr/opt/MME210/include" EXTRALIBS="$EXTRALIBS /usr/opt/MME220/lib/libmme.a" else AC_MSG_RESULT(no) fi dnl BSD/OS's sb_dsp AC_MSG_CHECKING(enable_audio=sb_dsp) if test "x$au_enable_sb_dsp" = xyes; then case "$target" in *-*-bsdi2.0) AC_MSG_RESULT(yes) ;; *) AC_MSG_WARN(may not work on $target) ;; esac EXTRADEFS="$EXTRADEFS -DAU_BSDI -DDEFAULT_RATE=22500" SYSEXTRAS="$SYSEXTRAS bsd20_a.c" else AC_MSG_RESULT(no) fi dnl Windows' MME AC_MSG_CHECKING(enable_audio=w32) if test "x$au_enable_w32" = xyes; then case "$target" in *-*-cygwin*) AC_MSG_RESULT(yes) ;; *-*-mingw32) AC_MSG_RESULT(yes) ;; *) AC_MSG_WARN(may not work on $target) ;; esac SYSEXTRAS="$SYSEXTRAS w32_a.c" if test "x$VCPP" = xyes || test "x$BORLANDC" = xyes || test "x$WATCOM_C" = xyes; then EXTRALIBS="$EXTRALIBS winmm.lib" else EXTRALIBS="$EXTRALIBS -lwinmm" fi EXTRADEFS="$EXTRADEFS -DAU_W32" else AC_MSG_RESULT(no) fi dnl Mac OS X / darwin-x86 AC_MSG_CHECKING(enable_audio=darwin) if test "x$au_enable_darwin" = xyes; then EXTRADEFS="$EXTRADEFS -DAU_DARWIN" SYSEXTRAS="$SYSEXTRAS darwin_a.c" EXTRALIBS="$EXTRALIBS -framework CoreAudio" dnl just say yes or no :-P case "$target" in *-*-darwin*) AC_MSG_RESULT(yes);; *) AC_MSG_WARN(may not work on $target) ;; esac else AC_MSG_RESULT(no) fi dnl alsa - Advanced Linux Sound Architecture AC_MSG_CHECKING(enable_audio=alsa) if test "x$au_enable_alsa" = xyes; then AC_MSG_RESULT([yes, configuring alsa]) KEEPCFLAGS=$CFLAGS KEEPLIBS=$LIBS KEEPLDFLAGS=$LDFLAGS AM_PATH_ALSA() if test "x$alsa_found" = "xyes" ; then dnl AC_MSG_RESULT(yes) EXTRADEFS="$EXTRADEFS -DAU_ALSA" SYSEXTRAS="$SYSEXTRAS alsa_a.c" EXTRACT_CPPFLAGS(CPPFLAGS,CFLAGS,$ALSA_CFLAGS) LIBS="$LIBS $ALSA_LIBS" AC_CHECK_FUNCS(snd_seq_port_info_set_timestamping) else AC_MSG_WARN(Couldn't configure alsa.) CFLAGS=$KEEPCFLAGS LIBS=$KEEPLIBS LDFLAGS=$KEEPLDFLAGS fi else AC_MSG_RESULT(no) fi dnl HP-UX Alib AC_MSG_CHECKING(enable_audio=alib) if test "x$au_enable_alib" = xyes; then case "$target" in *-*-hpux*) AC_MSG_RESULT(yes) ;; *) AC_MSG_WARN(may not work on $target) ;; esac SYSEXTRAS="$SYSEXTRAS hpux_a.c" EXTRADEFS="$EXTRADEFS -DAU_HPUX_ALIB" if test -d /opt/audio/include; then CPPFLAGS="$CPPFLAGS -I/opt/audio/include" fi if test -d /opt/audio/lib; then EXTRALIBS="$EXTRALIBS -L/opt/audio/lib" fi EXTRALIBS="$EXTRALIBS -lAlib" else AC_MSG_RESULT(no) fi dnl nas AC_MSG_CHECKING(enable_audio=nas) if test "x$au_enable_nas" = xyes; then if test "x$with_x" != xyes; then AC_MSG_ERROR(nas: --with-x option must be specified) fi EXTRADEFS="$EXTRADEFS -DAU_NAS" SYSEXTRAS="$SYSEXTRAS nas_a.c" dnl -laudio conflicts another audio library, dnl so I specify NAS library with absolete path. if test "x$with_nas_library" != x; then AC_MSG_RESULT($with_nas_library); EXTRALIBS="$EXTRALIBS $with_nas_library" else AC_MSG_RESULT() MY_SEARCH_LIBS(AuOpenServer, [$x_libraries/libaudio.a \ /usr/lib/libaudio.so \ /usr/lib/libaudio.a ], [ AC_MSG_RESULT(NAS: $timidity_cv_search_AuOpenServer) EXTRALIBS="$EXTRALIBS $timidity_cv_search_AuOpenServer"], [AC_MSG_WARN(NAS library is not found.)]) fi test "x$with_nas_includes" != x && CPPFLAGS="$CPPFLAGS -I$with_nas_includes" lib_xt_opt=-lXt if test "x$have_xext" = xyes; then lib_xext_opt=-lXext fi if test "x$have_xprelibs" = xyes; then lib_xprelibs_opt='-lSM -lICE' fi else AC_MSG_RESULT(no) fi dnl aRts of KDE AC_MSG_CHECKING(enable_audio=arts) if test "x$au_enable_arts" = xyes; then AC_MSG_RESULT([yes, configuring aRts]) KEEPCFLAGS=$CFLAGS KEEPLIBS=$LIBS KEEPLDFLAGS=$LDFLAGS AM_PATH_ARTS() CFLAGS=$KEEPCFLAGS LIBS=$KEEPLIBS LDFLAGS=$KEEPLDFLAGS if test "x$no_arts" = x; then dnl AC_MSG_RESULT(aRts: Enabled) EXTRADEFS="$EXTRADEFS -DAU_ARTS" SYSEXTRAS="$SYSEXTRAS aRts_a.c" EXTRACT_CPPFLAGS(CPPFLAGS,CFLAGS,$ARTS_CFLAGS) LIBS="$LIBS $ARTS_LIBS" else AC_MSG_WARN(aRts: Couldn't configure) fi else AC_MSG_RESULT(no) fi dnl EsounD AC_MSG_CHECKING(enable_audio=esd) if test "x$au_enable_esd" = xyes; then AC_MSG_RESULT([yes, configuring esd]) KEEPCFLAGS=$CFLAGS KEEPLIBS=$LIBS KEEPLDFLAGS=$LDFLAGS AM_PATH_ESD() CFLAGS=$KEEPCFLAGS LIBS=$KEEPLIBS LDFLAGS=$KEEPLDFLAGS if test "x$no_esd" = x; then dnl AC_MSG_RESULT(EsounD: Enabled) EXTRADEFS="$EXTRADEFS -DAU_ESD" SYSEXTRAS="$SYSEXTRAS esd_a.c" EXTRACT_CPPFLAGS(CPPFLAGS,CFLAGS,$ESD_CFLAGS) LIBS="$LIBS $ESD_LIBS" else AC_MSG_WARN(EsounD: Couldn't configure) fi else AC_MSG_RESULT(no) fi dnl portaudio E AC_MSG_CHECKING(enable_audio=portaudio) if test "x$au_enable_portaudio" = xyes; then AC_MSG_RESULT(yes) if test "x$CYGNUS" = xyes ||test "x$MSYS" = xyes; then SYSEXTRAS="$SYSEXTRAS portaudio_a.c w32_portaudio_dll.c" EXTRALIBS="$EXTRALIBS -lportaudio" EXTRADEFS="$EXTRADEFS -DAU_PORTAUDIO -DAU_PORTAUDIO_DLL" else SYSEXTRAS="$SYSEXTRAS portaudio_a.c" EXTRALIBS="$EXTRALIBS -lportaudio" EXTRADEFS="$EXTRADEFS -DAU_PORTAUDIO" fi else AC_MSG_RESULT(no) fi dnl JACK AC_MSG_CHECKING(enable_audio=jack) if test "x$au_enable_jack" = xyes; then AC_MSG_RESULT(yes) SYSEXTRAS="$SYSEXTRAS jack_a.c" EXTRALIBS="$EXTRALIBS $(pkg-config --libs jack)" EXTRADEFS="$EXTRADEFS -DAU_JACK $(pkg-config --cflags jack)" else AC_MSG_RESULT(no) fi dnl AO AC_MSG_CHECKING(enable_audio=ao) if test "x$au_enable_ao" = xyes; then AC_MSG_RESULT([yes, configuring ao]) XIPH_PATH_AO() if test "x$no_ao" = "x" ; then # AC_MSG_RESULT(yes) EXTRADEFS="$EXTRADEFS -DAU_AO" SYSEXTRAS="$SYSEXTRAS ao_a.c" EXTRACT_CPPFLAGS(CPPFLAGS,CFLAGS,$AO_CFLAGS) LIBS="$LIBS $AO_LIBS" else AC_MSG_WARN(Couldn't configure libao.) fi else AC_MSG_RESULT(no) fi dnl ogg's vorbis AC_MSG_CHECKING(enable_audio=vorbis) if test "x$au_enable_vorbis" = xyes; then AC_MSG_RESULT([yes, configuring vorbis]) AM_PATH_OGG([ AM_PATH_VORBIS([ have_vorbis=yes SYSEXTRAS="$SYSEXTRAS vorbis_a.c" EXTRADEFS="$EXTRADEFS -DAU_VORBIS $OGG_CFLAGS $VORBIS_CFLAGS" EXTRALIBS="$EXTRALIBS $VORBIS_LIBS $VORBISENC_LIBS $OGG_LIBS" if test "x$CYGNUS" = "xyes"; then EXTRADEFS="-DAU_VORBIS_DLL $EXTRADEFS" SYSEXTRAS="$SYSEXTRAS w32g_vorbisenc_dll.c w32g_vorbis_dll.c w32g_ogg_dll.c" fi if test "x$MSYS" = "xyes"; then EXTRADEFS="-DAU_VORBIS_DLL $EXTRADEFS" SYSEXTRAS="$SYSEXTRAS w32g_vorbisenc_dll.c w32g_vorbis_dll.c w32g_ogg_dll.c" fi ],[ AC_MSG_WARN([Unable to configure vorbis, but ogg is there (???)]) ]) ],[ AC_MSG_WARN(Unable to configure vorbis!) have_vorbis=no ]) else AC_MSG_RESULT(no) fi dnl libFLAC - Free Lossless Audio Codec if test "x$CYGNUS" = xyes || test "x$MSYS" = xyes ; then AC_MSG_CHECKING(enable_audio=flac) if test "x$au_enable_flac" = xyes; then AC_MSG_RESULT([yes, configuring flac]) SYSEXTRAS="$SYSEXTRAS flac_a.c w32_libFLAC_dll.c w32_libOggFLAC_dll.c" AM_PATH_LIBFLAC([ EXTRADEFS="$EXTRADEFS -DAU_FLAC -DAU_FLAC_DLL" EXTRACT_CPPFLAGS(CPPFLAGS,CFLAGS,$LIBFLAC_CFLAGS) LIBS="$LIBS $LIBFLAC_LIBS" ]) AM_PATH_LIBOGGFLAC([ EXTRADEFS="$EXTRADEFS -DAU_OGGFLAC -DAU_OGGFLAC_DLL" EXTRACT_CPPFLAGS(CPPFLAGS,CFLAGS,$LIBOGGFLAC_CFLAGS) LIBS="$LIBS $LIBOGGFLAC_LIBS" ]) else AC_MSG_RESULT(no) fi else AC_MSG_CHECKING(enable_audio=flac) if test "x$au_enable_flac" = xyes; then AC_MSG_RESULT([yes, configuring flac]) SYSEXTRAS="$SYSEXTRAS flac_a.c" AM_PATH_LIBFLAC([ EXTRADEFS="$EXTRADEFS -DAU_FLAC" EXTRACT_CPPFLAGS(CPPFLAGS,CFLAGS,$LIBFLAC_CFLAGS) LIBS="$LIBS $LIBFLAC_LIBS" ]) AM_PATH_LIBOGGFLAC([ EXTRADEFS="$EXTRADEFS -DAU_OGGFLAC" EXTRACT_CPPFLAGS(CPPFLAGS,CFLAGS,$LIBOGGFLAC_CFLAGS) LIBS="$LIBS $LIBOGGFLAC_LIBS" ]) else AC_MSG_RESULT(no) fi fi dnl ogg's speex AC_MSG_CHECKING(enable_audio=speex) if test "x$au_enable_speex" = xyes; then AC_CACHE_VAL(have_speex, [AC_TRY_LINK([ #include #include ], [ SpeexBits *dummy; ], [have_speex=yes], [have_speex=no])]) AC_MSG_RESULT($have_speex) if test "x$have_speex" = xyes; then SYSEXTRAS="$SYSEXTRAS speex_a.c" EXTRALIBS="$EXTRALIBS -lspeex -logg" EXTRADEFS="$EXTRADEFS -DAU_SPEEX" fi else AC_MSG_RESULT(no) fi dnl Win32 Gogo-no-coder AC_MSG_CHECKING(enable_audio=gogo) if test "x$au_enable_gogo" = xyes; then if test "x$CYGNUS" = "xyes"; then AC_MSG_RESULT(yes, configuring gogo) else if test "x$MSYS" = "xyes"; then AC_MSG_RESULT(yes, configuring gogo) else AC_MSG_WARN(May be gogo is not supported. You need hack the gogo_a.c) fi fi have_gogo=yes SYSEXTRAS="$SYSEXTRAS gogo_a.c w32_gogo.c" EXTRADEFS="$EXTRADEFS -DAU_GOGO -DAU_GOGO_DLL" EXTRALIBS="$EXTRALIBS -lgogo" else AC_MSG_RESULT(no) fi dnl Pseudo audio device (Undocumented). if test "x$au_enable_none" = xyes; then EXTRADEFS="$EXTRADEFS -DAU_NONE -DAU_AUDRIV" SYSEXTRAS="$SYSEXTRAS audriv_a.c audriv_none.c" fi dnl dnl TIMIDITY_OUTPUT_ID dnl AC_MSG_CHECKING(default output mode) if test "x$DEFAULT_PLAYMODE" = x; then DEFAULT_PLAYMODE=`echo $enable_audio | sed 's/,.*//'` fi case ".$DEFAULT_PLAYMODE" in .default) TIMIDITY_OUTPUT_ID=d ;; .oss) TIMIDITY_OUTPUT_ID=d ;; .alsa) TIMIDITY_OUTPUT_ID=s ;; .sun) TIMIDITY_OUTPUT_ID=d ;; .hpux) TIMIDITY_OUTPUT_ID=d ;; .irix) TIMIDITY_OUTPUT_ID=d ;; .mme) TIMIDITY_OUTPUT_ID=d ;; .sb_dsp) TIMIDITY_OUTPUT_ID=d ;; .darwin) TIMIDITY_OUTPUT_ID=d ;; .w32) TIMIDITY_OUTPUT_ID=d ;; .alib) TIMIDITY_OUTPUT_ID=A ;; .nas) TIMIDITY_OUTPUT_ID=n ;; .arts) TIMIDITY_OUTPUT_ID=R ;; .esd) TIMIDITY_OUTPUT_ID=e ;; .portaudio) TIMIDITY_OUTPUT_ID=p ;; .wav) TIMIDITY_OUTPUT_ID=w ;; .au) TIMIDITY_OUTPUT_ID=u ;; .aiff) TIMIDITY_OUTPUT_ID=a ;; .list) TIMIDITY_OUTPUT_ID=l ;; .vorbis) TIMIDITY_OUTPUT_ID=v ;; .flac) TIMIDITY_OUTPUT_ID=F ;; .speex) TIMIDITY_OUTPUT_ID=S ;; .gogo) TIMIDITY_OUTPUT_ID=g ;; .jack) TIMIDITY_OUTPUT_ID=j ;; *) TIMIDITY_OUTPUT_ID= ;; esac AC_MSG_RESULT($DEFAULT_PLAYMODE/$TIMIDITY_OUTPUT_ID) # # Interface Section # interface_targets='dynamic ncurses slang motif tcltk emacs vt100 xaw xskin gtk alsaseq winsyn winsyng portmidisyng' AC_ARG_ENABLE(interface, [ --enable-interface=[interface_list] Comma separated interface list ], [ for i in `echo $enableval | sed 's/,/ /g'`; do eval "enable_$i=yes" done ]) # Dynamic link configuration AC_ARG_ENABLE(dynamic, [ --enable-dynamic Enable dynamic link interface (default is no) --enable-dynamic=dynamic_list Comma separated dynamic interface list], [ dnl --enable-dynamic=yes to --enable-dynamic=dynamic if test "x$enable_dynamic" = xyes; then enable_dynamic=dynamic elif test "x$enable_dynamic" != xno; then for i in `echo $enableval | sed 's/,/ /g'`; do eval "enable_$i=dynamic" done fi]) join_targets= for i in $interface_targets; do eval "join_targets=$join_targets\$enable_$i" done case ".$join_targets" in .*dynamic*) NEEDDLOPEN=yes;; *) NEEDDLOPEN=no;; esac dnl check -fpic option for gcc if test "x$GCC" = xyes; then SHCFLAGS="$SHCFLAGS -fPIC"; fi case "x$enable_ump" in xyes|xdynamic) EXTRACFLAGS="$EXTRACFLAGS -DXP_UNIX $SHCFLAGS";; esac dnl Which type of dynamic loader? if test "$NEEDDLOPEN" = "yes"; then have_dl=no WAPI_CHECK_FUNC(LoadLibrary,,[LoadLibrary(0);],have_dl=w32) test $wapi_cv_func_LoadLibrary = yes && have_dl=w32 if test "$have_dl" = "no"; then AC_CHECK_FUNC(shl_load,have_dl=hpux) fi if test "$have_dl" = "no"; then dnl darwin has both dyld and libdl: in case user installed dlcompat. dnl dyld is recommended because libdl is a wrapper for dyld. AC_CHECK_FUNC(NSLinkModule,have_dl=dyld) fi if test "$have_dl" = "no" -a "x$ac_cv_lib_dl_dlopen" = xyes; then have_dl=dlopen fi if test "$have_dl" = "no"; then AC_CHECK_FUNC(dlopen,have_dl=dlopen) fi if test "$have_dl" = "no"; then AC_CHECK_FUNC(dld_init,have_dl=dld) fi if test "$have_dl" = "no"; then AC_CHECK_LIB(dld,dld_init,have_dl=dld;lib_dl_opt=-ldld) fi AC_MSG_CHECKING(dynamic link method) case "$have_dl" in dlopen) AC_MSG_RESULT(use dl_dlopen.c) SYSEXTRAS="$SYSEXTRAS dl_dlopen.c" CHECK_DLSYM_UNDERSCORE(AC_DEFINE(DLSYM_NEEDS_UNDERSCORE,1,Define to 1 if you have to add "_" to every identifiers.)) ;; dld) AC_MSG_RESULT(use dl_dld.c) SYSEXTRAS="$SYSEXTRAS dl_dld.c" ;; hpux) AC_MSG_RESULT(use dl_hpux.c) SYSEXTRAS="$SYSEXTRAS dl_hpux.c" LDFLAGS="$LDFLAGS -Wl,-E $LDFLAGS" ;; w32) AC_MSG_RESULT(use dl_w32.c) SYSEXTRAS="$SYSEXTRAS dl_w32.c" ;; dyld) AC_MSG_RESULT(use dl_dyld.c) SYSEXTRAS="$SYSEXTRAS dl_dyld.c" ;; *) NEEDDLOPEN="no" AC_MSG_WARN(no method to open a shared object) ;; esac fi if test "$NEEDDLOPEN" = "yes"; then MY_DEFINE(IA_DYNAMIC) AC_DEFINE_UNQUOTED(SHARED_LIB_EXT,".$so", shared library extention) dnl needless? dnl EXTRADEFS="$EXTRADEFS \$(DEF_SHLIB_DIR)" test "x$GCC" = xyes -a "x$timidity_cv_ccoption_rdynamic" = xyes && timidity_LDFLAGS="-rdynamic" fi AM_CONDITIONAL(NEEDDLOPEN, test "$NEEDDLOPEN" = "yes") dnl dnl Each interface section dnl dnl ncurses AM_CONDITIONAL(ENABLE_NCURSES, false) CONFIG_INTERFACE(ncurses,NCURSES,n, [ --enable-ncurses Enable ncurses interface (default is no)], [ AC_CHECK_HEADERS(ncurses.h ncurses/curses.h curses.h) dnl #include is failure on Plamo Linux 1.3/ncurses 1.9.9e dnl because includes : dnl /usr/include/ncurses/curses.h:34: unctrl.h: No such file or directory dnl But surely there is unctl.h at /usr/include/ncurses/unctrl.h. dnl configure must check ncurses header with -I/usr/include/ncurses option. case "$ac_cv_header_curses_h$ac_cv_header_ncurses_curses_h$ac_cv_header_ncurses_h" in *yes*);; *) for i in /usr/include /usr/local/include; do if test -f "$i/ncurses/curses.h" -a -f "$i/ncurses/unctrl.h"; then AC_MSG_WARN(ncurses test is failure. Please check config.h and common.makefile later) CPPFLAGS="$CPPFLAGS -I$i/ncurses" break fi done ;; esac AC_CHECK_LIB(ncurses,initscr,lib_curses_opt=-lncurses, [ dnl checking pdcurses AC_CHECK_LIB(curses,PDC_set_ctrl_break, [ lib_curses_opt=-lcurses AC_DEFINE(USE_PDCURSES,1,Define to 1 if you use PDcurses) lib_user32_opt="$lib_user32_test" ], [ dnl checking libpdcurses AC_CHECK_LIB(pdcurses,PDC_set_ctrl_break, [ lib_curses_opt=-lpdcurses AC_DEFINE(USE_PDCURSES,1,Define to 1 if you use PDcurses) lib_user32_opt="$lib_user32_test" ], [ dnl OpenBSD use -lcurses instead of -lncurses. case "$target" in *openbsd*) AC_CHECK_LIB(curses,initscr,lib_curses_opt=-lcurses, [ AC_MSG_WARN(ncurses interface is not enabled) enable_ncurses=no ]) ;; *) if test "x$VCPP" = xyes || test "x$BORLANDC" = xyes || test "x$WATCOM_C" = xyes; then lib_curses_opt=libpdcurses.lib AC_DEFINE(USE_PDCURSES,1,Define to 1 if you use PDcurses) else AC_MSG_WARN(ncurses interface is not enabled) enable_ncurses=no fi ;; esac ]) ], $lib_user32_test) ]) ], [ LIBS="$LIBS $lib_curses_opt" case "$target" in *-*-freebsd[123]*) EXTRALIBS="$EXTRALIBS -lmytinfo" ;; esac INTERFACE_SRCS="$INTERFACE_SRCS ncurs_c.c" ], [ n_so_libs="$lib_curses_opt" case "$target" in *-*-freebsd[123]*) EXTRALIBS="$EXTRALIBS -lmytinfo" ;; esac]) dnl slang AM_CONDITIONAL(ENABLE_SLANG, false) CONFIG_INTERFACE(slang,SLANG,s, [ --enable-slang Enable slang interface (default is no)], [ AC_CHECK_LIB(slang,SLang_init_tty,:, [ enable_slang=no AC_MSG_WARN(slang interface is not enabled) ]) AC_CHECK_HEADERS(slang/slang.h slang.h) ], [ LIBS="$LIBS -lslang" INTERFACE_SRCS="$INTERFACE_SRCS slang_c.c" ], [ s_so_libs="-lslang" AC_CHECK_LIB(termcap,initscr,s_so_libs="$s_so_libs -ltermcap") ]) dnl Motif AM_CONDITIONAL(ENABLE_MOTIF, false) CONFIG_INTERFACE(motif,MOTIF,m, [ --enable-motif Enable motif interface (default is no)], [ if test "x$with_x" != xyes; then AC_MSG_ERROR(motif: --with-x option must be specified) fi if test "x$have_xm" != xyes; then AC_MSG_WARN(Motif library is not found.) enable_motif=no fi ], [ lib_xm_opt=-lXm lib_xt_opt=-lXt lib_xext_opt=-lXext if test "x$have_xprelibs" = xyes; then lib_xprelibs_opt='-lSM -lICE' fi INTERFACE_SRCS="$INTERFACE_SRCS motif_c.c motif_i.c motif_p.c" ], [ if test x$have_xprelibs = xyes; then m_so_libs="-lXext -lSM -lICE" fi m_so_libs="$ldflags_x_opt -lXm -lXt $m_so_libs -lX11" ]) dnl Tcl/Tk AM_CONDITIONAL(ENABLE_TCLTK, false) CONFIG_INTERFACE(tcltk,TCLTK,k, [ --enable-tcltk Enable tcltk interface (default is no)], [ if test "x$with_x" != xyes; then AC_MSG_ERROR(tcltk: --with-x option must be specified) fi dnl save flags KEEPCPPFLAGS=$CPPFLAGS KEEPLDFLAGS=$LDFLAGS KEEPLIBS=$LIBS CPPFLAGS="$tcl_include_dir $tk_includes $CPPFLAGS" LDFLAGS="$tcl_libdir $tk_libdir $LDFLAGS" LIBS="$LIBS $lib_dl_opt" tcl_lib= tk_lib= for l in tcl tcl8.4 tcl8.3 tcl8.0jp tcl7.6jp tcl80jp tcl76jp tcl8.0 tcl7.6 tcl80 tcl76; do case "x$tcl_lib" in x) AC_CHECK_LIB($l,Tcl_Init,tcl_lib=-l$l);; esac done LIBS="$LIBS $tcl_lib" for l in tk tk8.4 tk8.3 tk8.0jp tk4.2jp tk80jp tk42jp tk8.0 tk4.2 tk80 tk42; do case "x$tk_lib" in x) AC_CHECK_LIB($l,Tk_Init,tk_lib=-l$l);; esac done LIBS=$KEEPLIBS if test "x$tcl_lib" = x -o "x$tk_lib" = x; then CPPFLAGS=$KEEPCPPFLAGS LDFLAGS=$KEEPLDFLAGS enable_tcltk=no AC_MSG_WARN(tcl/tk is not enable) else tcltk_dep='tclIndex' fi ], [ LIBS=`echo $LIBS | sed "s/-lX11/$tk_lib $tcl_lib -lX11/"` case "$target" in *-*-bsdi*) EXTRALIBS="$EXTRALIBS -lipc" ;; esac INTERFACE_SRCS="$INTERFACE_SRCS tk_c.c" ], [ k_so_libs="$tcl_libdir $tk_libdir $tcl_lib $tk_lib $lib_dl_opt" case "$target" in *-*-bsdi*) k_so_libs="$k_so_libs -lipc" ;; esac k_so_libs="$k_so_libs -lX11 -lm" ]) AM_CONDITIONAL(ENABLE_DYNAMIC_TCLTK, test "x$enable_tcltk" = "xdynamic") dnl Emacs AM_CONDITIONAL(ENABLE_EMACS, false) CONFIG_INTERFACE(emacs,EMACS,e, [ --enable-emacs Enable emacs interface (default is no)], , [ ELFILES="$ELFILES timidity.el" INTERFACE_SRCS="$INTERFACE_SRCS emacs_c.c" ], [ ELFILES="$ELFILES timidity.el" ]) dnl VT100 AM_CONDITIONAL(ENABLE_VT100, false) CONFIG_INTERFACE(vt100,VT100,T, [ --enable-vt100 Enable VT100 interface (default is no)], , [ INTERFACE_SRCS="$INTERFACE_SRCS vt100_c.c vt100.c" ]) dnl X Athena Widget AM_CONDITIONAL(ENABLE_XAW, false) CONFIG_INTERFACE(xaw,XAW,a, [ --enable-xaw Enable athena interface (default is no)], [ if test "x$with_x" != xyes; then AC_MSG_ERROR(xaw: --with-x option must be specified) fi if test "x$have_xaw" != "xyes" -a "x$have_xaw" != "x3d"; then AC_MSG_WARN(X Athena Widget library is not found.) enable_xaw=no fi ], [ dnl Add -lXext -lSM -lICE -lXmu -lXt {-lXaw|-lXaw3d} if test "x$have_xext" = xyes; then lib_xext_opt=-lXext fi if test "x$have_xprelibs" = xyes; then lib_xprelibs_opt='-lSM -lICE' fi lib_xmu_opt=-lXmu lib_xt_opt=-lXt if test "x$have_xaw" = x3d; then AC_DEFINE(XAW3D,1,Define to 1 if you have libXaw3d.) lib_xaw_opt=-lXaw3d else lib_xaw_opt=-lXaw fi INTERFACE_SRCS="$INTERFACE_SRCS xaw_c.c xaw_i.c" ], [ if test "x$have_xext" = xyes; then a_so_libs="-lXext -lX11" else a_so_libs="-lX11" fi case "$target" in *darwin*) a_so_libs="$a_so_libs -lcc_dynamic" ;; esac if test "x$have_xprelibs" = xyes; then a_so_libs="-lSM -lICE $a_so_libs" fi if test "x$have_xaw" = xyes; then a_so_libs="-lXaw -lXmu -lXt $a_so_libs" elif test "x$have_xaw" = x3d; then AC_DEFINE(XAW3D,1,Define to 1 if you have libXaw3d.) a_so_libs="-lXaw3d -lXmu -lXt $a_so_libs" fi a_so_libs="$ldflags_x_opt $a_so_libs" ]) AM_CONDITIONAL(ENABLE_DYNAMIC_XAW, test "x$enable_xaw" = "xdynamic") dnl X skin AM_CONDITIONAL(ENABLE_XSKIN, false) CONFIG_INTERFACE(xskin,XSKIN,i, [ --enable-xskin Enable X skin interface (default is no)], [ if test "x$with_x" != xyes; then AC_MSG_ERROR(xskin: --with-x option must be specified) fi ], [ INTERFACE_SRCS="$INTERFACE_SRCS xskin_c.c xskin_i.c xskin_loadBMP.c xskin_spectrum.c" ], [ i_so_libs="$ldflags_x_opt -lX11" ]) dnl GTK+ AM_CONDITIONAL(ENABLE_GTK, false) CONFIG_INTERFACE(gtk, GTK, g, [ --enable-gtk Enable GTK+ interface (default is no)], [ AM_PATH_GTK_2_0(2.0.0, [AC_DEFINE(HAVE_GTK_2,1,Define to 1 if you have GTK+ 2.x)], [AM_PATH_GTK(1.1.3,,enable_gtk=no)]) ], [ LIBS="$LIBS $GTK_LIBS" EXTRACT_CPPFLAGS(CPPFLAGS,CFLAGS,$GTK_CFLAGS) INTERFACE_SRCS="$INTERFACE_SRCS gtk_c.c gtk_i.c gtk_p.c" ], [ if test "x$GCC" = xyes; then dnl Do not include -rdynamic option in $g_so_libs. for i in $GTK_LIBS; do case "x$i" in x-rdynamic) ;; *) g_so_libs="$g_so_libs $i" ;; esac done else g_so_libs="$GTK_LIBS" fi EXTRACT_CPPFLAGS(CPPFLAGS,CFLAGS,$GTK_CFLAGS) ]) dnl TiMidity Network MIDI Server AM_CONDITIONAL(ENABLE_SERVER, false) CONFIG_INTERFACE(server,SERVER,r, [ --enable-server Enable server interface (default is no)], , [ INTERFACE_SRCS="$INTERFACE_SRCS server_c.c" AC_CHECK_HEADERS(sys/soundcard.h) ]) dnl TiMidity ALSA sequencer server AM_CONDITIONAL(ENABLE_ALSASEQ, false) CONFIG_INTERFACE(alsaseq,ALSASEQ,A, [ --enable-alsaseq Enable ALSA sequencer server interface (default is no)], , [ INTERFACE_SRCS="$INTERFACE_SRCS alsaseq_c.c" AM_PATH_ALSA ]) dnl TiMidity Windows synthesizer server AM_CONDITIONAL(ENABLE_WINSYN, false) CONFIG_INTERFACE(winsyn,WINSYN,W, [ --enable-winsyn Enable Windows Synthesizer interface (default is no)], , [ INTERFACE_SRCS="$INTERFACE_SRCS winsyn_c.c rtsyn_common.c rtsyn_winmm.c" ]) dnl TiMidity PortMIDI synthesizer server AM_CONDITIONAL(ENABLE_PORTMIDISYN, false) CONFIG_INTERFACE(portmidisyn,PORTMIDISYN,P, [ --enable-portmidisyn Enable PortMIDI Synthesizer interface (default is no)], , [ INTERFACE_SRCS="$INTERFACE_SRCS portmidisyn_c.c rtsyn_common.c rtsyn_portmidi.c" ]) dnl TiMidity Windows GUI synthesizer server AM_CONDITIONAL(ENABLE_W32G_SYN, false) CONFIG_INTERFACE(winsyng,W32G_SYN,W, [ --enable-winsyng Enable Windows GUI Synthesizer interface (default is no)], , [ if test "x$VCPP" = xyes || test "x$BORLANDC" = xyes || test "x$WATCOM_C" = xyes; then INTERFACE_SRCS="$INTERFACE_SRCS w32g_ini.c w32g_pref.c w32g_syn.c w32g_utl.c winsyn_c.c rtsyn_common.c rtsyn_winmm.c" lib_w32gui_opt='gdi32.lib comctl32.lib comdlg32.lib ole32.lib' lib_user32_opt='user32.lib' if test "x$VCPP" = xyes; then VCPP_LDFLAGS="$VCPP_LDFLAGS -subsystem:windows " fi if test "x$BORLANDC" = xyes; then BORLANDC_START='C0W32.OBJ' CFLAGS="$CFLAGS -tW" lib_w32gui_opt="-aa $lib_w32gui_opt" fi if test "x$WATCOM_C" = xyes; then CFLAGS="$CFLAGS -bw" WATCOM_LDFLAGS="$WATCOM_LDFLAGS SYS nt_win" fi else lib_w32gui_opt='-lgdi32 -lcomctl32 -lcomdlg32 -lole32' lib_user32_opt='-luser32' LDFLAGS="-mwindows $LDFLAGS" INTERFACE_SRCS="$INTERFACE_SRCS w32g_ini.c w32g_pref.c w32g_syn_escaped.c w32g_utl.c winsyn_c.c rtsyn_common.c rtsyn_winmm.c" fi ]) dnl Windows GUI AM_CONDITIONAL(ENABLE_W32GUI, false) CONFIG_INTERFACE(w32gui, W32GUI, w, [ --enable-w32gui Enable Windows GUI interface (default is no)], , [ if test "x$VCPP" = xyes || test "x$BORLANDC" = xyes || test "x$WATCOM_C" = xyes; then INTERFACE_SRCS="$INTERFACE_SRCS w32g_c.c w32g_ini.c w32g_i.c w32g_playlist.c w32g_utl.c w32g_pref.c w32g_subwin.c w32g_subwin2.c w32g_subwin3.c w32g_ut2.c w32g_dib.c wrdt_w32g.c w32g_mag.c" lib_w32gui_opt='gdi32.lib comctl32.lib comdlg32.lib ole32.lib' lib_user32_opt='user32.lib' if test "x$VCPP" = xyes; then VCPP_LDFLAGS="$VCPP_LDFLAGS -subsystem:windows " fi if test "x$BORLANDC" = xyes; then BORLANDC_START='C0W32.OBJ' CFLAGS="$CFLAGS -tW" lib_w32gui_opt="-aa $lib_w32gui_opt" fi if test "x$WATCOM_C" = xyes; then CFLAGS="$CFLAGS -bw" WATCOM_LDFLAGS="$WATCOM_LDFLAGS SYS nt_win" fi else lib_w32gui_opt='-lgdi32 -lcomctl32 -lcomdlg32 -lole32' lib_user32_opt='-luser32' LDFLAGS="-mwindows $LDFLAGS" INTERFACE_SRCS="$INTERFACE_SRCS w32g_c.c w32g_ini.c w32g_i.c w32g_playlist.c w32g_utl.c w32g_pref.c w32g_subwin_escaped.c w32g_subwin2.c w32g_subwin3.c w32g_ut2.c w32g_dib.c wrdt_w32g.c w32g_mag.c" fi ]) dnl UMP configuration AM_CONDITIONAL(ENABLE_PLUGIN, false) CONFIG_INTERFACE(ump, PLUGIN, p, [ --enable-ump UMP configuration (default is no)], [ if test ! -d ump; then AC_MSG_ERROR(UMP Package is not exists. Can't configure it.) fi AC_CHECK_HEADER(X11/xpm.h,,AC_MSG_ERROR([UMP Package needs xpm.h[,] but could not find it.])) AC_CHECK_LIB(Xpm,XpmCreatePixmapFromData,:,AC_MSG_ERROR([UMP Package needs libXpm.a[,] but could not find it.])) if test "x$have_xext" = xyes; then lib_xext_opt=-lXext fi if test "x$have_xprelibs" = xyes; then lib_xprelibs_opt='-lSM -lICE' fi lib_xmu_opt=-lXmu lib_xt_opt=-lXt ]) dnl Offix support dnl this rely on CFLAGS and LIBS AC_ARG_ENABLE(offix, [ --enable-offix Enable offix support (default is no)], [ if test "$enableval" = "yes"; then KEEPCPPFLAGS=$CPPFLAGS KEEPLIBS=$LIBS KEEPLDFLAGS=$LDFLAGS CPPFLAGS="$CPPFLAGS $offix_include_dir" LDFLAGS="$LDFLAGS $offix_lib_dir" LIBS="$LIBS $lib_xmu_opt $lib_xt_opt $lib_xprelibs_opt $lib_xext_opt -lX11" AC_CHECK_LIB(Dnd,DndInitialize,[ LIBS=$KEEPLIBS lib_offix_opt="-lDnd" AC_DEFINE(OFFIX,1,Define to 1 if you need offix support) ], [ LDFLAGS=$KEEPLDFLAGS CPPFLAGS=$KEEPCPPFLAGS LIBS=$KEEPLIBS ]) fi ]) dnl Network section AC_ARG_ENABLE(network, [ --enable-network Enable network support (default is no)], [ if test "$enableval" = "yes"; then AC_DEFINE(SUPPORT_SOCKET,1,Define to 1 if you need network support) fi ]) AM_CONDITIONAL(ENABLE_NETWORK, test "x$enable_network" = "xyes") dnl Sound Spectrogram Viewer AC_ARG_ENABLE(spectrogram, [ --enable-spectrogram Enable Sound Spectrogram Viewer (default is no)], [ if test "$enableval" = "yes"; then if test "x$with_x" != xyes; then AC_MSG_ERROR(spectrogram: --with-x option must be specified) fi AC_DEFINE(SUPPORT_SOUNDSPEC,1,Define to 1 if you need spectrogram vewer.) fi ]) AM_CONDITIONAL(ENABLE_SOUND_SPEC, test "x$enable_spectrogram" = "xyes") dnl Wave Spline Interpolations AC_ARG_ENABLE(spline, [ --enable-spline=[method] Specify spline method. one of no,linear,cubic,lagrange,newton,gauss (default is linear)], [ case "x$enableval" in xlinear) AC_DEFINE(DEFAULT_RESAMPLATION,resample_linear,Define resampler.) ;; xcubic) AC_DEFINE(DEFAULT_RESAMPLATION,resample_cspline,Define resampler.) ;; xlagrange) AC_DEFINE(DEFAULT_RESAMPLATION,resample_lagrange,Define resampler.) ;; xnewton) AC_DEFINE(DEFAULT_RESAMPLATION,resample_newton,Define resampler.) ;; xgauss) AC_DEFINE(DEFAULT_RESAMPLATION,resample_gauss,Define resampler.) ;; xno) AC_DEFINE(DEFAULT_RESAMPLATION,resample_none,Define resampler.) ;; *) AC_MSG_ERROR(Invalid method of --enable-spline) ;; esac ]) dnl WRD interface AC_ARG_ENABLE(wrd, [ --enable-wrd Enable WRD interface for X (default is no)], [ if test "$enableval" = "yes"; then if test "x$with_x" != xyes; then AC_MSG_ERROR(wrd: --with-x option must be specified) fi AC_DEFINE(WRDT_X,1,Define to 1 if you need wrd support for X.) enable_sherry_wrd=yes AC_CHECK_LIB(z,zlibVersion,:,enable_sherry_wrd=no) AC_CHECK_HEADER(png.h,,enable_sherry_wrd=no) AC_CHECK_LIB(png,png_init_io,:,enable_sherry_wrd=no,-lz) if test "$enable_sherry_wrd" = yes; then AC_DEFINE(ENABLE_SHERRY,1,Define to 1 if you enable Sherry WRD) lib_zip_opt=-lz lib_png_opt=-lpng else AC_MSG_WARN([Sherry WRD is disabled: png.h, libpng.a, libz.a are required]) fi if test "x$have_xext" = xyes; then lib_xext_opt=-lXext fi fi ]) dnl end of interfaces # # Finish up # AM_CONDITIONAL(ENABLE_WRD, test "x$enable_wrd" = "xyes") AM_CONDITIONAL(CYGNUS, test "x$CYGNUS" = xyes) AM_CONDITIONAL(MSYS, test "x$MSYS" = xyes) AM_CONDITIONAL(VCPP, test "x$VCPP" = xyes) AM_CONDITIONAL(BORLANDC, test "x$BORLANDC" = xyes) AM_CONDITIONAL(WATCOM_C, test "x$WATCOM_C" = xyes) AM_CONDITIONAL(W32READDIR, test "x$W32READDIR" = "xyes") SET_UNIQ_WORDS(LDFLAGS,$LDFLAGS) SET_UNIQ_WORDS(SHLDFLAGS,$SHLDFLAGS) SET_UNIQ_WORDS(CFLAGS,$EXTRACFLAGS $CFLAGS) SET_UNIQ_WORDS(CPPFLAGS,$CPPFLAGS $EXTRADEFS) if test "x$oss_device" != x; then AC_DEFINE_UNQUOTED(OSS_DEVICE,"$oss_device", oss device name) fi if test "x$TIMIDITY_OUTPUT_ID" != x; then AC_DEFINE_UNQUOTED(TIMIDITY_OUTPUT_ID,"$TIMIDITY_OUTPUT_ID", the output specification) fi if test "x$with_x" = xyes; then dnl Order of X-library is: -lXm -lXaw -lXmu -lXt -lSM -lICE -lXext -lX11 LIBS=`echo $LIBS | sed "s/-lX11/$lib_offix_opt $lib_xm_opt $lib_xaw_opt $lib_xmu_opt $lib_xt_opt $lib_xprelibs_opt $lib_xext_opt -lX11/"` fi LIBS="$LIBS $lib_dl_opt $lib_png_opt $lib_zip_opt $lib_user32_opt $lib_w32gui_opt $EXTRALIBS" SHLD="$SHLD $SHLDFLAGS" AC_SUBST(BORLANDC_START) AC_SUBST(BORLANDC_LDFLAGS) AC_SUBST(SHELL) AC_SUBST(timidity_LDFLAGS) AC_SUBST(WATCOM_LDFLAGS) AC_SUBST(VCPP_LDFLAGS) AC_SUBST(SYSEXTRAS) AC_SUBST(EXTRALIBS) AC_SUBST(NETSRCS) AC_SUBST(ELFILES) AC_SUBST(SHLD) AC_SUBST(SHCFLAGS) AC_SUBST(dynamic_targets) AC_SUBST(so) AC_SUBST(LN_S) AC_SUBST(WISH) AC_SUBST(tcltk_dep) AC_SUBST(program_transform_name) AC_SUBST(INTERFACE_SRCS) AC_SUBST(pkgdatadir) AC_SUBST(pkglibdir) AC_CONFIG_FILES([ Makefile autoconf/Makefile common.makefile configs/Makefile doc/Makefile doc/C/Makefile doc/ja_JP.eucJP/Makefile interface/Makefile interface/motif_bitmaps/Makefile interface/bitmaps/Makefile interface/pixmaps/Makefile libarc/Makefile libunimod/Makefile timidity/Makefile utils/Makefile script/Makefile TiMidity.ad TiMidity-uj.ad ]) AC_OUTPUT TiMidity++-2.13.2/interface.h.in0100644004711200001440000000247410055364457015433 0ustar tamukiusers/* Define if you have EMACS interface. */ #undef IA_EMACS /* Define if you have GTK interface. */ #undef IA_GTK /* Define if you have KMIDI interface. */ #undef IA_KMIDI /* Define if you have MOTIF interface. */ #undef IA_MOTIF /* Define if you have NCURSES interface. */ #undef IA_NCURSES /* Define if you have PLUGIN interface. */ #undef IA_PLUGIN /* Define if you have SLANG interface. */ #undef IA_SLANG /* Define if you have TCLTK interface. */ #undef IA_TCLTK /* Define if you have VT100 interface. */ #undef IA_VT100 /* Define if you have XAW interface. */ #undef IA_XAW /* Define if you have XSKIN interface. */ #undef IA_XSKIN /* Define if you have DYNAMIC interface. */ #undef IA_DYNAMIC /* Define if you have Windows32 GUI interface. */ #undef IA_W32GUI /* Define if you have Windows GUI synthesizer mode interface. */ #undef IA_W32G_SYN /* Define if you have Remote MIDI interface. */ #undef IA_SERVER /* Define if you have Remote MIDI interface. */ #undef IA_ALSASEQ /* Define if you have Windows synthesizer mode interface. */ #undef IA_WINSYN /* Define if you have PortMIDI synthesizer mode interface. */ #undef IA_PORTMIDISYN #if defined(IA_W32GUI) || defined(IA_W32G_SYN) #ifndef __W32READDIR__ #define __W32READDIR__ #endif #define URL_DIR_CACHE_ENABLE #define __W32G__ /* for Win32 GUI */ #endif TiMidity++-2.13.2/ChangeLog.10100644004711200001440000006626407421005037014622 0ustar tamukiusers-- 1.3.8 Tue Apr 6 1999 Summary: * Fixed some bugs or problems. Date: Sun, 4 Apr 1999 18:14:43 +1000 (EST) From: David Gibson Files: timidity/linux_a.c The two bugs are both in the linux audio driver. Firstly, the driver opens /dev/dsp for both reading and writing, where only writing is necessary. Secondly, the code uses hard coded constants 8 and 16 to set the output format on /dev/dsp. This fails on big-endian machines such as the PowerPC. This patch makes the code use constants #defined by glibc. Date: Sun Apr 4 21:05:37 JST 1999 From: Masanao Izumo Files: interface/x_wrdwindow.c Fixed to change undefined color code to default color (white). Date: Sat, 03 Apr 1999 22:07:45 +0900 (JST) From: Yoshishige ARAI Files: interface/xaw_i.c doc/C/README.xaw doc/ja_JP.ujis/README.xaw Fixed XAW bug. Chnaged some discriptions for XAW document. Date: Wed Mar 31 1999 From: Masanao Izumo Files: timidity/playmidi.c Fixed bug of drumpart recognization. Files: interface/ncurs_c.c Fixed bug about buffer over-running of comment_indicator_buffer. From: Takaya Nogami Date: Sat, 27 Mar 1999 10:38:11 +0900 Files: interface/VTPrsTbl.c timidity/output.c Enabled clear screen with @esc(2j) command for MIMPI WRD. Included from output.c -- 1.3.7 Summary: Tue Mar 30 1999 * Fixed some bugs or problems. * In GTK interface, enabled to delete loaded files from the play list. Date: Tue Mar 30 1999 From: Masanao Izumo Files: interface/gtk_p.c interface/motif_p.c Used select() instead of ioctl/FIONREAD. Date: Mon, 29 Mar 1999 21:08:16 +1000 (EST) From: ggt@netspace.net.au (Glenn Trigg) Enabled loaded files to be deleted from the play list by double-right-clicking on the list entry. From: Masanao Izumo Date: Mon Mar 29 1999 Files: timidity/support.h Fixed prototype mismatch problem for getopt(). Files: configure.in interface/ncurs_c.c Added configure test for PDcurses. Increased COMMAND_BUFFER_SIZE to 4096. Date: Sat Mar 27 1999 From: Masanao Izumo Files: timidity/playmidi.c Fixed to ignore LSB data entry. Files: timidity/readmidi.c Turned the control MIDI event value to 127 if the value is more than 127. Files: timidity/readmidi.c Fixed not to change to GM_SYSTEM_MODE if play_system_mode is not DEFAULT_SYSTEM_MODE. Date: Thu, 25 Mar 1999 23:41:46 -0600 (CST) From: "Eric A. Welsh" Files: interface/ncurs_c.c In cmsg(), in ncurs_c.c, there is an #ifdef __BORLANDC__ which adds in a nl(). This should be changed to include __WIN32__ && ! __CYGWIN32__, since standard Win32 does not do a \r when a \n is issued. Files: interface/ncurs_c.c interface/vt100_c.c Fixed a bug in the lyric display for non .KAR files that have lyrics. In every non .KAR file that I have that has lyrics, '\n' are where '\r' should be, and '\r' are in very strange places that result in very bad positions to do carriage returns. The '\n' also do bad things to the -int display, since the '\n' caues the text to go below the single line of output. Summary: Tue Mar 23 1999 * In XAW interface, Added new user interfaces. * Fixed some bugs. -- 1.3.6 Date: Sat, 20 Mar 1999 22:01:43 +0900 (JST) From: Yoshishige ARAI Files: configure.in interface/xaw_i.c Added -lXext for Motif link option. On XAW, Enabled selection & deletion with `Backspace' key in load dialog text. Date: Fri, 19 Mar 1999 20:54:15 -0500 (EST) From: Franklin Chen Files: configure.in interface/slang_c.c On Linux Red Hat 5.2: must change to . Added configure test for , and included it if it is found (by Masanao Izumo ) Date: Mon Mar 15 1999 From: Masanao Izumo Files: timidity/common.c libarc/url.c Fixed bug for Windows. Date: Fri Mar 12 1999 From: Masanao Izumo Files: utils/support.c Fixed bug of strncasecmp() Date: Wed, 10 Mar 1999 14:00:18 +0900 (JST) From: Yoshishige Arai Files: interface/xaw_c.c Fixed bug for XAW interface. Date: Wed, 10 Mar 1999 03:09:31 +0900 (JST) From: Yoshishige Arai Files: interface/xaw_c.c interface/xaw_i.c Pached for XAW interface: * Fixed bug about `Save Config' * Added `Add All' button * Checked whether specified file is MIDI file or not * Changed KeyBoardFocus for the File Load window * Stored the changed directory to File Load Dialog * Used XtVaSetValues() instead of XtSetValues() Date: Tue, 09 Mar 1999 20:41:19 +0900 From: Masanao Izumo Files: interface/xaw_i.c Pached for XAW interface about velocity bar. -- 1.3.5 Mon Mar 8 1999 Summary: * In XAW interface, added new user interfaces. * Added AM_EXEEXT test for configuring. Date: Mon Mar 8 1999 From: Masanao Izumo Files: configure.in Added AM_EXEEXT test for configuring. From: Yoshishige Arai Date: Sat, 06 Mar 1999 23:36:24 +0900 (JST) Files: interface/{xaw_i.c,xaw_c.c,xaw.h} doc/C/README.xaw doc/ja_JP.ujis/README.xaw Patched for XAW interface. Fixed some problems and changed some interfaces. Added documentation for XAW interface. From: Yoshishige Arai Date: Thu, 04 Mar 1999 03:06:04 +0900 (JST) Files: interface/xaw_i.c Patched for XAW interface. Fixed some bugs and changed some interfaces. Date: Wed, 03 Mar 1999 00:21:46 +0900 (JST) From: Yoshishige Arai Files: interface/{xaw_i.c,xaw_c.c,xaw.h,on.xbm,off.xbm} Patched for XAW interface. Added the list window to select to play. Added the control window to change timidity extends mode (-E). -- 1.3.4 Mon Mar 1 1999 Summary: * In XAW interface, fixed bug about MIDI title displaying. * In GTK interface: Fixed the button highlight problem. Added a new WM-icon provided by Tim Allen. Defined the wmclass & wmname to make TiMidity friendlier to window managers. * Fixed otner bugs or problems. Date: Sat Feb 27 1999 From: Masanao Izumo Files: interface/xaw_c.c In XAW interface, fixed bug about MIDI title displaying. Fri Feb 26 JST 1999 From: Masanao Izumo Files: timidity/au_a.c timidity/wave_a.c timidity/aiff_a.c Handled write error at opening. Files: timidity/instrum.h Fixed bug of buffer over-run of inst_map_table. Files: utils/support.c Fixed bug of strdup implementation. Date: Fri, 26 Feb 1999 22:45:34 +1100 (EST) From: ggt@netspace.net.au (Glenn Trigg), thristian@usa.net (Tim Allen) Files: interface/gtk_i.c In GTK interface: Fixed the button highlight problem. I'd forgotten about the mask! Added a nice colorful icon provided by Tim Allen. Defined the wmclass & wmname to make TiMidity friendlier to window managers. Date: Thu, 25 Feb 1999 01:17:45 +0900 (JST) From: Yoshishige Arai Files: interface/xaw_i.c Fixed problem of cascade file selection popup menu. -- 1.3.3 Wed Feb 24 1999 Summary: * Used WAVE_MAPPER for waveOutOpen() in Windows. * Renamed inflate to zip_inflate, and deflate to zip_deflate. * Modified to port to some OSes. * Improved XAW interface. * Added strdup implementation is it was not exists. * Fixed bug that MIDI reset did not update the display of program. * Added `extern errno' in timidity.h * Fixed XAW geometry problem on non-trace mode. * Not to call glob() if GLOB_BRACE is not defined. Date: Wed Feb 24 1999 From: Masanao Izumo Files: timidity/win_a.c Used WAVE_MAPPER for waveOutOpen() Files: libarc/url_dir.c interface/ncurs_c.c interface/xaw_i.c Added S_ISDIR macro definition if it is not defined. There is no difinition of this macro on NeXTSTEP under /usr/include/ or /usr/include/sys/. It is defined in /usr/include/bsd/sys/stat.h, but I don't include this file because some conflicts may occur. Files: interface/xaw_i.c timidity/timidity.h Moved strstr and strncasecmp implementation to timidity.h and support.c. Date: Mon Feb 22 1999 From: Masanao Izumo Files: timidity/audriv_none.c Removed error codes. Files: libarc/{zip.h,arc.c,inflate.c,url_inflate.c,arc_tar.c,deflate.c} timidity/readmidi.c Renamed inflate to zip_inflate, and deflate to zip_deflate. Files: utils/support.c timidity/timidity.c timidity/timidity.h libarc/url_dir.c Modified to port to some OSes such as NeXTSTEP. Added strdup() and getcwd() implementation if they are not exist. Added declarations for `optind' and `optarg' in timidity.c if is not exist. Included from timidity.h Included from url_dir.c for S_ISDIR Date: Sat, 20 Feb 1999 14:06:25 +0900 (JST) From: Yoshishige Arai Files: interface/{xaw_i.c,xaw_c.c,xaw.h,arrow.xbm} Improved XAW interface. - Cascading pulldown menu for file selection. - Add time bar. - Add auto exit, repeat, and shuffle On/Off to menu. - Add translation keys: CTRL-M: Text display on/off CTRL-T: Trace display on/off CTRL-S: shuffle on/off CTRL-R: repeat on/off - Display GM, GS, XG to upper right button. - Change the function of upper right button. Left mouse click: Text display on/off Center mouse click: Trace display on/off Right mouse click: Change window size. - Display number of voices and title of MIDI in bottom of window. Date: Tue Feb 16 1999 From Masanao Izumo Files: timidity/playmidi.c Fixed bug that MIDI reset did not update the display of program. Date: Mon Feb 15 1999 From: Masanao Izumo Files: timidity.h Added `extern errno' in timidity.h Date: Fri, 12 Feb 1999 12:46:51 +0900 From: "KINOSHITA, K." Files: interface/xaw_i.c Fixed XAW geometry problem on non-trace mode. Files: interface/gtk_i.c Not to call glob() if GLOB_BRACE is not defined. -- 1.3.2 Wed Feb 10 1999 Summary: * Patched for BSD/OS. * Changed icons of motif interface. * Changed sorting algorithm for xaw and Tck/Tk interface. * Fixed bugs and problems of Tcl/Tk interface Date: Wed Feb 10 1999 From: Masanao Izumo Files: configure.h timidity/timidity.h Included from timidity.h if configure finds it. Files: interface/tkpanel.tcl Fixed bug of Tcl/Tk interface: If a file is added on suffle, it is possible to be error. Tck may access to out of range of Stat(SuffleList). Date: Tue, 09 Feb 1999 04:11:55 +0900 From: (Masahiko Kimoto) Files: configure.in timidity/linux_a.c timidity/timidity.h Patched for BSD/OS. Date: Mon, 08 Feb 1999 07:42:46 -0500 From: Roger Fujii Files: interface/motif_i.c interface/motif_bitmaps/{Makefile.in,Makefile.am,back.xbm,fwd.xbm, next.xbm,pause.xbm,prev.xbm,quit.xbm,restart.xbm,timidity.xbm,Makefile} Attached is better looking xbms for the motif interface plus a fix to prevent the last button from resizing when the window is resized. Date: Mon Feb 8 JST 1999 From: Masanao Izumo Files: interface/ncurs_c.c Modified ncurs_c.c. Date: Sun Feb 7 1999 From: Masanao Izumo Files: interface/vt100_c.c Bug fixed for Windows. select() from Windows API is not available for file descriptor, but from EGCS is ok. Files: interface/browser.tcl Changed `lsort -dictionary' to `lsort -ascii'. Date: Sat, 6 Feb 1999 10:44:42 +0100 (CET) From: Peter Kleiweg Files: interface/xaw_i.c Changed the sorting algorithm for the xaw interface. Now, directories are listed before regular files. Date: Sat, 6 Feb 1999 01:45:20 +0100 (CET) From: Peter Kleiweg Files: interface/tkpanel.tcl Fixed Tck/Tk interface problem: The proc MakeShuffleList is broken. The list of numbers it generates has a `hole' in it. This generates an error when the last number in the list has been played. Also, with Tk, whenever a new song starts, the global X11 selection is changed. This is very annoying when I'm just doing some cut-and-paste in another application. I can even loose the data I was attempting to move. So I changed this behavior in tkpanel. -- 1.3.1 Fri Feb 5 1999 Summary: * Fixed some bugs. * Enabled compile with gcc from MINGW32. (This package has not dir.h which is included and , so configure of AC_HEADER_DIRENT section is failed all. Where is it gone?) Date: Fri Feb 5 1999 From: Masanao Izumo Files: interface/Makefile.am Linked support.$(so) to each dynamic interfaces. Date: Thu Feb 4 1999 From: Masanao Izumo Files: timidity.c Fixed bug that core dummped if specified out of range of program number in *.cfg. This bug is reported by Erik Inge Bolso. Thank you. about error message for out of range of program number in *.cfg Files: INSTALL INSTALL.jp Added about installation on CYGNUS. Files: configure.in utils/{net.c,net.h} Used WINSOCK (Windows API -lwsock32) if `AC_CHECK_FUNC(socket)' is failed, and called WSAStartup() in open_socket() at first once. WINSOCK is needed to compile with gcc from MINGW32 package. Files: acinclude, configure.in Added tests for Windows API. Files: libarc/url_dir.c Fixed bug & improved of url_dir.c about URL_DIR_CACHE_ENABLE implementation. Files: timidity/timidity.h configure.in Fixed some compilation errors. -- 1.3.0 Wed Feb 3 1999 Summary: * Fixed some problems with the Xaw and Tcl/Tk interfaces. * Modified to compile on cygnus. * Made support.c to define missing functions. * Used `strerror()' instead of `sys_errlist[]'. * Imported Macintosh source from 1999.1.7 released. * Defined BIG_ENDIAN or LITTLE_ENDIAN according to WORDS_BIGENDIAN. * Configure/Makefile modifications: - Enabled to configure on cygnus. - Remove -aout compiler flag on FreeBSD. - Remove -Wall compiler flag. - Don't use `+=' operation in any Makefiles. Old GNU make may not recognize append operator. * Improved XAW interface for trace playing. * Improved reverb sounds. * Fixed MIME/Multipart bug. Date: Tue, 2 Feb 1999 21:15:14 +0100 (CET) From: Peter Kleiweg Files: interface/{browser.tcl,xaw_i.c,tkmidity.ptcl} Fixed some problems with the Xaw and Tcl/Tk interfaces: - With the Xaw interface, in the File Open dialog, the file/directory listing was unsorted. - With the Tcl/Tk interface, in the File Open dialog, the directory listing was sorted, but not the file listing. - On some machine, there is no 17 point fonts. Changed the use of 17 point fonts into 18 point fonts. Date: Wed Feb 3 1999 From: Masanao Izumo Files: timidity/{win_a.c,timidity.c,playmidi.c} Modified to compile on CYGNUS/gcc. Fragment optimizations. Date: Tue Feb 2 1999 From: Masanao Izumo Files: utils/support.c timidity/timidity.h Defined missing functions. And declared them in timidity.h. Files: timidity/output.c timidity/output.h Added output_encoding_string() function to display the name of encoding. Files: interface/{wrdt_wincon.c,vt100_c.c} timidity/{playmidi.c,win_a.c} Modified to compile on CYGNUS/gcc Files: interface{gtk_p.c,motif_p.c,tk_c.c} libarc/url.c timidity/{aiff_a.c,au_a.c,audriv_al.c,audriv_sun.c,bsd20_a.c,common.c, dl_dlopen.c,dl_hpux.c,hpux_d_a.c,linux_a.c,raw_a.c,readmidi.c, timidity.c,timidity.h,wave_a.c} Used `strerror()' instead of `sys_errlist[]'. Included in timidity.h if HAVE_ERRNO_H is true. Files: timidity/{mac_a.c,mac_com.h,mac_dlog.c,mac_main.c,mac_main.h,mac_qt_a.c, mac_soundspec.c} interface/{mac_c.c,mac_c.h,mac_loadBMP.c,mac_loadBMP.h,mac_mag.c, mac_mag.h,mac_skin.c,mac_skin.h,mac_trace.c,mac_wrdwindow.c, mac_wrdwindow.h,wrdt_mac.c} utils/{mac_readdir.c,mac_readdir.h,mac_util.c,mac_util.h} Imported Macintosh source from 1999.1.7 released. Files: timidity/timidity.h If WORDS_BIGENDIAN is defined in config.h, define BIG_ENDIAN, otherwise define LITTLE_ENDIAN. Files: utils/timer.c Use gettimeofday() if HAVE_GETTIMEOFDAY, otherwise Use Windows API. Files: configure.in utils/Makefile.am libarc/url_dir.c Modified the implementation about opendir(). Date: Mon Feb 1 1999 From: Yoshishige Arai Improved XAW interface display in trace mode. Date: Fri Jan 29 1999 From: Masanao Izumo Files: configure.in On FreeBSD, There is problem to make shared object library. Netscape Plugin needs `aout' format, but I don't have enough knowledge to build aout format under ELF environment FreeBSD. So I just removed -aout flag for compiler. Files: doc/ja_JP.ujis/timidity.cfg.5 Changed `Kairyouban' to `TiMidity++'. Files: INSTALL, INSTALL.jp Added some discriptions. Files: common.makefile.in Removed -Wall option from compiler option. Expanded `+=' macro definition. Defined @EXTRADEFS@ in CPPFLAGS instead of DEFS. Date: Thu, 28 Jan 1999 From: Masaki Kiryu Files: timidity/reverb.{c,h} Improved reverb sounds. Date: Wed Jan 27 1999 From: Masanao Izumo Files: libarc/arc_mime.c Fixed bug about MIME archiver for multipart/mixed. You can play midi in MIME/Multipart file. For example: % timidity mail:~/Mail/inbox/1234 I think MIME/Multipart is one of archive file format. :-) -- 1.2.1 Mon Jan 25 1999 Summary: * Fixed some configuration problems. * Added --enable-dynamic `configure' option. Date: Mon Jan 25 1999 From: Masanao Izumo Files: acinclude.m4 configure.in Fixed some problems of configuration: * Remove duplicated -lXpm option. * Not to change the order of comple flags. * and so on... Files: interface/gtk_c.c Implemented interface_g_loader() Files: timidity/dl_dlopen.c Added "\n" to error message of dl_find_symbol() Date: Mon, 25 Jan 1999 01:18:27 +0900 (JST) From: nork@lb.u-tokai.ac.jp (Norikatsu Shigemura) Files: configure.in Pached for making FreeBSD UMP. Date: Fri Jan 22 1999 From: Masanao Izumo Files: configure.in Added --enable-dynamic configure option. It is enable to always compile dynamic link codes. Files: timidity/gtk_i.c On Solaris, glob()'s flag is different in the interface. So I just changed not to call glob() on Solaris. Date: Thu, 21 Jan 1999 12:53:18 +0900 From: "KINOSHITA, K." Files: timidity/timidity.c Removed no effect statements. Date: Thu, 21 Jan 1999 03:40:38 +0900 From: Ueyama Rui Files: interface/pixmaps/{fast,slow,restart,keyup,keydown}.xpm Reported some files for Gtk pixmaps are missing. Added them. -- 1.2.0 Thu Jan 21 JST 1999 Summary: * XAW interface: - Changed button bitmap of random & repeat - Modified some implementations. * Gtk interface: - Added buttons (& implementation) for raising & lowering the pitch. - Added buttons (& implementation) for increasing/decreasing the tempo. * Lookup TIMIDITY_SOUND_CARD and TIMIDITY_PCM_DEVICE environment variable to select the PCM device of ALSA. * Made interface.h to define IA_* macro for TiMidity interface. This file is generated automatically by configure. * Fixed some bugs. Date: Thu, 21 Jan 1999 01:33:58 +0900 (JST) From: nork@lb.u-tokai.ac.jp (Norikatsu Shigemura) Files: configure.in Fixed configure bug about FreeBSD dynamic interface. Date: Wed Jan 20 1999 From: Masanao Izumo Files: interface/xskin_spectrum.c Don't define xskin_spe_ana() and xskin_wave() if soundspec is not enable. Files: configure.in interface.h.in timidity/{Makefile.am,timidity.c,controls.c} Fixed configuration bug that tcl needed -dl on some machines. IA_* macro is into interface.h. interface.h is generated automatically by configure. Date: Tue, 19 Jan 1999 23:16:33 +0900 (JST) From: Yoshishige Arai Files: interface{bitmaps/Makefile.am,bitmaps/Makefile.in,bitmaps/random.xbm, bitmaps/repeat.xbm,xaw.h,xaw_i.c} Modified XAW interface: - Changed Form Widget to Box Widget. - Changed icon bitmaps - Obsoleted MSGWINDOW macro configuration. Message window is always enable. Date: Tue, 19 Jan 1999 17:54:53 +0900 From: Takanori Watanabe , Glenn Trigg Files: interface{emacs_c.c,gtk_c.c,gtk_h.h,gtk_i.c,gtk_p.c,ncurs_c.c, pixmaps/Makefile.in,vt100_c.c} timidity/{controls.h,playmidi.c,timidity.c,wrd_read.c} Pached from Glenn Trigg: The changes are (roughly): - Added buttons (& implementation) for raising & lowering the pitch. - Added buttons (& implementation) for increasing/decreasing the tempo. - Fixed a bug where starting with no files and then loading a file and trying to play it caused a crash. - Fixed a typo RC_TOGGLE_DURMCHAN => RC_TOGGLE_DRUMCHAN. - Added some braces to two macros to stop some compiler warnings. Date: Tue, 19 Jan 1999 00:21:35 +0900 From: Yamahata Isaku Files: alsa_a.c Lookup TIMIDITY_SOUND_CARD and TIMIDITY_PCM_DEVICE environment variable to select the PCM device. -- 1.1.1 Mon Jan 18 1999 Summary: * Fixed some bugs. * Modified that xaw interface is enable to run without any midi files. Date: Mon Jan 18 1999 From: Masanao Izumo Files: interface/{xaw_i.c,xaw_c.c} timidity/common.c Fixed some bugs. Date: Mon Jan 18 1999 From: takawata@shidahara1.planet.sci.kobe-u.ac.jp Files: configure.in Fixed configuration bug about OffiX. Fixed configuration bug about ALSA. Files: interface/{xaw_c.c,xaw_i.c} timidity/timidity.c Modified that xaw interface is enable to run without any midi files. Date: Mon Jan 18 1999 From: "KINOSHITA, K." Files: configure.in Removed -ltcl when configure option of --enabel-tcltk=dynamic is specified. Files: interface/Makefile.am Modified some installation. Used `$(INSTALL_DATA)' instead of `$(INSTALL) -m 644' Files: interface/{dumb_c.c,dynamic_c.c,emacs_c.c} On some compilers, `stdout' can't assign to any variable in global statement. Fixed this problem. Files: configure.in config.h.in timidity/timidity.c Added HAVE_GETOPT_H macro. Files: configure.in Fixed bugs of configure without --with-x. Files: timidity/Makefile.am Fixed problem to `make install' instead of `make; make install' -- 1.1.0 Mon Jan 18 1999 Summary: * Fixed bugs of xaw interface with no trace mode. * Added configuration for UMP package. * Modified configure and Makefiles. * Added trace mode to xaw interface. * Supported OffiX configuration. * Some bugs are fixed. Date: Mon Jan 18 1999 From: Masanao Izumo Files: interface/xaw_i.c Fixed bugs of xaw interface with no trace mode. Files: configure* */Makefile* Added configuration for UMP package. Modified configure and Makefiles. Date: Sat, 16 Jan 1999 02:18:01 +0900 (JST) From: Yoshishige Arai Files: interface/{xaw.h,xaw_c.c,xaw_i.c} Added trace mode to xaw interface. Date: Fri, 15 Jan 1999 14:26:17 +0900 From: Takanori Watanabe Files: configure.in interface/xaw.h interface/xskin_loadBMP.c Supported OffiX configuration. The new configure options are: --enable-offix Turn on OffiX interface for XAW. --with-offix-includes=[dir] Specify include directry for Offix library. --with-offix-libs=[dir] Specify library for Offix. Fixed tkl/tk configure bug. Included config.h in xskin_loadBMP.c. -- 1.0.1 Thu Jan 14 1999 Summary: * Define function of vsnprintf() and snprintf() if it is not exists. * Fixed message transfer problem with '\n' for some interface. * Modified manual installation. * Check libXaw3d before checking libXaw. * Fixed ALSA configuration problem. * Modified for OffiX interface. * Tcl/tk interface can start with no midi file arguments. * Modified doc/C/README.xskin Date: Thu Jan 14, 1999 From: Masanao Izumo Files: timidity/common.c interface/{motif_c.c,slang_c.c,vt100_c,ncurs_c.c,c, xaw_i.c,xaw_c.c,tk_c.c,wrdt_x.c} Define function of vsnprintf() and snprintf() if it is not exists. And use it some where. Fixed Tck/Tk message transfer problem with '\n' (Not completed) Files: interface/xaw_c.c interface/xaw_i.c Fixed XAW message transfer problem with '\n'. Files: configure.in doc/Makefile* doc/*/Makefile* Modified manual installation. Files: configure.in interface/xaw.h Check libXaw3d before checking libXaw. Modified the comment in xaw.h Date: Tue, 12 Jan 1999 22:00:26 +0900 From: Yamahata Isaku Files: configure.in acinclude.m4 Fixed ALSA configuration problem. Date: Tue, 12 Jan 1999 21:25:32 +0900 From: Takanori Watanabe Files: interface/xaw.h interface/xaw_i.c Modified for OffiX file drag & drop interface for xaw. (need libDnd) This interface is not enabled by default. If you want build this, define OFFIX in interface/xaw.h and link libDnd. xaw.h:WIDGET_IS_LABEL_WIDGET is undefined by default. Date: Tue, 12 Jan 1999 11:38:16 +0900 From: "KINOSHITA, K." Files: interface/tk_c.c interface/tkpanel.tcl interface/timidity.c Tcl/tk interface can start with no midi file arguments. Date: Sun, 10 Jan 1999 18:58:17 +0900 (JST) From: Yoshishige Arai Files: doc/C/README.xskin Fixed spelling and syntax. -- 1.0.0 1/6, 1999 Major changes from 0.2i: * Install with `configure' script. * Synchronization for audio and interface controls. * Uses GUS/patch and SoundFont for voice data * Plays the MIDI file via network (UNIX version) * Plays the MIDI file in archive file * Plays not only SMF file but also MOD, RCP/R36/G18/G36 * Can handle 32 channel data * Can handle user interfaces as dynamic link modules (UNIX version) * Can display the sound spectrogram (UNIX or Macinotsh version) * Automatically detects the mode of MIDI file (GM/GS/XG) * Automatically detects drum channels (GS/XG) * Can display MIMPI's WRD file (One of KARAOKE system mainly used in japan) * Localization for Japanese * Improve new curses interface * Add new interface: VT100, X Athena Wiget, Emacs, skin, gtk * Make Pre-calculated resampling cache * Enable private user configuration (in ~/.timidity.cfg) * Add some effects * Can control follows while playing: - Change drumpart - Load patch file - Pitch up/down - Speed up/down - Maxmum voices up/down (limited to MAX_VOICES macro defined at compiling) * Can output Sun audio file (*.au) * Can output encoding of G.711 A-Law * Use pager program specified by PAGER Environment when displaying the command line help * The following new MIDI events are supported: ChannelPressure, ModulationWheel, Portamento, ReverbEffect, ChorusEffect, RPN+/-, Mono/Poly Part, Lyric, KARAOKE-Part(@KMIDI), and SystemExclusiveMessages * Many bugs (that is found in the original) are fixed. TiMidity++-2.13.2/ChangeLog.20100644004711200001440000052473710031632412014621 0ustar tamukiusers2004-03-29 mput * NEWS: update * configure.in: version to 2.13.0 * configure.in: disable --enable-simd (not working) 2004-02-28 TAMUKI Shoichi * configs/msc[67]-project.zip: version to 2.13.0 * doc/C/README.mts, doc/ja_JP.eucJP/README.mts: Update 2004-03-28 mput * timidity/resample.c (set_current_resampler): RESAMPLE_NONE was deactivated. 2004-03-26 Kentaro Sato * timidity/instrum.[ch], timidity/smplfile.c, timidity/sndfont.c: Supported LOOKUP_HACK for %sample. 2004-03-25 TAMUKI Shoichi * doc/C/timidity.1, doc/ja_JP.eucJP/timidity.1, timidity/effect.c, timidity/timidity.c: Change specification of -EFns=? option (for 16-bit) -EFns=0 : no noise shaping -EFns=1 : traditional noise shaping -EFns=2 : overdrive-like soft-clipping + new noise shaping -EFns=3 : tube-amplifier-like soft-clipping + new noise shaping -EFns=4 : new noise shaping (default) 2004-03-24 TAMUKI Shoichi * interface/w32g.h, interface/w32g_c.c, interface/w32g_i.c: Fix handling of canvas mode (W32GUI version) 2004-03-20 Saito * timidity/reverb.[ch], timidity/readmidi.c: Implement XG Amp Simulator (incomplete). Change algorithm of Overdrive / Distortion. 2004-03-20 Takaya Nogami * timidity/darwin_a.c: 24bit output support 2004-03-19 Saito * interface/w32g_ut2.[ch], interface/w32g_i.c: Set GS LCD Mode to default. * interface/w32g_res.rc, timidity/optcode.h, timidity/effect.c: Implement "soft-clipping before waveshaping" again. 2004-03-18 Saito * timidity/optcode.h: Add imuldiv28() for waveshaping. 2004-03-18 Kentaro Sato * timidity/timidity.c: Bug fix. Changed #extension level option's argument format. * doc/C/timidity.cfg.5, doc/ja_JP.eucJP/timidity.cfg.5: Updated. 2004-03-18 Eric A. Welsh * timidity/mix.c (recompute_envelope, recompute_modulation_envelope): fix for -m option (was not working correctly) 2004-03-17 Saito * interface/w32g.h, interface/w32g_i.c, interface/w32g_c.c: Fix GS LCD in Win32GUI interface. 2004-03-16 Saito * timidity/reverb.c, timidity/playmidi.c: Bug fix. 2004-03-15 Saito * interface/w32g.h, interface/w32g_i.c, interface/w32g_c.c: Support for GS LCD in Win32GUI interface. 2004-03-14 Saito * timidity/readmidi.c, timidity/reverb.[ch]: Support for effect: Auto Wah (incomplete). 2004-03-13 Saito * timidity/reverb.[ch]: Beautify. 2004-03-12 Saito * timidity/reverb.c: Fix around effects. 2004-03-10 Kentaro Sato * timidity/timidity.c: Fixed an old bug preventing from specifying "pan=left" in config. 2004-03-10 Saito * timidity/readmidi.c, timidity/reverb.[ch], timidity/tables.[ch]: Support for effect: Lo-Fi (incomplete), Stereo-EQ. * timidity/playmidi.c: Fix around effects. 2004-03-08 Saito * timidity/playmidi.c: Fix bug of adjust_panning(). * interface/w32g_res.{h,rc}, interface/w32g_pref.c: Add "Edit" button to preference window. 2004-03-08 Eric A. Welsh * timidity/playmidi.c (midi_program_change): #if 0 out the useless -1 check, formally was a kluge for XG emulation. 2004-03-07 Kentaro Sato * timidity/playmidi.c: Fixed GM2 drumch on program change. 2004-03-07 Eric A. Welsh * timidity/playmidi.c (midi_program_change): Fix for a drum channel turns back into a melody channel 2004-03-07 Eric A. Welsh * timidity/playmidi.c (note_off): Fix for remapped drum. 2004-03-07 TAMUKI Shoichi * doc/ja_JP.ujis: Move to ja_JP.eucJP * doc/C/timidity.cfg.5, doc/ja_JP.eucJP/timidity.cfg.5: Update 2004-03-06 TAMUKI Shoichi * timidity/playmidi.c (select_play_sample): Fix handling of resample cache in case of using MTS 2004-03-06 Saito * timidity/playmidi.c, timidity/readmidi.c, timidity/reverb.[ch], timidity/effect.c, timidity/mix.c: Support for XG variation effect: Echo, Symphonic(incomplete), Celeste, 2-Band EQ, 3-Band EQ. Fix around envelope. 2004-03-05 Saito * timidity/sndfont.c: Fix for Soundfonts with strange loop points. * timidity/playmidi.c, timidity/readmidi.[ch], timidity/reverb.[ch]: Support for XG variation effect: Delay L,C,R, Delay L,R, Cross Delay. 2004-03-05 TAMUKI Shoichi * interface/w32g_pref.c, interface/w32g_res.{h,rc}: Change to fit with initial keysig option behavior (W32GUI version) * doc/ja_JP.ujis/Makefile.{am,in}, doc/ja_JP.ujis/README.alsaseq: Add README.alsaseq in Japanese 2004-03-04 Kentaro Sato * timidity/playmidi.c: Small fixes. 2004-03-04 TAMUKI Shoichi * timidity/timidity.c (parse_opt_Z1): Fix typo * interface/alsaseq_c.c, interface/rtsyn_common.c, interface/w32g_pref.c, timidity/playmidi.c: Change behavior so that keysig control may not react when initial keysig option for pure intonation is specified 2004-03-04 mput * timidity/readmidi.c (set_xg_chorus_type): Re-activate flanger 2004-03-04 mput * timidity/reverb.h: Fix undeclared type error 2004-03-03 Saito * timidity/reverb.[ch], timidity/playmidi.c, timidity/readmidi.[ch]: Under construction for XG insertion / variation / system effects. 2004-03-02 TAMUKI Shoichi * timidity/recache.c: Beautify (functionally no change) 2004-03-02 Kouji 'kekyo' Suzuki * configs/msc7-project.zip: Fix about Windows Installer. 2004-03-02 mput * timidity/output.h, timidity/common.h, timidity/readmidi.h, timidity/miditrace.h: Fix #inlude dependencies 2004-03-02 Saito * timidity/playmidi.c, timidity/readmidi.[ch], timidity/reverb.[ch], timidity/effect.c, timidity/tables.[ch]: Under construction for XG insertion / variation / system effects. 2004-03-02 Kentaro Sato * timidity/playmidi.c: Fixed to set drumch on program change (GM2). 2004-03-01 TAMUKI Shoichi * README(.ja), INSTALL(.ja), doc/C/timidity.1, doc/ja_JP.ujis/timidity.1, doc/ja_JP.ujis/README.m2m: Update 2004-03-01 Saito * timidity/w32g_subwin3.c: Fix Win32GUI tracer window. 2004-02-29 mput * configure.in: version to 2.13.0-rc2 2004-02-29 TAMUKI Shoichi * doc/ja_JP.ujis/README.dl: Was written in iso-2022-jp, convert to eucJP * doc/C/README.mts, doc/ja_JP.ujis/README.mts: Add * doc/C/Makefile.{am,in}, doc/ja_JP.ujis/Makefile.{am,in}: Fix to fit with change above 2004-02-29 Saito * interface/w32g_tracer.bmp: Fix. * timidity/playmidi.c: Fix sostenuto and redamper. 2004-02-28 TAMUKI Shoichi * AUTHORS: Update * interface/Makefile.{am,in}: Fix due to make dist * doc/C/timidity.1, doc/ja_JP.ujis/timidity.1, doc/C/timidity.cfg.5, doc/ja_JP.ujis/timidity.cfg.5: Update * doc/m2m.txt: Move to doc/C/README.m2m * doc/ja_JP.ujis/README.m2m: Add * doc/Makefile.{am,in}, doc/C/Makefile.{am,in}, doc/ja_JP.ujis/Makefile.{am,in}: Fix to fit with change above * script/Makefile.{am,in}, script/lspatch.pl: Fix a little 2004-02-28 Saito * interface/w32g_i.c, interface/w32g.h: Fix about Win32 GUI. * interface/w32g_icon.ico: Fix large icon. * timidity/readmidi.c, timidity/playmidi.c, timidity/reverb.[ch]: Fix around effects. 2004-02-27 Takashi Iwai * interface/Makefile.am, interface/interface_[Ak].txt: Added the missing text files for interface A and k. 2004-02-26 TAMUKI Shoichi * doc/C/timidity.cfg.5, doc/ja_JP.ujis/timidity.cfg.5: Update * script/lspatch.pl: Fix to fit with new patch options * timidity/instrum.c: Fix a little 2004-02-26 Saito * timidity/instrum.[ch], timidity/timidity.c, timidity/playmidi.[ch], timidity/readmidi.c, timidity/mix.c: Rename #extension redamper to #extension damper. Add some patch options. 2004-02-25 Saito * timidity/w32g_vorbis_dll.c, timidity/vorbis_a.c, timidity/recache.c: Fix. 2004-02-24 Saito * interface/w32g_syn.c, interface/w32g_i.c: Improve bahaviour around taskbar. 2004-02-24 mput * configure.in: avoid warning 2004-02-24 Henrique de Moraes Holschuh * interface/Makefile.am (install.dynamics): The Dynamic interfaces need the .txt files installed too. * doc/C/timidity.cfg.5: Fix English expressions * common.makefile.in (ELISP_DIR): Bug fix 2004-02-24 mput * configure.in: ALSA 1.0 support for alsaseq interface, thanks to 2004-02-23 Saito * interface/w32g_res.{h,rc}, interface/w32g_i.c, interface/w32g_subwin.c, interface/w32g_pref.c, interface/w32g_icon.ico: Change and add some items. 2004-02-22 Saito * timidity/reverb.c, timidity/playmidi.c: Fix bug of opt_pan_delay with opt_surround_chorus. * timidity/sndfont.c: Fix around memory allocation. 2004-02-22 Kentaro Sato * timidity/mac_a.c: Support 8/24-bit output and PF_BUFF_FRAGM_OPT. * timidity/aiff_a.c, timidity/smplfile.c: Fixed padding bug. 2004-02-21 TAMUKI Shoichi * timidity/instrum.c: Beautify and fix typo 2004-02-21 Saito * interface/w32g_pref.c: Fix "force cfg reload". * timidity/sndfont.c: Fix. * timidity/tables.[ch], timidity/mix.c: Put together modulation envelope tables. 2004-02-20 Saito * interface/w32g_icon.ico, interface/w32g_res.{rc,h}, interface/w32g_i.c, interface/w32g_subwin.c, interface/w32g_subwin2.c, interface/w32g_subwin3.c, interface/w32g_syn.c: Change icons. * interface/w32g_syn_icon.ico: Add this file. 2004-02-19 Saito * timidity/tables.c: Fix volume table of modulation envelope (incomplete). 2004-02-18 Kentaro Sato * timidity/resample.c: Fixed noise of c-spline/lagrange/linear. 2004-02-18 Saito * timidity/reverb.[ch], timidity/playmidi.c, timidity/readmidi.c: Clean up around chorus effect. Fix bug of opt_pan_delay with opt_surround_chorus. Rewrite DSP Chorus Effect. 2004-02-18 TAMUKI Shoichi * doc/C/timidity.cfg.5, doc/ja_JP.ujis/timidity.cfg.5: Update * script/Makefile.{am.in}, script/lspatch.pl, script/readme.txt: Add lspatch.pl (list the entire instrument configuration) * timidity/timidity.c (set_gus_patchconf_opts): Change behavior of "note=" patch option 2004-02-17 Takashi Iwai * interface/{alsaseq_c.c,gtk_i.c,ncurs_c.c,soundspec.c,tk_c.c, x_wrdwindow.c}, libunimod/mloader.c, timidity/{aiff_a.c,alsa_a.c, common.c,effect.c,freq.c,instrum.c,jack_a.c,mfi.c,mix.c, mod2midi.c,oss_a.c,playmidi.c,rcp.c,readmidi.c,resample.c, reverb.c,smplfile.c,tables.c,timidity.c,vorbis_a.c}: Fix compile warnings with the recent gcc. 2004-02-17 Kouji 'kekyo' Suzuki * configs/msc7-project.zip: Support for Windows Installer in VC7. Fix portaudio output in VC7. 2004-02-17 Saito * timidity/readmidi.[ch], timidity/playmidi.c: Support for GM2 Reverb Type, etc. 2004-02-17 skeishi * interface/winsyn_c.c: Fix timer of TWSYNTH. 2004-02-17 Eric A. Welsh * timidity/resample.c (resample_lagrange): Bug fix. 2004-02-16 Saito * timidity/reverb.[ch]: Implement new reverberation algorithm: Delay and Panning Delay. * timidity/resample.[ch], timidity/recache.c, timidity/mix.c: Fasten. 2004-02-15 Kentaro Sato * timidity/aiff_a.c: Fixed AIFC sample size field. 2004-02-15 Saito * timidity/portaudio_a.c: Fix for Win32. * configs/msc[67]-project.zip: Add portaudio files and modify projects. * timidity/playmidi.c: Fix fatal typo around Chamberlin filter. * interface/w32g_pref.c: Fix static reverb level. * timidity/reverb.c: Fix reverb level. 2004-02-14 Saito * timidity/playmidi.[ch], timidity/mix.c, timidity/sndfont.c, timidity/instrum.c timidity/tables.c, timidity/timidity.c: Fix modulation envelope of SoundFont. Fix bahaviour of filter. Hack up around load_instrument(). * interface/w32g_subwin3.c: Fix. 2004-02-14 TAMUKI Shoichi * README(.ja), AUTHORS, INSTALL(.ja), doc/C/timidity.1, doc/ja_JP.ujis/timidity.1: Update * timidity/wrd_read.c: Revert fix timing @WAIT bug emulation of the original MIMPI player; use -WRd=2 instead 2004-02-14 mput * Makefile.am (EXTRA_DIST): Fix to fit below * timidity.ide, timidity.mak: Remove * timidity/wrd_read.c: Fix aborting about WRD 2004-02-13 mput * timidity/tables.c: Add newline at the end of file. * timidity/readmidi.c (set_xg_chorus_type): fix flanger. 2004-02-13 Kentaro Sato * timidity/aiff_a.c: Support PE_ULAW/PE_ALAW output. * timidity/mfi.c: Support MFi version 3, vibrato and pitch bend. * timidity/mac_a.c: Minor fix. 2004-02-13 Saito * timidity/reverb.[ch], timidity/playmidi.c, timidity/effect.c, timidity/readmidi.c: Adjust Freeverb. Fix and adjust Standard Reverb. Fix play_midi_load_instrument(). 2004-02-13 mput * timidity/optcode.h (d2i): remove * timidity/resample.c (initialize_resampler_coeffs): remove C++ style '//' comment 2004-02-13 Eric A. Welsh * timidity/m2m.c: new function fill_nonlin_to_lin_table() * doc/m2m.txt: update 2004-02-12 TAMUKI Shoichi * timidity/Makefile.{am,in}: Change CR+LF -> LF due to fatal error 2004-02-12 Saito * interface/w32g_pref.c, interface/w32g_res.{h,rc}, interface/rtsyn_common.c: Support for 24-bit output in Win32GUI/TWSYNTH interface. * timidity/w32g_a.c, timidity/Makefile.{am,in}: Remove w32g_a.c. * configs/msc[67]-sjis.txt: Update. * timidity/gogo_a.c, timidity/vorbis_a.c: Fix for 24-bit output mode. * configs/msc6-project.zip, configs/msc6-sjis.txt: Support for TWSYNG service mode. * interface/w32g_utl.[ch], interface/w32g_ini.c, interface/w32g_pref.c, interface/w32g_res.{h,rc}, timidity/playmidi.[ch], timidity/mix.c: Support for Surround (opt_pan_delay). Improve opt_pan_delay. 2004-02-12 Kentaro Sato * timidity/output.c: Fixed endian problem of 24-bit output. 2004-02-11 mput * configure.in: version to 2.13.0-rc1 2004-02-11 Kentaro Sato * timidity/aiff_a.c, timidity/au_a.c, timidity/mac_a.c, timidity/output.c, timidity/raw_a.c, timidity/wave_a.c Fixes for 24-bit output. 2004-02-11 TAMUKI Shoichi * timidity/timidity.c: Fix some codes for 24bit output 2004-02-11 Kouji 'kekyo' Suzuki * interface/w32g_syn.c, configs/msc7-project.zip: Support for TWSYNSRV. 2004-02-11 Saito * timidity/output.[ch], timidity/wave_a.c, timidity/w32_a.c, timidity/aq.c, timidity/effect.c, timidity/timidity.c, interface/w32g_utl.c: Fix some codes for 24bit output. Swap s32tos24() and s32tos24x(). * timidity/reverb.[ch], timidity/playmidi.[ch], timidity/mix.c, timidity/sndfont.c, interface/w32g_utl.[ch], interface/w32g_res.rc, interface/w32g_pref.c, interface/w32g_ini.c: Remove opt_effect_quality. Fix typos. 2004-02-10 Saito * interface/w32g_pref.c, timidity/w32_gogo.c, timidity/gogo_a.c: Change to . * configs/msc[67]-project.zip: Add header files of Ogg Vorbis and gogo. 2004-02-10 TAMUKI Shoichi * aclocal.m4, configure(.in), config.h.in, Makefile.{am,in}, {autoconf,configs,doc(/{C,ja_JP.ujis}), interface(/bitmaps)}/Makefile.in: Sorry, revert fix due to make dist problem 2004-02-10 Kouji 'kekyo' Suzuki * interface/rtsyn_winmm.c, interface/w32g_i.c, interface/w32g_ini.c, interface/w32g_pref.c, interface/w32g_res.[ch], interface/w32g_syn.c, interface/w32g_utl.[ch], interface/w32g.h: Add process-priority function to TWSYNG. * configs/msc7-project.zip, timidity/calcnewt.c: Fix. 2004-02-09 mput * Makefile.am (install-data-local): ditto * configure.in: Add --with-ad-dir=DIR 2004-02-09 Saito * interface/w32g_pref.c, interface/w32g_subwin3.c, interface/w32g_res.h, interface/w32g_res.rc, interface/w32g_utl.[ch], interface/w32g_ini.c: Fix Win32GUI preference window. Add opt_default_module to Win32GUI preference. * timidity/playmidi.c, timidity/reverb.c: Change behaviour of opt_effect_quality. 2004-02-09 TAMUKI Shoichi * INSTALL(.ja): Fix a little * doc/C/timidity.1, doc/ja_JP.ujis/timidity.1: Update man page of timidity.1 * timidity/playmidi.c (select_play_sample): Fix determination method of frequency for sample selection Hack up around select_play_sample 2004-02-08 Daisuke Aoki * timidity/sndfont.c: Fix cfgforsf. 2004-02-08 Saito * interface/w32g_tracer.bmp, interface/w32g_subwin3.c, timidity/playmidi.c: Change tracer window. * configs/msc[67]-project.zip: Fix projects for cfgforsf. 2004-02-07 Saito * timidity/sysdep.h: Add some #pragma warning for VC environment. * interface/w32g_tracer.bmp: Fix. 2004-02-07 TAMUKI Shoichi * timidity/calcnewt.c: Fix to fit with Cygwin 2004-02-06 TAMUKI Shoichi * configs/Makefile.{am,in}: Rename entry for msc-project[67].zip to msc[67]-project.zip Rename entry for msc-sjis.txt to msc6-sjis.txt Add entry for msc7-sjis.txt * doc/C/timidity.1, doc/ja_JP.ujis/timidity.1: Update man page of timidity.1 * timidity/playmidi.c (get_play_note_ratio): Fix bug * timidity/timidity.c (parse_opt_h): Rewrite help message for --module 2004-02-06 Kouji 'kekyo' Suzuki * configs/msc[67]-project.zip, msc6-sjis.txt: Rename * configs/msc7-sjis.txt: Add * interface/rtsyn_common.c, timidity/calcnewt.c: Fix to fit with Visual C++ 7.0 2004-02-05 TAMUKI Shoichi * configs/Makefile.{am,in}: Delete entry for msc-project.zip Add entry for msc-project[67].zip 2004-02-05 Kouji 'kekyo' Suzuki * configs/msc-project.zip: Remove this file. * configs/msc-project6.zip, configs/msc-project7.zip: Add files. * interface/rtsyn_winmm.c, interface/w32g_pref.c, interface/w32g_subwin3.c, interface/winsyn_c.c, timidity/gogo_a.c, timidity/timidity.c, timidity/vorbis_a.c, timidity/wave_a.c, utils/support.h: Fix codes for Visual C++ 7.0. 2004-02-05 Kentaro Sato * timidity/smplfile.c: Fixed bug with WAVE Sampler chunk without loop. 2004-02-05 TAMUKI Shoichi * Makefile.{am,in}: Change directory order * configs/Makefile.{am,in}: Delete entry for msc-(twsyn-)interface.h * configs/msc-(twsyn-)interface.h: Remove * timidity/reverb.c: Fix typo * timidity/timidity.c (parse_opt_output_format): Fix bug 2004-02-04 TAMUKI Shoichi * timidity/timidity.c: Add help message for --module * INSTALL(.ja), README(.ja): Beautify 2004-02-04 Saito * timidity/readmidi.c, timidity/timidity.c, timidity/playmidi.[ch], timidity/reverb.[ch]: Add --module=n option. Rewrite Delay Effect. * timidity/output.[ch]: Add some codes for 24-bit output. * interface/w32g_pref.h: Fix around sampling-rate. 2004-02-04 mput * Makefile.am (dist-hook): delete * configs/Makefile.am (EXTRA_DIST): delete entry for msc-config.h * configs/msc-config.h{,.in}: remove 2004-02-04 mput * Makefile.am (dist-hook): Fix to preserve timestamp. 2004-02-03 Kentaro Sato * timidity/timidity.c: Fixed copybank bug. * timidity/instrum.[ch], timidity/readmidi.c: Fixed problem freeing mapped banks. 2004-02-03 TAMUKI Shoichi * doc/C/timidity.1, doc/ja_JP.ujis/timidity.1, doc/C/timidity.cfg.5, doc/ja_JP.ujis/timidity.cfg.5: Beautify man pages * timidity/sndfont.c: Hack up around set_rootkey() and set_rootfreq() 2004-02-03 Saito * timidity/mix.c, timidity/timidity.c, timidity/playmidi.[ch], timidity/readmidi.c, timidity/reverb.c: Change implementation of #extension timeout. Fix some initializations. Fix some free() functions. Implement opt_default_module. Fix timidity_pre_load_configuration(). * interface/w32g_utl.c: Fix bug about number of voices. 2004-02-02 Kentaro Sato * timidity/instrum.c, timidity/timidity.c: Changed alloc_instrument_map_bank()'s behavior. 2004-02-02 Saito * timidity/mix.c: Fix sustain. * timidity/sndfont.c: fasten set_rootfreq(). 2004-02-02 TAMUKI Shoichi * timidity/sndfont.c: Fix around scale tuning 2004-02-01 TAMUKI Shoichi * doc/C/timidity.cfg.5, doc/ja_JP.ujis/timidity.cfg.5: Update "(bank|drumset) mapid num" and "#extension copymap" 2004-01-31 mput * Makefile.am (EXTRA_DIST): Fix to fit below * INSTALL.jp: Move to INSTALL.ja * README.jp: Move to README.ja * INSTALL: update. * README: update. 2004-01-31 Kentaro Sato * timidity/instrum.[ch], timidity/playmidi.[ch], timidity/readmidi.c, timidity/timidity.c: New syntax of *.cfg: (bank|drumset) #extension copymap Besides, 'copybank' now copies tunes, envelopes, etc. That should be what it is expected to do. * timidity/sysdep.h Fixed a compilation error with MAX_CHANNELS > 32. * timidity/freq.c, timidity/sndfont.c Changed error handling of freq_fourier() with cfgforsf. 2004-01-31 TAMUKI Shoichi * doc/C/timidity.cfg.5, doc/ja_JP.ujis/timidity.cfg.5, timidity/instrum.[ch], timidity/mod2midi.c, timidity/playmidi.c, timidity/smplfile.c, timidity/sndfont.c, timidity/timidity.c: Support for GUS scale tuning Support for scale tuning patch option 2004-01-29 TAMUKI Shoichi * timidity/playmidi.c, timidity/readmidi.c: Hack up around find_samples() 2004-01-28 Saito * timidity/playmidi.c, timidity/readmidi.c: Fix "TONE MAP-0 NUMBER". Fix around select_play_sample(). Fix about modulation wheel depth. 2004-01-27 TAMUKI Shoichi * timidity/wrd_read.c: Fix bug 2004-01-26 TAMUKI Shoichi * INSTALL(.jp), README(.jp): Update README and INSTALL * doc/C/{timidity.1,timidity.cfg.5}, doc/ja_JP.ujis/{timidity.1,timidity.cfg.5}: Fix typo 2004-01-26 TAMUKI Shoichi * doc/C/timidity.1, doc/ja_JP.ujis/timidity.1: Rewrite and fix typo a little 2004-01-26 mput * doc/C/timidity.1: Remove Japanese characters * doc/ja_JP.ujis/timidity.1: Add some missed entries 2004-01-26 Saito * timidity/playmidi.h, timidity/mix.c: Fix envelope generator. 2004-01-25 TAMUKI Shoichi * doc/C/timidity.1, doc/ja_JP.ujis/timidity.1: Update man page of timidity.1 TODO: Translate some new items into English * timidity/timidity.c (parse_opt_h): Fix typo 2004-01-25 Kentaro Sato * timidity/playmidi.c, timidity/readmidi.c: Fixed channel layer. 2004-01-24 Kentaro Sato * timidity/playmidi.c: Fixed event filtering. * timidity/timidity.c: Added tone->rnddelay (re)initialization. 2004-01-22 TAMUKI Shoichi * doc/C/timidity.cfg.5, doc/ja_JP.ujis/timidity.cfg.5: Fix typo 2004-01-22 mput * doc/C/timidity.cfg.5: update to fit with ranvis' patch * doc/ja_JP.ujis/timidity.cfg.5: ditto 2004-01-22 Kentaro Sato * timidity/instrum.h, timidity/playmidi.c, timidity/readmidi.c, timidity/timidity.c: Removed GM2 default MSB support. Added new map 'gm2[drum]' (GM2) and 'sc8850[drum]' (GS LSB=4). Note that although GS LSB=4 indicates both SC-8820 and SC-8850 and they're mapped identically, waveforms in the actual hardwares differ. 2004-01-21 mput * doc/ja_JP.ujis/timidity.cfg.5: sorry, I was confusing. revert. * doc/C/timidity.cfg.5: fix typo 2004-01-21 mput * doc/ja_JP.ujis/timidity.cfg.5: Was written in eucJP, convert to iso-2022-jp * doc/C/timidity.cfg.5: Bug fix. 2004-01-21 TAMUKI Shoichi * doc/C/timidity.cfg.5, doc/ja_JP.ujis/timidity.cfg.5: Update man page of timidity.cfg.5 2004-01-21 Kentaro Sato * timidity/{aiff_a.c,common.c,mac_a.c,mac_main.c,mac_qt_a.c, mac_soundspec.c,mac_util.c,recache.c,wrd_read.c}, interface/{mac_c.c,mac_mag.c,mac_wrdwindow.c,wrdt_mac.c}, libarc/arc_mime.c: Updated Mac interface to compile. 2004-01-20 Kentaro Sato * interface/dumb_c.c, timidity/playmidi.c, timidity/sndfont.c: Added playnote calculation for cfgforsf (finished). 2004-01-20 Saito * timidity/playmidi.c: Fix around NRPN vibrato. 2004-01-18 mput * timidity/playmidi.c (calc_random_delay): tiny bug fix 2004-01-18 Saito * timidity/readmidi.c: Fix aborting. 2004-01-17 Saito * timidity/playmidi.c: Fix sostenuto and redamper. 2004-01-16 Saito * timidity/playmidi.c: Fix SysEx. * timidity/reverb.[ch], timidity/effect.c, timidity/mt19937ar.h, timidity/playmidi.[ch], timidity/instrum.h, timidity/timidity.c: Implement pink noise generator. Support for #extension rnddelay [ms]. 2004-01-15 Kentaro Sato * timidity/common.[ch], timidity/sndfont.c, timidity/timidity.c: Changed #extension ...send, playnote option's argument format. 2004-01-15 Saito * timidity/timidity.c, timidity/playmidi.[ch], timidity/instrum.h, timidity/mix.c, timidity/readmidi.c: Support for redamper effect (#extension redamper). Support for Sostenuto and Hold1 Half Pedal. 2004-01-15 Kentaro Sato * timidity/playmidi.c: Casting error fixed. * timidity/sndfont.c: Added playnote calculation for cfgforsf (incomplete). 2004-01-15 Daisuke Aoki * timidity/sndfont.c: cfgforsf supported comment option. 2004-01-14 mput * timidity/playmidi.c (play_event): Fix for buffer overflow * timidity/readmidi.c (drum_setup_xg): ditto 2004-01-13 Christian Casteyde * timidity/aRts_a.c (open_output): Fix for aRts backend hogging 100% CPU 2004-01-13 TAMUKI Shoichi * timidity/playmidi.c: Rewrite and fix around select_play_sample() 2004-01-11 Saito * timidity/timidity.c, timidity/playmidi.c, timidity/instrum.h: Support for #extension reverbsend, chorussend, delaysend. Fix SF2 scale tuning. 2004-01-10 Saito * timidity/timidity.c, timidity/playmidi.[ch]: Support for Drumpart Effect Send Level. 2004-01-09 Saito * timidity/timidity.c, timidity/playmidi.c, timidity/mix.c, timidity/instrum.[ch]: Fix typo. Fix modulation envelope. Fix GS SysEx. Drum Instrument Play Note. Fix modulation wheel. Add #extension playnote. Add some patch options. 2004-01-08 Saito * timidity/sndfont.c, timidity/playmidi.[ch], timidity/mix.c, timidity/recache.c, timidity/resample.c: Fix vintage bug of SoundFont. Fix resampling with SF2 scale tuning. Fix modulation envelope. Fix GS SysEx. Drum Instrument Play Note. 2004-01-07 Saito * timidity/playmidi.c, timidity/instrum.[ch], timidity/mod2midi.c, timidity/smplfile.c: Fix around SoundFont. 2004-01-06 Saito * timidity/playmidi.c, timidity/sndfont.c, timidity/instrum.h, timidity/mix.c: Support for SoundFont's Sample Link. FIx around modulation wheel. Fix around MoogVCF. Undo change of opt_drum_power. 2004-01-05 Saito * timidity/playmidi.[ch], timidity/sndfont.c, timidity/mix.c, timidity/effect.c: Fix around SoundFont. Fix LPF resonance. Add soft clipping function to noise-shaping on 16bit output. 2004-01-04 Saito * timidity/playmidi.[ch], timidity/mix.c, timidity/sndfont.c: Fix resonance of MoogVCF. Fix around LPF. Fix around SoundFont. 2004-01-03 Saito * timidity/playmidi.c: Fix NRPN Resonance and Harmonic Content. * timidity/tables.c: Change modulation delay table of Chorus Effect. 2004-01-02 Saito * timidity/playmidi.c: Fix around modulation wheel. * timidity/sndfont.c: Fix around SoundFont. 2003-12-31 Saito * timidity/sndfont.c, timidity/reverb.c: Fix delay modulation. Fix about SoundFont. * timidity/playmidi.c: Improve compatibility of opt_drum_power. 2003-12-30 Saito * timidity/playmidi.[ch]: Fix RPN Modulation Depth Range. 2003-12-29 Saito * timidity/playmidi.[ch], timidity/readmidi.c: Fix SysEx. 2003-12-28 Saito * timidity/playmidi.[ch], timidity/readmidi.c, timidity/reverb.[ch]: Support for Velocity Limit and Note Limit through GS / XG SysEx. Support for Rx. Note On and Rx. Note Off through GS SysEx. Support for XG SysEx Drum Setup. Support for Dry Level through XG SysEx. 2003-12-27 Saito * timidity/playmidi.[ch], timidity/readmidi.[ch]: Fix about SysEx. Fix XG channel layer. Fix around channel pressure. * timidity/playmidi.[ch], timidity/resample.c, interface/slang_c.c, interface/tk_c.c, interface/w32g_subwin3.c, interface/xaw_c.c, interface/w32g_c.c, interface/ vt100_c.c: Rewrite modulation wheel. 2003-12-26 Saito * timidity/playmidi.c, timidity/readmidi.c: Fix around channel pressure. 2003-12-25 Kentaro Sato * timidity/playmidi.c, timidity/readmidi.c, timidity/tables.[ch], timidity/timidity.c: Support for GM2 default MSB bank and volume curve. 2003-12-24 Saito * timidity/playmidi.[ch], timidity/readmidi.c: Fix around channel pressure. Fix system exclusive message. Fix channel layer. 2003-12-23 Saito * timidity/reverb.[ch], timidity/readmidi.[ch], timidity/playmidi.[ch], timidity/tables.[ch], timidity/effect.c: Implement XG Multi EQ. Implement XG Part EQ (tone only). 2003-12-23 Kentaro Sato * timidity/playmidi.c, timidity/readmidi.[ch], timidity/reverb.[ch] timidity/tables.[ch], timidity/timidity.c: Support for GM2 On SysEx. and pan table. 2003-12-21 Saito * timidity/reverb.[ch], timidity/readmidi.c, timidity/playmidi.c: Fix about Insertion Effect. Sort out codes. Fix lowpass filter for system effect. 2003-12-16 Saito * timidity/reverb.[ch], timidity/readmidi.c: Implement Plate Reverberator. * timidity/mix.c: Fix tremolo waveform for SoundFont. 2003-12-12 Saito * timidity/playmidi.[ch], timidity/resample.c: Fix around vibrato. 2003-12-09 Eric A. Welsh * timidity/m2m.c (m2m_process_events): Fix drum volumes 2003-12-07 Saito * timidity/reverb.c, timidity/readmidi.c: Fix parameters of HEXA-CHORUS. 2003-12-06 Saito * timidity/reverb.[ch], timidity/readmidi.c, timidity/playmidi.c: Fix Insertion Effect. Implement HEXA-CHORUS for Insertion Effect. Fix around opt_pan_delay. 2003-12-04 TAMUKI Shoichi * timidity/playmidi.c, timidity/timidity.[ch]: Support for voice LPF command line option 2003-12-04 Saito * timidity/reverb.[ch], timidity/readmidi.[ch], timidity/playmidi.c: Fasten initialization of Insertion Effect. Implement new LPF for System Effect. 2003-12-03 Saito * interface/w32g_res.rc: Fix dialog around temperaments. * timidity/reverb.[ch], timidity/readmidi.c: Implement new algorithm for Distortion and Overdrive effect. * timidity/mix.c: Fix a comment. 2003-12-02 Saito * timidity/playmidi.[ch], timidity/mix.c: Implement Moog VCF resonant lowpass filter; it sounds good, but slow. * timidity/mix.c: Fix typo. 2003-12-01 Saito * timidity/playmidi.[ch], timidity/tables.[ch], timidity/mix.c, timidity/sndfont.c: Implement Chamberlin's resonant lowpass filter; it's faster but narrow band. 2003-11-30 Saito * timidity/readmidi.c, timidity/tables.[ch]: Fix parameter-handling of Chorus Effect. 2003-11-28 Saito * timidity/reverb.[ch]: Fix around Chorus Effect. * timidity/playmidi.c: Turn off opt_pan_delay in default. 2003-11-27 Saito * timidity/reverb.[ch], timidity/effect.c, timidity/readmidi.c: Fix around GS Insertion Effect. 2003-11-24 Kentaro Sato * timidity/playmidi.c: Bug exposed by dynamic allocation of voice[] was fixed. 2003-11-22 Saito * interface/w32g_utl.c: Fix typos. 2003-11-21 TAMUKI Shoichi * interface/w32g_pref.c, interface/w32g_res.{h,rc}, interface/w32g_subwin3.c, interface/w32g_tracer.bmp: Support for user-defined temperament (W32GUI version) 2003-11-19 TAMUKI Shoichi * interface/ncurs_c.c, timidity/playmidi.[ch], timidity/readmidi.c: Support for user-defined temperament entry with Universal SysEx. - User-defined Temperament Entry (F0 7E id 08 0C tt ll [fh fl bh bl aa bb cc dd ee ff] ... F7) 2003-11-17 Takashi Iwai * interface/alsaseq_c.c, timidity/alsa_a.c: Fix the compilation with the latest ALSA 1.0.0. 2003-11-14 TAMUKI Shoichi * interface/alsaseq_c.c, interface/rtsyn_common.c, interface/ncurs_c.c, interface/w32g_subwin3.c, timidity/playmidi.[ch], timidity/tables.[ch]: Support for temperament with passing major/minor key 2003-11-13 TAMUKI Shoichi * timidity/timidity.c: Rewrite option handling a little 2003-11-13 Eric A. Welsh * timidity/playmidi.[ch], timidity/tables.[ch], timidity/timidity.c: new option -V power, --volume-curve=power 2003-11-10 TAMUKI Shoichi * timidity/tables.c: Adjust mean-tone tuning (Salinas) in a stricter theory 2003-11-10 Eric A. Welsh * timidity/resample.c (set_resampler_parm): -N for Newton interpolation should be 1 to 57 odd, not 1 to 56 even 2003-11-08 TAMUKI Shoichi * timidity/effect.c, timidity/playmidi.c, timidity/reverb.c, timidity/timidity.c: Hack up reverb levels without opt_effect_quality 2003-11-08 Eric A. Welsh * timidity/timidity.c (parse_opt_p): max voices to be changeable (timidity_init_player): ditto. * timidity/mac_dlog.c (mac_SetPlayOption): ditto. * timidity/playmidi.h (max_voices): Add. * timidity/playmidi.c (max_voices): Add. * timidity/timidity.h (MAX_VOICES): Delete. 2003-11-06 TAMUKI Shoichi * timidity/playmidi.c, timidity/tables.c: Adjust Pythagoras tuning and pure intonation in a stricter theory 2003-11-05 Takashi Iwai * timidity/alsa_a.c: Fixed bogus calculation of GETSAMPLES. 2003-11-05 mput * timidity/readmidi.c: Reindent. 2003-11-04 Eric A. Welsh * timidity/readmidi.c (set_xg_reverb_type): Add. (parse_sysex_event_multi): Support for XG SysEx. reverb/chorus types 2003-11-01 Saito * timidity/sndfont.c: Fix behaviour of SoundFont's scale-tuning like SB-Live!. * timidity/playmidi.c: Add opt_pan_delay. 2003-11-01 mput * timidity/timidity.c (parse_opt_h): Fix in help message (parse_opt_j): Enforce returning a int value (parse_opt_Z1): ditto (parse_opt_fail): Change exit status to EXIT_FAILURE 2003-10-31 Saito * timidity/playmidi.c: Fix initialization of drumsets on synthesizer modes. 2003-10-30 Eric A. Welsh * timidity/playmidi.c (set_reverb_level, get_reverb_level): More flexibility for reverb level * timidity/timidity.c (parse_opt_reverb): Fix for case 0 2003-10-28 Eric A. Welsh * timidity/playmidi.c, timidity/effect.c, timidity/timidity.c: The user can now set the reverb level of any of the reverb modes. 2003-10-27 Kentaro Sato * timidity/effect.c: Fixed noise shaping filter bug. 2003-10-26 Saito * timidity/mix.c, timidity/tables.[ch], playmidi.[ch]: Implement phase difference between left and right experimentally. If you want to disable this function, please #undef "ENABLE_PAN_DELAY". 2003-10-25 skeishi * interface/rtsyn.h: Bug fix about TWSYNTH. * interface/rtsyn_common.c: Fix timer of TWSYNTH. 2003-10-23 mput * timidity/controls.h: Fix signedness for ctl->flags * timidity/timidity.c (main): Fix for getopt_long 2003-10-14 TAMUKI Shoichi * timidity/readmidi.c: Fix around channel layer 2003-10-12 Kentaro Sato * timidity/rcp.c: RCP tempo gradation is supported. 2003-10-11 TAMUKI Shoichi * timidity/playmidi.[ch], timidity/readmidi.c: Fix temperament control to fit with channel layer 2003-10-10 TAMUKI Shoichi * timidity/playmidi.c, timidity/readmidi.c: Fix around channel layer (GS - maybe completed) 2003-10-08 Takashi Iwai * timidity/timidity.c: Fixed segfault or error with use of #extension opt. optind is reset before calling getopt_long() again. 2003-10-08 TAMUKI Shoichi * */Makefile.in, aclocal.m4, configure, configure.in, utils/getopt.c, utils/tmdy_getopt.h: Revert fix getopt_long problem in MinGW environment 2003-10-08 Kentaro Sato * timidity/playmidi.c: Fixed crash with --realtime-load when an instrument of the alternative bank is not defined. * timidity/readmidi.c: Returning an error from WRDTracer.start() now disables ME_SHERRY in addition to ME_WRD. Fixed ME_GSLCD to be handled correctly in trace mode. 2003-10-08 mput * timidity/timidity.c (set_tim_opt_long): Bug fix 2003-10-07 Takashi Iwai * timidity/timidity.c: Clean up option handling. 2003-10-07 TAMUKI Shoichi * timidity/playmidi.[ch], timidity/readmidi.[ch]: Fix around channel layer (to be continued) * timidity/newton_table.c: move to configs/msc-project.zip 2003-10-07 Saito * timidity/newton_table.c: Add this file for VC. * utils/tmdy_getopt.h: Fix for VC. 2003-10-07 skeishi * utils/getopt.c, utils/tmdy_getopt.h: Fix getopt_long's problem in MINGW environment. * interface/rtsyn_winmm.c: Fix CPU usage rate of TWSYNTH. 2003-10-04 TAMUKI Shoichi * timidity/playmidi.c, timidity/readmidi.c: Fix around channel layer (to be continued) 2003-10-03 TAMUKI Shoichi * timidity/playmidi.[ch], timidity/readmidi.[ch]: Hack up around channel layer (to be continued) * timidity/timidity.c: Rewrite help a little Rename --effects -> --ext Rename -EFresample -> -EFresamp 2003-10-03 mput * timidity/Makefile.in: redo automake to fit with Iwai's commit 2003-10-02 Takashi Iwai * configure.in, timidity/Makefile.am, timidity/resample.c, timidity/resample.h, timidity/recache.c, timidity/timidity.c, timidity/timidity.h, timidity/playmidi.c, timidity/playmidi.h, timidity/calcnewt.c: Use functions instead of macros for resamplation. This doesn't make the operation slower (even somtimes faster!). The algorithm can be switched either by option --resample or -EFresample (i.e. dynamically changable on ncurses interface). The default algorighm is kept to gauss (defined in timidity.h). The behavior of -N option is now dependent on which algorithm is being chosen. -N0 for gauss and newton will switch to linear interpolation for keeping compatibility. The gauss interpolation is optimized a bit for the default case. It will give more chance for the compiler to make its job better. The newton coeff. table is included statically in the source code, which was calculated formerly by calcnewt.c. 2003-10-01 mput * configure: autoreconf 2003-10-01 Takashi Iwai * timidity/optcode.c, timidity/optcode.h: Use macros instead of functions for imuldiv*() on generic architectures. 2003-10-01 Takashi Iwai * timidity/aRts_a.c, timidity/output.c: Removed arts2 output mode, which is identical with arts mode, indeed. Fixed wrong cast of pointer to integer. Fixed the detect function of aRts. 2003-09-30 TAMUKI Shoichi * configure.in: Change order of Tcl/Tk library version 2003-09-29 TAMUKI Shoichi * timidity/playmidi.[ch], timidity/readmidi.c: Hack up around channel layer 2003-09-26 Kentaro Sato * timidity/readmidi.c: Replaced the previous patch mis-applied. 2003-09-24 Kentaro Sato * timidity/playmidi.c, timidity/readmidi.c: Fixed crash with --realtime-load (opt_realtime_playing). 2003-09-21 Saito * timidity/w32_a.c: Add detect() functions. * interface/rtsyn_winmm.c: Fix around sleep(). 2003-09-21 Kentaro Sato * timidity/readmidi.c (add_channel_layer, remove_channel_layer): Bug Fix 2003-09-18 Takashi Iwai * timidity/output.h, timidity/timidity.c, timidity/*_a.c: Added the detect callback to output record. It's used to check the availability of default device and fallback devices. 2003-09-18 mput * timidity/playmidi.c (note_off): Bug fix SEGV-ing for non-existent instrument 2003-09-16 Saito * utils/getopt.h: Fix around including unistd.h. * configs/msc-project.zip: Fix utils.dsp for getopt.c. 2003-09-14 Eric A. Welsh * timidity/m2m.c (m2m_process_events): Bug Fix * timidity/m2m.c (vol_nonlin_to_lin): Bug Fix * timidity/mod2midi.c: Move all linear/non-linear MOD volume conversion stuff into m2m.c * timidity/playmidi.c (recompute_amp): Use linear volume curves when playing MOD files * timidity/playmidi.c (new_chorus_voice_alternate): Use IS_CURRENT_MOD_FILE to check for MOD file types instead of checking specifically for IS_MOD_FILE and IS_S3M_FILE 2003-09-13 TAMUKI Shoichi * timidity/timidity.c: Rewrite help a little 2003-09-13 Kentaro Sato * timidity/readmidi.c (recompute_insertion_effect): Bug fix. 2003-09-12 Takashi Iwai * timidity/playmidi.h, timidity/timidity.c, interface/alsaseq_c.c: Added --realtime-priority and --sequencer-ports options for ALSA sequencer interface. * Drop root privilege after chaging RT-priority. * Enable background option only when ALSA seq. interface is built in. 2003-09-12 Eric A. Welsh * timidity/playmidi.c (new_chorus_voice_alternate): Revert surround chorus delay back again (to 0.003) (midi_drumpart_change): set/unset drumchannel info 2003-09-12 mput * timidity/playmidi.c: Remove C++ style ``//'' comments 2003-09-09 Eric A. Welsh * timidity/playmidi.c (new_chorus_voice_alternate): Revert surround chorus delay back to the value (0.002) used in v2.11.3. 2003-09-07 TAMUKI Shoichi * timidity/playmidi.c, timidity/tables.c: Adjust minor of mean-tone tuning and pure intonation by syntonic comma, instead of Pythagoras tuning 2003-09-03 Takashi Iwai * interface/alsaseq_c.c: Fixed the compilation on ALSA 0.5.x environemnt. 2003-09-03 mput * configure: autoreconf 2003-09-02 Takashi Iwai * TiMidity.ad.in, TiMidity-uj.ad.in: Move. * interface/tkmidity.ptcl, interface/xaw_c.c, interface/xaw_i.c: Bug fix. 2003-08-28 TAMUKI Shoichi * timidity/timidity.c: Little patch to avoid prototype mismatch 2003-08-27 mput * configure: autoreconfed 2003-08-27 Takashi Iwai * interface/alsaseq_c.c, configure.in: higher resolution of rendering in ALSA sequencer mode with the event timestamps. works only on the latest ALSA 0.9. works now also with the non-audio-device (e.g. wav). 2003-08-26 Takashi Iwai * timidity/timidity.c: clean up set_value(). * interface/alsaseq_c.c: set the client name. 2003-08-25 mput * configure,timidity/Makefile.in: To fit with Iwai's changes 2003-08-25 Takashi Iwai * configure.in, timidity/Makefile.am, timidity/output.c, timidity/jack_a.c: JACK output support (jackit.sf.net) To enable JACK, you'll need pkgconfig installed. * timidity/timidity.c: Fixed the path of libesd for AMD64 and PPC64 (/usr/lib64) * timidity/playmidi.c: Added parentheses around the ambiguous conditions. 2003-08-21 TAMUKI Shoichi * timidity/timidity.c (parse_opt_s): -s option works correctly again 2003-08-19 TAMUKI Shoichi * timidity/playmidi.c, timidity/tables.c: Adjust minor of Pythagoras tuning by syntonic comma 2003-08-18 TAMUKI Shoichi * timidity/timidity.c: Bug fix --{default,force}-{bank,program} 2003-08-17 TAMUKI Shoichi * timidity/playmidi.c, timidity/timidity.c: Bug fix --force-program 2003-08-17 mput * timidity/timidity.c (parse_opt_h): Bug Fix 2003-08-17 Eric A. Welsh * timidity/timidity.c (parse_opt_s): -s option works correctly again * timidity/reverb.c (init_reverb): -EFchorus=3 was cousing mono output to crash. 2003-08-15 TAMUKI Shoichi * timidity/playmidi.[ch], timidity/timidity.[ch]: Support for "Always use program n on channel m" option Support for multi-argument of -Q option Support for "Enable/Disable Temperament control" option Fix typo around short/long options 2003-08-13 TAMUKI Shoichi * timidity/timidity.c: Support long option for "#extension opt" in timidity.cfg 2003-08-12 TAMUKI Shoichi * timidity/timidity.c: Fix typo around long options Rename --patch -> --patch-file 2003-08-12 TAMUKI Shoichi * timidity/timidity.c: Fix typo around long options 2003-08-11 TAMUKI Shoichi * timidity/timidity.c: Hack up around short/long options 2003-08-10 TAMUKI Shoichi * timidity/timidity.c (help): rewrite to fit with long options Some option renamed --[no-]modulation-wheel -> --[no-]mod-wheel --[no-]channel-pressure -> --[no-]ch-pressure --[no-]modulation-envelope -> --[no-]mod-envelope --[no-]sort-list -> --[no-]sort 2003-08-10 TAMUKI Shoichi * timidity/timidity.c: Commonize functions between short and long options 2003-08-09 TAMUKI Shoichi * timidity/timidity.c: Some option renamed --mode -> --output-mode --stereo -> --output-stereo --mono -> --output-mono --bit-width -> --output-{16,8}bit --encoding -> --output-{linear,ulaw,alaw} --[no-]output-byte-swap -> --[no-]output-swab 2003-08-09 TAMUKI Shoichi * interface/alsaseq_c.c, interface/ncurs_c.c, interface/rtsyn_common.c, interface/server_c.c, timidity/playmidi.c, timidity/timidity.c (opt_realtime_playing, ctl.trace_playing): Fix to fit with long options Commonize parse_opt_O() between short and long options 2003-08-08 TAMUKI Shoichi * timidity/timidity.c: Hack up around short/long options Some option renamed --[no-]4-point-interpolation -> --interpolation (merged) --drums -> --drum-channel --[no-]new-lpf -> --[no-]voice-lpf --exec -> --config-string Some option deleted --[no-]auto-start --[no-]auto-exit --[no-]drag-start --[no-]uniq-list --[no-]refine-list --[no-]continue 2003-08-07 TAMUKI Shoichi * timidity/timidity.c: Commonize functions between short and long options 2003-08-07 TAMUKI Shoichi * timidity/timidity.c: Hack up around long options Rename --temperament -> --pure-intonation 2003-08-07 mput * timidity/timidity.c (set_tim_opt_long): Some options was disabled: re-activate them. 2003-08-06 TAMUKI Shoichi * timidity/timidity.c: Fix around long options Hack up around output option parser 2003-08-06 TAMUKI Shoichi * timidity/timidity.c: Fix wrong branch between set_tim_opt_{long,short} Fix typo around long options Hack up around interface option parser 2003-08-04 TAMUKI Shoichi * timidity/timidity.c: Some option renamed --mid -> --default-mid --noise-shaper -> --noise-shaping Hack up around effect option parser 2003-08-04 mput * timidity/timidity.c: Some option renamed --auto-volume-compensation -> --[no-]volume-compensation --config -> --config-file --keysig -> --force-keysig --key -> --adjust-key --[no-]recomposer-dll -> --[no-]-rcpcv-dll --tempo -> --adjust-tempo --[no-]overlap -> --[no-]overlap-voice --text-conversion -> --output-charset (parse_opt_204): Add 2003-08-04 TAMUKI Shoichi * timidity/timidity.c: Fix typo again 2003-08-04 TAMUKI Shoichi * timidity/timidity.c: Separate independence of --auto-volume-compensation Merge --buffer-bits to --buffer-fragments 2003-08-04 TAMUKI Shoichi * timidity/timidity.c: Fix typo around long options 2003-08-03 TAMUKI Shoichi * timidity/timidity.c: Hack up around long options 2003-08-03 TAMUKI Shoichi * timidity/timidity.c: Add function prototypes 2003-08-03 mput * timidity/timidity.c (parse_opt_223): Fix typo 2003-08-02 TAMUKI Shoichi * timidity/timidity.c: Fix almost all warnings 2003-08-02 mput * timidity/timidity.c: Fix typo and so on 2003-08-02 TAMUKI Shoichi * timidity/timidity.c: Fix around long options 2003-07-31 mput * utils/tmdy_getopt.h: Moved from utils/getopt.h * timidity/timidity.c, utils/Makefile.am, utils/getopt.c: Fix to fit above 2003-07-31 mput * utils/getopt.h: Fix including headers * timidity/timidity.c: Fix doubled header include 2003-07-29 mput * timidity/timidity.c (help): rewrite to fit with long options. (set_tim_opt_short): Rename from set_tim_opt(). (set_tim_opt_long): Add. (version): Add. * utils/getopt.[ch]: Add. * utils/support.[ch]: Delete getopt() 2003-07-28 TAMUKI Shoichi * timidity/playmidi.c, timidity/tables.c: Support for modal interchange playing in pure intonation Fix around user-defined temperament type 2003-07-22 TAMUKI Shoichi * timidity/effect.c, timidity/timidity.c: Hack up noise shaping filter for 8-bit linear encoding Update command help 2003-07-22 Takashi Iwai * timidity/timidity.c: - Fixed the broken fallback-deveice selection. - Changed the verbosity of gaussian table initialization messages. 2003-07-21 TAMUKI Shoichi * timidity/darwin_a.c, timidity/effect.c, timidity/playmidi.c, timidity/sndfont.c, timidity/timidity.[ch], timidity/w32_a.c, timidity/w32g_a.c: Change default settings for command line interface - Change default output rate to 44100Hz - Disable surround chorus in default - Enable noise shaping filter in default Enable SoundFont scale tuning Beautify timidity/effect.c a little 2003-07-19 TAMUKI Shoichi * timidity/playmidi.c: Fix around SoundFont scale tuning 2003-07-19 TAMUKI Shoichi * timidity/playmidi.[ch], timidity/readmidi.c: Hack up SoundFont scale tuning Fix around single-note tuning change 2003-07-16 TAMUKI Shoichi * timidity/playmidi.[ch]: Support for RPN tuning program select 2003-07-14 TAMUKI Shoichi * interface/alsaseq_c.c, interface/rtsyn_common.c, interface/rtsyn_winmm.c, timidity/playmidi.[ch], timidity/rcp.c, timidity/readmidi.c: Support for bulk tuning dump 2003-07-10 TAMUKI Shoichi * timidity/playmidi.c: Fix around single-note tuning change 2003-07-07 Takashi Iwai * timidity/alsa_a.c: Open a PCM device with non-blocking mode and later set back to the blocking mode (for better usability). 2003-07-06 Saito * timidity/reverb.[ch], timidity/readmidi.c: Fix comments. * configs/msc-project.zip: Fix twsyng.dsp and interface.h. 2003-07-06 TAMUKI Shoichi * timidity/playmidi.[ch], timidity/readmidi.c, timidity/tables.[ch], timidity/timidity.c: Support for single-note tuning change Support for channel mute by user-defined temperament type Fix around temperament type redrawing on ME_RESET Fix around channel mute by temperament type on ME_RESET 2003-07-03 TAMUKI Shoichi * timidity/playmidi.c, timidity/tables.[ch], timidity/timidity.c: Support for user-defined temperaments (to be continued) 2003-07-03 Takashi Iwai * configure.in: Support for tcltk 8.3/8.4 * timidity/readmidi.c (read_midi_file): Support for RMI * timidity/sysdep.h: Fix in C99 bit width warranted integer types 2003-06-30 Eric A. Welsh * timidity/mod2midi.c (Voice_SetVolume): converted linear volume events to non-linear events, so that mods will sound correct again 2003-06-30 skeishi * interface/rtsyn.h, interface/rtsyn_common.c, interface/rtsyn_wimm.c interface/rtsyn_portmidi.c: Fix Realteime Synthesizer Engine. 2003-06-29 skeishi * interface/portmidisyn_c.c, interface/rtsyn.h, interface/rtsyn_common.c, interface/rtsyn_wimm.c, interface/rtsyn_portmidi.c: Added. * configure.in, interface.h.in, interface/w32g_syn.c, interface/winsyn_c.c, timidity/controls.c, timidity/timdity.c: Add PortMIDI synthesizer mode. 2003-06-28 Saito * timidity/sndfont.c: Fix volume bug of drum instruments. 2003-06-26 Eric A. Welsh * timidity/playmidi.c (reduce_voice_CPU): Bug fix (this is obsolate yet) * timidity/playmidi.c (note_off): rx_note_off == 0 should only ignore drum Note Off if the sample is not looped, otherwise the note will get stuck 2003-06-24 mput * bootstrap.sh, autoconf/Makefile.boot: Deleted. * Makefile.am (M4DIR, ACLOCAL_AMFLAGS): Add. * configs/Makefile.am (EXTRA_DIST): To fit with Saito's changes * timidity/Makefile.am (EXTRA_timidity_SOURCES): To fit with Saito's changes 2003-06-22 Saito * nouse, timw32g, timw32gd, twsyng, cfgforsf, ...: Remove VC++ project files. * configs/msc-project.zip: Add msc-project.zip. 2003-06-21 Saito * nouse, timw32g, timw32gd, twsyng, cfgforsf, ...: Add VC++ project files to be able to compile Win32GUI interface. Fix VC++ project files. * timidity/sndfont.c: Fix for cfgforsf. 2003-06-17 s_keishi * interface/winsyn_c.c: To work under PortAudio * interface/Makefile.am (EXTRA_DIST): Add entry for escape_sjis.pl * interface/escape_sjis.pl: Add * timidity/portaudio_a.c: Bug fix 2003-06-16 Saito * timidity/readmidi.c, timidity/reverb.c, timidity/timidity.c: Fix lowpass filters of system effects. Fix reverb-time calculation for new reverberation effect. Remove overlapping initialize_gauss_table(). 2003-06-15 mput * configure.in, timidity/Makefile.am: Fix a bit to merge s_keishi's patch 2003-06-14 s_keishi * configure.in: Fix to fit with the addition * timidity/timidity.c, timidity/output.c: Fix to fit with the addition * timidity/Makefile.am (EXTRA_timidity_SOURCES): Fix to fit with the addition * timidity/portaudio_a.c: Add. 2003-06-14 s_keishi * timidity/timidity.c: Fix noise with gauss interpolation at synthesizer modes. 2003-06-13 s_keishi * configure.in, interface.h.in, timidity/Makefile.am, timidity/timidity.c: Fix configures to be able to compile twsyng with gcc. 2003-06-13 Saito * timidity/playmidi.c, timidity/readmidi.c, timidity/reverb.[ch], timidity/tables.c: Fix insertion effect. Fix illegal-parameter handling of delay effect. Strengthen delay and chorus effect. Support for reverb / chorus / delay LPF in correct method. 2003-06-12 Saito * timidity/playmidi.c, timidity/readmidi.c, timidity/reverb.[ch]: Renew insertion effect. 2003-06-08 Saito * timidity/playmidi.[ch], timidity/readmidi.[ch], timidity/rcp.c, timidity/timidity.c, timidity/reverb.c, timidity/resample.c: Fix in channel layer. Change default -N to 0. 2003-06-08 mput * Makefile.am (dist-hook): Not to change msc-config.h every time * timidity/recache.c, timidity/resample.c, timidity/timidity.c: Fix linkage of newt_coeff[][]. 2003-06-06 Saito * timidity/playmidi.c, timidity/tables.c: Fix about sc_vol_table[] and sc_vel_table[]. 2003-06-06 Eric A. Welsh * timidity/tables.[ch], timidity/timidity.c, timidity/playmidi.c: recompute_amp() handles velocity/volume/expression levels correctly now. see comments on perceived_vol_table[] in tables.c 2003-06-06 mput * timidity/esd_a.c: Restore. Latest changes into this file turned out to be unable to run on Windows. 2003-06-06 Takashi Iwai * timidity/aRts_a.c (output_data, open_output): Fix typo 2003-06-05 mput * timidity/timidity.c (main): Add check codes for interface exsitence (thanks Bernhard Rosenkraenzer ) * timidity/arts_a.c, timidity/output.c: Merged Bernhard Rosenkraenzer 's implementation. * configure.in: Fix to fit with David's patch * timidity/esd_a.c (open_output, close_output): dlopen() libesd rather than introducing yet another requirement (thanks David Walser and Bernhard Rosenkraenzer ) * timidity/timidity.h (MAIL_DOMAIN): to localhost (thanks David Walser and Maurizio De Cecco) 2003-06-04 mput * Makefile.am (dist-hook): Bug fix * configure.in,autoconf/Makefile.boot: modernize 2003-06-02 mput * bootstrap.sh: Fix to use make * configure.in: Fix to fit the adding files * autoconf/Makefile.am, autoconf/Makefile.boot, autoconf/Makefile.in, configs/Makefile.am, configs/Makefile.in: Add. 2003-06-01 Eric A. Welsh * timidity/effect.c (do_effect): Do not do reverb or chorus if do_compute_data_midi() has already applied them with USE_DSP_EFFECT. * timidity/playmidi.c (new_chorus_voice_alternate): opt_surround update to work with the new effects (adjust_panning): Hack to handle -EFchorus=2 in a "reasonable" way 2003-05-30 Kentaro Sato * timidity/resample.c, recache.c: Fix LAGRANGE_INTERPOLATION for uint32. 2003-05-30 TAMUKI Shoichi * timidity/playmidi.c, timidity/reverb.[ch], timidity/timidity.[ch]: Support for command line option below. -E e/E : Enable/Disable modulation envelope. -EFreverb=3 : Enable NEW MIDI reverb effect control (freeverb) This effect is only available in stereo Rename NEW_CHORUS as USE_DSP_EFFECT. 2003-05-30 Saito * timidity/sndfont.c: Fix around set_rootkey(). 2003-05-29 Eric A. Welsh * timidity/timidity.h (DEFAULT_VOICES): to 256 (was 64) * timidity/playmidi.c (do_compute_data_midi): Fix -EFchorus option interpretation 2003-05-29 Kentaro Sato * timidity/resample.c: Fasten initialize_gauss_table(). 2003-05-28 Eric A. Welsh * timidity/readmidi.c (parse_sysex_event_multi): Fix XG Bulk Dump SysEx event parsing 2003-05-28 Saito * timidity/playmidi.c, timidity/reverb.c: Fix a little. 2003-05-27 Saito * timidity/playmidi.c: Bug fix in opt_realtime_playing != 2. Fix aborting with Cherry sequencer. (TWSynth version) * timidity/sndfont.c: Adapt some parameters to specifications for SoundBlaster Live!. 2003-05-27 Eric A. Welsh * timidity/readmidi.c (parse_sysex_event_multi): Fix XG multipart SysEx events 2003-05-26 Saito * timidity/recache.c, timidity/resample.c, timidity/timidity.h, timidity/instrum.c: Fix some codes to fit with EAW's commit. 2003-05-25 mput * configure.in Fix --enable-spline option to fit with EAW's commit. 2003-05-25 Eric A. Welsh * au_a.c, wave_a.c: Fix the file headers when > 1 audio file was output per timidity session; the data length was not being reset between midi before * recache.c, resample.c, timidity.c, timidity.h, playmidi.c, playmidi.h: Add Newton interpolation (slower and less accurate than Gauss). Add Gauss interpolation (recommended, but takes up to 560kb extra mem); defaults to -N 25 (best compromise between speed and accuracy), -N 34 is maximum quality and should run in realtime on many systems. * recache.c, resample.c: Speed up cubic Lagrange interpolation. Fix some loop and sample start/end related bugs in all interpolation methods. * resample.c: Rewrite most of pre_resample(), so that it can properly handle higher order interpolation methods. pre-resample with pentic B-splines, instead of cubic spline, if Gauss or Newton is not compiled in. * sndfont.c, instrum.c, mod2midi.c, recache.c: Allocate an extra sample at the end of all sample data, in order for all interpolation methods to not read beyond the bounds of the arrays. Initialize the extra sample to zero, so that there will be no reads from unintialized memory. Initialize the entire recache buffer to zero, for the same reason. * playmidi.c: Fix a problem with voice reduction under Linux, maybe other systems as well; rate is now calculated as it is displayed in ncurs_c.c. No more premature mass voice killings / auto-polyphony capping. 2003-05-25 Kentaro Sato * timidity/timidity.c: Bug fix in config parameter with quotation. 2003-05-24 Saito * timidity/mix.c, timidity/reverb.c, timidity/sndfont.c, timidity/playmidi.c: Fix new Reverberation Effect. Fix about SoundFont. 2003-05-22 Saito * timidity/tables.c, timidity/reverb.c, timidity/readmidi.c: Fix new Reverberation Effect. Improve Chorus Effect. 2003-05-21 Saito * timidity/playmidi.c, timidity/tables.c, timidity/reverb.c: Fix new Reverberation Effect. Fix tables for envelope generator. 2003-05-20 Saito * timidity/playmidi.c, timidity/tables.[ch], timidity/instrum.c, timidity/playmidi.c, timidity/mix.c: Support for transpose (key shift). Strengthen new Reverberation Effect. 2003-05-19 Saito * timidity/playmidi.c, timidity/tables.[ch], timidity/instrum.c, timidity/sndfont.c, timidity/mix.c: Fix in delay and envelope generator. Fix some noises. 2003-05-17 Saito * timidity/sndfont.c: Bug fix. 2003-05-15 Saito * timidity/rcp.c, timidity/playmidi.[ch], timidity/readmidi.[ch], timidity/resample.c, timidity/tables.[ch], timidity/sndfont.c, timidity/mix.c, timidity/timidity.c: Support for parse_sysex_multi() for RCP/R36/G18/G36 MIDI data. Support for channel layer (GS - Rx. Channel / XG - Rcv Channel). Fix in delay, envelope generator, vibrato and tremolo. 2003-05-12 Saito * timidity/sndfont.c, timidity/mix.c: Fix tremolo. 2003-05-10 Saito * timidity/instrum.c, timidity/smplfile.c, timidity/mod2midi.c: Fix fatal bug about scaleTuning. * timidity/sndfont.c, timidity/tables.[ch], timidity/mix.c, timidity/playmidi.[ch], timidity/instrum.[ch], timidity/reverb.c: Fix about tremolo again. Fix in reverb parameters. Fix about envelope for SoundFont. Support for SF2 scaleTuning. 2003-05-08 Saito * timidity/sndfont.c: Fix about tremolo again. 2003-05-07 Kentaro Sato * timidity/sysdep.h: Fix compile error in case of MAX_CHANNEL >= 33 2003-05-07 Saito * timidity/tables.[ch], timidity/mix.c, timidity/playmidi.[ch], timidity/sndfont.c, timidity/resample.c: Fix around tremolo and vibrato. Fix about envelope generator. Bug fix in pitch control. 2003-05-05 Saito * timidity/sndfont.c: Fix in modify-release (pseudo-reverb). 2003-05-04 Daisuke Aoki * timidity/instrum.c, timidity/playmidi.c, timidity/playmidi.c, interface/w32g_ut2.[ch], interface/w32g_subwin.c, interface/w32g_subwin3.c, interface/w32g_pref.c, interface/w32g_res.[h,rc]: Fix around Win32 GUI. Support for dynamic cfg changing experimentally. 2003-05-03 Saito * timidity/mix.c, timidity/playmidi.[ch], timidity/instrum.[ch], timidity/sndfont.c, timidity/mod2midi.c, timidity/smplfile.c: Fix around tremolo and vibrato. Fix delay. Fix in volume & modulation envelope generator. 2003-05-02 TAMUKI Shoichi * interface/w32g_{ini,pref}.c, interface/w32g_utl.[ch]: Add temperament type mute selector in preference. (W32GUI version) 2003-05-02 Saito * timidity/sndfont.c: Fix around initialization. Fix about tremolo. * timidity/mix.c, timidity/playmidi.[ch]: Fix about modulation envelope. Fix about velocity to filter cutoff frequency. Fix around envelope generator. 2003-05-01 Saito * timidity/sndfont.c, timidity/instrum.c, timidity/mod2midi.c, timidity/smplfile.c: Fix around initialization. * timidity/mix.c: Bug fix in envelope generator. 2003-04-30 TAMUKI Shoichi * interface/ncurs_c.c, interface/w32g_subwin3.c, timidity/controls.h, timidity/playmidi.c: Support for CTLE_MUTE. 2003-04-30 Saito * timidity/mix.c: Bug fix in envelope generator. 2003-04-29 TAMUKI Shoichi * timidity/playmidi.[ch], timidity/timidity.c: Support for channel mute by temperament type. Fix behavior of quiet channel option -Q0. Fix around temperament control SysEx. 2003-04-29 Saito * timidity/instrum.c: Fix behavior of user drumset / instrument. * timidity/tables.c, timidity/mix.c: Modify envelope generator. * timidity/playmidi.c: Disable Rx. Note Off for the moment. * timidity/sndfont.c: Fix about initialization. 2003-04-29 Kentaro Sato * timidity/playmidi.c, timidity/mod2midi.c: Fix around MOD. 2003-04-24 Saito * timidity/reverb.c, timidity/playmidi.c, timidity/readmidi.c: Fix around new reverb. * timidity/tables.c: Randomize triangular waveform for SoundFont's LFO. * timidity/instrum.h: Add some parameters to Sample struct. 2003-04-23 Saito * timidity/sndfont.c, timidity/playmidi.c, timidity/instrum.c: Fix about cfgforsf. 2003-04-22 Saito * timidity/playmidi.c: Fix about modulation envelope to pitch. * timidity/reverb.c: Fix around reverb initialize. * timidity/recache.c, timidity/resample.c: Fix around CSPLINE_INTERPOLATION. 2003-04-21 Saito * timidity/instrum.[ch], timidity/playmidi.c, timidity/smplfile.c, timidity/sndfont.c, timidity/mix.c: Add some internal parameters. Change LPF behavior. 2003-04-19 Saito * timidity/reverb.c: Fix about access violation. * timidity/playmidi.[ch], timidity/mix.c: Support for LPF transition. (the source of this code is "fluidsynth") 2003-04-18 Kentaro Sato * timidity/reverb.c: Fix about LPF for system effects. 2003-04-18 Saito * interface/w32g_ini.c, interface/w32g_pref.c, interface/w32g_utl.[ch], interface/w32g_res.[rc,h]: Add "Effect Quality" option. * timidity/reverb.c: Support for new reverberation effect. * timidity/sndfont.c: Bug fix about initialize. * timidity/mix.c: Bug fix about lowpass filter with modulation envelope. 2003-04-17 Saito * timidity/tables.[ch], timidity/reverb.[ch]: Replace sine wave with triangular wave in chorus effect. * timidity/playmidi.[ch]: Fix about NRPN vibrato. * timidity/readmidi.c: Fix about map behavior. 2003-04-16 TAMUKI Shoichi * timidity/playmidi.c, timidity/tables.[ch], timidity/timidity.c: Support for Salinas as mean-tone tuning in case of minor tonality. # Be careful of wolf. 2003-04-15 Saito * interface/w32g_ini.c, interface/w32g_pref.c, interface/w32g_utl.[ch], interface/w32g_res.[rc,h], timidity/sndfont.c, timidity/playmidi.[ch], timidity/instrum.[ch], timidity/mix.[ch]. timidity/smplfile.c: Support for modulation envelope. 2003-04-15 s_keishi * interface/winsyn_c.c, interface/w32g_syn.c: Fix about free_instruments_afterwards. 2003-04-14 Daisuke Aoki * interface/w32g_pref.c: Fix about preference window. (TWSynth version) 2003-04-13 Daisuke Aoki * interface/w32g_res.rc: Fix about preference window. (TWSynth version) 2003-04-13 s_keishi TAMUKI Shoichi * interface/winsyn_c.c, timidity/playmidi.c: Support for free_instruments_afterwards during MIDI streaming 2003-04-13 Daisuke Aoki * interface/w32g_pref.c, interface/w32g_res.[h,rc]: Fix about preference window. (W32GUI version) 2003-04-12 Saito * interface/w32g_c.c: Improve timer resolution. (W32GUI version) 2003-04-12 mput * timidity/optcode.h (d2i): rewrite using asm. (imuldiv8): rewrite using asm. (imuldiv16): rewrite using asm. (imuldiv24): rewrite using asm. 2003-04-11 Saito * timidity/reverb.c, timidity/effect.c, timidity/mix.c: Fix conversion to fixed-point number. * timidity/readmidi.[ch], timidity/instrum.c, timidity/timidity.c: Fix about User Drumset and User Instrument. 2003-04-11 Norikatsu Shigemura * timidity/timidity.c, timidity/mfi.c, timidity/sysdep.h, configure{,.in}: Fix about FreeBSD port. 2003-04-11 Saito * timidity/resample.c, timidity/playmidi.h: Fix about bidir loop. 2003-04-10 mput * timidity/optcode.h, timidity/optcode.c: delete repeated #define's 2003-04-10 TAMUKI Shoichi * timidity/sysdep.h: Fix again around splen_t 2003-04-10 Saito * timidity/tables.[ch]: Modify sc_drum_level_table. Add lookup_triangular. * timidity/mix.c: Replace sine wave with triangular wave in SF2 instrument tremolo. Disable tremolo auto-pan temporarily. * timidity/resample.c: Replace sine wave with triangular wave in SF2 instrument vibrato. 2003-04-09 Saito * timidity/optcode.[ch]: Implement imuldiv24() and d2i(). * timidity/reverb.c, timidity/effect.c, timidity/mix.c: Fasten effect-voice mixing function. Replace imuldiv16() with imuldiv24() in some functions. * timidity/resample.c, timidity/playmidi.h: Restore Voice struct sample_increment to int32. * timidity/playmidi.c: Restore PANNED_LEFT, RIGHT, CENTER. * timidity/sysdep.h: Change splen_t to uint32. * timidity/resample.c: Disable bidir loop if SAMPLE_LENGTH_BITS = 32. 2003-04-09 mput * timidity/sysdep.h, timidity/recache.c: Fix around splen_t. * configure, configure.in, {,*/}Makefile{,.in,.am}: Add integer size detection. 2003-04-09 TAMUKI Shoichi * timidity/sysdep.h, timidity/recache.c: Fix around INT32_MAX. 2003-04-07 TAMUKI Shoichi * interface/w32g_subwin3.c: Fix around temperament display (W32GUI version) 2003-04-06 Saito * timidity/playmidi.h, timidity/resample.c, timidity/recache.c, timidity/instrum.h: Change Sample struct (loop_end,loop_start,data_length) to splen_t(int64). Change Voice struct (sample_offset, sample_increment) to splen_t(int64). 2003-04-06 TAMUKI Shoichi * interface/w32g_subwin3.c, interface/w32g_tracer.{bmp,h}: Support for temperament display (W32GUI version) 2003-04-04 mput * timidity/playmidi.c (recompute_freq): Fix fprintf() arg * timidity/playmidi.c (start_note): Fix cast to fit prototypes 2003-04-03 TAMUKI Shoichi * timidity/playmidi.[ch], timidity/readmidi.c: Support for temperament control with Universal Real-Time SysEx. - Temperament keysig control (F0 7F id 08 0A sf mi F7) - Temperament type control (F0 7F id 08 0B ff gg hh tt F7) 2003-04-03 Saito * timidity/effect.c: Fix noise shaping filter for 16bit output mode. 2003-04-02 Saito * timidity/effect.c, timidity/mt19937ar.[ch]: Improve noise shaping filter for 16bit output mode. * timidity/playmidi.c, timidity/tables.[ch]: Support for non-linear for NRPN drum instrument tva level. 2003-04-01 Saito * interface/w32g_res.rc, timidity/effect.c: Implement noise shaping filter for 16bit output mode. * timidity/playmidi.c: Fix polyphonic key pressure. 2003-03-31 Saito * interface/w32g_subwin3.c: Fix tracer window (W32GUI version) * timidity/playmidi.[ch]: Fix NRPN vibrato control. * timidity/mix.c: Fix up tremolo. 2003-03-31 TAMUKI Shoichi * interface/ncurs_c.c: Fix around temperament control SysEx. 2003-03-30 Saito * interface/w32g_res.rc: Fix tab order (W32GUI version) # thanks to Mr.rc 2003-03-28 Saito * timidity/mix.c: Fix aborting in do_voice_filter() function. * timidity/playmidi.c: Fix around voice-by-voice LPF. 2003-03-28 Daisuke Aoki * interface/w32g_i.c, timidity/readmidi.c: Enhance support for .rmi files. 2003-03-27 Kentaro Sato * timidity/playmidi.c: Fix behavior of user drumset. 2003-03-27 Saito * timidity/playmidi.[ch], timidity/readmidi.c: Improve legato. Improve NRPN cutoff control. * interface/w32g_subwin3.c: Fix tracer window (W32GUI version) 2003-03-27 TAMUKI Shoichi * timidity/playmidi.c, timidity/readmidi.c: Fix around temperament control SysEx. 2003-03-27 Daisuke Aoki * interface/w32g_subwin3.c: Fasten tracer window (W32GUI version) 2003-03-26 Saito * interface/w32g_subwin3.c: Fasten tracer window (W32GUI version) 2003-03-26 TAMUKI Shoichi * interface/alsaseq_c.c, interface/ncurs_c.c, interface/winsyn_c.c, timidity/controls.h, timidity/playmidi.[ch], timidity/readmidi.c, timidity/tables.[ch], timidity/timidity.c: Support for temperament control with Universal Non Real-Time SysEx. - Temperament keysig control (F0 7E id 08 0A sf mi F7) - Temperament type control (F0 7E id 08 0B ff gg hh tt F7) 2003-03-26 Daisuke Aoki * interface/w32g_subwin.c (ListWndProc): Add a check for nfiles when double-clickng in list window * interface/w32g_subwin3.c: Bug fix in mutual exclusion for tracer window, which might cause problems on Windows 2000. 2003-03-26 Saito * interface/w32g_subwin3.c: Fix resource leak of tracer window (W32GUI version) 2003-03-25 Saito * timidity/playmidi.c: Fix channel pressure about LPF. Weaken NRPN cutoff controls. * interface/w32g_subwin3.c, interface/w32g_res.rc: Fix tracer window (W32GUI version) 2003-03-24 Saito * timidity/playmidi.h, timidity/resample.c: Restore Voice struct sample_offset to int32 * timidity/playmidi.c: Fix panning. * timidity/mix.c: Optimize MIXATION about voice-by-voice LPF. * interface/w32g_subwin3.c, interface/w32g_tracer.h, interface/w32g_res.h, interface/w32g_res.rc: Improve the appearance of tracer window (W32GUI version) 2003-03-20 Saito * timidity/table.c, timidity/playmidi.c: Fix panning. 2003-03-18 TAMUKI Shoichi * timidity/playmidi.[ch], timidity/timidity.[ch]: Support for command line option below. -E l/L: Enable/Disable voice-by-voice LPF. 2003-03-18 Saito Obsolete "velocity_table" Obsolete "opt_sf_lpf" Obsolete "opt_resonance" Obsolete "#extension cutoff" Obsolete "#extension resonance" * timidity/sndfont.c: Bug fix around envelope * timidity/mix.c: Fix around voice-by-voice LPF 2003-03-17 Saito * timidity/tables.[ch], timidity/timidity.c, timidity/mix.c: Hack up def_vol_table[] and gs_vol_table[] * timidity/playmidi.h, timidity/resample.c: Change Voice struct sample_offset to uint32 * timidity/sndfont.c: Bug fix around looping, sample rate, and envelope * timidity/mix.c: Fixed around recompute_envelope() 2003-02-26 Chisato Yamauchi * interface/xaw_i.c: Support for gradient bar resource Hack up around redraw 2003-02-23 TAMUKI Shoichi * timidity/tables.[ch], timidity/timidity.c: Hack up attack_vol_table[] and sb_vol_table[] 2003-02-22 Chisato Yamauchi * interface/xaw_i.c: Hack up around color resources 2003-02-16 Takaya Nogami * timidity/controls.c: Add macosx_control_mode * libarc/arc.c: Add NeoWrd Support 2003-02-16 Daisuke Aoki * interface/winsyn_c.c (ctl_pass_playing_list): Fasten 2003-02-16 Stas Sergeev * interface/server_c.c, timidity/timidity.c: Add timidity server support for dosemu's midid 2003-02-15 Daisuke Aoki * interface/winsyn.c: Bug fixed aborting (Windows synthesizer GUI version) 2003-02-08 Saito * interface/w32g_ini.c, interface/w32g_pref.c, interface/w32g_res.c, interface/w32g_utl.c, timidity/mix.c, timidity/playmidi.c, timidity/readmidi.c, timidity/tables.c, timidity/tables.h: Obsolete "Attack Env. (0..3)" option (W32GUI version) Improve envelope precision for SoundFont * ChangeLog: updated 2003-02-07 TAMUKI Shoichi * timidity/playmidi.c Bug fixed rarely aborting due to pitch bend 2003-02-07 mput * timidity/readmidi.c Bug fixed SysEx. parser in case of no EOX 2003-02-01 TAMUKI Shoichi * timidity/timidity.c Compilable on NetBSD/OpenBSD # thanks to Mr.342 2003-01-23 s_keishi * interface/w32g_syn.c, interface/w32g_utl.c, interface/winsyn_c.c, timidity/playmidi.c: Add time management on Windows synthesizer 2003-01-18 Daisuke Aoki * interface/w32g_ini.c, interface/w32g_pref.c, interface/w32g_res.h, interface/w32g_res.rc, interface/w32g_subwin2.c, interface/w32g_syn.c, interface/w32g_utl.c, interface/w32g_utl.h, interface/winsyn_c.c, libarc/unlzh.c, timidity/optcode.c, timidity/optcode.h, timidity/playmidi.c, timidity/smplfile.c: Add version information (Windows synthesizer GUI version) Bug fix around GUI (Windows synthesizer GUI version) Add max calculate time option (Windows synthesizer GUI version) Bug fix multi preference dialog opened (W32GUI version) Hack up playing performance (Windows synthesizer GUI version) Bug fix palette color on WRD window (W32GUI version) Hack up message display on main window (W32GUI version) 2003-01-18 s_keishi * interface/winsyn_c.c: Hack up starting performance on Windows synthesizer 2003-01-16 s_keishi * interface/winsyn_c.c: Bug fix around SysEx. on Windows synthesizer Hack up playing performance on Windows synthesizer 2003-01-16 mput * libarc/unlzh.c, timidity/optcode.c, timidity/optcode.h: Compilable on Solaris 8 2003-01-16 Saito * timidity/mix.c, timidity/playmidi.c, timidity/playmidi.h, timidity/readmidi.c: Support for real time SysEx. generally Hack up each voiced LPF faster (maybe) 2003-01-12 s_keishi * interface/winsyn_c.c: Support for real time SysEx. on Windows synthesizer 2003-01-11 s_keishi * interface/winsyn_c.c: Commonize parse_sysex_event_multi() in winsyn_c.c to main 2003-01-11 Daisuke Aoki * interface/w32g_i.c, interface/w32g_subwin2.c, interface/w32g_wrd.h: Bug fix text and graphic color on WRD window (W32GUI version) Bug fix quitting with iconized (W32GUI version) 2003-01-10 TAMUKI Shoichi * interface/alsaseq_c.c, timidity/readmidi.c, timidity/readmidi.h: Support for real time SysEx. on ALSA sequencer 2002-12-05 TAMUKI Shoichi * interface/winsyn_c.c, timidity/playmidi.c, timidity/playmidi.h, timidity/readmidi.c, timidity/tables.c, timidity/tables.h, timidity/timidity.c: Support for real time SysEx. scale tuning 2002-11-20 Saito * timidity/readmidi.c: Bug fix channel message affected by GS SysEx. 2002-11-18 Saito * timidity/reverb.c, timidity/tables.c, timidity/tables.h: Optimize reverb.c a little 2002-11-12 Saito * interface/w32g_ini.c, interface/w32g_res.rc: Modify English resources (W32GUI version) 2002-11-09 TAMUKI Shoichi * interface/w32g_ini.c, interface/w32g_pref.c, interface/w32g_utl.c, interface/w32g_utl.h, timidity/mix.c, timidity/playmidi.c, timidity/playmidi.h, timidity/timidity.c: Support for command line option -A as drumpower and auto volume adjustment Change handling drumpower in % value (W32GUI version) Beautify timidity/mix.c a little 2002-11-09 Saito * interface/w32g_i.c, interface/w32g_subwin2.c, interface/w32g_subwin3.c, timidity/playmidi.c, timidity/playmidi.h: Hacked up channel pressure (after touch) 2002-11-08 Saito * interface/w32g_ini.c, interface/w32g_pref.c, interface/w32g_res.h, interface/w32g_res.rc, interface/w32g_utl.c, interface/w32g_utl.h, libunimod/load_xm.c, libunimod/multil.c, timidity/gogo_a.c, timidity/playmidi.c, timidity/playmidi.h, timidity/vorbis_a.c, timidity/w32g_vorbis_dll.c: Support for auto volume adjustment Support for embedded title TAG on MP3 output Support for embedded title TAG on OggVorbis output # thanks to Mr.Hanada 2002-11-03 Saito * timidity/mix.c, timidity/playmidi.c, timidity/reverb.c, timidity/sndfont.c: Bug fixed noisy LPF except 44.1kHz Disabled drum detection on NRPN Fasten mixing a little 2002-11-03 Daisuke Aoki * interface/w32g_i.c, interface/w32g_subwin2.c, interface/w32g_subwin3.c: Bug fixed GM/GS/XG display on tracer window (W32GUI version) Hacked up drawing WRD window a little (W32GUI version) Support for saving playlist to add .pls extension by force (W32GUI version) 2002-10-30 Saito * timidity/mix.c, timidity/playmidi.c, timidity/playmidi.h, timidity/tables.h: Hack up envelope generator 2002-10-29 Saito * timidity/mix.c, timidity/playmidi.c: Bug fix release of SoundFont 2002-10-28 Saito * timidity/sndfont.c, timidity/tables.c: Hack up SoundFont volume calculation with Ton's cooperation 2002-10-27 Saito * timidity/instrum.h, timidity/mix.c, timidity/playmidi.h, timidity/sndfont.c: Bug fix around SoundFont modification 2002-10-26 Saito * libunimod/load_xm.c, libunimod/mlutil.c, timidity/mix.c, timidity/playmidi.c, timidity/readmidi.c, timidity/sndfont.c, timidity/tables.c, timidity/tables.h: Hack up for SoundFont reducing curve same as SB 2002-10-25 Saito * timidity/instrum.h, timidity/mix.c, timidity/playmidi.c, timidity/playmidi.h, timidity/readmidi.c, timidity/sndfont.c: Bug fix around real time SysEx. Change for envelope calculation on SoundFont Support for velocity and note envelope change 2002-10-20 Kentaro Sato * timidity/playmidi.c: Bug fixed not to initialize diff and reso in recompute_voice_filter() 2002-10-19 Saito * timidity/playmidi.c: Bug fix in case of illegal RPN value 2002-10-18 Saito * timidity/playmidi.c, timidity/sndfont.c: Bug fix around SPECIAL_SAMPLE panning 2002-10-17 Saito * timidity/mix.c, timidity/playmidi.c, timidity/playmidi.h, timidity/sndfont.c: Modify CC10 panning change as twice according to SF2.01 documentation Modify handling parameter of each voiced LPF 2002-10-15 Saito * timidity/playmidi.c, timidity/playmidi.h: Modify panning as stereo like on multi layer Support for stereo sampled drumset (maybe) Bug fixed around SysEx. chorus and delay (maybe) 2002-10-14 Saito * Modify volume pressure faster using effect 2002-10-10 Saito * Support for each voiced LPF activating velocity according to SF2.01 documentation 2002-10-09 Saito * Support for NRPN, Drum Filter Cutoff, and Resonance (XG) Support for part of real time GS SysEx such as EQ and reverb 2002-10-09 Daisuke Aoki * Bug fixed around tracer window (W32GUI version) 2002-10-09 Kentaro Sato * Support for AltiVec technology for powerpc 2002-10-08 Saito * Support for each voiced NRPN 2002-10-06 Saito * Support for each voiced(sampled) LPF 2002-10-05 Saito * Modify NRPN Vibrato Rate and Vibrato Depth as relative change Hacked up panning finely Support for stereo sample (maybe) Hacked up reverb very finely 2002-09-29 Saito * Support for GS SysEx. Rx. NOTE OFF 2002-09-28 Saito * Support for GS SysEx. Reverb Time (a little) 2002-09-27 Saito * Support for adjust drumset volume Support for GS SysEx. Reverb Level 2002-09-25 Saito * Bug fixed click noise around release-time 2002-09-22 Saito * Support for LIMITED-MULTI of assign mode 2002-09-22 Kentaro Sato * Support for modulation patch option in unit value Bug fixed around tremolo_phase_increment 2002-09-19 Kentaro Sato * Support for AIFF file as the voice data 2002-09-18 Saito * Support for GS SysEx. checksum 2002-09-15 Kentaro Sato * Support for WAVE file as the voice data 2002-09-14 Kentaro Sato * Bug fixed in case of MAX_CHANNEL >= 33 # thanks to Mr.Ueda 2002-09-10 TAMUKI Shoichi * Add initial keysig GUI option for pure intonation 2002-09-10 Saito * Hacked up to use default value for LPF/resonance 2002-09-08 TAMUKI Shoichi * Add initial keysig option for pure intonation 2002-09-01 Daisuke Aoki * Support for Windows synthesizer GUI version 2002-08-31 Kentaro Sato * Support for config parameter with quotation 2002-08-31 s_keishi * Support for 2 ports on Windows synthesizer mode 2002-08-29 TAMUKI Shoichi * Bug fixed ALSA sequencer to add readmidi_read_init() 2002-08-20 Likai Liu * Add ALSA daemon mode 2002-08-17 Saito * Bug fixed exit(1) -> return 1 in LZH extract 2002-08-10 s_keishi * Support for Windows synthesizer mode 2002-07-31 TAMUKI Shoichi * Support for meas.beat/keysig/tempo display on main panel 2002-07-29 TAMUKI Shoichi * Bug fixed to use equal frequency table to select voice sample 2002-07-29 Kentaro Sato * Bug fixed MAP behavior 2002-07-27 mput * timidity/optcode.c Support for MMX extension for powerpc (--with-simd) 2002-07-25 mput * timidity/{timidity.h,sysdep.h,optcode.c,optcode.h}: Arrange and divide timidity/timidity.h Create timidity/sysdep.h and timidity/optcode.[ch] 2002-07-22 Saito * Rewrite all do_compute_data_midi() 2002-07-21 Saito * Add key shift and fixed key signature GUI option 2002-07-20 Saito * Add pure intonation playing GUI option 2002-07-18 TAMUKI Shoichi * Add frequency table for minor song playing 2002-07-08 TAMUKI Shoichi * Support for ME_TIMESIG/ME_KEYSIG for RCP/R36/G18/G36 MIDI data 2002-07-06 mput * configure.in: Rewrite configure.in 2002-07-06 TAMUKI Shoichi * Support for real-time display of measure/beat (ncurses) 2002-07-01 TAMUKI Shoichi * Support for playing MIDI data in pure intonation 2002-06-21 TAMUKI Shoichi * Add key change command line option Update command help Modify moving song with not only down/up but only j/k (ncurses) 2002-06-15 TAMUKI Shoichi * Add function to play with fixed key signature number 2002-06-15 Saito * Modify volume to 1.63 2002-06-11 Daisuke Aoki * Support for channel_mute on tracer window (W32GUI version) 2002-06-10 Saito * Support for non-linear for pan 2002-06-08 TAMUKI Shoichi * Support for real-time display key signature on SMF (ncurses) Reflect keychange up/down to current key signature 2002-06-06 TAMUKI Shoichi * Support for real-time display of key/tempo (ncurses) 2002-06-06 Saito * Bug fixed not to initialize NRPN on reset all controller 2002-06-05 Kentaro Sato * Bug fixed to override patch option 2002-06-04 TAMUKI Shoichi * Support for real-time channel mute control (ncurses) Modify moving ch. with not only c/C but only j/k (ncurses) 2002-06-01 Daisuke Aoki * Support for WRD graphic surface (W32GUI version) 2002-05-28 Saito * Make table for Vel./Vol./Exp. volume 2002-05-27 Daisuke Aoki * Add location/size of window option (W32GUI version) Add tracer window (glow up right window) (W32GUI version) 2002-05-19 Daisuke Aoki * Keep window location (W32GUI version) Specify max. of sub windows (W32GUI version) Hacked up display surface (W32GUI version) 2002-05-19 Saito * Bug fixed noise in delay effect 2002-05-18 Saito * Support below drumset n #extension level [note] [tva level] 2002-05-17 Kentaro Sato * Modify velocity_table[] and linear_vol_table[] Support for playing MFi(Melody Format for i-mode, *.mld) file 2002-05-17 Saito * Support for #extension legato [prog] [0 or 1] Arrange tables and hacked up velocity table 2002-05-12 Peter L Jones * timidity/aRts_a.c Hacked up aRts output module An extension to the "order=o" SoundFont parameter 2002-05-12 Daisuke Aoki * Bug fixed random play (W32GUI version) Keep last time play list 2002-05-11 Saito * Enable "note=" for SoundFont 2002-05-06 Saito * Support for GS SysEx. Pitch Offset Fine Hacked up GS SysEx. around tone map Hacked up user drumset behavior Make table for envelope parameter module 2002-05-05 Saito * Support for Velocity Sense Depth/Offset Modity to display unsupported GS/XG SysEx on console Define int64 2002-05-02 Saito * Bug fixed to work alternate sound in case of -j option 2002-04-30 TAMUKI Shoichi * timidity/{instrum.[ch],timidity.[ch]} Support for modulation patch option 2002-04-20 TAMUKI Shoichi * timidity/{instrum.[ch],timidity.c} Support for ADSR patch option 2002-04-18 Saito * Bug fixed to reflect CFG setting in case of alternate sound Bug fixed infinite looped in rs_bidir() of resample.c Support for insertion effect only [01 10: Overdrive] 2002-04-16 TAMUKI Shoichi * timidity/instrum.c Using "tune=", change {low,high,root}_freq instead of sample_rate 2002-04-14 Saito * Change Sample struct (loop_end,loop_start,data_length) to uint32 2002-04-12 Saito * Modify to calculate LPF/resonance default value from parameter 2002-04-08 Saito * Support for LPF/resonance per channel 2002-03-27 Saito * Modify cfg option for SoundFont You may use "note=" "pan=" "strip=tail" Modify "amp=" algorithm 2002-03-04 Saito * Support for NRPN drum pitch coarse & fine 2002-02-28 Saito * Support for insertion effect 2002-02-19 Saito * Support for EQ ON/OFF per channel 2002-02-15 Saito * Fasten effect modules without reverb 2002-02-11 Saito * Support for chorus similar to delay Adjust delay/chorus effect volume same as reverb #define NEW_CHORUS to select previous surround chorus 2002-02-10 Saito * Support for delay nearly same as do_ch_reverb() 2002-01-31 Saito * Added semi-RT LPF (with resonance) 2002-01-27 Saito * Support for assign group for user drumset Hacked up LPF of SoundFont 2002-01-21 Daisuke Aoki * Support for text only WRD display (W32GUI version) 2002-01-17 Daisuke Aoki * configs/msc-config.h,interface/{w32g_i.c,w32g_pref.c,w32g_res.h, w32g_res.rc}, timidity/{common.c,gogo_a.c,vorbis_a.c,w32g_vorbisenc_dll.c}: - Updated windows version. - Bug fixed about gogo dll. - Bug fixed about dialog menu. * script/{dllutl.rb,script/readme.txt}: Dynamic import source generator for dll (vorbis, gogo). 2002-01-17 Thomas Klausner * timidity/C/timidity.1: Document fixed. 2002-01-16 Takashi Iwai Masanao Izumo * acinclude.m4,doc/C/Makefile.am,doc/C/README.alsaseq, interface/alsaseq_c.c,timidity/alsa_a.c: - Support ALSA 0.9 - Added alsaseq document (doc/C/README.alsaseq) 2002-01-16 Saito * timidity/{playmidi.c,readmidi.c}: Bug fixed * timidity/{playmidi.c,modmid_a.c}: Change 'MOD -> MIDI file conversion' identifier from 'm' to 'M'. 2002-01-16 Kentaro Sato * timidity/{playmidi.c,readmidi.c}: Bug fixed 2002-01-16 Masanao Izumo * timidity/instrum.c: Bug fixed. * timidity/readmidi.c: Added TIMIDITY_TOOLS macro to build for timidity tools. 2002-01-15 Masanao Izumo * timidity/{instrum.c,instrum.h,timidity.c}: New configuration parameter tune=[+-]number (float) For example bank 0 0 piano.pat tune=+1 # up 1 note key 1 britepno.pat tune=+2 # up 2 note key 2 synpiano.pat tune=-1.5 # down 1.5 note key 2002-01-12 Masanao Izumo * Version 2.11.2 released. 2002-01-12 Masanao Izumo * timidity/readmidi.c: Bug fixed about fix_string(strdup(...)); 2002-01-09 Masanao Izumo * config.guess: Updated. * config.sub: Updated. * configure.in (Cygwin): DLL gogo is default if --enable-audio=gogo is specified. 2002-01-08 Masanao Izumo * Update copyrights. 2002-01-07 Masanao Izumo * timidity/{timidity.h,mix.c,playmidi.h}: Bug fix about LOOKUP_HACK. * timidity/{timidity.c,instrum.c,instrum.h,common.c,common.h, readmidi.h,readmidi.c}: Free config data at end of the main. 2001-12-29 Masanao Izumo * Version 2.11.1 released. 2001-12-29 Masanao Izumo * interface/w32g_res.rc: fixed. * timidity/timidity.c (Windows): fixed. * timidity/timidity.c: Try to continue even if any configuration file is not found. * interface/{w32g_ini.c,w32g.h}: fixed. 2001-12-27 Masanao Izumo * Version 2.11.0 released. 2001-12-27 Masanao Izumo * timidity/{wave_a.c,output.c}: Move create_auto_output_name() from wave_a.c to output.c. * interface/{w32g_vorbisenc_dll.c,w32g_vorbis_dll.c,w32g_ogg_dll.c}, timidity/{w32g_vorbisenc_dll.c,w32g_vorbis_dll.c,w32g_ogg_dll.c}, Move them from interface to timidity. 2001-12-26 Saito * timidity/sndfont.c: Bug fixed about LFO. 2001-12-26 Thomas Klausner * timidity/sun_a.c: Fixed the way to find the audio queue size on NetBSD. 2001-12-26 Masanao Izumo Daisuke Aoki * timidity/{timidity.c,wave_a.c,w32_gogo.h,w32_gogo.c,vorbis_a.c, sndfont.c,output.c,gogo_a.h,gogo_a.c,audriv_none.c,audriv_a.c}, interface/{w32g_i.c,w32g_res.h,w32g_vorbisenc_dll.c,w32g_pref.c, w32g_vorbis_dll.c,w32g_ogg_dll.c,w32g_utl.c,w32g_ut2.c,w32g_subwin.h, w32g_subwin.c,w32g_pref.h,w32g_c.c,w32g.h}: - Merge windows code. - Update windows resource. 2001-12-25 Masanao Izumo * timidity/w32_a.c: Close&Open to reset/flush the audio device. 2001-12-23 Thomas Klausner * doc/C/timidity.1: Updated. 2001-12-23 Masanao Izumo * timidity/aq.c (aq_flush): Bug fixed. * timidity/vorbis_a.c: Enable to encode to variable sample rates. 2001-12-20 Masanao Izumo * timidity/playmidi.c: Bug fix. * interface/ncurs_c.c: Changed from 3 to 4 digits in audio queue monitor. * timidity/common.c: Fixed security problem 2001-11-28 Miloslav Trmac * interface/{dumb_c.c,slang_c.c,xaw_c.c,xskin_c.c}: Fixed some problems. 2001-11-19 Eric A. Welsh * timidity/playmidi.c: Fixed a bug and reduced voice cancellation in Chorus Mode 2. Mod files and drums can still cancel on some full Left/Right pans. * timidity/mod.c: Portas are now handled correctly for Ultimate Soundtracker mods. 2001-11-10 Daisuke Nagano * doc/C/timidity.1: Updated. 2001-11-05 Saito * timidity/sndfont.c: Updates do_lowpass(). 2001-10-25 Takashi Iwai * timidity/sndfont.c: Bug fix. 2001-10-23 Lalit Chhabra * timidity/sun_a.c: Modified the sun_a.c file so that it checks for the AUDIODEV environment variable and sets the sun audio device accordingly. 2001-10-19 Saito * timidity/{mix.c,mix.h,playmidi.c,playmidi.h,readmidi.c,readmidi.h, reverb.c,reverb.h,tables.c,tables.h}, interface/{w32g_ini.c,w32g_utl.c,w32g_utl.h,w32g_pref.c,w32g_res.h, w32g_res.rc,w32g_res.rc}: - Updates Win32GUI version. - Improved GS SysEx - Added attack/release/decay-time(CC/NRPN tone/NRPN dram) - Added drum level - Added CC#94 pseudo delay (like chorus method) - Adjusted reverb level - Added resonance filter - Modified envelope attack - Adjusted velocity - Supported user drumset (SC-88) - Added some GS SysEx'es. 2001-10-10 Frederic LOYER * timidity/sffile.h: Bug fix. Change uint8 pitchCorrection to int8 pitchCorrection. 2001-10-09 Masanao Izumo * Windows: Use w32_a.c instead of w32g_a.c * timidity/common.c: safe_malloc(), safe_large_malloc(): Modified to avoid malloc(0). * libunimod/{load_xm.c,load_imf.c,load_it.c,load_uni.c}: Strip gcc warnings. * Upgrade develop environment: - automake 1.5 - autoconf 2.5x - libtool 1.4.x 2001-06-25 Forever shall I be. * Vorbis 1.0 support. 2001-06-25 Masanao Izumo * timidity/{m2m.c,freq.c}: Change global variables to static. * interface/xaw_c.c: Bugfix for displaying title in random play mode. 2001-06-24 Hiroshi Yamashita * timidity/{instrum.c,instrum.h,playmidi.c,sndfont.c}: Enable to display SoundFont name. * interface/{xaw_c.c,xaw_i.c}: Support CTLE_DRUMPART message in xaw interface. 2001-06-16 Eric A. Welsh * timidity/{m2m.c,freq.c}: Remove some unused variables, and recast one of the functions to void. 2001-05-31 Eric A. Welsh * timidity/readmidi.c: Bugfix about restarting. 2001-05-29 Eric A. Welsh * timidity/{output.c,playmidi.c,modmid_a.c,freq.c,freq.h,m2m.c}, utils/{fft4g.c,fft4g.h}, doc/m2m.txt; New feature: MOD to MIDI conversion. 2001-05-29 Eric A. Welsh * timidity/instrum.c: GUS sample pans are calculated correctly now. The old method resulted in most pans being off by -4. * timidity/{mix.c,playmidi.c,playmidi.h,timidity.h}: New SMOOTH_MIXING define. Any changes to left_mix or right_mix are now smoothed over a 0.5 msec window, eliminating "cliffs" which could result in popping noises. This should be defined by default. * timidity/mod2midi.c: period2note patch from Paolo Bonzini (you should already have this). New shrink_huge_sample(Sample *sp) function. Some mod samples are bigger than 1 meg (the maximum size in TiMidity++) and need to be resampled down to fit under the limit. * timidity/mod.c: Tempo/BPM events are implemented more "correctly" now. Sample pans are no longer applied twice (which was usually resulting in everything coming out of the left speaker). 2001-05-26 Marcus Herbert * timidity/mod.h, libunimod/load_okt.c: Change CR/LF -> LF * libunimod/load_med.c, timidity/wrd_read.c: Fix cast problems. 2001-05-05 Paolo Bonzini * timidity/mod2midi.c (period2note): always pick the closest note instead of the lowest one. 2001-04-06 Takaya Nogami * timidity/resample.c: Bug fix. 2001-04-05 Joakim Verona * interface/alsaseq_c.c: Bug fix about quiet channel 2001-03-24 David Lawrence Ramsey * timidity/readmidi.c: support for RMI/RMID/RMIDI files. 2001-03-18 Masanao Izumo * Version 2.10.4 released. 2001-03-13 Masanao Izumo * timidity/w32_a.c: decreased acntl() PM_REQ_GETQSIZ size because of audio blocking. 2001-03-13 Masanao Izumo * Apply lost patches. 2001-03-10 Masanao Izumo * Version 2.10.3 released. 2001-02-24 Eric A. Welsh * timidity/readmidi.c: Improved XG SYSEX support. 2001-02-20 Ron Akkersdijk * interface/xaw_i.c: Bug fix. 1) Selecting "LoadALL" in the fileselecor didn't work. Adding a "/" at the end of the 'p' string did the trick ;-) 2) I think XtVaSetValues free's whatever memory it got from the caller the previous time. So ultimately it tries to free local var 'currdir' (which was nevered malloced) Solution: Copy 'currdir' to heapspace (new strsav routine). Of course this may have introduced a memory leak 8-) * timidity/common.c: Bug fix. Electric Fence doesn't like it if you try to alloc 0 bytes. Besides, why first malloc 0 bytes and then check for a 0 bogus count afterwards. Hmm, requesting 0 bytes should never happen doesn't it; We are actually "repairing" an error made elsewhere 8-) 2000-02-15 Paolo Bonzini * libunimod/load_stx.c: fix a crash if the tracker that made an STX file is not recognized * libunimod/mlutil.c: fixed false negatives in recognizing STM files. 2000-11-09 Masanao Izumo * timidity/playmidi.c: Fixed to update interface display. * configure.in, timidity/oss_a.c: Added new test for * timidity/oss_a.c: ioctl() has three arguments. * configure.in, timidity/oss_a.c: In OpenBSD OSS, use /dev/audio instead of /dev/dsp * configure.in, In OpenBSD, Added new test for -lcurses for ncurses * configure.in, Added new test for -lossaudio * timidity/{readmidi.c,playmidi.c}: Trial change for GX. 2000-11-06 Eric A. Welsh * timidity/mod.c: The XM E1,E2,EA,EB,X1,X2 effects were all implemented improperly before. 2000-11-02 Masanao Izumo * Version 2.10.2 released. 2000-11-01 Masanao Izumo * interface/alsaseq_c.c: Set time tick resolution to 100Hz. * timidity/aq.c: Bug fix. * interface/xaw_.c.: Bug fix. 2000-10-22 Masanao Izumo * timidity/mod.c: Bug fix. 2000-10-18 Masanao Izumo * Version 2.10.1 released. 2000-10-17 Paolo Bonzini Merged with libmikmod 3.1.9 * libunimod/Makefile.am: added load_okt.c * libunimod/load_imf.c: envelopes weren't loaded correctly. The first envelope point was correct, the remaining half points were bogus, and the other half completely random. * libunimod/load_m15.c: effect 0xc (set channel volume) with effect parameter 0xff was misplayed as a note cut. Effects 0x1, 0x2 and 0x3 (portamentos) with effect parameter 0x00 were using the command memory, but these commands do not have effect memory for MOD files. * libunimod/load_med.c: use better variable names. * libunimod/load_mod.c: same as load_m15.c * libunimod/load_okt.c: new file. * libunimod/load_stm.c: recognize Wuzamod STM modules. Plus, fixed sample rate. * libunimod/load_stx.c: recognize MOD2STM and Wuzamod STM modules. Plus, fixed sample rate. * libunimod/load_uni.c: recognize recent APlayer modules (.APUN format level 0x104) * libunimod/load_xm.c: same as load_imf.c * libunimod/mloader.c: register the Oktalyzer loader * libunimod/mlutil.c: moved the STM module signatures here, so that the STX loader can use them * libunimod/unimod_priv.h: moved the STM module signatures here, so that the STX loader can use them * timidity/mod.c: enabling the envelope (with an effect) for a sample with no associated envelope would cause immediate coredumps. Also fixed arpeggio memory (which was ignored) and tempo slide (which was processed incorrectly). 2000-10-02 Daisuke Aoki * utils/nkflib.c: Update newer version. 2000-08-30 Masanao Izumo * interface/{Makefile.am,Makefile.in}: Added target of interface_r.so and interface_A.so. 2000-08-29 Masanao Izumo * interface/x_sherry.c: Remove memory leak. 2000-08-26 Henrique M. Holschuh * Bug fixed about dynamic_interface_id * Added interface_?.txt files 2000-08-20 Eric A. Welsh * timidity/mix.c(sustain): Changed behavior to not begin the decay until after the sample plays past it's loop start. 2000-08-09 Masanao Izumo * Version 2.10.0 released. 2000-08-08 Masanao Izumo * interface/{w32g_ini.c,w32g_utl.c,w32g_utl.h},timidity/w32g_a.c: Change data_block_time to data_block_bits. 2000-07-24 Masanao Izumo * timidity/wave_a.c: Enable to write each separated wav file if `-o' command line option is omitted. The output filename is automatically generated from the input MIDI filename. The file extension is changed to ".wav". * timidity/au_a.c: Likewise. * timidity/aiff_a.c: Likewise. * timidity/raw_a.c: Likewise. 2000-07-21/2000-07-24 Takashi SHIRAI * timidity/oss_a.c: Bug fixed for the calculation of the counter. 2000-07-20 Masanao Izumo * configure: Added new options. --with-includes=DIRS Specify include directories (colon separated) --with-libraries=DIRS Specify library directories (colon separated) * configure: Check and -lvorbis * vorbis_a.c: Supported Ogg Vorbis output: -Ov This feature is enabled if TiMidity is configured with --enable-audio=default,vorbis option. 2000-07-18 Takashi Iwai * interface/alsaseq_c.c: Enabled OSS emulation. 2000-07-15 Takashi Iwai * interface/alsaseq_c.c: Added new interface: TiMidity as ALSA sequencer client. This interface enabled if the timidity is configured with --enable-alsaseq. 2000-07-15 Masanao Izumo * option -Bn,m sets audio buffer fragments as n, and audio buffer size as 2^n. Specify -1 for default. * timidity/{playmidi.c,playmidi.h}: audio_buffer_bits and audio_buffer_size are parameter. * timidity/aq.c: Modified. 2000-07-05 Masanao Izumo * Version 2.9.5 released. 2000-07-04 Daisuke Aoki * interface/{w32g.h,w32g_c.c,w32g_i.c,w32g_ini.c,w32g_playlist.c, w32g_res.h,w32g_res.rc,w32g_subwin.c,w32g_ut2.c,w32g_utl.c,w32g_utl.h, timidity.c}: Upgrade Windows version. 2000-06-29 Randolph Bentson * doc/C/timidity.cfg.5: Fixed error in the documentation. 2000-06-24 Yoichi Imai * interface/gtk_i.c: Support for 5 button mouse to scroll window. * doc/C/timidity.cfg.5: Fixed error in the documentation. 2000-05-29 Masanao Izumo * timidity/readmidi.c (readmidi_add_event): Avoid negative timestamp. 2000-05-24 Masanao Izumo * Version 2.9.4 released. 2000-05-17 Masanao Izumo * Fixed automake 1.4 bug, and updated Makefile.in files using this fixed version of automake. The automake patch is available from: http://www.goice.co.jp/member/mo/timidity/dist/automake-1.4-bugfix1.pat 2000-05-17 Eric A. Welsh * resample.c: Fixed drum portamento bug. * timidity/{instrum.c,sndfont.c}: Enable pre_resampling(). 2000-05-12 Katsuhiro Ueno * timidity/alsa_a.c: Support for ALSA 0.6 2000-05-09 Masanao Izumo * timidity/resample.c: Fixed drum portamento bug. 2000-05-08 Masanao Izumo * Version 2.9.3 released. 2000-05-08 Masanao Izumo * interface/{Makefile.am,Makefile.in}: Changed target dependency for tclIndex not to change tclIndex unless the tcl-sources are changed. 2000-04-20 Eric A. Welsh * timidity/{resample.c,recache.c,playmidi.c}: Fix the previous patch. - Drum & Sample pan fix. - Remove pre_resampling(). - And else... 2000-04-15 Eric A. Welsh * timidity/playmidi.c: Fixed voice reduction control. * timidity/{instrum.c,sndfont.c}: Removed the pre_resampling() calls in order to enable drum pitch bends. * timidity/readmidi.c: Remove duplicated code. * timidity/playmidi.c: Enable to get chorus level in drum channel. 2000-04-14 Eric A. Welsh * timidity/playmidi.c: Fixed pan pot 2000-04-12 Masanao Izumo * timidity/alsa_a.c(PF_BUFF_FRAGM_OPT): Added the flag. 2000-04-12 Eric A. Welsh * timidity/recache.c: Bug fixed. 2000-04-11 Takashi SHIRAI * timidity/oss_a.c: Fixed for OSS version of !defined(SNDCTL_DSP_GETODELAY). 2000-04-10 Masanao Izumo * Version 2.9.2 released. 2000-03-30 Masanao Izumo (Bug reported by Takeyuki Uehara ) * interface/ncurses.c: Fixed problem that all channel statuses are reseted if the key `t' is pressed. 2000-03-28 Masanao Izumo * timidity/readmidi.c: Bug fixed about reading SMF track boundary. 2000-03-23,26 Eric A. Welsh * timidity/{resample.c,recache.c}: Fixed problem of cspline interpolation. 2000-03-21 Masanao Izumo * Version 2.9.1 released. 2000-03-20 Masanao Izumo * libarc/arc_tar.c: Fixed memory leak. * libarc/url.c: url_dump(): Avoid return NULL if nbytes is zero. * timidity/controls.h: Redefine RC_NONE * timidity/wrdt.c: __W32G__ => IA_W32GUI * timidity/mod2midi.c: period2note(): Fixed to search the period note between 0 and 119. 2000-03-12 Eric A. Welsh * timidity/recache.c: cache_resampling() Defined RESAMPLATION_CACHE, INTERPVARS_CACHE Cache resampling should be the same as what is used for non-cached notes, or else things will sound strange * timidity/playmidi.c: compute_data() reduce_quality_flag was being set while the buffer was being filled (beginning of file, or after an unpause). !aq_fill_buffer_flag keeps this from happening. Also, the flag was sometimes being set due to round off errors when it should not have been. The (double) casting and < 99.5 check fix this problem. 2000-03-12 Eric A. Welsh * timidity/playmidi.c: fixed bug when resampling hit the end of a sample (mixing did not happen for the last portion of the sample) * timidity/resample.c: set voice[i].timeout to 1 when resampling hits the end of a sample 2000-03-11 Paolo Bonizni * timidity/mod.c: Fixed effect Fxy interpretation (xy=32 sets speed, not tempo) * timidity/readmidi.[ch]: added tempo_adjust variable * timidity/timidity.c: added -T option 2000-03-11 Daisuke Aoki * configs/msc-config.h, interface/{w32g.h,w32g_c.c,w32g_i.c,w32g_playlist.c,w32g_pref.c, w32g_res.h,w32g_res.rc,w32g_subwin.c,w32g_ut2.c,w32g_ut2.h, w32g_utl.c},timidity/wrdt.c: Upgrade Windows version. - Enable to resize Doc Window and List Window. And also enable to select the font. - Fixed bugs for displaying * libarc/arc_lzh: Fixed some problems 2000-03-08 Masanao Izumo * timidity/{playmidi.h}: Change ME_PATCH_OFFS enum position. * timidity/{mod2midi.c} (period2note): Fix to scan period_table[0..119]. 2000-03-08 Paolo Bonzini * timidity/{mod.c,mod2midi.c}: Bug fix 2000-03-07 Masanao Izumo * timidity/mod2midi.c: Check error condition of return value of period2note, and use ctl->cmsg() to display the warning message instead of printf(). 2000-03-06 Paolo Bonzini * timidity/mod2midi.c: Bug fix * timidity/playmidi.c (ME_PATCH_OFFS): Bug fix 2000-03-05 Paolo Bonzini * timidity/mod.c: fixed endless loop in the player * timidity/mod2midi.c: Voice_SetPeriod does not reset the sample (involved switching from ME_EXPRESSION to ME_KEYPRESSURE for volumes). Changed release time to 80 msec. * timidity/readmidi.h: made MidiEventList a doubly-linked list * timidity/readmidi.c: implemented doubly-linked-list in readmidi_add_event, and removed BACKWARD_EVENT_OK because the new implementation removed the inefficiency of backward events. 2000-03-05 Sawada Keiji * libarc/url_ftp.c: Bug fix. 2000-03-04 Mikhail Yakshin * timidity/{timidity.c,common.c}: Convert the text code from windows-1251 to koi8-r with command line option `-t 1251'. 2000-03-03 Masanao Izumo * timidity/C/timidity.cfg.5,timidity/ja_JP.ujis/timidity.cfg.5: update. 2000-03-02 Masanao Izumo * timidity/timidity.c (-R): Reset pseudo reverb (modify release) if `-R -1' is specified. * timidity/mod2midi.c: Enable to change release envelope time of the module file if command line option `-R' is specified. 2000-03-02 Paolo Bonzini * timidity/mod2midi.c: Solves a problem with low notes. 2000-02-27 Masanao Izumo * Version 2.9.0 released. 2000-02-24 Masanao Izumo * doc/C/timidity.cfg.5,doc/ja_JP.ujis/timidity.cfg.5 (#extension opt): Fixed documentation error. * libunimod/unimod.h (CHAR): Fixed redefiend error on Windows. 2000-02-19 Masanao Izumo * timidity/{playmidi.c,controls.h (CTLE_PROGRAM): Change control interface of program event. * timidity/{playmidi.c,controls.h (CTLE_DRUMPART): New event interface. * interface/ncurs_c.c: Change somethings... * interface/{gtk_c.cx_sherry.c},libunimod/{mloader.c,unimod.h}, timidity/mod2midi.h: Shut gcc warning up. * libunimod/{unimod.h,unimod_priv.h}: WIN32 => __W32__ * timidity/playmidi.c: Fixed key up/down for MOD file playing. 2000-02-18 Masanao Izumo * timidity/resample.c (FINALINTERP): Ignore. Now, TiMidity does not hit the end out of data, and ignores a final interpolation. * timidity/playmidi.c: Avoid overlapped voice when MOD file is playing. * interface/ncurs_c.c,timidity/playmidi.c: Fixed a indicator problem. 2000-02-16 Paolo Bonzini * configure.in,libunimod/*,timidity/{Makefile.am,mod.c,mod.h,mod2midi.c, mod2midi.h,readmidi.c,readmidi.c}: Support full module player. 2000-02-16 Paolo Bonzini * libarc/{url.h,url.c}: Bug fix 2000-02-15 Masanao Izumo * libarc/url.c (url_expand_home_dir): Bug fix of buffer-overrun. 2000-02-07 Masanao Izumo * Version 2.8.2 released. 2000-02-07 Katsuhiro Ueno * timidity/alsa_a.c: Improved. 2000-02-07 Masanao Izumo * timidity/alsa_a.c: Fixed for ALSA 0.4 * configure.in: Add a test of -lpdcurses for the curses library. Use *-*-cygwin* for matching $target to CYGWIN. * all files: Update copyright line. 2000-02-02 Katsuhiro Ueno * timidity/{aq.c,aq.h,output.h,timidity.c,alsa_a.c}: Support for ALSA 0.5 2000-01-10 Peter Stuer * timidity/w32_a.c: Fixed dead-lock problem on NT (for console version). 2000-01-09 Eric A. Welsh * timidity/{recache.c,resample.c}: Optimized. 2000-01-06 Eric A. Welsh * timidity/playmidi.c: Fixed a bug of random pan. 2000-01-13 Masanao Izumo * timidity/sndfont.c (def_drum_inst): Removed. 2000-01-09 Masanao Izumo * config.sub config.guess install-sh: Update new version from autoconf 2.13 * configure.in: Fixed variable substitution rules. 1999-12-24 Masanao Izumo * timidity/configure.in: Fixed typo. 1999-12-20 Masanao Izumo * timidity/instrum.c: Bug fix. 1999-12-02 Piotr Auksztulewicz * timidity/output.c: Fixed missing of semicolon. 1999-11-29 Masanao Izumo * Version 2.8.1 released. 1999-11-29 Masanao Izumo * timidity/timidity.c,interface/{gtk_c.c,motif_c.c,w32g_i.c,w32g_util.c, w32g_ini.c,wrdt_wcon.c,xaw_c.c}: Bug fixes about over-running in strncpy. 1999-11-24 Masanao Izumo * configure.in: Fix typos 1999-11-19 Eric A. Welsh * timidity/playmidi.c (reduce_voice_CPU): Obsoleted. Use reduce_voice() instead of reduce_voice_CPU(). 1999-11-24 Masanao Izumo * Version 2.8.0 released. 1999-11-24 Masanao Izumo * timidity/playmidi.c (start_note): Reset porta_control_counter. 1999-11-19 Masanao Izumo Takaya Nogami * Imported Macintosh sources from the 1999.10.31 of T.Nogami released. 1999-11-19 Masanao Izumo * timidity/resample.c (rs_plain): Bug fixed about PRECALC_LOOPS counter. This bug from the original of TiMidity. Original form: i = (le - ofs) / incr + 1; (Original) Fixed form: i = (le - ofs + incr - 1) / incr; (Correct) * timidity/wrd_read.c: Check 0x20 command in the header block. 1999-11-18 Masanao Izumo * timidity/timidity.c (-M name): New command line switch. -M auto: Use *.mid.wav or *.mid.aiff instead of MIDI to WAVE conversion. The PCM file format must be 16bit sample and the sampling rate equals as timidity's rate. -M none: Disable this feature (default) -M : Use the specified file. 1999-11-17 Eric A. Welsh * timidity/playmidi.c (reduce_voice(), reduce_voice_CPU()): Improved chorus reduction. * timidity/timidity.c: Changed the -h information displayed for -EFchorus=2 1999-11-16 Masanao Izumo * timidity/playmidi.c: New variable `char *pcm_alternate_file'. NULL or "none": Don't use any pre-converted pcm files. "auto": Automatically select *.mid.wav or *.mid.aiff filename: Use the specified file. 1999-11-16 Masanao Izumo * configure.in,timidity/timidity.h: New configure option to choose wave interpolation in resampling. --enable-spline=linear Linear interpolation (default) --enable-spline=cubic Cubic interpolation --enable-spline=lagrange Lagrange interpolation --enable-spline=no No interpolation 1999-11-12 Masanao Izumo * timidity/{playmidi.h,playmidi.c}: Modified chorus implementations * interface/{Makefile.am,Makefile.in}: Added tclIndex in the package. If *.tcl are updated, tclIndex is automatically update with make. 1999-11-07 Takaya Nogami * timidity/{playmidi.c,readmidi.h}: Use pre-converted file *.mid.wav or *.mid.aiff file to play *.mid if it is exists. 1999-11-06 Glenn Trigg * interface/{gtk_c.c,gtk_h.h,gtk_i.c}: Added support for printing the lyrics from .kar files and also make the text area clear between files. 1999-10-26 Eric A. Welsh * timidity/instrum.c: Bug fixes. It is possible that (OFS>>FRACTION_BITS)+1 will yield a value which is 1 beyond the length of the sample. This happens when OFS < data_length, but (OFS>>FRACTION_BITS) == (data_length>>FRACTION_BITS). 1999-10-25 Eric A. Welsh * timidity/playmidi.c: Support adjust panning for chorused notes. This fix would remove "popping" noises. 1999-10-24 Michael Vanier * README: Proofread. 1999-10-17 Eric A. Welsh * timidity/{mix.h,mix.c,timidity.c} (-m N): New command line switch, and implemented envelope_volume decay. N is the minimum number of msec to sustain a sustained note. -m 1 Effectively behaves as if all sustains are ignored, volume ramping is the same as normal stage 3. -m 0 Disable sustain ramping, causes constant volume sustains. (default) -m 3000 A note at full volume will decay for 3 seconds once it begins to be sustained (assuming the regular stage 3 rate would not cause it to decay even longer). Softer notes will of course die sooner. 1999-10-15 Eric A. Welsh * timidity/playmidi.c: Improvement to -EFchorus=2 1999-10-15 Tomoki Aono * interface/{Makefile.am,Makefile.in}: Fixed a mistake of Makefile 1999-10-12 Masanao Izumo * Version 2.7.0 released. 1999-10-12 Masanao Izumo * NEWS,ChangeLog,ChangeLog.1,interface/xaw_redef.c: Fix typos. * timidity/readmidi.c (groom_list): Bug fix * interface/w32g_ini.c,timidity/{timidity.c,common.c,common.h (str2mID): Utility function to convert string to Manufacture ID. This function is moved from w32g_ini.c to common.c, and used global. * timidity/{timidity.c,readmidi.h,readmidi.c}: -EM: New option. Use midi system as : is `gs', `xg', or `gm'. 1999-10-05 Masanao Izumo * interface/w32g_playlist.c (w32g_add_playlist): Bug fix * timidity/playlist.c (adjust_panning_immediately): True by default. adjust_panning_immediately toggle on/off with -F option. If this flag is true, currently-sounding pan position is changed when a Panpot message is received. Otherwise, the pan position is changed when starting with the next note. 1999-10-04 Masanao Izumo * timidity/{readmidi.c,readmidi.h}: Fixed bug of random drum panning. 1999-10-01 Eric A. Welsh * timidity/readmidi.c: Modified GS Sysex for bank+program change. 1999-09-29 Eric A. Welsh * timidity/readmidi.c: Added GS Sysex for bank+program change. 1999-09-27 Masanao Izumo * Version 2.6.1 released. 1999-09-27 Masanao Izumo * AUTHORS,timidity/timidity.c,timidity/w32g_i.c: Changed E-mail address of Davide Moretti from to 1999-09-27 Eric A. Welsh * timidity/{playmidi.h,playmidi.c}: Fixed bug of random panning. Added new Channel structure member `int pan_random' for random pan flag. Note that all of dynamic interfaces must be re-compiled, because the size of `Channel' structure is changed. 1999-09-26 Eric A. Welsh * timidity/readmidi.c (XG SysEx): Support for XG Multi Part Data parameter change SysEx events. 1999-09-25 Masanao Izumo * timidity/{readmidi.c,playmidi.c}: Set MSB/LSB bank zero by default, except that XG MSB Bank of channel 10 is 127 by default. 1999-09-21 Eric A. Welsh * timidity/timidity.c (-EFchorus=2): Bug fix. Typo in timidity.c 2.6.0, opt_surround_chorus never set. 1999-09-21 Masanao Izumo * Version 2.6.0 released. 1999-09-21 Masanao Izumo * timidity/rcp.c: Bug fix of SameMeassure. * interface/vt100_c.c (ctl_current_time): Bug fix of displaying bold. 1999-09-20 Masanao Izumo * timidity/aq.c (aq_samples): Save PM_REQ_GETSAMPLES value if the acntl() succeeds. * timidity/sun_a.c: Implement PM_REQ_GETFILLED and PM_REQ_GETSAMPLES of acntl(). 1999-09-17 Eric A. Welsh * timidity/{timidity.c,playmidi.c,playmidi.h} (new_chorus_voice_alternate): To use the surround sound instead of detuned chorus. It is enabled with -EFchorus=2 or -EFchorus=2,level option (level := [0..63]) 1999-09-14 Masanao Izumo * timidity/timidity.c (set_channel_flag): Bug fixed 1999-09-12 Shusuke Nisiyama * timidity/timidity.c (fpsetmask): On FreeBSD, remove FP_X_DZ flag from fp mask. 1999-09-10 Norikatsu Shigemura * configure.in: Use $CC instead of ld for $SHLD of NetBSD. 1999-09-09 Masanao Izumo * Version 2.6.0-beta4 released for test version. 1999-09-08 Masanao Izumo * interface/x_sherry.c: Bug fix. * interface/{wrd_read.c,x_sherry.c}: Support part of the sherry ver.2. 1999-09-07 Masanao Izumo * configure.in,common.makefile.in: Fix missing of DEFAULT_PATH. * acinclude.m4: Add gtk.m4 1999-09-06 Katsuhiro Ueno * timidity/common.c (pathcmp): Bug fixed. * timidity/{acinclude.m4,configure.in}: Fix misspelled comment and remove garbage of output. 1999-09-06 Masanao Izumo * timidity/alsa_c.c: Check output rate with snd_pcm_playback_status. acntl: PM_REQ_GETQSIZ, PM_REQ_GETFILLABLE, PM_REQ_GETFILLED, PM_REQ_GETSAMPLES, and PM_REQ_FLUSH are supported. 1999-09-05 Masanao Izumo * Version 2.6.0-beta3 released for test version. 1999-09-05 Masanao Izumo * timidity/{readmidi.c,playmidi.c}: On XG mode, ignore the program change without bank select LSB. 1999-09-05 Yasuhide Oomori * interface/gtk_i.c (gtk_set_locale): Enable locale. 1999-09-04 Masanao Izumo * timidity/{common.c,common.h} (pathcmp): New function to compare the path. * timidity/{common.c,common.h} (pathcasecmp): Obsoleted. * timidity/common.c (add_to_pathlist): Remove the duplicated path from `pathlist'. * interface/w32g_playlist.c: Use pathcmp() to compare the path. 1999-09-03 Masanao Izumo * configure.in (PKGDATADIR, PKGLIBDIR): New macro which is for $(pkgdatadir) and $(pkglibdir). * interface/xaw_i.c (XAW_BITMAP_DIR): New macro. XAW bitmap files are in XAW_BITMAP_DIR. * configure.in, timidity/timidity.h (TCL_DIR): Remove it from cpp flag. * configure.in,interface/tk_c.c (TKPROGPATH): Remove it from cpp flag. Add the definition in tk_c.c. * configure.in,timidity/timidity.c: SHARED_LIB_PATH -> SHLIB_DIR 1999-09-02 Masanao Izumo * timidity/dl_cygwin32.c -> timidity/dl_w32.c * timidity/{dl_w32.c,dl_dld.c,dl_dlopen.c,dl_hpux.c,dlutils.h} (dl_free): New function to unload dynamic link handler. * interface/dynamic_c.c: Make a hook to call dl_free() on ctl->close(). * acinclude.m4,configure.in: Search and test for NAS library. * configure.in: Add --with-nas-library=library to specify NAS library with absolute path. Note that -laudio can not be used because it is possible -laudio is not NAS library. * configure.in: Add --with-nas-includes=dir to specify the NAS include directory. * libarc/url_file.c: On Windows, use mapped-file to read the file. * timidity/timidity.c (handler): Only mark `intr'. * interface/w32g_i.c: Use WaitSingleObject() to wait to terminate the thread. 1999-09-02 Yasuhide Oomori * INSTALL,INSTALL.jp: Update documentation to match new configuration mechanism. 1999-09-01 Masanao Izumo * configure.in: Modify action of --enable-dynamic[=mode_list]. 1999-09-01 Masanao Izumo * Version 2.6.0-beta2 released for test version. 1999-09-01 Masanao Izumo * configure.in: Modify action of --enable-audio[=mode_list]. * configure.in (--enable-interface[=interface_list]): New configure option. Specify comma separated interface list. For example: --enable-interface=ncurses,tcltk,gtk * configure.in,timidity/timidity.c: If default audio is not specified, remove TIMIDITY_OUTPUT_ID macro from compiler option. 1999-08-31 Yasuhide Oomori * timidity/oss_a.c: dsp_play_mode -> oss_play_mode 1999-08-31 Kei Hibino * configure.in (SHELL): AC_SUBST() for autoconf-2.12 * configure.in (slang.h): Add new test. 1999-08-31 Katsuhiro Ueno * acinclude.m4: Bug fixed. 1999-08-30 Masanao Izumo * Version 2.6.0-beta1 released for test version. 1999-08-30 Masanao Izumo * timidity/playmidi.c (midi_program_change): Bug fixed. * configure.in: enable_audio_opt -> have_audio_opt * timidity/hpux_a.c: Use 'A' for HPUX network audio (Alib) instead of 'n'. * configure.in,timidity/{linux_a.c,oss_a.c,output.c}: Rename linux_a.c to oss_a.c * configure.in,timidity/output.c: Rename AU_LINUX to AU_OSS. Split AU_HPUX into AU_HPUX_AUDIO and AU_HPUX_ALIB. * configure.in: (Audio options): --enable-audio[=mode_list] `mode_list' is comma separated mode list: dev: (default) /dev/dsp (Linux, FreeBSD, BSD/OS) /dev/sb_dsp (BSD/OS) /dev/audio (Sun, NetBSD, HPUX) IRIX audio or OSF/1 MME Windows MMS oss: OSS /dev/dsp (Exclusive dev mode) alsa: ALSA pcm device alib: HPUX network audio (Alib) nas: NAS - Network Audio System esd: EsounD Example: --enable-audio=alsa,nas,esd compiles and links ALSA, NAS, and EsounD audio output. By default, --enable-audio=dev. * timidity.c(TIMIDITY_OUTPUT_ID): Environment shell variable to specify output mode id. * configure.in(--with-default-output=): Support more output modes. 1999-08-28 Katsuhiro Ueno * configure.in: enable-dynamic -> dynamic If the compiler is gcc, use it for SHLD instead of ld. * configure.in, timidity/output.c (--with-default-output=): New configure option to specify default output mode. * interface/bitmaps/Makefile.am: $(TIMID_DIR)/bitmaps -> $(TCL_DIR)/bitmaps * common.makefile.in (TIMID_DIR): Set $(pkgdatadir) instead of $(pkglibdir). *** CAUTION ***: The default configuration file is replaced to /usr/local/share/timidity/timidity.cfg * configure.in, common.makefile.in, interface/Makefile.am (SHLIB_DIR): New makefile macro. SHLIB_DIR is used to specify the directory which contains dynamic TiMidity interfaces. * configure.in, timidity/Makefile.am: Add -rdynamic option for gcc if --enable-dynamic. * interface/dynamic_c.c, timidity/timidity.c: Pass dynamic_control_mode.flags to dynamic interface. 1999-08-27 Masanao Izumo * Version 2.5.1 released. 1999-08-27 Masanao Izumo * timidity/aq.c: Bug fixed. Avoid infinite loop in aq_flush(); * timidity/{output.h,aq.c,w32g_a.c} (PM_REQ_OUTPUT_FINISH): * interface/{x_wrdt.c,x_sherry.c},configure.in (ENABLE_SHERRY): Bug fix. 1999-08-26 Masanao Izumo * timidity/linux_a.c (ignore_processed_probrem, BYTES_PROCESSED_BUGFIX): Obsoleted. * timidity/linux_a.c (SNDCTL_DSP_GETOPTR, SNDCTL_DSP_GETODELAY): Use SNDCTL_DSP_GETODELAY instead of SNDCTL_DSP_GETOPTR to calculate sample point. * interface/w32g_utl.c: Bug fixed about the chorus and reverb settings. 1999-08-26 Masanao Izumo * Version 2.5.0 released. 1999-08-26 Masanao Izumo * timidity/linux_a.c(ignore_processed_probrem): Ignore to fix the byte processed problem if any errors occur. Why count_info.bytes doesn't stop even if the process is suspended? * configure.in: Remove -rdynamic option from $g_so_libs. 1999-08-25 Masanao Izumo * libarc/url_dir.c: If !unix, Don't use i-node to compare the directory. * configs/{msc-config.h,msc-interface.h,msc-sjis.txt}: Configuration header files for MSC. * Makefile.am(dist-hook): Added script to distribute configs/* * timidity/playmidi.c (Voice Reduction): Avoid division by zero. 1999-08-25 Eric A. Welsh * timidity/resample.c(RESAMPLATION): Optimization of macro for cspline with linear fallback. 1999-08-24 Masanao Izumo * interface/{Makefile.am,Makefile.in,w32g.h,w32g_c.c,w32g_i.c, w32g_ini.c,w32g_playlist.c,w32g_pref.c,w32g_rec.h,w32g_res.h, w32g_res.rc,w32g_subwin.c,w32g_subwin.h,w32g_utl.c,w32g_utl.h, w32g_sleep.bmp}, libarc/url.c, timidity/{aq.c,common.c,controls.h,effect.c,playmidi.c,readmidi.c, sndfont.c,timidity.c,timidity.h,version.c,audio_cnv.c}, Update new version of Windows GUI. Changes for MSC version. * TiMidity.ad, TiMidity-uj.ad: X Resources for XAW interface. * timidity/playmidi.c (compute_data): Fix division by zero. 1999-08-21 Masanao Izumo * timidity/{output.h,playmidi.c,w32g_a.c} (PM_REQ_PLAY_END): New macro. PM_REQ_PLAY_END is called just after playing. * timidity/playmidi.c (midi_program_change): Don't load instrument if !(play_mode->flag & PF_PCM_STREAM) * timidity/list_a.c (ME_PROGRAM): Call midi_program_change() to change the program. * timidity/list_a.c (channel): static -> extern. * timidity/list_a.c (start_list_a, end_list_a): New function. start_list_a(): Initialize internal variable. end_list_a(): Report internal variable. * interface/{w32g_c.c,w32g_i.c,w32g_pref.c} (List Midi Event `l'): Supported. This output mode is useful to check what kind of patch is used. 1999-08-20 Eric A. Welsh * timidity/{playmidi.c,playmidi.h,resample.h,timidity.c} (cspline and lagrange interpolation): reduce_quality_flag: New variable to reduce CPU load for cspline and lagrange interpolation. TiMidity turns reduce_quality_flag on when the CPU is heavily loaded. -4: New command line option to toggle whether ignore reduce_quality_flag. By default, TiMidity uses reduce_quality_flag. 1999-08-20 Masanao Izumo * interface/{w32g*,Makefile.am},timidity/w32g_a.c,configure.in: Update new version of Windows GUI. * timidity/{playmidi.c,controls.h} (RC_TUNE_END) Used for skip current playing. This changes may be useful to play backward order of playlist. * timidity/miditrace.c (trace_wait_samples): Bug fixed. This fix would down the CPU load in the trace mode. 1999-08-19 Masanao Izumo * timidity/{controls.h,playmidi.c} (CTLE_MAXVOICES): New macro for `voices' change. 1999-08-18 Eric A. Welsh * libarc/url_dir.c (d_ino): Ignore to check d_ino on Windows. 1999-08-18 Masanao Izumo * interface/ncurs_c.c (GSLCD): Draw GSLCD SysEx. Note that LCD is cleared if there is no message between 10 second. * interface/ncurs_c.c: Enable to display channels more than 16ch. The terminal must be able to display more than 24 rows to display more than 16ch. 1999-08-17 Masanao Izumo * interface/{common.c,common.h} (path_strchr, path_strrchr): New function to find path separator. * timidity/timidity.h (IS_PATH_SEP): New macro to test whether the character is the path separator. * interface/{ncurs_c.c,w32g_utl.c}, timidity/{common.c,wrdt.c,timidity.c}, libarc/{arc.c,url.c}: Fix comparison of path separator. - Use `IS_PATH_SEP(c)' instead of `c == PATH_SEP'. - Use `pathsep_strchr(str)' instead of `strchr(str, PATH_SEP)' - Use `pathsep_strrchr(str)' instead of `strrchr(str, PATH_SEP)' Windows console ncurses interface recognizes both "/" and "\" as path separator. * utils/{bitset.c,bitset.h} (check_bitset,change_bitset): New function. 1999-08-16 Masanao Izumo * interface/x_wrdwindow.c: Works more stable for TrueColor. * interface/x_sherry.c: Don't draw the window in skipping. * interface/x_sherry.c: Bug fixed: - Could not re-open window. - Printed unexpected character. 1999-08-15 Masanao Izumo * interface/x_sherry.c: Change debug message verbosity. * interface/wrdt_x.c: Change debug message verbosity. 1999-08-13 Masanao Izumo * interface/ncurs_c.c: Fixed `L' command bug. 1999-08-11 Masanao Izumo * Version 2.4.1 released. 1999-08-11 Masanao Izumo * timidity/linux_a.c: Fixed to adjust PM_REQ_GETSAMPLES. * interface/x_sherry.c (sry_text): Do nothing if string length is zero. * interface/soundspec.c: Multipuly 1.5 to results. * interface/w32g_c.c(ctl_read): In Windows GUI interface, if play_pause_flag is true, wait until any control message is received. There is no CPU usage during pause. * libarc/arc.c (regist_archive): Static function. This function is no longer library interface function. * timidity/timidity.c (read_config_file): Don't remove the end of '#' followed by non-space. * timidity/{playmidi.h,playmidi.c,readmidi.c,mac_c.c}: Make a new MidiEvent type `ME_GSLCD' and the interface control message `CTLE_GSLCD'. If ME_GSLCD is received, TiMidity sends CTLE_GSLCD to the interface. * timidity/{common.c,timidity.c} (open_file_noise_mode): new global variable to pass `noise_mode' of open_file() to arc_error_handler. * wrdt.c: Make more elegant. * x_wrdwindow.c (gscreen_plane_mask): Bug fix. 1999-08-10 Masanao Izumo * libarc/arc.c (): Bug fixed to extract `-lh0-' and `-lz4-' of the lha. * interface/x_sherry.c: Bug fixed to create SHM pixmap. * libarc/{arc.h,arc.c}: Removed `pool' from ArchiveHandler. Use static variable arc_buffer in arc.c instead of ArchiveHandler.pool. `arc_buffer' is internal usage only. * timidity/playmidi.c (apply_controls): usleep(300000) if play_pause_flag. * interface/{w32g_c.c,w32g_canvas.c}: Fixed update timing for channel bar mode. 1999-08-09 Masanao Izumo * Version 2.4.0 released. 1999-08-09 Masanao Izumo Takaya Nogami * utils/{support.c,mac_readdir.c,mac_util.c,mac_util.h}, interface/{xskin.h,VTPrsTbl.c,mac_c.c,mac_loadBMP.c,mac_loadBMP.h, mac_loadpng.c,mac_oms.c,mac_oms.h,mac_sherry.c,mac_skin.c,mac_skin.h, mac_trace.c,mac_wrd.h,mac_wrdwindow.c,mac_wrdwindow.h,wrdt_mac.c}, timidity/{output.h,playmidi.h,playmidi.c,readmidi.c,wrdt.c, mac_a.c,mac_com.h,mac_dlog.c,mac_main.c,mac_main.h,mac_oms_a.c mac_qt_a.c} Imported Macintosh sources from the 1999.8.7 of T.Nogami released Added GS lcd event by T.Nogami. 1999-08-08 Masanao Izumo * timidity/playmidi.c (ctl_updatetime): New function to update interface time. * timidity/common.c (DECOMPRESSOR_LIST, PATCH_CONVERTERS): Ignored for Windows. These filters are not worked yet. * interface/w32g.h (RC_EXT_UPDATE_PLAYLIST): New macro. * interface/{w32g_c.c,w32g_i.c}: w32g_update_playlist() only called from w32g_c.c. Don't call it from w32g_i.c. * interface/vt100_c.c: Change a old copyright to new one. 1999-08-07 Masanao Izumo * libarc: Make archive library code more simple. Some interfaces are changed. New archive library can expand more archive files. * timidity/{timidity.c,common.c} interface/{ncurs_c.c,xaw_c.c}: Change to new libarc interface. * timidity/playmidi.c (midi_program_change): Don't change the instrument of SPECIAL_PROGRAM channel. * timidity/output.h (PM_REQ_GETFILLABLE): New macro. play_mode->acntl(PM_REQ_GETFILLABLE, &fillable) gets number of samples can write. * timidity/output.h (PM_REQ_GETFILLED): New macro. play_mode->acntl(PM_REQ_GETFILLED, &filled) gets number of samples in audio device. * timidity/aq.c (aq_fillable): Check PM_REQ_GETFILLABLE. * timidity/aq.c (aq_filled): Check PM_REQ_GETFILLED. * timidity/linux_a.c (acntl): PM_REQ_GETQSIZ, PM_REQ_GETFILLABLE, PM_REQ_GETFILLED, PM_REQ_GETSAMPLES, and PM_REQ_FLUSH are implemented. (Tested SOUND_VERSION 0x030802) * timidity/aq.c (aq_flush): Avoid unterminated loop. * interface/ncurs_c.c: Bug fixed about displaying instrum name scroll. 1999-08-02 Masanao Izumo * interface/w32g_i.c (hListWnd, hSettingWnd): Create at first open. * interface/w32g_i.c (w32g_i_init): New function. It is called just last of w32g_initialize(). * interface/w32g_canvas.c (TmCanvasMode): Global. * interface/w32g_i.c (SettingWndApply): Restore ctl->trace_playing after ApplySettingTiMidity(). * interface/w32g_i.c: Remove warning message that was displayed when a user tries to change the timidity parameter. 1999-08-01 Masanao Izumo * Version 2.3.0 released. 1999-07-31 Masanao Izumo * timidity/playmidi.c (compute_data): Move the call of apply_controls() position to before output. * timidity/playmidi.c (play_midi_file): Initialize `current_file_info' at beginning of play_midi_file(); * timidity/readmidi.h (IS_ERROR_FILE): New macro to mark the error file. * timidity/playmidi.c (play_midi_file): Mark IS_ERROR_FILE to current_file_info if the file isn't recognized as MIDI file. * timidity/playmidi.c: Enabled to control playing position during pause. * interface/{w32g.h,w32g_c.c,w32g_canvas.c,w32g_i.c,w32g_ini.c, w32g_panel.c,w32g_playlist.c,w32g_res.h,w32g_res.rc,w32g_utl.c, w32g_utl.h}: - Re-made Windows GUI interface. - Added new feature of changing the output. Now, Windows GUI TiMidity can convert MIDI to WAVE file. - Enabled to delete playlist file. [Delete] Key: Delete the CurSel item. [BackSpace] Key: Delete the upper of CurSel item. 1999-07-30 Masanao Izumo * timidity/controls.h (CTLE_PAUSE): New macro for pause event. * timidity/playmidi.c (ctl_pause_event): New function to send CTLE_PAUSE. * timidity/ncurs_c.c (display_aq_ratio): Bug fixed division by zero. * timidity/aq_c.c (aq_setup): Clear the queue for file output. * timidity/{controls.h,timidity.c} (CTLF_AUTOSTART, CTLF_AUTOEXIT): New macro for ControlMode. CTLF_AUTOSTART is toggle on/off with -i?a option. CTLF_AUTOEXIT is toggle on/off with -i?x option. 1999-07-28 Masanao Izumo * timidity/w32_a.c (wait, wait_playing): Changed wait to wait_playing. * timidity/w32_a.c (PM_REQ_FLUSH): Implemented. * timidity/miditrace.c (trace_nodelay): Removed. Use !ctl->trace_playing instead of midi_trace.nodelay. 1999-07-27 Masanao Izumo * timidity/{controls.h,playmidi.c} (RC_STOP): New macro for interface to terminate playing. * timidity/{timidity.c,playmidi.c} (intr): Uncommented. Ctl-C marks `intr' true, and TiMidity will shutdown safety. 1999-07-26 Eric A. Welsh * timidity/playmidi.c (voice reduction): Improved both in quality and in speed. * timidity/{timidity.c,playmidi.c} (auto polyphony reduction): Added new feature of auto polyphony reduction. This feature is enabled/disabled with -p a option. It is enabled by default. 1999-07-25 Masanao Izumo * timidity/timidity.c (opt_aq_max_buff, opt_aq_fill_buff, output_text_code): Fixed memory leak. * interface/{w32g_utl.c,w32g_utl.h} (SETTING_TIMIDITY): Reconstructed. * timidity/playmidi.c (play_pause_flag): Global variable. 1999-07-24 Masanao Izumo * timidity/timidity.c (set_tim_opt): Ordered switch-case. * timidity/timidity.c (set_ctl): Changed for Windows GUS. * timidity/instrum.c (Instrument caching): Don't cache default instrument. * interface/w32g_utl.c (PLAYLIST): Bug fixed and simplify. 1999-07-23 Eric A. Welsh * timidity/playmidi.c (Voice reduction): Improved. 1999-07-21 Masanao Izumo * timidity/aq.c (aq_add): Buffering in non trace mode. 1999-07-19 Masanao Izumo * Version 2.2.0 released. 1999-07-19 Masanao Izumo * timidity/Makefile.am (EXTRA_timidity_SOURCES): Added timpp32g.ini * interface/soundspec.c: Support screen depth 16, 24, and 32. 1999-07-17 Masanao Izumo * interface/w32g_c.c, timidity/{timidity.c,aq.c} (-q): New option. `-q' specify size of software audio buffering. The option format is "-q m/n". m:Maximum buffer in second or percent of size of device driver buffer n:Filled to start in second or percent of size of device driver buffer The default is "5.0/100%". * timidity/timidity.c (help): Arranged the help message of option in order. * timidity/timidity.c (open_pager): In Windows console version, Enable to pipe "PAGER" to display help message. For example: > set PAGER=more > timidity -h Bug fixed (isatty). * configure.in (isatty): Check for `isatty' function. * utils/{nkflib.c,net.c}, libarc/arc_zip.c, interface/{xaw_i.c,gtk_i.c,x_wrdwindow.c,wrdt_x.c,ncurs_c.c}, timidity/{output.c,wrd_read.c,common.c}: Shut gcc warning up. * configure.in: Fixed bug about X path option. * timidity/timidity.h (NLS): Change to "\n" for cygwin. * interface/gtk_c.c (trace_playing): False by default. * interface/gtk_c.c (ctl_current_time): Update whether trace_playing is true or false. * interface/gtk_c.c (cmsg): Likewise. * interface/gtk_c.c (_ctl_refresh): Obsoleted. 1999-07-16 Eric A. Welsh * timidity/playmidi.c (Voice reduction): Improved. Powerful MIDI file less skip, and sound better! 1999-07-13 Norikatsu Shigemura * timidity/nas_a.c: Fixed the problem that occurs with 'timidity -On /dev/null'. * configure.in: Fixed building for FreeBSD Objects. Please specify configure option '--with-elf' if you create ELF object, otherwise create AOUT object. This option is only for FreeBSD. 1999-07-12 Masanao Izumo * interface/{ncurs_c.c,vt100_c.c}: (reverb): Just remove about reverb control interface. It is not supported reverb control interface in the current version yet. 1999-07-09 Masanao Izumo * Version 2.1.1 released. 1999-07-09 Masanao Izumo * interface/xaw_i.c (redrawAction): Redraw once at last expose event. 1999-06-23 Masanao Izumo * utils/{support.c,support.h} (sleep, usleep): Modify the implementation. 1999-06-22 Masanao Izumo * libarc/arc_tar.c: Use checksum whether the tar file is valid or not. "ustar" magic is ignored. 1999-06-14 Masanao Izumo * Makefile.am(tools): Add new Makefile target to build timidity-tools. * Makefile.am(ump): Add new Makefile target to build UMP. 1999-06-10 Masanao Izumo * Version 2.1.0 released. 1999-06-05 Michael Haardt * timidity/nas_a.c: Reduce BUFFERED_SECS to 3 and increase LOW_WATER_PERCENT to 40. 1999-05-22 Keiichi Sakai * timidity/{timidity.h,resample.c}: Enable a multi-point interpolation in resampling. In timidity, defining CSPLINE_INTERPOLATION cause 4-point interpolation by cubic spline curve. Defining LAGRANGE_INTERPOLATION cause 4-point interpolation by Lagrange method. The default is disabled because it wastes much CPU power. 1999-05-20 Takanori Watanabe * timidity/list_a.c: Bug fix. 1999-05-16 Eric A. Welsh * timidity/common.c(pathcasecmp): pathcasecmp() was not forcing the right variable types for s1 and s2. The way it was before resulted in pointers to total garbage, which caused it to not sort properly. 1999-05-04 Vignaud Jean-Baptiste * timidity/timidity.h: Fix typedef for linux axp. 1999-05-02 Nando Santagata * doc/C/timidity.1: Document the -Z option. * timidity/{Makefile.am,common.h,loadtab.c,timidity.c} (-Z): New option: -Z : Load frequency table from . 1999-04-29 Noboru Suzaki * timidity/linux_a.c (open_output): Remove O_NDELAY 1999-04-28 Masanao Izumo * Version 2.0.2 released. 1999-04-28 Masanao Izumo * README, README.jp, INSTALL, INSTALL.jp: Update 1999-04-27 Masanao Izumo * configure.in(*-sgi-irix6.2): Define SGI_OLDAL. * timidity/{sndfont.c,sun_a.cwrd_read.c,timidity.c}, interface/{motif_i.c,x_sherry.c}: Remove c++ comment style "//" 1999-04-26 Masanao Izumo * timidity/audriv_a.c: Bug fix. 1999-04-18 Eric A. Welsh * interface/ncurs_c.c (lastbends, ctl_pitch_bend): Bug fix. 1999-04-25 Masanao Izumo * Version 2.0.1 released. 1999-04-24 Masanao Izumo * configure.in (--enable-dynamic): Bug fix. 1999-04-23 Masanao Izumo * interface/server_c.c (cmd_timebase): Bug fix. * interface/server_c.c (TMR_TEMPO): Ignore. (What is TMR_TEMPO ?) 1999-04-21 Masanao Izumo * configure.in (HAVE_XMUREGISTEREXTERNALAGENT): Test for XmuRegisterExternalAgent() * configure.in (HAVE_X11_XMU_EXTAGENT_H): Test for * interface/xaw_redef.c(XmuRegisterExternalAgent): Don't use XmuRegisterExternalAgent if it is not defined. * xaw_i.c: Fix bug about directory browsing. * timidity/timidity.c (read_config_file): Avoid compiler warnings. timidity/aq.c (do_effect): Likewise. 1999-04-19 Eric A. Welsh * timidity/playmidi.c (play_midi_file): Reset the voice reduction variables at the beginning of each midi. 1999-04-18 Masanao Izumo * common.makefile interface/Makefile.am doc/Makefile.am: Use variable `SUFFIXES', not target `.SUFFIXES' (for automake 1.4) * timidity/resample.c (pre_resample): Fixed integer overflow bug. * timidity/recache.c (resamp_cache_refer_off): Likewise. 1999-04-17 Masanao Izumo * Version 2.0.0 released. 1999-04-17 Masanao Izumo * timidity/playmidi.c: Fix portamento controls. 1999-04-16 Masanao Izumo * interface/{xaw_c.c,xaw_i.c}: Clean up unused variable. * timidity/w32_a.c (output_data): -B 8 in minimum. * configure.in: New configure option --enable-esd to configure EsounD output. EsounD is not enabled by default. 1999-04-15 Masanao Izumo * timidity/linux_a.c (output_data): Error is ignored. * interface/server_c.c timidity/playmidi.c: Re-write the code to play streamed MIDI. * timidity/playmidi.c: Fixed voice reduction. 1999-04-14 Eric A. Welsh * timidity/playmidi.c (new_chorus_voice): Chose 42 as the maximum chorus cutoff level. 1999-04-13 Eric A. Welsh * timidity/w32_a.c timidity/timpp32g.ini interface/w32g_main.c: Change default output rate to 33075. This rate is supported by most soundcards. * timidity/timidity.c (timidity_start_initialize): The first random number generated by the generator is often the same number. So call it once before using it for any real random numbers. 1999-04-12 Masanao Izumo * timidity/aq.c (aq_set_dev_queuesize, max_device_qsize): Obsolete. * interface/srever_c.c timidity/playmidi.c timidity/playmidi.h: Change some variables, function names, and the implementations. * interface/srever_c.c (do_timing): Fix bug. * interface/srever_c.c (ctl_pass_playing_list): data-port argument is optional. The port number would be decided by socket driver. 1999-04-14 Eric A. Welsh * timidity/playmidi.c: Improve voice reduction algorithm. 1999-04-11 Eric A. Welsh * interface/ncurs_c.c: Use __W32__ instead of __WIN32__. * timidity/sndfont.c timidity/mac_qt_a.c: Remove obsoleted macro __WIN32__. 1999-04-11 Masanao Izumo * libarc/url.c (url_close): Don't access free memory. * timidity/timidity.c timidity/instrum.c interface/ncurs_c.c: Add new feature of soundfont assignment. New syntax of *.cfg: # Syntax: # For drumset # %font 128 [options] # For melodic instrument # %font [keynote] [options] # Note that bank 128 is used for drumset patch in soundfont file. # # The prefix name "%font" is special to load the patch from # soundfont. # For example. bank 0 24 %font /usr/local/lib/timidity/sfbank/Nylon_Guita_1.sf2 0 0 * timidity/linux_a.c (AFMT_S16_NE): Define AFMT_S16_NE if it is not defined. * timidity/playmidi.c (recompute_freq): Modulation wheel rate was depended on vibrato rate in v2 beta-4 and beta-5. But this dependence causes bad detuned note if vibrato rate is slow. So the dependence is disabled. 1999-04-10 Masanao Izumo * interface/server_c.c: Support interactive mode (non TMR_START mode). * timidity/linux_a.c: Define AFMT_S16_NE if it is not defined. * timidity/playmidi.c (play_event, play_midi): Move function call of play_mode->acntl(PM_REQ_MIDI) into play_event(). 1999-04-09 Albert K T Hui * acinclude.m4, configure.in, timidity/esd_a.c, timidity/output.c: Added EsounD output mode (-Oe) 1999-04-07 Masanao Izumo * configure.in: The test for is failure on Plamo Linux 1.3/ncurses 1.9.9e in spite of existence of /usr/include/ncurses/curses.h: /usr/include/ncurses/curses.h:34: unctrl.h: No such file or directory But surely there is unctl.h at /usr/include/ncurses/unctrl.h. So I added -I/usr/include/ncurses option to CPPFLAG. 1999-04-07 Masanao Izumo * timidity/w32_a.c (acntl): Support PM_REQ_GETQSIZ request. 1999-04-07 Takaya Nogami * timidity/mac_qt_a.c: Function play_midi() renamed to do_event(). 1999-04-07 Masanao Izumo * ChangeLog: Change this format. ChangeLog for beta series. -- beta 5 ('>' prefix for 1.3.8 changes) Major new features: - Supported to play streamed MIDI in realtime. The stream format is same as OSS /dev/sequencer format. TiMidity read the MIDI events via TCP/IP. See the protocol in the source code (interface/server_c.c). - Portamento control time is completely adjusted. - Expanded playlist files (.m3u, .pls, and .asx). Date: Tue Apr 6 1999 From: Masanao Izumo Files: timidity/common.c Modified expand_file_lists() implementation. >Date: Sun, 4 Apr 1999 18:14:43 +1000 (EST) >From: David Gibson >Files: timidity/linux_a.c > The two bugs are both in the linux audio driver. Firstly, the driver opens > /dev/dsp for both reading and writing, where only writing is necessary. > Secondly, the code uses hard coded constants 8 and 16 to set the output > format on /dev/dsp. This fails on big-endian machines such as the PowerPC. > This patch makes the code use constants #defined by glibc. Date: Sun Apr 4 21:05:37 JST 1999 From: Masanao Izumo Files: timidity/playmidi.c timidity/readmidi/c timidity/mac_qt_a.c Changed ME_PORTAMENTO_TIME to ME_PORTAMENTO_TIME_MSB and ME_PORTAMENTO_TIME_LSB. Passed the original value of MIDI control to the player. Files: timidity/nas_a.c Enabled to synchronize NAS output tracing. >Files: interface/x_wrdwindow.c > Fixed to change undefined color code to default color (white). >Date: Sat, 03 Apr 1999 22:07:45 +0900 (JST) >From: Yoshishige ARAI >Files: interface/xaw_i.c doc/C/README.xaw doc/ja_JP.ujis/README.xaw > Fixed XAW bug. > Changed some descriptions for XAW document. Date: Sat, 3 Apr 1999 19:33:28 +1000 (EST) From: ggt@netspace.net.au (Glenn Trigg) Files: interface/gtk_i.c The ability to load and save play-lists. It uses the TIMIDITY_PLAYLIST_DIR environment variable as a default playlist directory where playlist files are saved to and load from. If that variable doesn't exist it just uses the current directory. A playlist file is simply a text file which has a list of midi filenames. A menu item which lets you clear the list of loaded midi files. I also changed a bunch of printf's in this file to g_warning's which removed the dependency on stdio.h. Date: Sat Apr 3 1999 From: Masanao Izumo Files: interface/server_c.c timidity/playmidi.h timidity/playmidi.c timidity/readmidi/c timidity/readmidi.h Added TiMidity server interface which is invoked -ir. And defined some new functions. Date: Wed, 31 Mar 1999 11:47:27 +0900 From KINOSHITA, K. Files: timidity/mac_qt_a.c Changed to the newest Macintosh QuickTime audio driver code. (Ported to beta5 by Masanao Izumo) Date: Wed Mar 31 1999 From: Masanao Izumo Files: timidity/aq.c timidity/playmidi.c Fixed bug of aq_flush(). >Files: timidity/playmidi.c > Fixed bug of drumpart recognition. >Files: interface/ncurs_c.c > Fixed bug about buffer over-running of comment_indicator_buffer. From: Takaya Nogami Date: Sat, 27 Mar 1999 10:38:11 +0900 Files: timidity/wrd_read.c interface/VTPrsTbl.c timidity/output.c Fixed last screen updating for Sherry WRD. > Enabled clear screen with @esc(2j) command for MIMPI WRD. > Included from output.c Files: libarc/arc_lzh.c libarc/url_dir.c timidity/common.c utils/timer.c Patched for Macintosh. - Fixed to compile arc_lzh.c and url_dir.c - Enabled to read archive files. - Implemented get_current_calendar_time(). Date: Fri Mar 26 1999 From: Masanao Izumo Imported Macintosh sources from the 1999.3.13 of T.Nogami released Date: Fri Mar 26 1999 From: Masanao Izumo Files: timidity/playmidi.c timidity/tables.c Almost completely adjusted portamento rate. Files: configure.in interface/Makefile.am Changed configure implementations. Defined INTERFACE_SRCS macro to specify TiMidity interface sources. Date: Thu, 25 Mar 1999 23:41:46 -0600 (CST) From: "Eric A. Welsh" Files: interface/ncurs_c.c Changed the 'p' command to restart the current song if looping is disable and the current song is the 1st song in the playlist. Files: timidity/common.c Created a expand_names_lists() function in common.c which is used to support the use of playlist files. It checks for the extensions of .m3u, .pls, and .asx (extensions supported by WinAMP) to indicate a playlist file. It then reads the files and inserts the file names inside the files in to the timidity playlist. I also let it use any file "foo" if it is preceded by an '@' on the command line arguments. `timidity @foo` would use the file "foo" as a playlist file. This is syntax left over from some old MS-DOS system commands that I am used to using. -- beta 4 Date: Wed Mar 24 1999 From: Masanao Izumo Files: timidity/nas_a.c Removed PF_CAN_TRACE flag from NAS PlayMode because NAS can't trace playing correctly. Fixed NAS encoding to PE_16BIT|PE_SIGNED. Files: interface/w32* In Windows GUI interface, added dialog to setup some option parameters. Files: configure.in Based on autoconf-2.13 and automake-1.4. --with-x option is `yes' by default. Date: Fri Mar 23 1999 From: Masanao Izumo Files: interface/xaw_i.c interface/xaw_redef.c Implemented re-definition for -lXaw(3d)'s vendorShellWidgetClass if Motif interface was linked. Date: Fri Mar 19 1999 From: Masanao Izumo Files: timidity/playmidi.c Changed calculation parameter of audio reduction for small audio buffer. Files: interface/ncurs_c.c Changed the place of audio queue displaying. Date: 17 Mar 1999 22:26:32 -0000 From: Michael Haardt Files: timidity/nas_a.c Added audio interface for NAS (Network Audio Sound) Date: Wed Mar 17 1999 From: Masanao Izumo Files: timidity/tables.c Changed some parameters or implementations: - Volume table for GS and XG - Modulation wheel rate - midi_time_table[]: changes portamento speed and NRPN vibrato delay. - Time of aq.c:aq_wait_ticks() Date: Sat Mar 13 1999 From: Masanao Izumo Files: timidity/common.c Fixed bug about reading WRD MIDI archive via http. Date: Sat, 13 Mar 1999 15:49:35 +0900 From: Takaya Nogami Files: interface/x_sherry.c timidity/wrd_read.c Fixed bug about Sherry WRD. -- beta 3 Date: Fri Mar 12 1999 From: Masanao Izumo Files: interface/{w32g.h,w32g_btn.bmp,w32g_c.c,w32g_c.h,w32g_icon.ico, w32g_ini.c,w32g_main.c,w32g_main.h,w32g_res.h,w32g_res.rc,w32g_res.res w32g_sleep.bmp,w32g_subbtn.bmp,w32g_utl.c,w32g_utl.h,Makefile.am} timidity/{timidity.c,timpp32g.ini,Makefile.am} configure.in Ported Windows32 GUI from http://www2.off.ne.jp/~dai/timidity/files/izumo/timw32gz1c-src.lzh Files: utils/{support.c,support.h} In Windows, modified sleep() and usleep() implementation. Files: interface/{xaw.h,xaw_c.c,xaw_i.c} In XAW interface, modified about implementation for velocity bar updating. Files: interface/{dumb_c.c,dynamic_c.c,emacs_c.c,gtk_c.c,mac_c.c,motif_c.c ncurs_c.c,slang_c.c,tk_c.c,vt100_c.c,w32g_c.c,xaw_c.c,xskin_c.c} timidity/{controls.h,playmidi.h,timidity.c} Added new member of `flags' to ControlMode structure. Added new control option. -i?l: play loop (some interface ignore this option) -i?r: randomize file list arguments -i?s: sorting file list arguments Thu Mar 11 1999 From: Masanao Izumo Files: timidity/{wrdt.c,wrd_read.c,wrd.h,readmidi.h,playmidi.h} interface/{x_sherry.c,x_sherry.h,wrdt_dumb.c,wrdt_wcon.c, wrdt_mac.c,wrdt_x.c,wrdt_tty.c} Modified Sherry WRD implementation. Files: timidity/sndfont.c Fixed bug of soundfont. Date: Wed Mar 10 1999 From: Masanao Izumo Files: timidity/timidity.c Changed signal handling. Date: Tue, 09 Mar 1999 15:36:44 +0900 From: "KINOSHITA, K." Files: timidity/playmidi.h timidity/readmidi.c Added follows MIDI Events (Not play yet. Reading only) BREATH, FOOT, BALANCE, SOSTENUETO, SOFT PEDAL, TREMOLO EFFECT, CELESTE EFFECT, PHASER EFFECT Date: Tue, 09 Mar 1999 12:25:11 +0900 From: takawata@shidahara1.planet.sci.kobe-u.ac.jp Files: configure.in Pached for OffiX. Date: Tue Mar 9 1999 From: Masanao Izumo Files: interface/x_sherry.c Optimized for Sherry WRD on TrueColor visual. -- beta 2 Date: Mon Mar 8 1999 From: Masanao Izumo Files: interface/x_sherry.c Handled Expose event to redraw the window. Optimized for SHM implementation. Date: Sat Mar 6 1999 From: Masanao Izumo Files: timidity/{timidity.c,output.c,aq.c,effect.c} Added effect.c to implement generic effectors. Move the noise shaping filter to effect.c from output.c. Obsoleted -n option. Use -EFns=? instead of -n?. Files: timidity/wave_a.c Fixed bugs. Date: Tue, 2 Mar 1999 22:08:00 +0900 From: Takaya Nogami Files: interface/x_sherry.c timidity/linux_a.c Fixed bugs. The implementation notes. ================================ * timidity/timpp32g.ini Sample Ini file for Windows32 GUI * common.[ch] Added new function: randomize_string_list() is used to randomize string array. pathcasecmp() is used to compare the path. sort_pathname() is used to sort the path. * ControlMode: Added new member: flags: #define CTLF_LIST_LOOP (1u<<0) /* -i?l */ #define CTLF_LIST_RANDOM (1u<<1) /* -i?r */ #define CTLF_LIST_SORT (1u<<2) /* -i?s */ This flags are used to tell the user preference to interface. Some interfaces (such as XAW) ignore this flags because they have own user preference interface. * WRDTracer Added new member function sherry() to trace Sherry WRD. * output.h, output.c Obsoleted member functions of PlayMode: flush_output() purge_output() current_samples() play_loop() New member function of PlayMode: acntl() - PlayMode.acntl() performs a variety of control functions for PlayMode. Changed member function of PlayMode: OLD: void (*output_data)(int32 *buf, int32 count); NEW: int (* output_data)(char *buf, int32 bytes); Now, output_data takes converted audio buffer and number of bytes of it. output_data() must write all of `buf'. It returns -1 if error occur, otherwise returns zero or positive value. About PlayMode.flag: Changed the macro name PF_NEED_INSTRUMENTS to PF_PCM_STREAM. Added the new flags: PF_MIDI_EVENT - To send MIDI event to PlayMode via acntl(). PF_BUFF_FRAGM_OPT - To enable to set extra_param[0] as buffer fragments. Added new macro FILE_OUTPUT_MODE to open file for writing. FILE_OUTPUT_MODE is defined to UNIX: O_WRONLY|O_CREAT|O_TRUNC, 0644 Windows: O_WRONLY|O_CREAT|O_TRUNC|O_BINARY, 0644 Macintosh:O_WRONLY|O_CREAT|O_TRUNC Added new functions: int32 general_output_convert(int32 *buf, int32 count); Use to convert 32-bit audio wave to output format. int validate_encoding(int enc, int include_enc, int exclude_enc); Use to convert specified encoding to validate encoding. * effect.c: Move some effect routines into effect.c. Reverb effect (partial) Noise shaping filter (move from output.c) L/R delay effect (move from playmidi.c) * do_reverb_flag as opt_reverb_control = 2; * play_midi_file() is more simple than that of v1. Others notes: automake --gnu interface/Makefile takes long time. why? NAS: incorrect trace_playing. TiMidity++-2.13.2/INSTALL.ja0100644004711200001440000004773610020566717014344 0ustar tamukiusers====================================================================== TiMidity++󥹥ȡ륬 б 2004ǯ0301 С2.13.0ʹ ====================================================================== ʸϤǤϡTiMidity++UNIX饤ʴĶ˥󥹥ȡ뤹뤿ˡ ˤĤƤޤ Windows 95/98/Me/NT/2000/XP/2003ǤϡCygwinȤȤǡʸϤ ˽timidity.exeǤޤWindowsĶοͤϡޤCygwin( mingw)ꤷƤ Macintoshϥ桼ɤFreeBSDʤΤǡʸϤ̤ˤ ꤯ϤǤŤMacintosh("Classic")ǤΥ󥹥ȡλϡ ʸϤˤƤޤ ====================================================================== Ūʼ ====================================================================== TiMidity++ϡGNU autotoolsȤäƤޤäơִñʥ ȡˡ: 1. ɤΤǥ쥯ȥˡcdɤơ./configureɤϤ ѥåꤷޤ(κȤϤФ餯֤ޤ)System V θŤСȤäƤϡ/bin/sh configureɤȤʤȤ ʤ⤷ޤ 2. makeɤȥפȥѥ뤬Ϥޤޤ(GNU makeɬפǤ GNU makegmakeɤȤ̾ǥ󥹥ȡ뤵ƤĶǤϡ ˡgmakeɤȥפƤ) 3. makeämake installɤȥפơξTiMidity++ 򥤥󥹥ȡ뤷Ƥ ====================================================================== ܺ٤ ====================================================================== 󥹥ȡδʼ 1. configre¹Ԥ 2. ɬפcommon.makefileMakefiletimidity.hԽ 3. ѥ 4. 󥹥ȡ 5. ե ǤʲޤʲǤϡ%ɤץץȤȤƻȤä ޤΤդƤ ====================================================================== configure ====================================================================== ޤʲΥޥɤ¹ԤƤߤƤ % /bin/sh configure --help configureΥץ󤬤ɽ줿ȻפޤΤ--help --prefix=PREFIXΤ褦¿ΥץϡŵŪ¾ΥץȤˤ ΤƱ̣/ˡǤTiMidity++ȼΥץ⤢ޤ --enable-debug ǥХåե饰ͭˤʤޤ --without-x TiMidity++ϡɸ֤XѤ褦ˤʤäƤޤΤǡXΥ饤 ȥ󥯤ʤϡŪ--without-xꤷʤȤ --enable-audio[=audio_list] ǥϤηꤷޤ--enable-audio=noξϡTiMidity++ ϤMIDI-to-WAVEѴȤʤޤ Υץ˻Ǥͤϡ * default: ưȽ * oss: OSS /dev/dsp * sun: SunOS /dev/audio * hpux: hp-ux /dev/audio * irix: IRIX audio library * mme: OSF/1 MME * sb_dsp: BSD/OS 2.0 /dev/sb_dsp * w32: Windows MMS * darwin: darwin(Mac OS X)CoreAudio frameowrk * alsa: ALSA pcm device * alib: hp-ux network audio (Alib) * nas: NAS * portaudio: PortAudio * jack: JACK * arts: aRts * esd: EsounD * vorbis: ogg vorbis * gogo: mp3Τ(Windows only) Ǥ --enable-interface[=interface_list] --enable-dynamic[=interface_list] Ѥ륤󥿥եꤷޤ--enable-dynamicȤȡ եưŪ󥯥⥸塼Ȥƥѥ뤵ޤ(Х ʥΥʤޤ) Υץ˻Ǥͤϡ * ncurses: ncurses󥿥ե * slang: S-Lang󥿥ե * motif: Motif󥿥ե(LestiffǤưޤ) * tcltk: Tcl/Tk󥿥ե * emacs: Emacsեȥ(M-x timidity) * vt100: vt100󥿥ե * xaw: X Athena Widget󥿥ե * xskin: X skin󥿥ե * gtk: GTK+󥿥ե * w32gui: Windows GUIǤȤƥѥ * winsyn: TiMidity++ Windows󥻥ФȤƥѥ * alsaseq: ALSA󥵥󥿥ե Ǥǡ --enable-interface=INTERFACE1,INTERFACE2,... Ȥ꤬ --enable-INTERFACE1=yes --enable-INTERFACE2=yes ... ȤƱ̣ǡƱͤ --enable-dynamic=INTERFACE1,INTERFACE2,... Ȥ꤬ --enable-INTERFACE1=dynamic --enable-INTERFACE2=dynamic ... ȤƱ̣ȤȤդƤ --enable-network ͥåȥݡȤͭˤޤTiMidity++URLϤȡͥåȥ ۤMIDIեդ뤳Ȥǽˤʤޤ --enable-spectrogram PCMΥڥȥ򡤥ꥢ륿ɽǤ褦ˤ ץǤ --enable-wrd WRDбͭˤޤ * configureȴĶѿ MIDIեˤäƤϡ󥰤ˤȤäƤCPUѥɬפʾ礬 ޤŬڤʺŬˡǤСΤ褦MIDIե⥹ࡼ ˱դǤ褦ˤʤ뤫⤷ޤ configureϡʲδĶѿ(ꤵƤ)ǧޤ CC Cѥ顣/usr/bin/gcc CFLAGS ${CC}Ϥե饰-O2 -pipe LDFLAGS 󥫤Ϥե饰-L/usr/gnu/lib CPPFLAGS ץץåϤե饰-traditional-cpp ѥˤϡκŬե饰ȻפޤȤ ultrasparc/gccξ: % env CFLAGS='-O3 -Wall -mv8 -funroll-all-loops -fomit-frame-pointer \ -mcpu=ultrasparc' /bin/sh configure [configure-options]... ʤɤȻꤹ뤳Ȥ(¿ʬ)®ʥХʥ꤬Ȼפޤ ====================================================================== եԽ ====================================================================== Τޤޤξ֤Ǥϥѥ뤬̤ʤȤޤʤȤˤϡ ưcommon.makefileMakefile뤤timidity.hԽȤޤ 礬ޤ * timidity.h˵ܤƤѥ᡼ TiMidity++ˤϡХʥ˥ϡɥɤƤ륪ץ󤬤Ĥ ޤΥѥ᡼ϡtimidity.h#defineǵҤƤޤ ʲεҤǡ֥ޥɥ饤󤫤ѹǤޤפȽ񤤤ƤΤ⤢ ޤΥץϥޥɥ饤ǻꤵʤäΥǥ ͤꤷƤޤˤ虜虜ѹɬ ȻפޤΤǡäƤƤ⤤󤸤ʤǤ礦 -- mput ** CONFIG_FILE ɬפ˱CONFIG_FILEƤǥեȤǤ #define CONFIG_FILE DEFAULT_PATH "/timidity.cfg" ȤʤäƤޤDEFAULT_PATHϡMakefileTIMID_DIRƱǤ ⤷ɤƤ¾ξ֤ʤ #define CONFIG_FILE "/etc/timidity.cfg" Τ褦ޤ ** DECOMPRESSOR_LIST եŸޥɤǤWindowsǤ̵뤷Ƥ ǥեȤǤ #define DECOMPRESSOR_LIST { \ ".gz", "gunzip -c %s", \ ".bz2", "bunzip2 -c %s", \ ".Z", "zcat %s", \ ".zip", "unzip -p %s", \ ".lha", "lha -pq %s", \ ".lzh", "lha -pq %s", \ ".shn", "shorten -x %s -", \ 0 } ȤʤäƤޤꥸʥTiMidityǤϡ嵭ǻꤷĥҤб ޥɤѤơեŸɤ߹ळȤǤޤ TiMidity++ǤϴĤηˤĤƤϡTiMidityŸƥե ɤ߹ߤޤ٤ƤηϥݡȤƤʤΤǡݡ Ƥʤˤϡ嵭ǻꤷޥɤѤޤ ** PATCH_CONVERTERS ѥåեѴޥɤ˴ؤǤWindowsǤ̵ ƤǥեȤǤ #define PATCH_CONVERTERS { \ ".wav", "wav2pat %s", \ 0 } ȤʤäƤޤ ** PATCH_EXT_LIST GUS/patchեγĥҤλǤ˻ꤷĥҤ*.cfgΥ ̾ǾάǤޤǥեȤǤ #define PATCH_EXT_LIST { \ ".pat", \ ".shn", ".pat.shn", \ ".gz", ".pat.gz", \ ".bz2", ".pat.bz2", \ 0 } ȤʤäƤޤ ** DEFAULT_PROGRAM ǥեȤinstrumentǤ #define DEFAULT_PROGRAM 0 ȤʤäƤޤMIDIProgram Change٥Ȥʤˡͤ ޤ̾0֤ϥԥΤǤ Υץϥޥɥ饤󤫤ǤΤǡΤޤޤǤ褤Ǥ ** DEFAULT_DRUMCHANNELS ɥͥǤǥեȤǤ #define DEFAULT_DRUMCHANNELS {10, -1} ȤʤäƤޤϡޥɥ饤󥪥ץѹǤΤǡ ޤޤɤȻפޤѹϡɥͥΥꥹȤʣ ꤷ-1ǽλޤ⤷1016ͥǥեȤǥɥ ͥˤʤС #define DEFAULT_DRUMCHANNELS {10, 16, -1} Ȥޤ ** FLOAT_T ưηλǤ typedef double FLOAT_T; typedef float FLOAT_T; Τɤ餫Ǥdouble٤FPUܤƤޥǤϡ floatdouble®ǤsparcSGI/IPʤɤϡdouble® ǶFPUϡƤξdouble٤®Ǥ ΥޥѥǤϡfloat®ˤʤ뤫Τޤ ** (MAX|MIN)_OUTPUT_RATE ץ졼Ȥβ¡¤ǤǥեȤǤ #define MIN_OUTPUT_RATE 4000 #define MAX_OUTPUT_RATE 65000 ȤʤäƤޤäѹɬפϤʤǤ礦 ** DEFAULT_AMPLIFICATION ޥܥ塼ΥǥեͤǤǥեȤǤ #define DEFAULT_AMPLIFICATION 70 ȤʤäƤޤͤϥѡͤǻꤷޤǥեȤ70%Ϥ ɤͤʤΤǡäѹʤƤɤǤ礦ޥɥ饤 ץѹ뤳ȤǤޤ ** DEFAULT_RATE ǥեȤκץ졼ȤǤǥեȤǤ #define DEFAULT_RATE 44100 ȤʤäƤޤͤϡѥ饪ץ-DDEFAULT_RATE=Τ ˻ꤷƤɤǤѥΤޥǡDATʼ¤ߤGUS/patch ȤäƲŬʲʹ #define DEFAULT_RATE 48000 ȤΤɤǤ ** DEFAULT_VOICES Ʊȯ˴ؤǤǥեȤǤ #define DEFAULT_VOICES 256 ȤʤäƤޤDEFAULT_VOICESϵưƱȯǡͤ-pץ Ѥ1꤬ޤǤοꤹ뤳ȤǤޤ-in 󥿥եǤϡ¹ԻѲ뤳ȤǤޤѥΤޥ ʤ顤ǥեȤƱȯ䤷 #define DEFAULT_VOICES 512 Τ褦ˤΤɤǤʤ顤и128ŲСMIDI ե뤬Ŭʹޤޤ256ŲۤMIDIեϤۤȤ¸ ߤʤ(˴ˤޤ)256ŲʾˤϤʤǽCPU (㤨R10000Ȥ)ǤäƤ٤⤤ǤΤᡤDEFAULT_VOICES ü䤷Ƥ⤢ޤ̣ʤΤǡ256餤¤ˤΤǤ ** AUDIO_BUFFER_BITS Хåե礭ǤǥեȤǤ #define AUDIO_BUFFER_BITS 12 ȤʤäƤޤäѹ뤳ȤϤʤǤ礦 ** CONTROLS_PER_SECOND TiMidityǤϡ٥פβ̷׻1ץ뤴Ȥ˷׻ΤǤϤʤ ٤ޤȤƷ׻ޤͤ礭Фۤɺ٤׻ ᡤμϤ褯ʤޤդCPU٤⤯ʤޤǥեȤǤ #define CONTROLS_PER_SECOND 1000 ȤʤäƤޤޥɥ饤󥪥ץѹǤΤǡΤޤޤ Ȥޤ礦 ** DEFAULT_RESAMPLATION ꥵץˤ䴰ǤǥեȤǤϡ #define DEFAULT_RESAMPLATION resample_gauss ȤʤäƤޤȡꥵץ˥䴰Ԥ 夷ޤȿ̡CPU٤夬ޤϤʥޥǤʤ¤ Ƥޤ礦䴰르ꥺȤơΤΤѲǽǤ( ηڤ) #define DEFAULT_RESAMPLATION resample_none #define DEFAULT_RESAMPLATION resample_linear #define DEFAULT_RESAMPLATION resample_lagrange #define DEFAULT_RESAMPLATION resample_cspline #define DEFAULT_RESAMPLATION resample_gauss #define DEFAULT_RESAMPLATION resample_newton 䴰르ꥺϡޥɥ饤󥪥ץѹǤޤ桼 äѹǤʤˤ #define FIXED_RESAMPLATION ΥȥȤ򳰤Ƥ ** USE_DSP_EFFECT DSPեȤ˴ؤǤǥեȤǤ #define USE_DSP_EFFECT ȤʤäƤޤ饹ǥ쥤EQӥ󥵡󥨥եȤ ǽ夵ΤǡäѹɬפϤʤǤ礦 ** LOOKUP_HACK ǥեȤǤ /* #define LOOKUP_HACK */ /* #define LOOKUP_INTERPOLATION */ ̤ˤʤäƤޤΥޥȡ¿®ưޤ 16ӥåȤΥץ8ӥåȤǷ׻ΤDzޤ ʥޥDZսɤդʤʤƤߤޤ礦 ** SMOOTH_MIXING ߥ󥰤ʳǡ޷ʲѲȡݥåԥ󥰡Υȯ 뤳ȤޤꤷƤȥݥåԥ󥰡Υηڸ˸ ޤǥեȤ #define SMOOTH_MIXING ͭǤȥȤȼ㴳®ˤʤޤ ** FAST_DECAY ٥פѲ®٤ꤷޤǥեȤǤ /* #define FAST_DECAY */ ̤ˤʤäƤޤȥ٥ץơ2® 褦ˤʤޤ̤Ȥơ®ˤĤʤΤǤȿ̡ ĹûʤꡤϤ˷礱Ƥޤϥޥɥ饤󤫤on/ offǤΤǡ̤ΤޤޤɤǤ礦 ** FRACTION_BITS TiMidityǤϡβѴưѤˡ32ӥåȸ꾮 ѤƷ׻ƤޤǥեȤǤ #define FRACTION_BITS 12 ȤʤäƤꡤϤΤޤޤɤǤ礦 ** ADJUST_SAMPLE_VOLUMES ưGUS/patchĴǤǥեȤǤ #define ADJUST_SAMPLE_VOLUMES ƤޤƤȡGUS/patchβ̤ưŪĴ Ʊ礭ˤޤ⤷GUS/patchϾޤޤˡ GUS/patch礭ޤޤˤʤ̤ˤƤΤ˥ 塼˥󥰤ƤGUS/patchåȤΤߤѤʤ̤ǤɤǤ ¾͡GUS/patchѤˡ̤·ˤʤäƤޤ ΤǡΥޥƤɤǤ礦 ** DENGEROUS_RENICE UNIXϥƥevil⡼ɤͭˤǤǥեȤǤ /* #define DANGEROUS_RENICE -15 */ ̤ˤʤäƤޤsetuid rootTiMidityǡץΥץ饤 夲Ƽ¹ԤϡΥޥƤUNIXΤߤͭ ǤΥޥTiMidity򥤥󥹥ȡ뤷ϡ # chown root /usr/local/bin/timidity # chmod u+s /usr/local/bin/timidity Τ褦ˤޤ աDANGEROUS_RENICEƤʤϡsetuidץˤʤ Ǥ ** MAX_DIE_TIME ΥѡȤβABȰܤȤAβֻ˾äƤޤȥ ΥФƤޤޤΥѥ᡼ǡֻ˾ä٤˥å ΥФʤ褦˥ȥ뤷ޤǥեȤǤ #define MAX_DIE_TIME 20 ȤʤäƤޤޤ꾮ʿˤȡåΤˤʤޤ ͤϤΤޤޤɤǤ礦 ** LOOKUP_SINE ؿơ֥뻲Ȥ˴ؤǤǥեȤǤ #define LOOKUP_SINE ȤʤäƤޤĤδĶ(ä˿ͱ黻ץåʤPCʤ) ϡؿͤơ֥뻲Ȥٷ׻꤫ʤ® ʤޤ PCϡCPUα黻®٤ɤɤ®ʤǡᥤΥ ֤Ϥƹ®Ƥޤ(̤)ơ֥ ԰٤ᥤؤΥΤǡǤʤΥ åߥҥåȡҤƤϥѥץ饤󥹥ȡ뤬ȯޤߤʳ Ǥȡơ֥뻲Ȥ򤹤ΤȤʤΤǤϡۤȤ®Ūʺ ޤ(ʤȤδĶǤ -- mput)ǯˤϡ׻ ®ˤʤͽۤޤ ** PRECALC_LOOPS ꥵץ󥰺Ŭ˴ؤǤǥեȤǤ #define PRECALC_LOOPS ȤʤäƤޤκŬϴĶˤäƸʤäꤷ ΤǡˤäƤ̤ˤ®⤷ޤ ** USE_LDEXP ldexp()ȤɤǤǥեȤǤ /* #define USE_LDEXP */ ̤ˤʤäƤޤưγݤldexp()Ѥ® ޥξƤɤäˤ纹ʤȤϻפޤ ** DEFAULT_CACHE_DATA_SIZE å礭ǤǥեȤǤ #define DEFAULT_CACHE_DATA_SIZE (2*1024*1024) 2MˤʤäƤޤTiMidity++ǤϡMIDI٥Ȥ˥󤷤ơ β򤢤餫ꥵץ󥰤ޤΥꥵץ󥰤ΥХåե 礭ꤷƤ礭ۤɹ®ˤʤޤʬ ϲ񤷤ޤ2Mʾ䤷Ƥ⡤ޤ긲˹®ʤޤ ɥ饤󥪥ץ󤫤ѹǤΤǡϥǥեȤΤޤޤɤ Ǥ礦 * ͥåȥϢ귲 TiMidity++ǤϡURLѤƥͥåȥ𤷤ƥե˥뤳 ȤǽˤʤäƤޤ(configure --enable-network ꤷ) ʲΥޥꤷƤ ** MAIL_DOMAIN ᡼륢ɥ쥹Υɥᥤ̾ꤷƤ㤨С᡼륢ɥ쥹 iz@onicos.co.jpȤȡ #define MAIL_DOMAIN "@onicos.co.jp" ȵҤޤ ** MAIL_NAME UNIXǤ̤ˤƤWindowsǤϥ᡼̾Ƥ С᡼륢ɥ쥹iz@onicos.co.jpȤȡ #define MAIL_NAME "iz" ȵҤޤ ** TMPDIR ե־ꤷޤǥեȤǤ /* #define TMPDIR "/var/tmp" */ ̤ˤʤäƤޤUNIXǤϡΥޥ̤ˤƤTMPDIR ĶѿƤǥ쥯ȥ˰եޤTMPDIR ޥTMPDIRĶѿɤȤ̤ξϡ/tmp˰ե뤬 ޤWindowsǤϡTMPDIRĶѿ̵뤵ޤΤǡTMPDIRޥ Ƥ ** GS_DRUMPART GSΥɥѡȤǧ˴ؤǤ #define GS_DRUMPART СGSΥ롼å֥åɥѡȤǧ ޤ /* #define GS_DRUMPART */ ̤ˤФεǽ̵ˤʤޤ * ܸϢ ܸΤΥץ󤬤Ĥޤ ** JAPANESE ܸĶǤ #define JAPANESE ƤܸĶǤʤϡ /* #define JAPANESE */ ȥȥȤƤ ** OUTPUT_TEXT_CODE ϥɤꤷޤʲʸͭǤ AUTO LANGĶѿ鼫ưŪ˷ ASCII ʸԥꥪɤѴ NOCNV ̵Ѵ⡼ 1251 windows-1251koi8-rѴ EUC eucJPǽ JIS JISǽ SJIS shift-JISǽ UNIXܸĶǤϡ嵭٤ͭǤWindowsܸĶǤϡ "ASCII""NOCNV""SJIS" Τɤ줫ꤷƤܸĶǤʤ ϡ"ASCII""NOCNV"Τɤ餫ꤷƤ ϥޥɥ饤󤫤ǽǤ ** MODULATION_WHEEL_ALLOW ** PORTAMENTO_ALLOW ** NRPN_VIBRATO_ALLOW ** REVERB_CONTROL_ALLOW ** FREEVERB_CONTROL_ALLOW ** CHORUS_CONTROL_ALLOW ** SURROUND_CHORUS_ALLOW ** GM_CHANNEL_PRESSURE_ALLOW ** VOICE_CHAMBERLIN_LPF_ALLOW ** VOICE_MOOG_LPF_ALLOW ** MODULATION_ENVELOPE_ALLOW ** ALWAYS_TRACE_TEXT_META_EVENT ** OVERLAP_VOICE_ALLOW ** TEMPER_CONTROL_ALLOW MIDI˴ؤǤǥեȤ #define MODULATION_WHEEL_ALLOW #define PORTAMENTO_ALLOW #define NRPN_VIBRATO_ALLOW /* #define REVERB_CONTROL_ALLOW */ #define FREEVERB_CONTROL_ALLOW #define CHORUS_CONTROL_ALLOW /* #define SURROUND_CHORUS_ALLOW */ /* #define GM_CHANNEL_PRESSURE_ALLOW */ #define VOICE_CHAMBERLIN_LPF_ALLOW /* #define VOICE_MOOG_LPF_ALLOW */ /* #define MODULATION_ENVELOPE_ALLOW */ /* #define ALWAYS_TRACE_TEXT_META_EVENT */ #define OVERLAP_VOICE_ALLOW #define TEMPER_CONTROL_ALLOW ȤʤäƤޤϡޥɥ饤󥪥ץѹ뤳ȤǤ ޤΤǡΤޤޤɤȻפޤ ====================================================================== make ====================================================================== ѥñˡmakeɤȥפǤGNU makemakeɰʳ ̾ƳƤĶǤϡȤäƤ ====================================================================== 󥹥ȡ ====================================================================== make installɤǥ󥹥ȡ뤵ޤޤʲΥåȤ ޤ install.bin ¹ԥե󥹥ȡ install.tk Tcl/Tk󥿥ե󥹥ȡ install.el Emacs󥿥ե󥹥ȡ install.man manڡ󥹥ȡ install 󥹥ȡ 󥹥ȡκݤˤ-nץϤơ뤫ǧƤ Ȼפޤ % make -n install ====================================================================== ǡõ ====================================================================== TiMidity++ϡñΤǤϲĤ餹ȤǤޤɬǡɬ ˤʤޤǡȤƤϡGUS/patchSoundFont(ξ)Ȥޤ ʤΤǡޤΥեꤷơե˻ꤹɬפ ޤTiMidity++եϡǥեȤǤ /usr/local/share/timidity/timidity.cfg (WindowsǤC:\WINDOWS\TIMIDITY.CFG)ˤޤ եϡ󥿡ͥåȾˤ¸ߤƤޤϰʲ URL餿ɤ뤳ȤǤǤ礦 * http://www.onicos.com/staff/iz/timidity/link.html#gus * http://www.onicos.com/staff/iz/timidity/dist/cfg/ (Some sample *.cfg's) * http://www.i.h.kyoto-u.ac.jp/~shom/timidity/ (10M and 4M patches) * ftp://ftp.cdrom.com/pub/gus/sound/patches/files/ (GUS site) TiMidity++-2.13.2/README.ja0100644004711200001440000000731610020566717014161 0ustar tamukiusers====================================================================== TiMidity++ -- MIDI-to-WAVEѴӥץ졼䡼 б 2004ǯ0301 С2.13.0ʹ ====================================================================== ====================================================================== ϲ? ====================================================================== TiMidity++ϡMIDIWAVEѴʤդ뤿Υեȥ ǤΥեȥϡ餫ǥǡȤѰ 줿եMIDIեϤȡꥢ륿˹ ʤ뤳ȤǤޤޤǤʤRIFFե ޥåȤʤɤPCMǡȤơϡɥǥ¸뤳ȤǽǤ TiMidity++ϡGNU̸ͭѵ˽ۤƤ롤ե꡼եȥ Ǥ TiMidity++ϡTuukka ToivonenκäTiMidity 0.2i١ˤƤ ޤTiMidity 0.2i1995ǯ˥꡼졤ʹTiMidityγȯϹԤ Ƥޤ(ϻŻ˻ȤͳǡȯߤޤäƤޤޤ) θ塤ȯϽб˰Ѥ졤ץ̾TiMidity++ ޤꥸʥȤΥСȶ̤뤿++ɤȤ å̾κǸդƤޤ ====================================================================== ħ ====================================================================== * ΥϡɥڻȤ鷺MIDIեդ뤳ȤǤޤ * ޤޤʷΥեɤ߹ޤ + SMF (Format 0, 1, 2) + MODե + RCP, R36, G18, G36 (쥳ݡ) + MFi (Version 3; i⡼ɤ) * б񤭽ФեޥåȤ + RIFF WAVE (*.wav) + SUN AU (*.au) + Apple Interchange File Format (*.aiff) + Ogg Vorbis (*.ogg) + MPEG-1 Audio layer 3 (*.mp3) (: WindowsǤΤߤб) * եȤưʲηȤޤ + Gravis Ultrasoundߴѥåե + SoundFont + AIFFWAVǡ(AIFFWAVϲȤƻȤˤ¿¤ޤ) * ˳ڶʤξɽ뤳ȤǤޤ * ˥ڥȥɽ뤳ȤǤޤ * դȥ졼ɽǤޤ * ¿̤ʥ󥿥եޤ + dumbü󥿥ե + ncurses󥿥ե + S-Lang󥿥ե + X Athena Widget󥿥ե + Tcl/Tk󥿥ե + Motif󥿥ե(LesstifǤưޤ) + vt100󥿥ե + Emacsեȥ(emacsen``M-x timidity''ǵư) + skin󥿥ե: WinAmp Υ󤬻Ȥޤ(Ϥä) + GTK+ 󥿥ե + ALSA󥵥󥿥ե + Windows󥻥󥿥ե + Windows GUI󥿥ե + Windows GUI󥻥󥿥ե + PortMIDI󥻥󥿥ե * URIꤹ뤳ȤǡͥåȥMIDIեľܱդ뤳Ȥ ǤޤбƤ륹 + HTTP + FTP + NetNews * ֤ƤMIDIեऻľܱդǤޤʲΥ ַбƤޤ + tar (*.tar) + gzip̺Ѥtar (*.tar.gz, *.tgz) + Zip̥ե (*.zip) + LHḁե lh0lh1lh2lh3lh4lh5lh6lz4lzslz5 (*.lzh) ====================================================================== ˡ ====================================================================== TiMidity++ϡʲΥȤǤǤ礦 http://www.timidity.jp ץ饤ޥꥵ http://timidity.sourceforge.net ȯϤǹԤƤޤɤǤޤ http://www.asahi-net.or.jp/~gb7t-ngm/timidity/ Macintosh Ǥޤ http://timidity.s11.xrea.com/ Windows Ǥޤ ====================================================================== 󥹥ȡˡ ====================================================================== °INSTALL.jaɤǤ TiMidity++-2.13.2/autoconf/0040755004711200001440000000000010031564160014512 5ustar tamukiusersTiMidity++-2.13.2/autoconf/Makefile.am0100644004711200001440000000176610056312417016560 0ustar tamukiusers# TiMidity++ -- MIDI to WAVE converter and player # Copyright (C) 1999-2003 Masanao Izumo # Copyright (C) 1995 Tuukka Toivonen # # 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 # USA EXTRA_DIST = \ alsa.m4 \ ao.m4 \ arts.m4 \ esd.m4 \ gtk.m4 \ gtk-2.0.m4 \ libFLAC.m4 \ libOggFLAC.m4 \ ogg.m4 \ utils.m4 \ vorbis.m4TiMidity++-2.13.2/autoconf/Makefile.in0100644004711200001440000002733710124332432016566 0ustar tamukiusers# Makefile.in generated by automake 1.7.6 from Makefile.am. # @configure_input@ # Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 # 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@ # TiMidity++ -- MIDI to WAVE converter and player # Copyright (C) 1999-2003 Masanao Izumo # Copyright (C) 1995 Tuukka Toivonen # # 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 # USA srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = .. am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ 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 = : host_triplet = @host@ ACLOCAL = @ACLOCAL@ ALSA_CFLAGS = @ALSA_CFLAGS@ ALSA_LIBS = @ALSA_LIBS@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AO_CFLAGS = @AO_CFLAGS@ AO_LIBS = @AO_LIBS@ ARTS_CFLAGS = @ARTS_CFLAGS@ ARTS_CONFIG = @ARTS_CONFIG@ ARTS_LIBS = @ARTS_LIBS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ A_so_libs = @A_so_libs@ BORLANDC_FALSE = @BORLANDC_FALSE@ BORLANDC_LDFLAGS = @BORLANDC_LDFLAGS@ BORLANDC_START = @BORLANDC_START@ BORLANDC_TRUE = @BORLANDC_TRUE@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGNUS_FALSE = @CYGNUS_FALSE@ CYGNUS_TRUE = @CYGNUS_TRUE@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ELFILES = @ELFILES@ EMACS = @EMACS@ ENABLE_ALSASEQ_FALSE = @ENABLE_ALSASEQ_FALSE@ ENABLE_ALSASEQ_TRUE = @ENABLE_ALSASEQ_TRUE@ ENABLE_DYNAMIC_TCLTK_FALSE = @ENABLE_DYNAMIC_TCLTK_FALSE@ ENABLE_DYNAMIC_TCLTK_TRUE = @ENABLE_DYNAMIC_TCLTK_TRUE@ ENABLE_DYNAMIC_XAW_FALSE = @ENABLE_DYNAMIC_XAW_FALSE@ ENABLE_DYNAMIC_XAW_TRUE = @ENABLE_DYNAMIC_XAW_TRUE@ ENABLE_EMACS_FALSE = @ENABLE_EMACS_FALSE@ ENABLE_EMACS_TRUE = @ENABLE_EMACS_TRUE@ ENABLE_GTK_FALSE = @ENABLE_GTK_FALSE@ ENABLE_GTK_TRUE = @ENABLE_GTK_TRUE@ ENABLE_MOTIF_FALSE = @ENABLE_MOTIF_FALSE@ ENABLE_MOTIF_TRUE = @ENABLE_MOTIF_TRUE@ ENABLE_NCURSES_FALSE = @ENABLE_NCURSES_FALSE@ ENABLE_NCURSES_TRUE = @ENABLE_NCURSES_TRUE@ ENABLE_NETWORK_FALSE = @ENABLE_NETWORK_FALSE@ ENABLE_NETWORK_TRUE = @ENABLE_NETWORK_TRUE@ ENABLE_PLUGIN_FALSE = @ENABLE_PLUGIN_FALSE@ ENABLE_PLUGIN_TRUE = @ENABLE_PLUGIN_TRUE@ ENABLE_PORTMIDISYN_FALSE = @ENABLE_PORTMIDISYN_FALSE@ ENABLE_PORTMIDISYN_TRUE = @ENABLE_PORTMIDISYN_TRUE@ ENABLE_SERVER_FALSE = @ENABLE_SERVER_FALSE@ ENABLE_SERVER_TRUE = @ENABLE_SERVER_TRUE@ ENABLE_SLANG_FALSE = @ENABLE_SLANG_FALSE@ ENABLE_SLANG_TRUE = @ENABLE_SLANG_TRUE@ ENABLE_SOUND_SPEC_FALSE = @ENABLE_SOUND_SPEC_FALSE@ ENABLE_SOUND_SPEC_TRUE = @ENABLE_SOUND_SPEC_TRUE@ ENABLE_TCLTK_FALSE = @ENABLE_TCLTK_FALSE@ ENABLE_TCLTK_TRUE = @ENABLE_TCLTK_TRUE@ ENABLE_VT100_FALSE = @ENABLE_VT100_FALSE@ ENABLE_VT100_TRUE = @ENABLE_VT100_TRUE@ ENABLE_W32GUI_FALSE = @ENABLE_W32GUI_FALSE@ ENABLE_W32GUI_TRUE = @ENABLE_W32GUI_TRUE@ ENABLE_W32G_SYN_FALSE = @ENABLE_W32G_SYN_FALSE@ ENABLE_W32G_SYN_TRUE = @ENABLE_W32G_SYN_TRUE@ ENABLE_WINSYN_FALSE = @ENABLE_WINSYN_FALSE@ ENABLE_WINSYN_TRUE = @ENABLE_WINSYN_TRUE@ ENABLE_WRD_FALSE = @ENABLE_WRD_FALSE@ ENABLE_WRD_TRUE = @ENABLE_WRD_TRUE@ ENABLE_XAW_FALSE = @ENABLE_XAW_FALSE@ ENABLE_XAW_TRUE = @ENABLE_XAW_TRUE@ ENABLE_XSKIN_FALSE = @ENABLE_XSKIN_FALSE@ ENABLE_XSKIN_TRUE = @ENABLE_XSKIN_TRUE@ ESD_CFLAGS = @ESD_CFLAGS@ ESD_CONFIG = @ESD_CONFIG@ ESD_LIBS = @ESD_LIBS@ EXEEXT = @EXEEXT@ EXTRALIBS = @EXTRALIBS@ GTK_CFLAGS = @GTK_CFLAGS@ GTK_CONFIG = @GTK_CONFIG@ GTK_LIBS = @GTK_LIBS@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INTERFACE_SRCS = @INTERFACE_SRCS@ LDFLAGS = @LDFLAGS@ LIBFLAC_CFLAGS = @LIBFLAC_CFLAGS@ LIBFLAC_LIBS = @LIBFLAC_LIBS@ LIBOBJS = @LIBOBJS@ LIBOGGFLAC_CFLAGS = @LIBOGGFLAC_CFLAGS@ LIBOGGFLAC_LIBS = @LIBOGGFLAC_LIBS@ LIBS = @LIBS@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ MAKEINFO = @MAKEINFO@ MSYS_FALSE = @MSYS_FALSE@ MSYS_TRUE = @MSYS_TRUE@ NEEDDLOPEN_FALSE = @NEEDDLOPEN_FALSE@ NEEDDLOPEN_TRUE = @NEEDDLOPEN_TRUE@ NEEDGETOPT_FALSE = @NEEDGETOPT_FALSE@ NEEDGETOPT_TRUE = @NEEDGETOPT_TRUE@ NETSRCS = @NETSRCS@ OBJEXT = @OBJEXT@ OGG_CFLAGS = @OGG_CFLAGS@ OGG_LIBS = @OGG_LIBS@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PKG_CONFIG = @PKG_CONFIG@ P_so_libs = @P_so_libs@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ SHCFLAGS = @SHCFLAGS@ SHELL = @SHELL@ SHLD = @SHLD@ STRIP = @STRIP@ SYSEXTRAS = @SYSEXTRAS@ T_so_libs = @T_so_libs@ VCPP_FALSE = @VCPP_FALSE@ VCPP_LDFLAGS = @VCPP_LDFLAGS@ VCPP_TRUE = @VCPP_TRUE@ VERSION = @VERSION@ VORBISENC_LIBS = @VORBISENC_LIBS@ VORBISFILE_LIBS = @VORBISFILE_LIBS@ VORBIS_CFLAGS = @VORBIS_CFLAGS@ VORBIS_LIBS = @VORBIS_LIBS@ W32READDIR_FALSE = @W32READDIR_FALSE@ W32READDIR_TRUE = @W32READDIR_TRUE@ WATCOM_C_FALSE = @WATCOM_C_FALSE@ WATCOM_C_TRUE = @WATCOM_C_TRUE@ WATCOM_LDFLAGS = @WATCOM_LDFLAGS@ WISH = @WISH@ W_so_libs = @W_so_libs@ X_CFLAGS = @X_CFLAGS@ X_EXTRA_LIBS = @X_EXTRA_LIBS@ X_LIBS = @X_LIBS@ X_PRE_LIBS = @X_PRE_LIBS@ a_so_libs = @a_so_libs@ ac_ct_CC = @ac_ct_CC@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ datadir = @datadir@ dynamic_targets = @dynamic_targets@ e_so_libs = @e_so_libs@ exec_prefix = @exec_prefix@ g_so_libs = @g_so_libs@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ i_so_libs = @i_so_libs@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ k_so_libs = @k_so_libs@ libdir = @libdir@ libexecdir = @libexecdir@ lispdir = @lispdir@ localstatedir = @localstatedir@ m_so_libs = @m_so_libs@ mandir = @mandir@ n_so_libs = @n_so_libs@ oldincludedir = @oldincludedir@ p_so_libs = @p_so_libs@ prefix = @prefix@ program_transform_name = @program_transform_name@ r_so_libs = @r_so_libs@ s_so_libs = @s_so_libs@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ so = @so@ sysconfdir = @sysconfdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ tcltk_dep = @tcltk_dep@ timidity_LDFLAGS = @timidity_LDFLAGS@ w_so_libs = @w_so_libs@ EXTRA_DIST = \ alsa.m4 \ ao.m4 \ arts.m4 \ esd.m4 \ gtk.m4 \ gtk-2.0.m4 \ libFLAC.m4 \ libOggFLAC.m4 \ ogg.m4 \ utils.m4 \ vorbis.m4 subdir = autoconf ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 mkinstalldirs = $(SHELL) $(top_srcdir)/autoconf/mkinstalldirs CONFIG_HEADER = $(top_builddir)/config.h $(top_builddir)/interface.h CONFIG_CLEAN_FILES = DIST_SOURCES = DIST_COMMON = Makefile.am Makefile.in config.guess config.sub depcomp \ install-sh missing mkinstalldirs all: all-am .SUFFIXES: $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) cd $(top_srcdir) && \ $(AUTOMAKE) --gnu autoconf/Makefile Makefile: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.in $(top_builddir)/config.status cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) uninstall-info-am: tags: TAGS TAGS: ctags: CTAGS CTAGS: DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) top_distdir = .. distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ list='$(DISTFILES)'; for file in $$list; do \ case $$file in \ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ esac; \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ $(mkinstalldirs) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ if test -d $$d/$$file; then \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ cp -pR $$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: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -rm -f Makefile $(CONFIG_CLEAN_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 distclean-am: clean-am distclean-generic dvi: dvi-am dvi-am: info: info-am info-am: install-data-am: install-exec-am: install-info: install-info-am install-man: installcheck-am: maintainer-clean: maintainer-clean-am 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-info-am .PHONY: all all-am check check-am clean clean-generic distclean \ distclean-generic distdir dvi dvi-am info info-am install \ install-am install-data install-data-am install-exec \ install-exec-am install-info install-info-am install-man \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-generic pdf pdf-am ps ps-am uninstall uninstall-am \ uninstall-info-am # 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: TiMidity++-2.13.2/autoconf/config.guess0100755004711200001440000012104707666607521017057 0ustar tamukiusers#! /bin/sh # Attempt to guess a canonical system name. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003 Free Software Foundation, Inc. timestamp='2003-05-22' # 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 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # 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 Per Bothner . # Please send patches to . Submit a context # diff and a properly formatted ChangeLog entry. # # This script attempts to guess a canonical system name similar to # config.sub. If it succeeds, it prints the system name on stdout, and # exits with 0. Otherwise, it exits with 1. # # The plan is that this can be called by configure scripts if you # don't specify an explicit build system type. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] Output the configuration name of the system \`$me' is run on. Operation modes: -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 (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 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 0 ;; --version | -v ) echo "$version" ; exit 0 ;; --help | --h* | -h ) echo "$usage"; exit 0 ;; -- ) # 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 -q "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || { 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 ;' # 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 # 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 tupples: *-*-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=`(/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 ;; *) machine=${UNAME_MACHINE_ARCH}-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently, or will in the future. case "${UNAME_MACHINE_ARCH}" in arm*|i386|m68k|ns32k|sh3*|sparc|vax) eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep __ELF__ >/dev/null 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 # 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/[-_].*/\./'` ;; 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}" exit 0 ;; amiga:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; arc:OpenBSD:*:*) echo mipsel-unknown-openbsd${UNAME_RELEASE} exit 0 ;; hp300:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; mac68k:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; macppc:OpenBSD:*:*) echo powerpc-unknown-openbsd${UNAME_RELEASE} exit 0 ;; mvme68k:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; mvme88k:OpenBSD:*:*) echo m88k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; mvmeppc:OpenBSD:*:*) echo powerpc-unknown-openbsd${UNAME_RELEASE} exit 0 ;; pmax:OpenBSD:*:*) echo mipsel-unknown-openbsd${UNAME_RELEASE} exit 0 ;; sgi:OpenBSD:*:*) echo mipseb-unknown-openbsd${UNAME_RELEASE} exit 0 ;; sun3:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; wgrisc:OpenBSD:*:*) echo mipsel-unknown-openbsd${UNAME_RELEASE} exit 0 ;; *:OpenBSD:*:*) echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE} exit 0 ;; alpha:OSF1:*:*) if test $UNAME_RELEASE = "V4.0"; then UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` fi # 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 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/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` exit 0 ;; Alpha\ *:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # Should we change UNAME_MACHINE based on the output of uname instead # of the specific Alpha model? echo alpha-pc-interix exit 0 ;; 21064:Windows_NT:50:3) echo alpha-dec-winnt3.5 exit 0 ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 exit 0;; *:[Aa]miga[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-amigaos exit 0 ;; *:[Mm]orph[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-morphos exit 0 ;; *:OS/390:*:*) echo i370-ibm-openedition exit 0 ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit 0;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp exit 0;; 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 0 ;; NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 exit 0 ;; DRS?6000:unix:4.0:6*) echo sparc-icl-nx6 exit 0 ;; DRS?6000:UNIX_SV:4.2*:7*) case `/usr/bin/uname -p` in sparc) echo sparc-icl-nx7 && exit 0 ;; esac ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; i86pc:SunOS:5.*:*) echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; 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 0 ;; 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 0 ;; sun3*:SunOS:*:*) echo m68k-sun-sunos${UNAME_RELEASE} exit 0 ;; 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 0 ;; aushp:SunOS:*:*) echo sparc-auspex-sunos${UNAME_RELEASE} exit 0 ;; # 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 0 ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit 0 ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit 0 ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) echo m68k-milan-mint${UNAME_RELEASE} exit 0 ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) echo m68k-hades-mint${UNAME_RELEASE} exit 0 ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint${UNAME_RELEASE} exit 0 ;; powerpc:machten:*:*) echo powerpc-apple-machten${UNAME_RELEASE} exit 0 ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 exit 0 ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix${UNAME_RELEASE} exit 0 ;; VAX*:ULTRIX*:*:*) echo vax-dec-ultrix${UNAME_RELEASE} exit 0 ;; 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix${UNAME_RELEASE} exit 0 ;; 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 \ && $dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ && exit 0 echo mips-mips-riscos${UNAME_RELEASE} exit 0 ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax exit 0 ;; Motorola:*:4.3:PL8-*) echo powerpc-harris-powermax exit 0 ;; Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) echo powerpc-harris-powermax exit 0 ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix exit 0 ;; m88k:CX/UX:7*:*) echo m88k-harris-cxux7 exit 0 ;; m88k:*:4*:R4*) echo m88k-motorola-sysv4 exit 0 ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 exit 0 ;; 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 0 ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 exit 0 ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 exit 0 ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 exit 0 ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd exit 0 ;; *:IRIX*:*:*) echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` exit 0 ;; ????????: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 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) echo i386-ibm-aix exit 0 ;; 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 0 ;; *: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 $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0 echo rs6000-ibm-aix3.2.5 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 0 ;; *:AIX:*:[45]) 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/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${IBM_ARCH}-ibm-aix${IBM_REV} exit 0 ;; *:AIX:*:*) echo rs6000-ibm-aix exit 0 ;; ibmrt:4.4BSD:*|romp-ibm:BSD:*) echo romp-ibm-bsd4.4 exit 0 ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to exit 0 ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx exit 0 ;; DPX/2?00:B.O.S.:*:*) echo m68k-bull-sysv3 exit 0 ;; 9000/[34]??:4.3bsd:1.*:*) echo m68k-hp-bsd exit 0 ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 exit 0 ;; 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 # avoid double evaluation of $set_cc_for_build test -n "$CC_FOR_BUILD" || eval $set_cc_for_build if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E -) | grep __LP64__ >/dev/null then HP_ARCH="hppa2.0w" else HP_ARCH="hppa64" fi fi echo ${HP_ARCH}-hp-hpux${HPUX_REV} exit 0 ;; ia64:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` echo ia64-hp-hpux${HPUX_REV} exit 0 ;; 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 && $dummy && exit 0 echo unknown-hitachi-hiuxwe2 exit 0 ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) echo hppa1.1-hp-bsd exit 0 ;; 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd exit 0 ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix exit 0 ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) echo hppa1.1-hp-osf exit 0 ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf exit 0 ;; i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo ${UNAME_MACHINE}-unknown-osf1mk else echo ${UNAME_MACHINE}-unknown-osf1 fi exit 0 ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites exit 0 ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd exit 0 ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit 0 ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd exit 0 ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd exit 0 ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd exit 0 ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; 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 0 ;; CRAY*TS:*:*:*) echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; CRAY*T3E:*:*:*) echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; CRAY*SV1:*:*:*) echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; *:UNICOS/mp:*:*) echo nv1-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; 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 0 ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} exit 0 ;; sparc*:BSD/OS:*:*) echo sparc-unknown-bsdi${UNAME_RELEASE} exit 0 ;; *:BSD/OS:*:*) echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit 0 ;; *:FreeBSD:*:*|*:GNU/FreeBSD:*:*) # Determine whether the default compiler uses glibc. eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include #if __GLIBC__ >= 2 LIBC=gnu #else LIBC= #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`${LIBC:+-$LIBC} exit 0 ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin exit 0 ;; i*:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit 0 ;; i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 exit 0 ;; x86:Interix*:3*) echo i586-pc-interix3 exit 0 ;; [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) echo i${UNAME_MACHINE}-pc-mks exit 0 ;; i*:Windows_NT*:* | Pentium*:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we # UNAME_MACHINE based on the output of uname instead of i386? echo i586-pc-interix exit 0 ;; i*:UWIN*:*) echo ${UNAME_MACHINE}-pc-uwin exit 0 ;; p*:CYGWIN*:*) echo powerpcle-unknown-cygwin exit 0 ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; *:GNU:*:*) echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit 0 ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit 0 ;; arm*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; cris:Linux:*:*) echo cris-axis-linux-gnu exit 0 ;; ia64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; m68*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; mips:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef mips #undef mipsel #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=mipsel #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=mips #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-gnu" && exit 0 ;; mips64:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef mips64 #undef mips64el #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=mips64el #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=mips64 #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-gnu" && exit 0 ;; ppc:Linux:*:*) echo powerpc-unknown-linux-gnu exit 0 ;; ppc64:Linux:*:*) echo powerpc64-unknown-linux-gnu exit 0 ;; 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 ld.so.1 >/dev/null if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} exit 0 ;; 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-gnu ;; PA8*) echo hppa2.0-unknown-linux-gnu ;; *) echo hppa-unknown-linux-gnu ;; esac exit 0 ;; parisc64:Linux:*:* | hppa64:Linux:*:*) echo hppa64-unknown-linux-gnu exit 0 ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux exit 0 ;; sh*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; sparc:Linux:*:* | sparc64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; x86_64:Linux:*:*) echo x86_64-unknown-linux-gnu exit 0 ;; i*86:Linux:*:*) # The BFD linker knows what the default object file format is, so # first see if it will tell us. cd to the root directory to prevent # problems with other programs or directories called `ld' in the path. # Set LC_ALL=C to ensure ld outputs messages in English. ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \ | sed -ne '/supported targets:/!d s/[ ][ ]*/ /g s/.*supported targets: *// s/ .*// p'` case "$ld_supported_targets" in elf32-i386) TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" ;; a.out-i386-linux) echo "${UNAME_MACHINE}-pc-linux-gnuaout" exit 0 ;; coff-i386) echo "${UNAME_MACHINE}-pc-linux-gnucoff" exit 0 ;; "") # Either a pre-BFD a.out linker (linux-gnuoldld) or # one that does not give us useful --help. echo "${UNAME_MACHINE}-pc-linux-gnuoldld" exit 0 ;; esac # Determine whether the default compiler is a.out or elf eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include #ifdef __ELF__ # ifdef __GLIBC__ # if __GLIBC__ >= 2 LIBC=gnu # else LIBC=gnulibc1 # endif # else LIBC=gnulibc1 # endif #else #ifdef __INTEL_COMPILER LIBC=gnu #else LIBC=gnuaout #endif #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0 test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0 ;; 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 0 ;; 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 0 ;; 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 0 ;; i*86:XTS-300:*:STOP) echo ${UNAME_MACHINE}-unknown-stop exit 0 ;; i*86:atheos:*:*) echo ${UNAME_MACHINE}-unknown-atheos exit 0 ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) echo i386-unknown-lynxos${UNAME_RELEASE} exit 0 ;; i*86:*DOS:*:*) echo ${UNAME_MACHINE}-pc-msdosdjgpp exit 0 ;; i*86:*:4.*:* | i*86:SYSTEM_V: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 0 ;; i*86:*:5:[78]*) 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 0 ;; 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 0 ;; 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 i386. echo i386-pc-msdosdjgpp exit 0 ;; Intel:Mach:3*:*) echo i386-pc-mach3 exit 0 ;; paragon:*:*:*) echo i860-intel-osf1 exit 0 ;; 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 0 ;; mini*:CTIX:SYS*5:*) # "miniframe" echo m68010-convergent-sysv exit 0 ;; mc68k:UNIX:SYSTEM5:3.51m) echo m68k-convergent-sysv exit 0 ;; M680?0:D-NIX:5.3:*) echo m68k-diab-dnix exit 0 ;; M68*:*:R3V[567]*:*) test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;; 3[34]??:*: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) 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 0 /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && echo i486-ncr-sysv4 && exit 0 ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-unknown-lynxos${UNAME_RELEASE} exit 0 ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit 0 ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos${UNAME_RELEASE} exit 0 ;; rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos${UNAME_RELEASE} exit 0 ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) echo powerpc-unknown-lynxos${UNAME_RELEASE} exit 0 ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv${UNAME_RELEASE} exit 0 ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 exit 0 ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 exit 0 ;; *: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 0 ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says echo i586-unisys-sysv4 exit 0 ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm echo hppa1.1-stratus-sysv4 exit 0 ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 exit 0 ;; *:VOS:*:*) # From Paul.Green@stratus.com. echo hppa1.1-stratus-vos exit 0 ;; mc68*:A/UX:*:*) echo m68k-apple-aux${UNAME_RELEASE} exit 0 ;; news*:NEWS-OS:6*:*) echo mips-sony-newsos6 exit 0 ;; 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 0 ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos exit 0 ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. echo powerpc-apple-beos exit 0 ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos exit 0 ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} exit 0 ;; SX-5:SUPER-UX:*:*) echo sx5-nec-superux${UNAME_RELEASE} exit 0 ;; SX-6:SUPER-UX:*:*) echo sx6-nec-superux${UNAME_RELEASE} exit 0 ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} exit 0 ;; *:Rhapsody:*:*) echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} exit 0 ;; *:Darwin:*:*) case `uname -p` in *86) UNAME_PROCESSOR=i686 ;; powerpc) UNAME_PROCESSOR=powerpc ;; esac echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} exit 0 ;; *: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 0 ;; *:QNX:*:4*) echo i386-pc-qnx exit 0 ;; NSR-[DGKLNPTVW]:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk${UNAME_RELEASE} exit 0 ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux exit 0 ;; BS2000:POSIX*:*:*) echo bs2000-siemens-sysv exit 0 ;; DS/*:UNIX_System_V:*:*) echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} exit 0 ;; *: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 0 ;; *:TOPS-10:*:*) echo pdp10-unknown-tops10 exit 0 ;; *:TENEX:*:*) echo pdp10-unknown-tenex exit 0 ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) echo pdp10-dec-tops20 exit 0 ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) echo pdp10-xkl-tops20 exit 0 ;; *:TOPS-20:*:*) echo pdp10-unknown-tops20 exit 0 ;; *:ITS:*:*) echo pdp10-unknown-its exit 0 ;; esac #echo '(No uname command or uname output not recognized.)' 1>&2 #echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 eval $set_cc_for_build cat >$dummy.c < # include #endif main () { #if defined (sony) #if defined (MIPSEB) /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, I don't know.... */ printf ("mips-sony-bsd\n"); exit (0); #else #include printf ("m68k-sony-newsos%s\n", #ifdef NEWSOS4 "4" #else "" #endif ); exit (0); #endif #endif #if defined (__arm) && defined (__acorn) && defined (__unix) printf ("arm-acorn-riscix"); exit (0); #endif #if defined (hp300) && !defined (hpux) printf ("m68k-hp-bsd\n"); exit (0); #endif #if defined (NeXT) #if !defined (__ARCHITECTURE__) #define __ARCHITECTURE__ "m68k" #endif int version; version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; if (version < 4) printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); else printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); exit (0); #endif #if defined (MULTIMAX) || defined (n16) #if defined (UMAXV) printf ("ns32k-encore-sysv\n"); exit (0); #else #if defined (CMU) printf ("ns32k-encore-mach\n"); exit (0); #else printf ("ns32k-encore-bsd\n"); exit (0); #endif #endif #endif #if defined (__386BSD__) printf ("i386-pc-bsd\n"); exit (0); #endif #if defined (sequent) #if defined (i386) printf ("i386-sequent-dynix\n"); exit (0); #endif #if defined (ns32000) printf ("ns32k-sequent-dynix\n"); exit (0); #endif #endif #if defined (_SEQUENT_) struct utsname un; uname(&un); if (strncmp(un.version, "V2", 2) == 0) { printf ("i386-sequent-ptx2\n"); exit (0); } if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ printf ("i386-sequent-ptx1\n"); exit (0); } printf ("i386-sequent-ptx\n"); exit (0); #endif #if defined (vax) # if !defined (ultrix) # include # if defined (BSD) # if BSD == 43 printf ("vax-dec-bsd4.3\n"); exit (0); # else # if BSD == 199006 printf ("vax-dec-bsd4.3reno\n"); exit (0); # else printf ("vax-dec-bsd\n"); exit (0); # endif # endif # else printf ("vax-dec-bsd\n"); exit (0); # endif # else printf ("vax-dec-ultrix\n"); exit (0); # endif #endif #if defined (alliant) && defined (i860) printf ("i860-alliant-bsd\n"); exit (0); #endif exit (1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && $dummy && exit 0 # Apollos put the system type in the environment. test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; } # Convex versions that predate uname can use getsysinfo(1) if [ -x /usr/convex/getsysinfo ] then case `getsysinfo -f cpu_type` in c1*) echo c1-convex-bsd exit 0 ;; c2*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit 0 ;; c34*) echo c34-convex-bsd exit 0 ;; c38*) echo c38-convex-bsd exit 0 ;; c4*) echo c4-convex-bsd exit 0 ;; esac fi cat >&2 < in order to provide the needed information to handle your system. config.guess timestamp = $timestamp 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` /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 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: TiMidity++-2.13.2/autoconf/config.sub0100755004711200001440000007247407666607524016536 0ustar tamukiusers#! /bin/sh # Configuration validation subroutine script. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003 Free Software Foundation, Inc. timestamp='2003-05-09' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software # can handle that machine. It does not imply ALL GNU software can. # # 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 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., 59 Temple Place - Suite 330, # Boston, MA 02111-1307, USA. # 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. # Please send patches to . Submit a context # diff and a properly formatted ChangeLog entry. # # 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. # 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 $0 [OPTION] ALIAS Canonicalize a configuration name. Operation modes: -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 (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 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 0 ;; --version | -v ) echo "$version" ; exit 0 ;; --help | --h* | -h ) echo "$usage"; exit 0 ;; -- ) # 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 0;; * ) 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 # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in nto-qnx* | linux-gnu* | freebsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; *) basic_machine=`echo $1 | sed 's/-[^-]*$//'` if [ $basic_machine != $1 ] then os=`echo $1 | sed 's/.*-/-/'` else os=; fi ;; esac ### Let's recognize common machines as not being operating systems so ### that things like config.sub decstation-3100 work. We also ### recognize some manufacturers as not being operating systems, so we ### can provide default operating systems below. case $os in -sun*os*) # Prevent following clause from handling this invalid input. ;; -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ -apple | -axis) os= basic_machine=$1 ;; -sim | -cisco | -oki | -wec | -winbond) os= basic_machine=$1 ;; -scout) ;; -wrs) os=-vxworks basic_machine=$1 ;; -chorusos*) os=-chorusos basic_machine=$1 ;; -chorusrdb) os=-chorusrdb basic_machine=$1 ;; -hiux*) os=-hiuxwe2 ;; -sco5) os=-sco3.2v5 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco4) os=-sco3.2v4 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2.[4-9]*) os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2v[4-9]*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco*) os=-sco3.2v2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -udk*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -isc) os=-isc2.2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -clix*) basic_machine=clipper-intergraph ;; -isc*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -lynx*) os=-lynxos ;; -ptx*) basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` ;; -windowsnt*) os=`echo $os | sed -e 's/windowsnt/winnt/'` ;; -psos*) os=-psos ;; -mint | -mint[0-9]*) basic_machine=m68k-atari os=-mint ;; esac # Decode aliases for certain CPU-COMPANY combinations. case $basic_machine in # Recognize the basic CPU types without company name. # Some are omitted here because they have special meanings below. 1750a | 580 \ | a29k \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \ | clipper \ | d10v | d30v | dlx | dsp16xx \ | fr30 | frv \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | i370 | i860 | i960 | ia64 \ | ip2k \ | m32r | m68000 | m68k | m88k | mcore \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ | mips64vr | mips64vrel \ | mips64orion | mips64orionel \ | mips64vr4100 | mips64vr4100el \ | mips64vr4300 | mips64vr4300el \ | mips64vr5000 | mips64vr5000el \ | mipsisa32 | mipsisa32el \ | mipsisa32r2 | mipsisa32r2el \ | mipsisa64 | mipsisa64el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ | msp430 \ | ns16k | ns32k \ | openrisc | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ | pyramid \ | sh | sh[1234] | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ | sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv9 | sparcv9b \ | strongarm \ | tahoe | thumb | tic80 | tron \ | v850 | v850e \ | we32k \ | x86 | xscale | xstormy16 | xtensa \ | z8k) basic_machine=$basic_machine-unknown ;; m6811 | m68hc11 | m6812 | m68hc12) # Motorola 68HC11/12. basic_machine=$basic_machine-unknown os=-none ;; m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) ;; # We use `pc' rather than `unknown' # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. i*86 | x86_64) basic_machine=$basic_machine-pc ;; # Object if more than one company name word. *-*-*) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; # Recognize the basic CPU types with company name. 580-* \ | a29k-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* \ | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ | clipper-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | elxsi-* \ | f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | i*86-* | i860-* | i960-* | ia64-* \ | ip2k-* \ | m32r-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ | m88110-* | m88k-* | mcore-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ | mips64vr-* | mips64vrel-* \ | mips64orion-* | mips64orionel-* \ | mips64vr4100-* | mips64vr4100el-* \ | mips64vr4300-* | mips64vr4300el-* \ | mips64vr5000-* | mips64vr5000el-* \ | mipsisa32-* | mipsisa32el-* \ | mipsisa32r2-* | mipsisa32r2el-* \ | mipsisa64-* | mipsisa64el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipstx39-* | mipstx39el-* \ | msp430-* \ | none-* | np1-* | nv1-* | ns16k-* | ns32k-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ | pyramid-* \ | romp-* | rs6000-* \ | sh-* | sh[1234]-* | sh[23]e-* | sh[34]eb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \ | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \ | tahoe-* | thumb-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ | tron-* \ | v850-* | v850e-* | vax-* \ | we32k-* \ | x86-* | x86_64-* | xps100-* | xscale-* | xstormy16-* \ | xtensa-* \ | ymp-* \ | z8k-*) ;; # 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-unknown 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 ;; 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 ;; 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 ;; aux) basic_machine=m68k-apple os=-aux ;; balance) basic_machine=ns32k-sequent os=-dynix ;; c90) basic_machine=c90-cray os=-unicos ;; 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 ;; crds | unos) basic_machine=m68k-crds ;; cris | cris-* | etrax*) basic_machine=cris-axis ;; 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 ;; dpx20 | dpx20-*) basic_machine=rs6000-bull os=-bosx ;; dpx2* | dpx2*-bull) basic_machine=m68k-bull os=-sysv3 ;; 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 ;; hppa-next) os=-nextstep3 ;; hppaosf) basic_machine=hppa1.1-hp os=-osf ;; hppro) basic_machine=hppa1.1-hp os=-proelf ;; i370-ibm* | ibm*) basic_machine=i370-ibm ;; # I'm not sure what "Sysv32" means. Should this be sysv3.2? 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 ;; i386-vsta | 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 ;; m88k-omron*) basic_machine=m88k-omron ;; magnum | m3230) basic_machine=mips-mips os=-sysv ;; merlin) basic_machine=ns32k-utek os=-sysv ;; mingw32) basic_machine=i386-pc os=-mingw32 ;; 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 ;; mmix*) basic_machine=mmix-knuth os=-mmixware ;; monitor) basic_machine=m68k-rom68k os=-coff ;; morphos) basic_machine=powerpc-unknown os=-morphos ;; msdos) basic_machine=i386-pc os=-msdos ;; mvs) basic_machine=i370-ibm os=-mvs ;; 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 ;; nv1) basic_machine=nv1-cray os=-unicosmp ;; nsr-tandem) basic_machine=nsr-tandem ;; op50n-* | op60c-*) basic_machine=hppa1.1-oki os=-proelf ;; or32 | or32-*) basic_machine=or32-unknown os=-coff ;; 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 ;; pbd) basic_machine=sparc-tti ;; pbb) basic_machine=m68k-tti ;; pc532 | pc532-*) basic_machine=ns32k-pc532 ;; pentium | p5 | k5 | k6 | nexgen | viac3) basic_machine=i586-pc ;; pentiumpro | p6 | 6x86 | athlon | athlon_*) basic_machine=i686-pc ;; pentiumii | pentium2) basic_machine=i686-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-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pn) basic_machine=pn-gould ;; power) basic_machine=power-ibm ;; ppc) basic_machine=powerpc-unknown ;; ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppcle | powerpclittle | ppc-le | powerpc-little) 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 | ppc64-le | powerpc64-little) 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 ;; 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 ;; sequent) basic_machine=i386-sequent ;; sh) basic_machine=sh-hitachi os=-hms ;; sparclite-wrs | 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 ;; 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 ;; tic4x | c4x*) basic_machine=tic4x-unknown os=-coff ;; tic54x | c54x*) basic_machine=tic54x-unknown os=-coff ;; tic55x | c55x*) basic_machine=tic55x-unknown os=-coff ;; tic6x | c6x*) basic_machine=tic6x-unknown os=-coff ;; tx39) basic_machine=mipstx39-unknown ;; tx39el) basic_machine=mipstx39el-unknown ;; toad1) basic_machine=pdp10-xkl os=-tops20 ;; tower | tower-32) basic_machine=m68k-ncr ;; 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 ;; xps | xps100) basic_machine=xps100-honeywell ;; ymp) basic_machine=ymp-cray os=-unicos ;; z8k-*-coff) basic_machine=z8k-unknown os=-sim ;; 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 ;; rs6000) basic_machine=rs6000-ibm ;; vax) basic_machine=vax-dec ;; pdp10) # there are many clones, so DEC is not a safe bet basic_machine=pdp10-unknown ;; pdp11) basic_machine=pdp11-dec ;; we32k) basic_machine=we32k-att ;; sh3 | sh4 | sh[34]eb | sh[1234]le | sh[23]ele) basic_machine=sh-unknown ;; sh64) basic_machine=sh64-unknown ;; sparc | sparcv9 | sparcv9b) basic_machine=sparc-sun ;; 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. -solaris1 | -solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; -solaris) os=-solaris2 ;; -svr4*) os=-sysv4 ;; -unixware*) os=-sysv4.2uw ;; -gnu/linux*) os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` ;; # First 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* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -aos* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \ | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* \ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix*) # 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 | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ | -windows* | -osx | -abug | -netware* | -os9* | -beos* \ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) ;; -mac*) os=`echo $os | sed -e 's|mac|macos|'` ;; -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 ;; -wince*) os=-wince ;; -osfrose*) os=-osfrose ;; -osf*) os=-osf ;; -utek*) os=-bsd ;; -dynix*) os=-bsd ;; -acis*) os=-aos ;; -atheos*) os=-atheos ;; -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 ;; -triton*) os=-sysv3 ;; -oss*) os=-sysv3 ;; -svr4) os=-sysv4 ;; -svr3) os=-sysv3 ;; -sysvr4) os=-sysv4 ;; # This must come after -sysvr4. -sysv*) ;; -ose*) os=-ose ;; -es1800*) os=-ose ;; -xenix) os=-xenix ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) os=-mint ;; -aros*) os=-aros ;; -kaos*) os=-kaos ;; -none) ;; *) # 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 *-acorn) os=-riscix1.2 ;; arm*-rebel) os=-linux ;; arm*-semi) os=-aout ;; # 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 # This also exists in the configure program, but was not the # default. # os=-sunos4 ;; m68*-cisco) os=-aout ;; 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 ;; *-be) os=-beos ;; *-ibm) os=-aix ;; *-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 ;; *-next) os=-nextstep3 ;; *-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 ;; -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 ;; -ptx*) vendor=sequent ;; -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 0 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: TiMidity++-2.13.2/autoconf/depcomp0100755004711200001440000003033507511601667016105 0ustar tamukiusers#! /bin/sh # depcomp - compile a program generating dependencies as side-effects # Copyright 1999, 2000 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, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. # 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 . 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 # `libtool' can also be set to `yes' or `no'. if test -z "$depfile"; then base=`echo "$object" | sed -e 's,^.*/,,' -e 's,\.\([^.]*\)$,.P\1,'` dir=`echo "$object" | sed 's,/.*$,/,'` if test "$dir" = "$object"; then dir= fi # FIXME: should be _deps on DOS. depfile="$dir.deps/$base" fi tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} rm -f "$tmpdepfile" # 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 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. "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi mv "$tmpdepfile" "$depfile" ;; gcc) ## 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). ## - 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 -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz ## 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. tr ' ' ' ' < "$tmpdepfile" | ## 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. ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -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 -eq 0; then : else 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 ' ' ' ' < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ tr ' ' ' ' >> $depfile echo >> $depfile # The second pass generates a dummy entry for each header file. tr ' ' ' ' < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ >> $depfile else # The sourcefile does not contain any dependencies, so just # store a dummy comment line, to avoid errors with the Makefile # "include basename.Plo" scheme. echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; aix) # The C for AIX Compiler uses -M and outputs the dependencies # in a .u file. 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. stripped=`echo "$object" | sed -e 's,^.*/,,' -e 's/\(.*\)\..*$/\1/'` tmpdepfile="$stripped.u" outname="$stripped.o" if test "$libtool" = yes; then "$@" -Wc,-M else "$@" -M fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi if test -f "$tmpdepfile"; then # Each line is of the form `foo.o: dependent.h'. # Do two passes, one to just change these to # `$object: dependent.h' and one to simply `dependent.h:'. sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile" sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile" else # The sourcefile does not contain any dependencies, so just # store a dummy comment line, to avoid errors with the Makefile # "include basename.Plo" scheme. echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; 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. base=`echo "$object" | sed -e 's/\.o$//' -e 's/\.lo$//'` tmpdepfile1="$base.o.d" tmpdepfile2="$base.d" if test "$libtool" = yes; then "$@" -Wc,-MD else "$@" -MD fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile1" "$tmpdepfile2" exit $stat fi if test -f "$tmpdepfile1"; then tmpdepfile="$tmpdepfile1" else tmpdepfile="$tmpdepfile2" fi if test -f "$tmpdepfile"; then sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" # That's a space and a tab in the []. sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" else echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; #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 proprocessed file to stdout, regardless of -o, # because we must use -o when running libtool. test -z "$dashmflag" && dashmflag=-M ( IFS=" " case " $* " in *" --mode=compile "*) # this is libtool, let us make it quiet for arg do # cycle over the arguments case "$arg" in "--mode=compile") # insert --quiet before "--mode=compile" set fnord "$@" --quiet shift # fnord ;; esac set fnord "$@" "$arg" shift # fnord shift # "$arg" done ;; esac "$@" $dashmflag | sed 's:^[^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" ) & proc=$! "$@" stat=$? wait "$proc" if test "$stat" != 0; then exit $stat; fi rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" tr ' ' ' ' < "$tmpdepfile" | \ ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. 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) # X makedepend ( shift cleared=no for arg in "$@"; do case $cleared in no) set ""; shift cleared=yes esac case "$arg" in -D*|-I*) set fnord "$@" "$arg"; shift;; -*) ;; *) set fnord "$@" "$arg"; shift;; esac done obj_suffix="`echo $object | sed 's/^.*\././'`" touch "$tmpdepfile" ${MAKEDEPEND-makedepend} 2>/dev/null -o"$obj_suffix" -f"$tmpdepfile" "$@" ) & proc=$! "$@" stat=$? wait "$proc" if test "$stat" != 0; then exit $stat; fi rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" sed '1,2d' "$tmpdepfile" | tr ' ' ' ' | \ ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. 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 proprocessed file to stdout, regardless of -o, # because we must use -o when running libtool. ( IFS=" " case " $* " in *" --mode=compile "*) for arg do # cycle over the arguments case $arg in "--mode=compile") # insert --quiet before "--mode=compile" set fnord "$@" --quiet shift # fnord ;; esac set fnord "$@" "$arg" shift # fnord shift # "$arg" done ;; esac "$@" -E | sed -n '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | sed '$ s: \\$::' > "$tmpdepfile" ) & proc=$! "$@" stat=$? wait "$proc" if test "$stat" != 0; then exit $stat; fi 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 proprocessed file to stdout, regardless of -o, # because we must use -o when running libtool. ( IFS=" " case " $* " in *" --mode=compile "*) for arg do # cycle over the arguments case $arg in "--mode=compile") # insert --quiet before "--mode=compile" set fnord "$@" --quiet shift # fnord ;; esac set fnord "$@" "$arg" shift # fnord shift # "$arg" done ;; esac for arg do case "$arg" in "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") set fnord "$@" shift shift ;; *) set fnord "$@" "$arg" shift shift ;; esac done "$@" -E | sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile" ) & proc=$! "$@" stat=$? wait "$proc" if test "$stat" != 0; then exit $stat; fi rm -f "$depfile" echo "$object : \\" > "$depfile" . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" echo " " >> "$depfile" . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile" rm -f "$tmpdepfile" ;; none) exec "$@" ;; *) echo "Unknown depmode $depmode" 1>&2 exit 1 ;; esac exit 0 TiMidity++-2.13.2/autoconf/install-sh0100755004711200001440000001267107511601666016536 0ustar tamukiusers#!/bin/sh # # install - install a program, script, or datafile # This comes from X11R5 (mit/util/scripts/install.sh). # # Copyright 1991 by the Massachusetts Institute of Technology # # Permission to use, copy, modify, distribute, and sell this software and its # documentation for any purpose is hereby granted without fee, provided that # the above copyright notice appear in all copies and that both that # copyright notice and this permission notice appear in supporting # documentation, and that the name of M.I.T. not be used in advertising or # publicity pertaining to distribution of the software without specific, # written prior permission. M.I.T. makes no representations about the # suitability of this software for any purpose. It is provided "as is" # without express or implied warranty. # # 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. It can only install one file at a time, a restriction # shared with many OS's install programs. # set DOITPROG to echo to test this script # Don't use :- since 4.3BSD and earlier shells don't like it. doit="${DOITPROG-}" # put in absolute paths if you don't have them in your path; or use env. vars. mvprog="${MVPROG-mv}" cpprog="${CPPROG-cp}" chmodprog="${CHMODPROG-chmod}" chownprog="${CHOWNPROG-chown}" chgrpprog="${CHGRPPROG-chgrp}" stripprog="${STRIPPROG-strip}" rmprog="${RMPROG-rm}" mkdirprog="${MKDIRPROG-mkdir}" transformbasename="" transform_arg="" instcmd="$mvprog" chmodcmd="$chmodprog 0755" chowncmd="" chgrpcmd="" stripcmd="" rmcmd="$rmprog -f" mvcmd="$mvprog" src="" dst="" dir_arg="" while [ x"$1" != x ]; do case $1 in -c) instcmd="$cpprog" shift continue;; -d) dir_arg=true shift continue;; -m) chmodcmd="$chmodprog $2" shift shift continue;; -o) chowncmd="$chownprog $2" shift shift continue;; -g) chgrpcmd="$chgrpprog $2" shift shift continue;; -s) stripcmd="$stripprog" shift continue;; -t=*) transformarg=`echo $1 | sed 's/-t=//'` shift continue;; -b=*) transformbasename=`echo $1 | sed 's/-b=//'` shift continue;; *) if [ x"$src" = x ] then src=$1 else # this colon is to work around a 386BSD /bin/sh bug : dst=$1 fi shift continue;; esac done if [ x"$src" = x ] then echo "install: no input file specified" exit 1 else : fi if [ x"$dir_arg" != x ]; then dst=$src src="" if [ -d $dst ]; then instcmd=: chmodcmd="" else instcmd=$mkdirprog fi else # Waiting for this to be detected by the "$instcmd $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if [ -f $src -o -d $src ] then : else echo "install: $src does not exist" exit 1 fi if [ x"$dst" = x ] then echo "install: no destination specified" exit 1 else : fi # If destination is a directory, append the input filename; if your system # does not like double slashes in filenames, you may need to add some logic if [ -d $dst ] then dst="$dst"/`basename $src` else : fi fi ## this sed command emulates the dirname command dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` # Make sure that the destination directory exists. # this part is taken from Noah Friedman's mkinstalldirs script # Skip lots of stat calls in the usual case. if [ ! -d "$dstdir" ]; then defaultIFS=' ' IFS="${IFS-${defaultIFS}}" oIFS="${IFS}" # Some sh's can't handle IFS=/ for some reason. IFS='%' set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` IFS="${oIFS}" pathcomp='' while [ $# -ne 0 ] ; do pathcomp="${pathcomp}${1}" shift if [ ! -d "${pathcomp}" ] ; then $mkdirprog "${pathcomp}" else : fi pathcomp="${pathcomp}/" done fi if [ x"$dir_arg" != x ] then $doit $instcmd $dst && if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else : ; fi && if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else : ; fi && if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else : ; fi && if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else : ; fi else # If we're going to rename the final executable, determine the name now. if [ x"$transformarg" = x ] then dstfile=`basename $dst` else dstfile=`basename $dst $transformbasename | sed $transformarg`$transformbasename fi # don't allow the sed command to completely eliminate the filename if [ x"$dstfile" = x ] then dstfile=`basename $dst` else : fi # Make a temp file name in the proper directory. dsttmp=$dstdir/#inst.$$# # Move or copy the file name to the temp name $doit $instcmd $src $dsttmp && trap "rm -f ${dsttmp}" 0 && # 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 $instcmd $src $dsttmp" command. if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else :;fi && if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else :;fi && if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else :;fi && if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else :;fi && # Now rename the file to the real destination. $doit $rmcmd -f $dstdir/$dstfile && $doit $mvcmd $dsttmp $dstdir/$dstfile fi && exit 0 TiMidity++-2.13.2/autoconf/missing0100755004711200001440000002405007511601666016123 0ustar tamukiusers#! /bin/sh # Common stub for a few missing GNU programs while installing. # Copyright 1996, 1997, 1999, 2000 Free Software Foundation, Inc. # Originally 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, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. # 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 run=: # In the cases where this matters, `missing' is being run in the # srcdir already. if test -f configure.ac; then configure_ac=configure.ac else configure_ac=configure.in fi case "$1" in --run) # Try to run requested program, and just exit if it succeeds. run= shift "$@" && exit 0 ;; esac # If it does not exist, or fails to run (possibly an outdated version), # try to emulate it. case "$1" in -h|--h|--he|--hel|--help) echo "\ $0 [OPTION]... PROGRAM [ARGUMENT]... Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an error status if there is no known handling for PROGRAM. Options: -h, --help display this help and exit -v, --version output version information and exit --run try to run the given command, and emulate it if it fails Supported PROGRAM values: aclocal touch file \`aclocal.m4' autoconf touch file \`configure' autoheader touch file \`config.h.in' automake touch all \`Makefile.in' files bison create \`y.tab.[ch]', if possible, from existing .[ch] flex create \`lex.yy.c', if possible, from existing .c help2man touch the output file lex create \`lex.yy.c', if possible, from existing .c makeinfo touch the output file tar try tar, gnutar, gtar, then tar without non-portable flags yacc create \`y.tab.[ch]', if possible, from existing .[ch]" ;; -v|--v|--ve|--ver|--vers|--versi|--versio|--version) echo "missing 0.4 - GNU automake" ;; -*) echo 1>&2 "$0: Unknown \`$1' option" echo 1>&2 "Try \`$0 --help' for more information" exit 1 ;; aclocal*) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 fi echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if you modified \`acinclude.m4' or \`${configure_ac}'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." touch aclocal.m4 ;; autoconf) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 fi echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if you modified \`${configure_ac}'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." touch configure ;; autoheader) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 fi echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if you modified \`acconfig.h' or \`${configure_ac}'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` test -z "$files" && files="config.h" touch_files= for f in $files; do case "$f" in *:*) touch_files="$touch_files "`echo "$f" | sed -e 's/^[^:]*://' -e 's/:.*//'`;; *) touch_files="$touch_files $f.in";; esac done touch $touch_files ;; automake*) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 fi echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." find . -type f -name Makefile.am -print | sed 's/\.am$/.in/' | while read f; do touch "$f"; done ;; autom4te) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 fi echo 1>&2 "\ WARNING: \`$1' is needed, and you do not seem to have it handy on your system. You might have modified some files without having the proper tools for further handling them. You can get \`$1Help2man' as part of \`Autoconf' from any GNU archive site." file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'` test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'` if test -f "$file"; then touch $file else test -z "$file" || exec >$file echo "#! /bin/sh" echo "# Created by GNU Automake missing as a replacement of" echo "# $ $@" echo "exit 0" chmod +x $file exit 1 fi ;; bison|yacc) echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if you modified a \`.y' file. You may need the \`Bison' package in order for those modifications to take effect. You can get \`Bison' from any GNU archive site." rm -f y.tab.c y.tab.h if [ $# -ne 1 ]; then eval LASTARG="\${$#}" case "$LASTARG" in *.y) SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` if [ -f "$SRCFILE" ]; then cp "$SRCFILE" y.tab.c fi SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` if [ -f "$SRCFILE" ]; then cp "$SRCFILE" y.tab.h fi ;; esac fi if [ ! -f y.tab.h ]; then echo >y.tab.h fi if [ ! -f y.tab.c ]; then echo 'main() { return 0; }' >y.tab.c fi ;; lex|flex) echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if you modified a \`.l' file. You may need the \`Flex' package in order for those modifications to take effect. You can get \`Flex' from any GNU archive site." rm -f lex.yy.c if [ $# -ne 1 ]; then eval LASTARG="\${$#}" case "$LASTARG" in *.l) SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` if [ -f "$SRCFILE" ]; then cp "$SRCFILE" lex.yy.c fi ;; esac fi if [ ! -f lex.yy.c ]; then echo 'main() { return 0; }' >lex.yy.c fi ;; help2man) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 fi echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if you modified a dependency of a manual page. You may need the \`Help2man' package in order for those modifications to take effect. You can get \`Help2man' from any GNU archive site." file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` if test -z "$file"; then file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'` fi if [ -f "$file" ]; then touch $file else test -z "$file" || exec >$file echo ".ab help2man is required to generate this page" exit 1 fi ;; makeinfo) if test -z "$run" && (makeinfo --version) > /dev/null 2>&1; then # We have makeinfo, but it failed. exit 1 fi echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if you modified a \`.texi' or \`.texinfo' file, or any other file indirectly affecting the aspect of the manual. The spurious call might also be the consequence of using a buggy \`make' (AIX, DU, IRIX). You might want to install the \`Texinfo' package or the \`GNU make' package. Grab either from any GNU archive site." file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` if test -z "$file"; then file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file` fi touch $file ;; tar) shift if test -n "$run"; then echo 1>&2 "ERROR: \`tar' requires --run" exit 1 fi # We have already tried tar in the generic part. # Look for gnutar/gtar before invocation to avoid ugly error # messages. if (gnutar --version > /dev/null 2>&1); then gnutar ${1+"$@"} && exit 0 fi if (gtar --version > /dev/null 2>&1); then gtar ${1+"$@"} && exit 0 fi firstarg="$1" if shift; then case "$firstarg" in *o*) firstarg=`echo "$firstarg" | sed s/o//` tar "$firstarg" ${1+"$@"} && exit 0 ;; esac case "$firstarg" in *h*) firstarg=`echo "$firstarg" | sed s/h//` tar "$firstarg" ${1+"$@"} && exit 0 ;; esac fi echo 1>&2 "\ WARNING: I can't seem to be able to run \`tar' with the given arguments. You may want to install GNU tar or Free paxutils, or check the command line arguments." exit 1 ;; *) echo 1>&2 "\ WARNING: \`$1' is needed, and you do not seem to have it handy on your system. You might have modified some files without having the proper tools for further handling them. Check the \`README' file, it often tells you about the needed prerequirements for installing this package. You may also peek at any GNU archive site, in case some other package would contain this missing \`$1' program." exit 1 ;; esac exit 0 TiMidity++-2.13.2/autoconf/mkinstalldirs0100755004711200001440000000350407666570237017345 0ustar tamukiusers#! /bin/sh # mkinstalldirs --- make directory hierarchy # Author: Noah Friedman # Created: 1993-05-16 # Public domain # $Id: mkinstalldirs,v 1.13 1999/01/05 03:18:55 bje Exp $ errstatus=0 dirmode="" usage="\ Usage: mkinstalldirs [-h] [--help] [-m mode] dir ..." # process command line arguments while test $# -gt 0 ; do case "${1}" in -h | --help | --h* ) # -h for help echo "${usage}" 1>&2; exit 0 ;; -m ) # -m PERM arg shift test $# -eq 0 && { echo "${usage}" 1>&2; exit 1; } dirmode="${1}" shift ;; -- ) shift; break ;; # stop option processing -* ) echo "${usage}" 1>&2; exit 1 ;; # unknown option * ) break ;; # first non-opt arg esac done for file do if test -d "$file"; then shift else break fi done case $# in 0) exit 0 ;; esac case $dirmode in '') if mkdir -p -- . 2>/dev/null; then echo "mkdir -p -- $*" exec mkdir -p -- "$@" fi ;; *) if mkdir -m "$dirmode" -p -- . 2>/dev/null; then echo "mkdir -m $dirmode -p -- $*" exec mkdir -m "$dirmode" -p -- "$@" fi ;; esac for file do set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` shift pathcomp= for d do pathcomp="$pathcomp$d" case "$pathcomp" in -* ) pathcomp=./$pathcomp ;; esac if test ! -d "$pathcomp"; then echo "mkdir $pathcomp" mkdir "$pathcomp" || lasterr=$? if test ! -d "$pathcomp"; then errstatus=$lasterr else if test ! -z "$dirmode"; then echo "chmod $dirmode $pathcomp" lasterr="" chmod "$dirmode" "$pathcomp" || lasterr=$? if test ! -z "$lasterr"; then errstatus=$lasterr fi fi fi fi pathcomp="$pathcomp/" done done exit $errstatus # Local Variables: # mode: shell-script # sh-indentation: 3 # End: # mkinstalldirs ends here TiMidity++-2.13.2/autoconf/alsa.m40100644004711200001440000001130107550664410015700 0ustar tamukiusersdnl Configure Paths for Alsa dnl Some modifications by Richard Boulton dnl Christopher Lansdown dnl Jaroslav Kysela dnl Modified for TiMidity++ by URABE, Shyouhei dnl Original : alsa.m4,v 1.22 2002/05/27 11:14:20 tiwai Exp dnl This version: alsa.m4, 2002/10/08 22:30:18 JST dnl AM_PATH_ALSA([MINIMUM-VERSION [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) dnl Test for libasound, and define ALSA_CFLAGS and ALSA_LIBS as appropriate. dnl enables arguments --with-alsa-prefix= dnl --with-alsa-enc-prefix= dnl --disable-alsatest (this has no effect, as yet) 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 dnl dnl Get the cflags and libraries for alsa dnl AC_ARG_WITH(alsa-prefix, [ --with-alsa-prefix=PFX Prefix where Alsa library is installed(optional)], [alsa_prefix="$withval"], [alsa_prefix=""]) AC_ARG_WITH(alsa-inc-prefix, [ --with-alsa-inc-prefix=PFX Prefix where include libraries are (optional)], [alsa_inc_prefix="$withval"], [alsa_inc_prefix=""]) dnl FIXME: this is not yet implemented AC_ARG_ENABLE(alsatest, [ --disable-alsatest Do not try to compile and run a test Alsa program], [enable_alsatest=no], [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) 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 -ldl -lpthread" LIBS=`echo $LIBS | sed 's/-lm//'` LIBS=`echo $LIBS | sed 's/-ldl//'` LIBS=`echo $LIBS | sed 's/-lpthread//'` LIBS=`echo $LIBS | sed 's/ //'` LIBS="$ALSA_LIBS $LIBS" AC_MSG_RESULT($ALSA_LIBS) dnl Check for a working version of libasound that is of the right version. min_alsa_version=ifelse([$1], ,0.1.1,$1) AC_MSG_CHECKING(for libasound headers version >= $min_alsa_version) 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/'` dnl This is the test program. AC_DEFUN([MPUT_ALSA_TRY],[ /* 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); ])dnl macro MPUT_ALSA_TRY AC_LANG_SAVE AC_LANG_C AC_TRY_COMPILE([ #include ], MPUT_ALSA_TRY(), [AC_MSG_RESULT(found.)], [AC_TRY_COMPILE([ #include ], MPUT_ALSA_TRY(), [AC_MSG_RESULT(found.)], [AC_MSG_RESULT(not present.) ifelse([$3], ,[AC_MSG_RESULT(libasound was not found anywhere.)]) alsa_found=no]) ifelse([$3], ,[AC_MSG_RESULT(Sufficiently new version of libasound not found.)]) ]) AC_LANG_RESTORE dnl Now that we know we have the right version, why not see if we dnl have the library and not just the headers. AC_CHECK_LIB([asound],[snd_ctl_open], , [ifelse([$3], ,[AC_MSG_RESULT(No linkable libasound was found.)]) alsa_found=no ]) 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" else ifelse([$3], , :, [$3]) CFLAGS="$alsa_save_CFLAGS" LDFLAGS="$alsa_save_LDFLAGS" LIBS="$alsa_save_LIBS" ALSA_CFLAGS="" ALSA_LIBS="" fi dnl That should be it. Now just export out symbols: AC_SUBST(ALSA_CFLAGS) AC_SUBST(ALSA_LIBS) ])TiMidity++-2.13.2/autoconf/ao.m40100644004711200001440000000715310036552540015362 0ustar tamukiusers# ao.m4 # Configure paths for libao # Jack Moffitt 10-21-2000 # Shamelessly stolen from Owen Taylor and Manish Singh dnl XIPH_PATH_AO([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]) dnl Test for libao, and define AO_CFLAGS and AO_LIBS dnl AC_DEFUN(XIPH_PATH_AO, [dnl dnl Get the cflags and libraries dnl AC_ARG_WITH(ao,[ --with-ao=PFX Prefix where libao is installed (optional)], ao_prefix="$withval", ao_prefix="") AC_ARG_WITH(ao-libraries,[ --with-ao-libraries=DIR Directory where libao library is installed (optional)], ao_libraries="$withval", ao_libraries="") AC_ARG_WITH(ao-includes,[ --with-ao-includes=DIR Directory where libao header files are installed (optional)], ao_includes="$withval", ao_includes="") AC_ARG_ENABLE(aotest, [ --disable-aotest Do not try to compile and run a test ao program],, enable_aotest=yes) if test "x$ao_libraries" != "x" ; then AO_LIBS="-L$ao_libraries" elif test "x$ao_prefix" != "x"; then AO_LIBS="-L$ao_prefix/lib" elif test "x$prefix" != "xNONE"; then AO_LIBS="-L$prefix/lib" fi if test "x$ao_includes" != "x" ; then AO_CFLAGS="-I$ao_includes" elif test "x$ao_prefix" != "x"; then AO_CFLAGS="-I$ao_prefix/include" elif test "x$prefix" != "xNONE"; then AO_CFLAGS="-I$prefix/include" fi # see where dl* and friends live AC_CHECK_FUNCS(dlopen, [AO_DL_LIBS=""], [ AC_CHECK_LIB(dl, dlopen, [AO_DL_LIBS="-ldl"], [ AC_MSG_WARN([could not find dlopen() needed by libao sound drivers your system may not be supported.]) ]) ]) AO_LIBS="$AO_LIBS -lao $AO_DL_LIBS" AC_MSG_CHECKING(for ao) no_ao="" if test "x$enable_aotest" = "xyes" ; then ac_save_CFLAGS="$CFLAGS" ac_save_LIBS="$LIBS" CFLAGS="$CFLAGS $AO_CFLAGS" LIBS="$LIBS $AO_LIBS" dnl dnl Now check if the installed ao is sufficiently new. dnl rm -f conf.aotest AC_TRY_RUN([ #include #include #include #include int main () { system("touch conf.aotest"); return 0; } ],, no_ao=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) CFLAGS="$ac_save_CFLAGS" LIBS="$ac_save_LIBS" fi if test "x$no_ao" = "x" ; then AC_MSG_RESULT(yes) ifelse([$1], , :, [$1]) else AC_MSG_RESULT(no) if test -f conf.aotest ; then : else echo "*** Could not run ao test program, checking why..." CFLAGS="$CFLAGS $AO_CFLAGS" LIBS="$LIBS $AO_LIBS" AC_TRY_LINK([ #include #include ], [ return 0; ], [ echo "*** The test program compiled, but did not run. This usually means" echo "*** that the run-time linker is not finding ao or finding the wrong" echo "*** version of ao. If it is not finding ao, you'll need to set your" echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" echo "*** to the installed location Also, make sure you have run ldconfig if that" echo "*** is required on your system" echo "***" echo "*** If you have an old version installed, it is best to remove it, although" echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"], [ echo "*** The test program failed to compile or link. See the file config.log for the" echo "*** exact error that occured. This usually means ao was incorrectly installed" echo "*** or that you have moved ao since it was installed." ]) CFLAGS="$ac_save_CFLAGS" LIBS="$ac_save_LIBS" fi AO_CFLAGS="" AO_LIBS="" ifelse([$2], , :, [$2]) fi AC_SUBST(AO_CFLAGS) AC_SUBST(AO_LIBS) rm -f conf.aotest ]) TiMidity++-2.13.2/autoconf/arts.m40100644004711200001440000001310307547454625015746 0ustar tamukiusersdnl This should be pulled in from arts.m4 dnl dnl Oh my word, I've never hacked automake before - let me know if this is a dnl complete rubbish! dnl Peter L Jones 2002-05-12 dnl Snarfed from the ESD code below - but the faults are all mine! dnl AM_PATH_ARTS([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) dnl Test for aRts, and define ARTS_CFLAGS and ARTS_LIBS dnl AC_DEFUN(AM_PATH_ARTS, [dnl dnl Get the cflags and libraries from the arts-config script dnl AC_ARG_WITH(arts-prefix,[ --with-arts-prefix=PFX Prefix where ARTS is installed (optional)], arts_prefix="$withval", arts_prefix="") AC_ARG_ENABLE(artstest, [ --disable-artstest Do not try to compile and run a test ARTS program], , enable_artstest=yes) if test x$arts_prefix != x ; then arts_args="$arts_args --prefix=$arts_prefix" if test x${ARTS_CONFIG+set} != xset ; then ARTS_CONFIG=$arts_prefix/bin/artsc-config fi fi AC_PATH_PROG(ARTS_CONFIG, artsc-config, no) min_arts_version=ifelse([$1], ,0.9.5,$1) AC_MSG_CHECKING(for ARTS - version >= $min_arts_version) no_arts="" if test "$ARTS_CONFIG" = "no" ; then no_arts=yes else ARTS_CFLAGS=`$ARTS_CONFIG $artsconf_args --cflags` ARTS_LIBS=`$ARTS_CONFIG $artsconf_args --libs` arts_major_version=`$ARTS_CONFIG $arts_args --version | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` arts_minor_version=`$ARTS_CONFIG $arts_args --version | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` arts_micro_version=`$ARTS_CONFIG $arts_config_args --version | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` if test "x$enable_artstest" = "xyes" ; then ac_save_CFLAGS="$CFLAGS" ac_save_LIBS="$LIBS" CFLAGS="$CFLAGS $ARTS_CFLAGS" LIBS="$LIBS $ARTS_LIBS" dnl dnl Now check if the installed ARTS is sufficiently new. (Also sanity dnl checks the results of arts-config to some extent dnl rm -f conf.artstest AC_TRY_RUN([ #include #include #include #include char* my_strdup (char *str) { char *new_str; if (str) { new_str = malloc ((strlen (str) + 1) * sizeof(char)); strcpy (new_str, str); } else new_str = NULL; return new_str; } int main () { int major, minor, micro; char *tmp_version; system ("touch conf.artstest"); /* HP/UX 9 (%@#!) writes to sscanf strings */ tmp_version = my_strdup("$min_arts_version"); if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { printf("%s, bad version string\n", "$min_arts_version"); exit(1); } if (($arts_major_version > major) || (($arts_major_version == major) && ($arts_minor_version > minor)) || (($arts_major_version == major) && ($arts_minor_version == minor) && ($arts_micro_version >= micro))) { return 0; } else { printf("\n*** 'artsc-config --version' returned %d.%d.%d, but the minimum version\n", $arts_major_version, $arts_minor_version, $arts_micro_version); printf("*** of ARTS required is %d.%d.%d. If artsc-config is correct, then it is\n", major, minor, micro); printf("*** best to upgrade to the required version.\n"); printf("*** If artsc-config was wrong, set the environment variable ARTS_CONFIG\n"); printf("*** to point to the correct copy of artsc-config, and remove the file\n"); printf("*** config.cache before re-running configure\n"); return 1; } } ],, no_arts=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) CFLAGS="$ac_save_CFLAGS" LIBS="$ac_save_LIBS" fi fi if test "x$no_arts" = x ; then AC_MSG_RESULT(yes) ifelse([$2], , :, [$2]) else AC_MSG_RESULT(no) if test "$ARTS_CONFIG" = "no" ; then echo "*** The artsc-config script installed by ARTS could not be found" echo "*** If ARTS was installed in PREFIX, make sure PREFIX/bin is in" echo "*** your path, or set the ARTS_CONFIG environment variable to the" echo "*** full path to artsc-config." else if test -f conf.artstest ; then : else echo "*** Could not run ARTS test program, checking why..." CFLAGS="$CFLAGS $ARTS_CFLAGS" LIBS="$LIBS $ARTS_LIBS" AC_TRY_LINK([ #include #include ], [ return 0; ], [ echo "*** The test program compiled, but did not run. This usually means" echo "*** that the run-time linker is not finding ARTS or finding the wrong" echo "*** version of ARTS. If it is not finding ARTS, you'll need to set your" echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" echo "*** to the installed location Also, make sure you have run ldconfig if that" echo "*** is required on your system" echo "***" echo "*** If you have an old version installed, it is best to remove it, although" echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"], [ echo "*** The test program failed to compile or link. See the file config.log for the" echo "*** exact error that occured. This usually means ARTS was incorrectly installed" echo "*** or that you have moved ARTS since it was installed. In the latter case, you" echo "*** may want to edit the arts-config script: $ARTS_CONFIG" ]) CFLAGS="$ac_save_CFLAGS" LIBS="$ac_save_LIBS" fi fi ARTS_CFLAGS="" ARTS_LIBS="" ifelse([$3], , :, [$3]) fi AC_SUBST(ARTS_CFLAGS) AC_SUBST(ARTS_LIBS) rm -f conf.artstest ]) dnl End of aRtsTiMidity++-2.13.2/autoconf/esd.m40100644004711200001440000001532207511600367015540 0ustar tamukiusers# Configure paths for ESD # Manish Singh 98-9-30 # stolen back from Frank Belew # stolen from Manish Singh # Shamelessly stolen from Owen Taylor dnl AM_PATH_ESD([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) dnl Test for ESD, and define ESD_CFLAGS and ESD_LIBS dnl AC_DEFUN(AM_PATH_ESD, [dnl dnl Get the cflags and libraries from the esd-config script dnl AC_ARG_WITH(esd-prefix,[ --with-esd-prefix=PFX Prefix where ESD is installed (optional)], esd_prefix="$withval", esd_prefix="") AC_ARG_WITH(esd-exec-prefix,[ --with-esd-exec-prefix=PFX Exec prefix where ESD is installed (optional)], esd_exec_prefix="$withval", esd_exec_prefix="") AC_ARG_ENABLE(esdtest, [ --disable-esdtest Do not try to compile and run a test ESD program], , enable_esdtest=yes) if test x$esd_exec_prefix != x ; then esd_args="$esd_args --exec-prefix=$esd_exec_prefix" if test x${ESD_CONFIG+set} != xset ; then ESD_CONFIG=$esd_exec_prefix/bin/esd-config fi fi if test x$esd_prefix != x ; then esd_args="$esd_args --prefix=$esd_prefix" if test x${ESD_CONFIG+set} != xset ; then ESD_CONFIG=$esd_prefix/bin/esd-config fi fi AC_PATH_PROG(ESD_CONFIG, esd-config, no) min_esd_version=ifelse([$1], ,0.2.7,$1) AC_MSG_CHECKING(for ESD - version >= $min_esd_version) no_esd="" if test "$ESD_CONFIG" = "no" ; then no_esd=yes else AC_LANG_SAVE AC_LANG_C ESD_CFLAGS=`$ESD_CONFIG $esdconf_args --cflags` ESD_LIBS=`$ESD_CONFIG $esdconf_args --libs` esd_major_version=`$ESD_CONFIG $esd_args --version | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` esd_minor_version=`$ESD_CONFIG $esd_args --version | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` esd_micro_version=`$ESD_CONFIG $esd_config_args --version | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` if test "x$enable_esdtest" = "xyes" ; then ac_save_CFLAGS="$CFLAGS" ac_save_LIBS="$LIBS" CFLAGS="$CFLAGS $ESD_CFLAGS" LIBS="$LIBS $ESD_LIBS" dnl dnl Now check if the installed ESD is sufficiently new. (Also sanity dnl checks the results of esd-config to some extent dnl rm -f conf.esdtest AC_TRY_RUN([ #include #include #include #include char* my_strdup (char *str) { char *new_str; if (str) { new_str = malloc ((strlen (str) + 1) * sizeof(char)); strcpy (new_str, str); } else new_str = NULL; return new_str; } int main () { int major, minor, micro; char *tmp_version; system ("touch conf.esdtest"); /* HP/UX 9 (%@#!) writes to sscanf strings */ tmp_version = my_strdup("$min_esd_version"); if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { printf("%s, bad version string\n", "$min_esd_version"); exit(1); } if (($esd_major_version > major) || (($esd_major_version == major) && ($esd_minor_version > minor)) || (($esd_major_version == major) && ($esd_minor_version == minor) && ($esd_micro_version >= micro))) { return 0; } else { printf("\n*** 'esd-config --version' returned %d.%d.%d, but the minimum version\n", $esd_major_version, $esd_minor_version, $esd_micro_version); printf("*** of ESD required is %d.%d.%d. If esd-config is correct, then it is\n", major, minor, micro); printf("*** best to upgrade to the required version.\n"); printf("*** If esd-config was wrong, set the environment variable ESD_CONFIG\n"); printf("*** to point to the correct copy of esd-config, and remove the file\n"); printf("*** config.cache before re-running configure\n"); return 1; } } ],, no_esd=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) CFLAGS="$ac_save_CFLAGS" LIBS="$ac_save_LIBS" AC_LANG_RESTORE fi fi if test "x$no_esd" = x ; then AC_MSG_RESULT(yes) ifelse([$2], , :, [$2]) else AC_MSG_RESULT(no) if test "$ESD_CONFIG" = "no" ; then echo "*** The esd-config script installed by ESD could not be found" echo "*** If ESD was installed in PREFIX, make sure PREFIX/bin is in" echo "*** your path, or set the ESD_CONFIG environment variable to the" echo "*** full path to esd-config." else if test -f conf.esdtest ; then : else echo "*** Could not run ESD test program, checking why..." CFLAGS="$CFLAGS $ESD_CFLAGS" LIBS="$LIBS $ESD_LIBS" AC_LANG_SAVE AC_LANG_C AC_TRY_LINK([ #include #include ], [ return 0; ], [ echo "*** The test program compiled, but did not run. This usually means" echo "*** that the run-time linker is not finding ESD or finding the wrong" echo "*** version of ESD. If it is not finding ESD, you'll need to set your" echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" echo "*** to the installed location Also, make sure you have run ldconfig if that" echo "*** is required on your system" echo "***" echo "*** If you have an old version installed, it is best to remove it, although" echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"], [ echo "*** The test program failed to compile or link. See the file config.log for the" echo "*** exact error that occured. This usually means ESD was incorrectly installed" echo "*** or that you have moved ESD since it was installed. In the latter case, you" echo "*** may want to edit the esd-config script: $ESD_CONFIG" ]) CFLAGS="$ac_save_CFLAGS" LIBS="$ac_save_LIBS" AC_LANG_RESTORE fi fi ESD_CFLAGS="" ESD_LIBS="" ifelse([$3], , :, [$3]) fi AC_SUBST(ESD_CFLAGS) AC_SUBST(ESD_LIBS) rm -f conf.esdtest ]) dnl AM_ESD_SUPPORTS_MULTIPLE_RECORD([ACTION-IF-SUPPORTS [, ACTION-IF-NOT-SUPPORTS]]) dnl Test, whether esd supports multiple recording clients (version >=0.2.21) dnl AC_DEFUN(AM_ESD_SUPPORTS_MULTIPLE_RECORD, [dnl AC_MSG_NOTICE([whether installed esd version supports multiple recording clients]) ac_save_ESD_CFLAGS="$ESD_CFLAGS" ac_save_ESD_LIBS="$ESD_LIBS" AM_PATH_ESD(0.2.21, ifelse([$1], , [ AM_CONDITIONAL(ESD_SUPPORTS_MULTIPLE_RECORD, true) AC_DEFINE(ESD_SUPPORTS_MULTIPLE_RECORD, 1, [Define if you have esound with support of multiple recording clients.])], [$1]), ifelse([$2], , [AM_CONDITIONAL(ESD_SUPPORTS_MULTIPLE_RECORD, false)], [$2]) if test "x$ac_save_ESD_CFLAGS" != x ; then ESD_CFLAGS="$ac_save_ESD_CFLAGS" fi if test "x$ac_save_ESD_LIBS" != x ; then ESD_LIBS="$ac_save_ESD_LIBS" fi ) ]) TiMidity++-2.13.2/autoconf/gtk.m40100644004711200001440000002013507511600307015542 0ustar tamukiusers# Configure paths for GTK+ # Owen Taylor 97-11-3 dnl AM_PATH_GTK([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]]) dnl Test for GTK, and define GTK_CFLAGS and GTK_LIBS dnl AC_DEFUN(AM_PATH_GTK, [dnl dnl Get the cflags and libraries from the gtk-config script dnl AC_ARG_WITH(gtk-prefix,[ --with-gtk-prefix=PFX Prefix where GTK is installed (optional)], gtk_config_prefix="$withval", gtk_config_prefix="") AC_ARG_WITH(gtk-exec-prefix,[ --with-gtk-exec-prefix=PFX Exec prefix where GTK is installed (optional)], gtk_config_exec_prefix="$withval", gtk_config_exec_prefix="") AC_ARG_ENABLE(gtktest, [ --disable-gtktest Do not try to compile and run a test GTK program], , enable_gtktest=yes) for module in . $4 do case "$module" in gthread) gtk_config_args="$gtk_config_args gthread" ;; esac done if test x$gtk_config_exec_prefix != x ; then gtk_config_args="$gtk_config_args --exec-prefix=$gtk_config_exec_prefix" if test x${GTK_CONFIG+set} != xset ; then GTK_CONFIG=$gtk_config_exec_prefix/bin/gtk-config fi fi if test x$gtk_config_prefix != x ; then gtk_config_args="$gtk_config_args --prefix=$gtk_config_prefix" if test x${GTK_CONFIG+set} != xset ; then GTK_CONFIG=$gtk_config_prefix/bin/gtk-config fi fi AC_PATH_PROG(GTK_CONFIG, gtk-config, no) min_gtk_version=ifelse([$1], ,0.99.7,$1) AC_MSG_CHECKING(for GTK - version >= $min_gtk_version) no_gtk="" if test "$GTK_CONFIG" = "no" ; then no_gtk=yes else GTK_CFLAGS=`$GTK_CONFIG $gtk_config_args --cflags` GTK_LIBS=`$GTK_CONFIG $gtk_config_args --libs` gtk_config_major_version=`$GTK_CONFIG $gtk_config_args --version | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` gtk_config_minor_version=`$GTK_CONFIG $gtk_config_args --version | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` gtk_config_micro_version=`$GTK_CONFIG $gtk_config_args --version | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` if test "x$enable_gtktest" = "xyes" ; then ac_save_CFLAGS="$CFLAGS" ac_save_LIBS="$LIBS" CFLAGS="$CFLAGS $GTK_CFLAGS" LIBS="$GTK_LIBS $LIBS" dnl dnl Now check if the installed GTK is sufficiently new. (Also sanity dnl checks the results of gtk-config to some extent dnl rm -f conf.gtktest AC_TRY_RUN([ #include #include #include int main () { int major, minor, micro; char *tmp_version; system ("touch conf.gtktest"); /* HP/UX 9 (%@#!) writes to sscanf strings */ tmp_version = g_strdup("$min_gtk_version"); if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { printf("%s, bad version string\n", "$min_gtk_version"); exit(1); } if ((gtk_major_version != $gtk_config_major_version) || (gtk_minor_version != $gtk_config_minor_version) || (gtk_micro_version != $gtk_config_micro_version)) { printf("\n*** 'gtk-config --version' returned %d.%d.%d, but GTK+ (%d.%d.%d)\n", $gtk_config_major_version, $gtk_config_minor_version, $gtk_config_micro_version, gtk_major_version, gtk_minor_version, gtk_micro_version); printf ("*** was found! If gtk-config was correct, then it is best\n"); printf ("*** to remove the old version of GTK+. You may also be able to fix the error\n"); printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n"); printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n"); printf("*** required on your system.\n"); printf("*** If gtk-config was wrong, set the environment variable GTK_CONFIG\n"); printf("*** to point to the correct copy of gtk-config, and remove the file config.cache\n"); printf("*** before re-running configure\n"); } #if defined (GTK_MAJOR_VERSION) && defined (GTK_MINOR_VERSION) && defined (GTK_MICRO_VERSION) else if ((gtk_major_version != GTK_MAJOR_VERSION) || (gtk_minor_version != GTK_MINOR_VERSION) || (gtk_micro_version != GTK_MICRO_VERSION)) { printf("*** GTK+ header files (version %d.%d.%d) do not match\n", GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION); printf("*** library (version %d.%d.%d)\n", gtk_major_version, gtk_minor_version, gtk_micro_version); } #endif /* defined (GTK_MAJOR_VERSION) ... */ else { if ((gtk_major_version > major) || ((gtk_major_version == major) && (gtk_minor_version > minor)) || ((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_micro_version >= micro))) { return 0; } else { printf("\n*** An old version of GTK+ (%d.%d.%d) was found.\n", gtk_major_version, gtk_minor_version, gtk_micro_version); printf("*** You need a version of GTK+ newer than %d.%d.%d. The latest version of\n", major, minor, micro); printf("*** GTK+ is always available from ftp://ftp.gtk.org.\n"); printf("***\n"); printf("*** If you have already installed a sufficiently new version, this error\n"); printf("*** probably means that the wrong copy of the gtk-config shell script is\n"); printf("*** being found. The easiest way to fix this is to remove the old version\n"); printf("*** of GTK+, but you can also set the GTK_CONFIG environment to point to the\n"); printf("*** correct copy of gtk-config. (In this case, you will have to\n"); printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n"); printf("*** so that the correct libraries are found at run-time))\n"); } } return 1; } ],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) CFLAGS="$ac_save_CFLAGS" LIBS="$ac_save_LIBS" fi fi if test "x$no_gtk" = x ; then AC_MSG_RESULT(yes) ifelse([$2], , :, [$2]) else AC_MSG_RESULT(no) if test "$GTK_CONFIG" = "no" ; then echo "*** The gtk-config script installed by GTK could not be found" echo "*** If GTK was installed in PREFIX, make sure PREFIX/bin is in" echo "*** your path, or set the GTK_CONFIG environment variable to the" echo "*** full path to gtk-config." else if test -f conf.gtktest ; then : else echo "*** Could not run GTK test program, checking why..." CFLAGS="$CFLAGS $GTK_CFLAGS" LIBS="$LIBS $GTK_LIBS" AC_TRY_LINK([ #include #include ], [ return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version)); ], [ echo "*** The test program compiled, but did not run. This usually means" echo "*** that the run-time linker is not finding GTK or finding the wrong" echo "*** version of GTK. If it is not finding GTK, you'll need to set your" echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" echo "*** to the installed location Also, make sure you have run ldconfig if that" echo "*** is required on your system" echo "***" echo "*** If you have an old version installed, it is best to remove it, although" echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" echo "***" echo "*** If you have a RedHat 5.0 system, you should remove the GTK package that" echo "*** came with the system with the command" echo "***" echo "*** rpm --erase --nodeps gtk gtk-devel" ], [ echo "*** The test program failed to compile or link. See the file config.log for the" echo "*** exact error that occured. This usually means GTK was incorrectly installed" echo "*** or that you have moved GTK since it was installed. In the latter case, you" echo "*** may want to edit the gtk-config script: $GTK_CONFIG" ]) CFLAGS="$ac_save_CFLAGS" LIBS="$ac_save_LIBS" fi fi GTK_CFLAGS="" GTK_LIBS="" ifelse([$3], , :, [$3]) fi AC_SUBST(GTK_CFLAGS) AC_SUBST(GTK_LIBS) rm -f conf.gtktest ]) TiMidity++-2.13.2/autoconf/gtk-2.0.m40100644004711200001440000001655010056312417016045 0ustar tamukiusers# Configure paths for GTK+ # Owen Taylor 1997-2001 dnl AM_PATH_GTK_2_0([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]]) dnl Test for GTK+, and define GTK_CFLAGS and GTK_LIBS, if gthread is specified in MODULES, dnl pass to pkg-config dnl AC_DEFUN(AM_PATH_GTK_2_0, [dnl dnl Get the cflags and libraries from pkg-config dnl AC_ARG_ENABLE(gtktest, [ --disable-gtktest do not try to compile and run a test GTK+ program], , enable_gtktest=yes) pkg_config_args=gtk+-2.0 for module in . $4 do case "$module" in gthread) pkg_config_args="$pkg_config_args gthread-2.0" ;; esac done no_gtk="" AC_PATH_PROG(PKG_CONFIG, pkg-config, no) if test x$PKG_CONFIG != xno ; then if pkg-config --atleast-pkgconfig-version 0.7 ; then : else echo *** pkg-config too old; version 0.7 or better required. no_gtk=yes PKG_CONFIG=no fi else no_gtk=yes fi min_gtk_version=ifelse([$1], ,2.0.0,$1) AC_MSG_CHECKING(for GTK+ - version >= $min_gtk_version) if test x$PKG_CONFIG != xno ; then ## don't try to run the test against uninstalled libtool libs if $PKG_CONFIG --uninstalled $pkg_config_args; then echo "Will use uninstalled version of GTK+ found in PKG_CONFIG_PATH" enable_gtktest=no fi if $PKG_CONFIG --atleast-version $min_gtk_version $pkg_config_args; then : else no_gtk=yes fi fi if test x"$no_gtk" = x ; then GTK_CFLAGS=`$PKG_CONFIG $pkg_config_args --cflags` GTK_LIBS=`$PKG_CONFIG $pkg_config_args --libs` gtk_config_major_version=`$PKG_CONFIG --modversion gtk+-2.0 | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` gtk_config_minor_version=`$PKG_CONFIG --modversion gtk+-2.0 | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` gtk_config_micro_version=`$PKG_CONFIG --modversion gtk+-2.0 | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` if test "x$enable_gtktest" = "xyes" ; then ac_save_CFLAGS="$CFLAGS" ac_save_LIBS="$LIBS" CFLAGS="$CFLAGS $GTK_CFLAGS" LIBS="$GTK_LIBS $LIBS" dnl dnl Now check if the installed GTK+ is sufficiently new. (Also sanity dnl checks the results of pkg-config to some extent) dnl rm -f conf.gtktest AC_TRY_RUN([ #include #include #include int main () { int major, minor, micro; char *tmp_version; system ("touch conf.gtktest"); /* HP/UX 9 (%@#!) writes to sscanf strings */ tmp_version = g_strdup("$min_gtk_version"); if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { printf("%s, bad version string\n", "$min_gtk_version"); exit(1); } if ((gtk_major_version != $gtk_config_major_version) || (gtk_minor_version != $gtk_config_minor_version) || (gtk_micro_version != $gtk_config_micro_version)) { printf("\n*** 'pkg-config --modversion gtk+-2.0' returned %d.%d.%d, but GTK+ (%d.%d.%d)\n", $gtk_config_major_version, $gtk_config_minor_version, $gtk_config_micro_version, gtk_major_version, gtk_minor_version, gtk_micro_version); printf ("*** was found! If pkg-config was correct, then it is best\n"); printf ("*** to remove the old version of GTK+. You may also be able to fix the error\n"); printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n"); printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n"); printf("*** required on your system.\n"); printf("*** If pkg-config was wrong, set the environment variable PKG_CONFIG_PATH\n"); printf("*** to point to the correct configuration files\n"); } else if ((gtk_major_version != GTK_MAJOR_VERSION) || (gtk_minor_version != GTK_MINOR_VERSION) || (gtk_micro_version != GTK_MICRO_VERSION)) { printf("*** GTK+ header files (version %d.%d.%d) do not match\n", GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION); printf("*** library (version %d.%d.%d)\n", gtk_major_version, gtk_minor_version, gtk_micro_version); } else { if ((gtk_major_version > major) || ((gtk_major_version == major) && (gtk_minor_version > minor)) || ((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_micro_version >= micro))) { return 0; } else { printf("\n*** An old version of GTK+ (%d.%d.%d) was found.\n", gtk_major_version, gtk_minor_version, gtk_micro_version); printf("*** You need a version of GTK+ newer than %d.%d.%d. The latest version of\n", major, minor, micro); printf("*** GTK+ is always available from ftp://ftp.gtk.org.\n"); printf("***\n"); printf("*** If you have already installed a sufficiently new version, this error\n"); printf("*** probably means that the wrong copy of the pkg-config shell script is\n"); printf("*** being found. The easiest way to fix this is to remove the old version\n"); printf("*** of GTK+, but you can also set the PKG_CONFIG environment to point to the\n"); printf("*** correct copy of pkg-config. (In this case, you will have to\n"); printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n"); printf("*** so that the correct libraries are found at run-time))\n"); } } return 1; } ],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) CFLAGS="$ac_save_CFLAGS" LIBS="$ac_save_LIBS" fi fi if test "x$no_gtk" = x ; then AC_MSG_RESULT(yes (version $gtk_config_major_version.$gtk_config_minor_version.$gtk_config_micro_version)) ifelse([$2], , :, [$2]) else AC_MSG_RESULT(no) if test "$PKG_CONFIG" = "no" ; then echo "*** A new enough version of pkg-config was not found." echo "*** See http://pkgconfig.sourceforge.net" else if test -f conf.gtktest ; then : else echo "*** Could not run GTK+ test program, checking why..." ac_save_CFLAGS="$CFLAGS" ac_save_LIBS="$LIBS" CFLAGS="$CFLAGS $GTK_CFLAGS" LIBS="$LIBS $GTK_LIBS" AC_TRY_LINK([ #include #include ], [ return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version)); ], [ echo "*** The test program compiled, but did not run. This usually means" echo "*** that the run-time linker is not finding GTK+ or finding the wrong" echo "*** version of GTK+. If it is not finding GTK+, you'll need to set your" echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" echo "*** to the installed location Also, make sure you have run ldconfig if that" echo "*** is required on your system" echo "***" echo "*** If you have an old version installed, it is best to remove it, although" echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" ], [ echo "*** The test program failed to compile or link. See the file config.log for the" echo "*** exact error that occured. This usually means GTK+ is incorrectly installed."]) CFLAGS="$ac_save_CFLAGS" LIBS="$ac_save_LIBS" fi fi GTK_CFLAGS="" GTK_LIBS="" ifelse([$3], , :, [$3]) fi AC_SUBST(GTK_CFLAGS) AC_SUBST(GTK_LIBS) rm -f conf.gtktest ]) TiMidity++-2.13.2/autoconf/libFLAC.m40100644004711200001440000000737410040251210016145 0ustar tamukiusers# Configure paths for libFLAC # "Inspired" by ogg.m4 dnl AM_PATH_LIBFLAC([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]) dnl Test for libFLAC, and define LIBFLAC_CFLAGS and LIBFLAC_LIBS dnl AC_DEFUN(AM_PATH_LIBFLAC, [dnl dnl Get the cflags and libraries dnl AC_ARG_WITH(libFLAC,[ --with-libFLAC=PFX Prefix where libFLAC is installed (optional)], libFLAC_prefix="$withval", libFLAC_prefix="") AC_ARG_WITH(libFLAC-libraries,[ --with-libFLAC-libraries=DIR Directory where libFLAC library is installed (optional)], libFLAC_libraries="$withval", libFLAC_libraries="") AC_ARG_WITH(libFLAC-includes,[ --with-libFLAC-includes=DIR Directory where libFLAC header files are installed (optional)], libFLAC_includes="$withval", libFLAC_includes="") AC_ARG_ENABLE(libFLACtest, [ --disable-libFLACtest Do not try to compile and run a test libFLAC program],, enable_libFLACtest=yes) if test "x$libFLAC_libraries" != "x" ; then LIBFLAC_LIBS="-L$libFLAC_libraries" elif test "x$libFLAC_prefix" != "x" ; then LIBFLAC_LIBS="-L$libFLAC_prefix/lib" elif test "x$prefix" != "xNONE" ; then LIBFLAC_LIBS="-L$prefix/lib" fi LIBFLAC_LIBS="$LIBFLAC_LIBS -lFLAC -lm" if test "x$libFLAC_includes" != "x" ; then LIBFLAC_CFLAGS="-I$libFLAC_includes" elif test "x$libFLAC_prefix" != "x" ; then LIBFLAC_CFLAGS="-I$libFLAC_prefix/include" elif test "$prefix" != "xNONE"; then LIBFLAC_CFLAGS="-I$prefix/include" fi AC_MSG_CHECKING(for libFLAC) no_libFLAC="" if test "x$enable_libFLACtest" = "xyes" ; then ac_save_CFLAGS="$CFLAGS" ac_save_CXXFLAGS="$CXXFLAGS" ac_save_LIBS="$LIBS" CFLAGS="$CFLAGS $LIBFLAC_CFLAGS" CXXFLAGS="$CXXFLAGS $LIBFLAC_CFLAGS" LIBS="$LIBS $LIBFLAC_LIBS" dnl dnl Now check if the installed libFLAC is sufficiently new. dnl rm -f conf.libFLACtest AC_TRY_RUN([ #include #include #include #include int main () { system("touch conf.libFLACtest"); return 0; } ],, no_libFLAC=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) CFLAGS="$ac_save_CFLAGS" LIBS="$ac_save_LIBS" fi if test "x$no_libFLAC" = "x" ; then AC_MSG_RESULT(yes) ifelse([$1], , :, [$1]) else AC_MSG_RESULT(no) if test -f conf.libFLACtest ; then : else echo "*** Could not run libFLAC test program, checking why..." CFLAGS="$CFLAGS $LIBFLAC_CFLAGS" LIBS="$LIBS $LIBFLAC_LIBS" AC_TRY_LINK([ #include #include ], [ return 0; ], [ echo "*** The test program compiled, but did not run. This usually means" echo "*** that the run-time linker is not finding libFLAC or finding the wrong" echo "*** version of libFLAC. If it is not finding libFLAC, you'll need to set your" echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" echo "*** to the installed location Also, make sure you have run ldconfig if that" echo "*** is required on your system" echo "***" echo "*** If you have an old version installed, it is best to remove it, although" echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"], [ echo "*** The test program failed to compile or link. See the file config.log for the" echo "*** exact error that occured. This usually means libFLAC was incorrectly installed" echo "*** or that you have moved libFLAC since it was installed. In the latter case, you" echo "*** may want to edit the libFLAC-config script: $LIBFLAC_CONFIG" ]) CFLAGS="$ac_save_CFLAGS" LIBS="$ac_save_LIBS" fi LIBFLAC_CFLAGS="" LIBFLAC_LIBS="" ifelse([$2], , :, [$2]) fi AC_SUBST(LIBFLAC_CFLAGS) AC_SUBST(LIBFLAC_LIBS) rm -f conf.libFLACtest ]) TiMidity++-2.13.2/autoconf/libOggFLAC.m40100644004711200001440000000775010040251210016600 0ustar tamukiusers# Configure paths for libOggFLAC # "Inspired" by ogg.m4 dnl AM_PATH_LIBOGGFLAC([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]) dnl Test for libOggFLAC, and define LIBOGGFLAC_CFLAGS and LIBOGGFLAC_LIBS dnl AC_DEFUN(AM_PATH_LIBOGGFLAC, [dnl dnl Get the cflags and libraries dnl AC_ARG_WITH(libOggFLAC,[ --with-libOggFLAC=PFX Prefix where libOggFLAC is installed (optional)], libOggFLAC_prefix="$withval", libOggFLAC_prefix="") AC_ARG_WITH(libOggFLAC-libraries,[ --with-libOggFLAC-libraries=DIR Directory where libOggFLAC library is installed (optional)], libOggFLAC_libraries="$withval", libOggFLAC_libraries="") AC_ARG_WITH(libOggFLAC-includes,[ --with-libOggFLAC-includes=DIR Directory where libOggFLAC header files are installed (optional)], libOggFLAC_includes="$withval", libOggFLAC_includes="") AC_ARG_ENABLE(libOggFLACtest, [ --disable-libOggFLACtest Do not try to compile and run a test libOggFLAC program],, enable_libOggFLACtest=yes) if test "x$libOggFLAC_libraries" != "x" ; then LIBOGGFLAC_LIBS="-L$libOggFLAC_libraries" elif test "x$libOggFLAC_prefix" != "x" ; then LIBOGGFLAC_LIBS="-L$libOggFLAC_prefix/lib" elif test "x$prefix" != "xNONE" ; then LIBOGGFLAC_LIBS="-L$prefix/lib" fi LIBOGGFLAC_LIBS="$LIBOGGFLAC_LIBS -lOggFLAC -lFLAC -lm" if test "x$libOggFLAC_includes" != "x" ; then LIBOGGFLAC_CFLAGS="-I$libOggFLAC_includes" elif test "x$libOggFLAC_prefix" != "x" ; then LIBOGGFLAC_CFLAGS="-I$libOggFLAC_prefix/include" elif test "$prefix" != "xNONE"; then LIBOGGFLAC_CFLAGS="-I$prefix/include" fi AC_MSG_CHECKING(for libOggFLAC) no_libOggFLAC="" if test "x$enable_libOggFLACtest" = "xyes" ; then ac_save_CFLAGS="$CFLAGS" ac_save_CXXFLAGS="$CXXFLAGS" ac_save_LIBS="$LIBS" CFLAGS="$CFLAGS $LIBOGGFLAC_CFLAGS" CXXFLAGS="$CXXFLAGS $LIBOGGFLAC_CFLAGS" LIBS="$LIBS $LIBOGGFLAC_LIBS" dnl dnl Now check if the installed libOggFLAC is sufficiently new. dnl rm -f conf.libOggFLACtest AC_TRY_RUN([ #include #include #include #include int main () { system("touch conf.libOggFLACtest"); return 0; } ],, no_libOggFLAC=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) CFLAGS="$ac_save_CFLAGS" LIBS="$ac_save_LIBS" fi if test "x$no_libOggFLAC" = "x" ; then AC_MSG_RESULT(yes) ifelse([$1], , :, [$1]) else AC_MSG_RESULT(no) if test -f conf.libOggFLACtest ; then : else echo "*** Could not run libOggFLAC test program, checking why..." CFLAGS="$CFLAGS $LIBOGGFLAC_CFLAGS" LIBS="$LIBS $LIBOGGFLAC_LIBS" AC_TRY_LINK([ #include #include ], [ return 0; ], [ echo "*** The test program compiled, but did not run. This usually means" echo "*** that the run-time linker is not finding libOggFLAC or finding the wrong" echo "*** version of libOggFLAC. If it is not finding libOggFLAC, you'll need to set your" echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" echo "*** to the installed location Also, make sure you have run ldconfig if that" echo "*** is required on your system" echo "***" echo "*** If you have an old version installed, it is best to remove it, although" echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"], [ echo "*** The test program failed to compile or link. See the file config.log for the" echo "*** exact error that occured. This usually means libOggFLAC was incorrectly installed" echo "*** or that you have moved libOggFLAC since it was installed. In the latter case, you" echo "*** may want to edit the libOggFLAC-config script: $LIBOGGFLAC_CONFIG" ]) CFLAGS="$ac_save_CFLAGS" LIBS="$ac_save_LIBS" fi LIBOGGFLAC_CFLAGS="" LIBOGGFLAC_LIBS="" ifelse([$2], , :, [$2]) fi AC_SUBST(LIBOGGFLAC_CFLAGS) AC_SUBST(LIBOGGFLAC_LIBS) rm -f conf.libOggFLACtest ]) TiMidity++-2.13.2/autoconf/ogg.m40100644004711200001440000000676607515600037015553 0ustar tamukiusers# Configure paths for libogg # Jack Moffitt 10-21-2000 # Shamelessly stolen from Owen Taylor and Manish Singh dnl AM_PATH_OGG([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]) dnl Test for libogg, and define OGG_CFLAGS and OGG_LIBS dnl AC_DEFUN(AM_PATH_OGG, [dnl dnl Get the cflags and libraries dnl AC_ARG_WITH(ogg,[ --with-ogg=PFX Prefix where libogg is installed (optional)], ogg_prefix="$withval", ogg_prefix="") AC_ARG_WITH(ogg-libraries,[ --with-ogg-libraries=DIR Directory where libogg library is installed (optional)], ogg_libraries="$withval", ogg_libraries="") AC_ARG_WITH(ogg-includes,[ --with-ogg-includes=DIR Directory where libogg header files are installed (optional)], ogg_includes="$withval", ogg_includes="") AC_ARG_ENABLE(oggtest, [ --disable-oggtest Do not try to compile and run a test Ogg program],, enable_oggtest=yes) if test "x$ogg_libraries" != "x" ; then OGG_LIBS="-L$ogg_libraries" elif test "x$ogg_prefix" != "x" ; then OGG_LIBS="-L$ogg_prefix/lib" elif test "x$prefix" != "xNONE" ; then OGG_LIBS="-L$prefix/lib" fi OGG_LIBS="$OGG_LIBS -logg" if test "x$ogg_includes" != "x" ; then OGG_CFLAGS="-I$ogg_includes" elif test "x$ogg_prefix" != "x" ; then OGG_CFLAGS="-I$ogg_prefix/include" elif test "x$prefix" != "xNONE"; then OGG_CFLAGS="-I$prefix/include" fi AC_MSG_CHECKING(for Ogg) no_ogg="" if test "x$enable_oggtest" = "xyes" ; then ac_save_CFLAGS="$CFLAGS" ac_save_LIBS="$LIBS" CFLAGS="$CFLAGS $OGG_CFLAGS" LIBS="$LIBS $OGG_LIBS" dnl dnl Now check if the installed Ogg is sufficiently new. dnl rm -f conf.oggtest AC_TRY_RUN([ #include #include #include #include int main () { system("touch conf.oggtest"); return 0; } ],, no_ogg=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) CFLAGS="$ac_save_CFLAGS" LIBS="$ac_save_LIBS" fi if test "x$no_ogg" = "x" ; then AC_MSG_RESULT(yes) ifelse([$1], , :, [$1]) else AC_MSG_RESULT(no) if test -f conf.oggtest ; then : else echo "*** Could not run Ogg test program, checking why..." CFLAGS="$CFLAGS $OGG_CFLAGS" LIBS="$LIBS $OGG_LIBS" AC_TRY_LINK([ #include #include ], [ return 0; ], [ echo "*** The test program compiled, but did not run. This usually means" echo "*** that the run-time linker is not finding Ogg or finding the wrong" echo "*** version of Ogg. If it is not finding Ogg, you'll need to set your" echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" echo "*** to the installed location Also, make sure you have run ldconfig if that" echo "*** is required on your system" echo "***" echo "*** If you have an old version installed, it is best to remove it, although" echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"], [ echo "*** The test program failed to compile or link. See the file config.log for the" echo "*** exact error that occured. This usually means Ogg was incorrectly installed" echo "*** or that you have moved Ogg since it was installed. In the latter case, you" echo "*** may want to edit the ogg-config script: $OGG_CONFIG" ]) CFLAGS="$ac_save_CFLAGS" LIBS="$ac_save_LIBS" fi OGG_CFLAGS="" OGG_LIBS="" ifelse([$2], , :, [$2]) fi AC_SUBST(OGG_CFLAGS) AC_SUBST(OGG_LIBS) rm -f conf.oggtest ]) TiMidity++-2.13.2/autoconf/utils.m40100644004711200001440000001655007511601546016131 0ustar tamukiusersdnl TiMidity++ -- MIDI to WAVE converter and player dnl Copyright (C) 1999-2002 Masanao Izumo dnl Copyright (C) 1995 Tuukka Toivonen 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, dnl but WITHOUT ANY WARRANTY; without even the implied warranty of dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the dnl GNU 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 02111-1307 USA dnl MY_DEFINE(VARIABLE) AC_DEFUN(MY_DEFINE, [cat >> confdefs.h < dyna.c < fred.c < #$i_dlfcn I_DLFCN #ifdef I_DLFCN #include /* the dynamic linker include file for Sunos/Solaris */ #else #include #include #include #endif extern int fred() ; main() { void * handle ; void * symbol ; #ifndef RTLD_LAZY int mode = 1 ; #else int mode = RTLD_LAZY ; #endif handle = dlopen("./dyna.$so", mode) ; if (handle == NULL) { printf ("1\n") ; fflush (stdout) ; exit(0); } symbol = dlsym(handle, "fred") ; if (symbol == NULL) { /* try putting a leading underscore */ symbol = dlsym(handle, "_fred") ; if (symbol == NULL) { printf ("2\n") ; fflush (stdout) ; exit(0); } printf ("3\n") ; } else printf ("4\n") ; fflush (stdout) ; exit(0); } EOM : Call the object file tmp-dyna.o in case dlext=o. if ${CC-cc} $CFLAGS $SHCFLAGS $CPPFLAGS -c dyna.c > /dev/null 2>&1 && mv dyna.o tmp-dyna.o > /dev/null 2>&1 && $SHLD $SHLDFLAGS -o dyna.$so tmp-dyna.o > /dev/null 2>&1 && ${CC-cc} -o fred $CFLAGS $CPPFLAGS $LDFLAGS fred.c $LIBS $lib_dl_opt > /dev/null 2>&1; then xxx=`./fred` case $xxx in 1) AC_MSG_WARN(Test program failed using dlopen. Perhaps you should not use dynamic loading.) ;; 2) AC_MSG_WARN(Test program failed using dlsym. Perhaps you should not use dynamic loading.) ;; 3) timidity_cv_func_dlsym_underscore=yes ;; 4) timidity_cv_func_dlsym_underscore=no ;; esac else AC_MSG_WARN(I can't compile and run the test program.) fi rm -f dyna.c dyna.o dyna.$so tmp-dyna.o fred.c fred.o fred ]) case "x$timidity_cv_func_dlsym_underscore" in xyes) [$1] AC_MSG_RESULT(yes) ;; xno) [$2] AC_MSG_RESULT(no) ;; esac ]) dnl contains program from perl5 dnl CONTAINS_INIT() AC_DEFUN(CONTAINS_INIT, [dnl Some greps do not return status, grrr. AC_MSG_CHECKING(whether grep returns status) echo "grimblepritz" >grimble if grep blurfldyick grimble >/dev/null 2>&1 ; then contains="./contains" elif grep grimblepritz grimble >/dev/null 2>&1 ; then contains=grep else contains="./contains" fi rm -f grimble dnl the following should work in any shell case "$contains" in grep) AC_MSG_RESULT(yes) ;; ./contains) AC_MSG_RESULT(AGH! Grep doesn't return a status. Attempting remedial action.) cat >./contains <<'EOSS' grep "[$]1" "[$]2" >.greptmp && cat .greptmp && test -s .greptmp EOSS chmod +x "./contains" ;; esac ]) dnl CONTAINS(word,filename,action-if-found,action-if-not-found) AC_DEFUN(CONTAINS, [if $contains "^[$1]"'[$]' $2 >/dev/null 2>&1; then [$3] else [$4] fi ]) dnl SET_UNIQ_WORDS(shell-variable,words...) AC_DEFUN(SET_UNIQ_WORDS, [rm -f wordtmp >/dev/null 2>&1 val='' for f in $2; do CONTAINS([$f],wordtmp,:,[echo $f >>wordtmp; val="$val $f"]) done $1="$val" rm -f wordtmp >/dev/null 2>&1 ]) dnl WAPI_CHECK_FUNC(FUNCTION, INCLUDES, TEST-BODY, [ACTION-FI-FOUND [, ACTION-IF-NOT-FOUND]]) AC_DEFUN(WAPI_CHECK_FUNC, [AC_MSG_CHECKING(for $1) AC_CACHE_VAL(wapi_cv_func_$1, [AC_TRY_LINK([#include $2 ], [$3], wapi_cv_func_$1=yes, wapi_cv_func_$1=no)]) if eval "test \"`echo '$wapi_cv_func_'$1`\" = yes"; then AC_MSG_RESULT(yes) ifelse([$4], , :, [$4]) else AC_MSG_RESULT(no) ifelse([$5], , , [$5 ])dnl fi ]) dnl WAPI_CHECK_LIB(LIBRARY, FUNCTION, dnl INCLUDES, TEST-BODY dnl [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND dnl [, OTHER-LIBRARIES]]]) AC_DEFUN(WAPI_CHECK_LIB, [AC_MSG_CHECKING([for $2 in -l$1]) ac_lib_var=`echo $1['_']$2 | sed 'y%./+-%__p_%'` AC_CACHE_VAL(wapi_cv_lib_$ac_lib_var, [ac_save_LIBS="$LIBS" LIBS="-l$1 $7 $LIBS" AC_TRY_LINK([#include $3 ], [$4], eval "wapi_cv_lib_$ac_lib_var=yes", eval "wapi_cv_lib_$ac_lib_var=no") LIBS="$ac_save_LIBS" ])dnl if eval "test \"`echo '$wapi_cv_lib_'$ac_lib_var`\" = yes"; then AC_MSG_RESULT(yes) ifelse([$5], ,LIBS="-l$1 $LIBS", [$5]) else AC_MSG_RESULT(no) ifelse([$6], , , [$6 ])dnl fi ]) dnl EXTRACT_CPPFLAGS(CPPFLAGS-to-append,others-to-append,FLAGS) AC_DEFUN(EXTRACT_CPPFLAGS, [for f in $3; do case ".$f" in .-I?*|.-D?*) $1="[$]$1 $f" ;; *) $2="[$]$1 $f" ;; esac done ]) dnl CHECK_COMPILER_OPTION(OPTIONS [, ACTION-IF-SUCCEED [, ACTION-IF-FAILED]]) AC_DEFUN(CHECK_COMPILER_OPTION, [AC_MSG_CHECKING([whether -$1 option is recognized]) ac_ccoption=`echo $1 | sed 'y%./+-%__p_%'` AC_CACHE_VAL(timidity_cv_ccoption_$ac_ccoption, [cat > conftest.$ac_ext < conftest.out 2>&1; then if test -s conftest.out; then eval "timidity_cv_ccoption_$ac_ccoption=no" else eval "timidity_cv_ccoption_$ac_ccoption=yes" fi else eval "timidity_cv_ccoption_$ac_ccoption=no" fi ]) if eval "test \"`echo '$timidity_cv_ccoption_'$ac_ccoption`\" = yes"; then AC_MSG_RESULT(yes) ifelse([$2], , , [$2 ]) else AC_MSG_RESULT(no) ifelse([$3], , , [$3 ]) fi ]) dnl MY_SEARCH_LIBS(FUNCTION, LIBRARIES [, ACTION-IF-FOUND dnl [, ACTION-IF-NOT-FOUND [, OTHER-LIBRARIES]]]) dnl Search for a library defining FUNC, if it's not already available. AC_DEFUN(MY_SEARCH_LIBS, [AC_CACHE_CHECK([for library containing $1], [timidity_cv_search_$1], [ac_func_search_save_LIBS="$LIBS" timidity_cv_search_$1="no" for i in $2; do LIBS="$i $5 $ac_func_search_save_LIBS" AC_TRY_LINK_FUNC([$1], [timidity_cv_search_$1="$i"; break]) done LIBS="$ac_func_search_save_LIBS"]) if test "$timidity_cv_search_$1" != "no"; then $3 else : $4 fi])TiMidity++-2.13.2/autoconf/vorbis.m40100644004711200001440000000746207511600316016271 0ustar tamukiusers# Configure paths for libvorbis # Jack Moffitt 10-21-2000 # Shamelessly stolen from Owen Taylor and Manish Singh dnl AM_PATH_VORBIS([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]) dnl Test for libvorbis, and define VORBIS_CFLAGS and VORBIS_LIBS dnl AC_DEFUN(AM_PATH_VORBIS, [dnl dnl Get the cflags and libraries dnl AC_ARG_WITH(vorbis,[ --with-vorbis=PFX Prefix where libvorbis is installed (optional)], vorbis_prefix="$withval", vorbis_prefix="") AC_ARG_WITH(vorbis-libraries,[ --with-vorbis-libraries=DIR Directory where libvorbis library is installed (optional)], vorbis_libraries="$withval", vorbis_libraries="") AC_ARG_WITH(vorbis-includes,[ --with-vorbis-includes=DIR Directory where libvorbis header files are installed (optional)], vorbis_includes="$withval", vorbis_includes="") AC_ARG_ENABLE(vorbistest, [ --disable-vorbistest Do not try to compile and run a test Vorbis program],, enable_vorbistest=yes) if test "x$vorbis_libraries" != "x" ; then VORBIS_LIBS="-L$vorbis_libraries" elif test "x$vorbis_prefix" != "x" ; then VORBIS_LIBS="-L$vorbis_prefix/lib" elif test "x$prefix" != "xNONE"; then VORBIS_LIBS="-L$prefix/lib" fi VORBIS_LIBS="$VORBIS_LIBS -lvorbis -lm" VORBISFILE_LIBS="-lvorbisfile" VORBISENC_LIBS="-lvorbisenc" if test "x$vorbis_includes" != "x" ; then VORBIS_CFLAGS="-I$vorbis_includes" elif test "x$vorbis_prefix" != "x" ; then VORBIS_CFLAGS="-I$vorbis_prefix/include" elif test "x$prefix" != "xNONE"; then VORBIS_CFLAGS="-I$prefix/include" fi AC_MSG_CHECKING(for Vorbis) no_vorbis="" if test "x$enable_vorbistest" = "xyes" ; then ac_save_CFLAGS="$CFLAGS" ac_save_LIBS="$LIBS" CFLAGS="$CFLAGS $VORBIS_CFLAGS $OGG_CFLAGS" LIBS="$LIBS $VORBIS_LIBS $OGG_LIBS" dnl dnl Now check if the installed Vorbis is sufficiently new. dnl rm -f conf.vorbistest AC_TRY_RUN([ #include #include #include #include int main () { system("touch conf.vorbistest"); return 0; } ],, no_vorbis=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) CFLAGS="$ac_save_CFLAGS" LIBS="$ac_save_LIBS" fi if test "x$no_vorbis" = "x" ; then AC_MSG_RESULT(yes) ifelse([$1], , :, [$1]) else AC_MSG_RESULT(no) if test -f conf.vorbistest ; then : else echo "*** Could not run Vorbis test program, checking why..." CFLAGS="$CFLAGS $VORBIS_CFLAGS" LIBS="$LIBS $VORBIS_LIBS $OGG_LIBS" AC_TRY_LINK([ #include #include ], [ return 0; ], [ echo "*** The test program compiled, but did not run. This usually means" echo "*** that the run-time linker is not finding Vorbis or finding the wrong" echo "*** version of Vorbis. If it is not finding Vorbis, you'll need to set your" echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" echo "*** to the installed location Also, make sure you have run ldconfig if that" echo "*** is required on your system" echo "***" echo "*** If you have an old version installed, it is best to remove it, although" echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"], [ echo "*** The test program failed to compile or link. See the file config.log for the" echo "*** exact error that occured. This usually means Vorbis was incorrectly installed" echo "*** or that you have moved Vorbis since it was installed." ]) CFLAGS="$ac_save_CFLAGS" LIBS="$ac_save_LIBS" fi VORBIS_CFLAGS="" VORBIS_LIBS="" VORBISFILE_LIBS="" VORBISENC_LIBS="" ifelse([$2], , :, [$2]) fi AC_SUBST(VORBIS_CFLAGS) AC_SUBST(VORBIS_LIBS) AC_SUBST(VORBISFILE_LIBS) AC_SUBST(VORBISENC_LIBS) rm -f conf.vorbistest ]) TiMidity++-2.13.2/utils/0040755004711200001440000000000010031564160014034 5ustar tamukiusersTiMidity++-2.13.2/utils/Makefile.am0100644004711200001440000000477710056744111016107 0ustar tamukiusers# TiMidity++ -- MIDI to WAVE converter and player # Copyright (C) 1999-2002 Masanao Izumo # Copyright (C) 1995 Tuukka Toivonen # # 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA include $(top_srcdir)/common.makefile.in INCLUDES = \ -I$(top_srcdir)/libarc \ -I$(top_srcdir)/timidity noinst_LIBRARIES = libutils.a libutils_a_SOURCES = \ bitset.c \ bitset.h \ fft4g.c \ fft4g.h \ tmdy_getopt.h \ mblock.c \ mblock.h \ memb.c \ memb.h \ nkflib.c \ nkflib.h \ strtab.c \ strtab.h \ support.c \ support.h \ timer.c \ timer.h EXTRA_libutils_a_SOURCES = \ fft.c \ fft.h \ getopt.c \ support.c \ net.c \ net.h \ mac_util.c \ mac_util.h \ mac_readdir.c \ mac_readdir.h \ readdir.h \ readdir_win.c if NEEDGETOPT GETOPT_OBJS = getopt.$(OBJEXT) endif if ENABLE_NETWORK NET_OBJS = net.$(OBJEXT) endif if ENABLE_SOUND_SPEC SOUND_SPEC_OBJS = fft.$(OBJEXT) endif if W32READDIR W32READDIR_OBJS = readdir_win.$(OBJEXT) endif libutils_LIBADD= \ $(NET_OBJS) \ $(W32READDIR_OBJS) \ $(SOUND_SPEC_OBJS) \ $(GETOPT_OBJS) libutils_a_LIBADD=$(libutils_LIBADD) libutils.a: $(libutils_a_OBJECTS) $(libutils_a_DEPENDENCIES) if VCPP rm -f libutils.a rm -f utils.lib link -lib $(libutils_a_OBJECTS) $(libutils_LIBADD) -out:utils.lib if test -f utils.lib ; then touch $@ ; fi else if BORLANDC rm -f libutils.a rm -f utils.lib for foo in $(libutils_a_OBJECTS) $(libutils_a_LIBADD);do \ tlib utils.lib +$$foo; \ done if test -f utils.lib ; then touch $@ ; fi else if WATCOM_C rm -f libutils.a rm -f utils.lib for foo in $(libutils_a_OBJECTS) $(libutils_a_LIBADD);do \ wlib -q utils.lib +$$foo; \ done if test -f utils.lib ; then touch $@ ; fi else -rm -f libutils.a $(libutils_a_AR) libutils.a $(libutils_a_OBJECTS) $(libutils_a_LIBADD) $(RANLIB) libutils.a endif endif endif clean: rm -f *.$(OBJEXT) rm -f *.$(so) rm -f *.a rm -f *.lib TiMidity++-2.13.2/utils/Makefile.in0100644004711200001440000006227410124332440016106 0ustar tamukiusers# Makefile.in generated by automake 1.7.6 from Makefile.am. # @configure_input@ # Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 # 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@ # TiMidity++ -- MIDI to WAVE converter and player # Copyright (C) 1999-2002 Masanao Izumo # Copyright (C) 1995 Tuukka Toivonen # # 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # Define follows if you want to change. # Note that the definition of beginning with just one `#' implies # default value from configure. srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = .. am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ 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 = : host_triplet = @host@ pkgdatadir = @pkgdatadir@ #CC= @CC@ #CFLAGS = @CFLAGS@ # For pentium gcc # For PGCC #CPPFLAGS = @CPPFLAGS@ #DEFS = @DEFS@ #LDFLAGS = @LDFLAGS@ #LIBS = @LIBS@ #SHLD = @SHLD@ #SHCFLAGS = @SHCFLAGS@ #@SET_MAKE@ #prefix = @prefix@ #exec_prefix = @exec_prefix@ #bindir = @bindir@ #libdir = @libdir@ #datadir = @datadir@ #mandir = @mandir@ pkglibdir = @pkglibdir@ ACLOCAL = @ACLOCAL@ ALSA_CFLAGS = @ALSA_CFLAGS@ ALSA_LIBS = @ALSA_LIBS@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AO_CFLAGS = @AO_CFLAGS@ AO_LIBS = @AO_LIBS@ ARTS_CFLAGS = @ARTS_CFLAGS@ ARTS_CONFIG = @ARTS_CONFIG@ ARTS_LIBS = @ARTS_LIBS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ A_so_libs = @A_so_libs@ BORLANDC_FALSE = @BORLANDC_FALSE@ BORLANDC_LDFLAGS = @BORLANDC_LDFLAGS@ BORLANDC_START = @BORLANDC_START@ BORLANDC_TRUE = @BORLANDC_TRUE@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGNUS_FALSE = @CYGNUS_FALSE@ CYGNUS_TRUE = @CYGNUS_TRUE@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ELFILES = @ELFILES@ EMACS = @EMACS@ ENABLE_ALSASEQ_FALSE = @ENABLE_ALSASEQ_FALSE@ ENABLE_ALSASEQ_TRUE = @ENABLE_ALSASEQ_TRUE@ ENABLE_DYNAMIC_TCLTK_FALSE = @ENABLE_DYNAMIC_TCLTK_FALSE@ ENABLE_DYNAMIC_TCLTK_TRUE = @ENABLE_DYNAMIC_TCLTK_TRUE@ ENABLE_DYNAMIC_XAW_FALSE = @ENABLE_DYNAMIC_XAW_FALSE@ ENABLE_DYNAMIC_XAW_TRUE = @ENABLE_DYNAMIC_XAW_TRUE@ ENABLE_EMACS_FALSE = @ENABLE_EMACS_FALSE@ ENABLE_EMACS_TRUE = @ENABLE_EMACS_TRUE@ ENABLE_GTK_FALSE = @ENABLE_GTK_FALSE@ ENABLE_GTK_TRUE = @ENABLE_GTK_TRUE@ ENABLE_MOTIF_FALSE = @ENABLE_MOTIF_FALSE@ ENABLE_MOTIF_TRUE = @ENABLE_MOTIF_TRUE@ ENABLE_NCURSES_FALSE = @ENABLE_NCURSES_FALSE@ ENABLE_NCURSES_TRUE = @ENABLE_NCURSES_TRUE@ ENABLE_NETWORK_FALSE = @ENABLE_NETWORK_FALSE@ ENABLE_NETWORK_TRUE = @ENABLE_NETWORK_TRUE@ ENABLE_PLUGIN_FALSE = @ENABLE_PLUGIN_FALSE@ ENABLE_PLUGIN_TRUE = @ENABLE_PLUGIN_TRUE@ ENABLE_PORTMIDISYN_FALSE = @ENABLE_PORTMIDISYN_FALSE@ ENABLE_PORTMIDISYN_TRUE = @ENABLE_PORTMIDISYN_TRUE@ ENABLE_SERVER_FALSE = @ENABLE_SERVER_FALSE@ ENABLE_SERVER_TRUE = @ENABLE_SERVER_TRUE@ ENABLE_SLANG_FALSE = @ENABLE_SLANG_FALSE@ ENABLE_SLANG_TRUE = @ENABLE_SLANG_TRUE@ ENABLE_SOUND_SPEC_FALSE = @ENABLE_SOUND_SPEC_FALSE@ ENABLE_SOUND_SPEC_TRUE = @ENABLE_SOUND_SPEC_TRUE@ ENABLE_TCLTK_FALSE = @ENABLE_TCLTK_FALSE@ ENABLE_TCLTK_TRUE = @ENABLE_TCLTK_TRUE@ ENABLE_VT100_FALSE = @ENABLE_VT100_FALSE@ ENABLE_VT100_TRUE = @ENABLE_VT100_TRUE@ ENABLE_W32GUI_FALSE = @ENABLE_W32GUI_FALSE@ ENABLE_W32GUI_TRUE = @ENABLE_W32GUI_TRUE@ ENABLE_W32G_SYN_FALSE = @ENABLE_W32G_SYN_FALSE@ ENABLE_W32G_SYN_TRUE = @ENABLE_W32G_SYN_TRUE@ ENABLE_WINSYN_FALSE = @ENABLE_WINSYN_FALSE@ ENABLE_WINSYN_TRUE = @ENABLE_WINSYN_TRUE@ ENABLE_WRD_FALSE = @ENABLE_WRD_FALSE@ ENABLE_WRD_TRUE = @ENABLE_WRD_TRUE@ ENABLE_XAW_FALSE = @ENABLE_XAW_FALSE@ ENABLE_XAW_TRUE = @ENABLE_XAW_TRUE@ ENABLE_XSKIN_FALSE = @ENABLE_XSKIN_FALSE@ ENABLE_XSKIN_TRUE = @ENABLE_XSKIN_TRUE@ ESD_CFLAGS = @ESD_CFLAGS@ ESD_CONFIG = @ESD_CONFIG@ ESD_LIBS = @ESD_LIBS@ EXEEXT = @EXEEXT@ EXTRALIBS = @EXTRALIBS@ GTK_CFLAGS = @GTK_CFLAGS@ GTK_CONFIG = @GTK_CONFIG@ GTK_LIBS = @GTK_LIBS@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INTERFACE_SRCS = @INTERFACE_SRCS@ LDFLAGS = @LDFLAGS@ LIBFLAC_CFLAGS = @LIBFLAC_CFLAGS@ LIBFLAC_LIBS = @LIBFLAC_LIBS@ LIBOBJS = @LIBOBJS@ LIBOGGFLAC_CFLAGS = @LIBOGGFLAC_CFLAGS@ LIBOGGFLAC_LIBS = @LIBOGGFLAC_LIBS@ LIBS = @LIBS@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ MAKEINFO = @MAKEINFO@ MSYS_FALSE = @MSYS_FALSE@ MSYS_TRUE = @MSYS_TRUE@ NEEDDLOPEN_FALSE = @NEEDDLOPEN_FALSE@ NEEDDLOPEN_TRUE = @NEEDDLOPEN_TRUE@ NEEDGETOPT_FALSE = @NEEDGETOPT_FALSE@ NEEDGETOPT_TRUE = @NEEDGETOPT_TRUE@ NETSRCS = @NETSRCS@ OBJEXT = @OBJEXT@ OGG_CFLAGS = @OGG_CFLAGS@ OGG_LIBS = @OGG_LIBS@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PKG_CONFIG = @PKG_CONFIG@ P_so_libs = @P_so_libs@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ SHCFLAGS = @SHCFLAGS@ SHELL = @SHELL@ SHLD = @SHLD@ STRIP = @STRIP@ SYSEXTRAS = @SYSEXTRAS@ T_so_libs = @T_so_libs@ VCPP_FALSE = @VCPP_FALSE@ VCPP_LDFLAGS = @VCPP_LDFLAGS@ VCPP_TRUE = @VCPP_TRUE@ VERSION = @VERSION@ VORBISENC_LIBS = @VORBISENC_LIBS@ VORBISFILE_LIBS = @VORBISFILE_LIBS@ VORBIS_CFLAGS = @VORBIS_CFLAGS@ VORBIS_LIBS = @VORBIS_LIBS@ W32READDIR_FALSE = @W32READDIR_FALSE@ W32READDIR_TRUE = @W32READDIR_TRUE@ WATCOM_C_FALSE = @WATCOM_C_FALSE@ WATCOM_C_TRUE = @WATCOM_C_TRUE@ WATCOM_LDFLAGS = @WATCOM_LDFLAGS@ WISH = @WISH@ W_so_libs = @W_so_libs@ X_CFLAGS = @X_CFLAGS@ X_EXTRA_LIBS = @X_EXTRA_LIBS@ X_LIBS = @X_LIBS@ X_PRE_LIBS = @X_PRE_LIBS@ a_so_libs = @a_so_libs@ ac_ct_CC = @ac_ct_CC@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ datadir = @datadir@ dynamic_targets = @dynamic_targets@ e_so_libs = @e_so_libs@ exec_prefix = @exec_prefix@ g_so_libs = @g_so_libs@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ i_so_libs = @i_so_libs@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ k_so_libs = @k_so_libs@ libdir = @libdir@ libexecdir = @libexecdir@ lispdir = @lispdir@ localstatedir = @localstatedir@ m_so_libs = @m_so_libs@ mandir = @mandir@ n_so_libs = @n_so_libs@ oldincludedir = @oldincludedir@ p_so_libs = @p_so_libs@ prefix = @prefix@ program_transform_name = @program_transform_name@ r_so_libs = @r_so_libs@ s_so_libs = @s_so_libs@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ so = @so@ sysconfdir = @sysconfdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ tcltk_dep = @tcltk_dep@ timidity_LDFLAGS = @timidity_LDFLAGS@ w_so_libs = @w_so_libs@ #INSTALL = @INSTALL@ # Where to install the patches, config files. PKGDATADIR = $(pkgdatadir) # Where to install the Tcl code and the bitmaps. # It also contains bitmaps which are shared with XAW interface. PKGLIBDIR = $(pkglibdir) # Where to install the dynamic link interface. SHLIB_DIR = $(pkglibdir) # Where to install timidity.el ELISP_DIR = $(lispdir) # If you want to change TCL_DIR, please do follows. # * Add -DTKPROGPATH=\"$(TCL_DIR)/tkmidity.tcl\" to CPPFLAGS. # * Make a symbolic link $(PKGLIBDIR)/bitmaps to $(TCL_DIR)/bitmaps TCL_DIR = $(PKGLIBDIR) # Define the timidity default file search path. DEF_DEFAULT_PATH = -DDEFAULT_PATH=\"$(PKGDATADIR)\" # You sould not change follows definitions. DEF_PKGDATADIR = -DPKGDATADIR=\"$(PKGDATADIR)\" DEF_PKGLIBDIR = -DPKGLIBDIR=\"$(PKGLIBDIR)\" DEF_SHLIB_DIR = -DSHLIB_DIR=\"$(SHLIB_DIR)\" BITMAP_DIR = $(TCL_DIR)/bitmaps INCLUDES = \ -I$(top_srcdir)/libarc \ -I$(top_srcdir)/timidity noinst_LIBRARIES = libutils.a libutils_a_SOURCES = \ bitset.c \ bitset.h \ fft4g.c \ fft4g.h \ tmdy_getopt.h \ mblock.c \ mblock.h \ memb.c \ memb.h \ nkflib.c \ nkflib.h \ strtab.c \ strtab.h \ support.c \ support.h \ timer.c \ timer.h EXTRA_libutils_a_SOURCES = \ fft.c \ fft.h \ getopt.c \ support.c \ net.c \ net.h \ mac_util.c \ mac_util.h \ mac_readdir.c \ mac_readdir.h \ readdir.h \ readdir_win.c @NEEDGETOPT_TRUE@GETOPT_OBJS = getopt.$(OBJEXT) @ENABLE_NETWORK_TRUE@NET_OBJS = net.$(OBJEXT) @ENABLE_SOUND_SPEC_TRUE@SOUND_SPEC_OBJS = fft.$(OBJEXT) @W32READDIR_TRUE@W32READDIR_OBJS = readdir_win.$(OBJEXT) libutils_LIBADD = \ $(NET_OBJS) \ $(W32READDIR_OBJS) \ $(SOUND_SPEC_OBJS) \ $(GETOPT_OBJS) libutils_a_LIBADD = $(libutils_LIBADD) subdir = utils ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 mkinstalldirs = $(SHELL) $(top_srcdir)/autoconf/mkinstalldirs CONFIG_HEADER = $(top_builddir)/config.h $(top_builddir)/interface.h CONFIG_CLEAN_FILES = LIBRARIES = $(noinst_LIBRARIES) libutils_a_AR = $(AR) cru @ENABLE_NETWORK_FALSE@@ENABLE_SOUND_SPEC_FALSE@@NEEDGETOPT_FALSE@@W32READDIR_TRUE@libutils_a_DEPENDENCIES = \ @ENABLE_NETWORK_FALSE@@ENABLE_SOUND_SPEC_FALSE@@NEEDGETOPT_FALSE@@W32READDIR_TRUE@ readdir_win.$(OBJEXT) @ENABLE_NETWORK_FALSE@@ENABLE_SOUND_SPEC_FALSE@@NEEDGETOPT_FALSE@@W32READDIR_FALSE@libutils_a_DEPENDENCIES = @ENABLE_NETWORK_FALSE@@ENABLE_SOUND_SPEC_FALSE@@NEEDGETOPT_TRUE@@W32READDIR_TRUE@libutils_a_DEPENDENCIES = \ @ENABLE_NETWORK_FALSE@@ENABLE_SOUND_SPEC_FALSE@@NEEDGETOPT_TRUE@@W32READDIR_TRUE@ readdir_win.$(OBJEXT) \ @ENABLE_NETWORK_FALSE@@ENABLE_SOUND_SPEC_FALSE@@NEEDGETOPT_TRUE@@W32READDIR_TRUE@ getopt.$(OBJEXT) @ENABLE_NETWORK_FALSE@@ENABLE_SOUND_SPEC_FALSE@@NEEDGETOPT_TRUE@@W32READDIR_FALSE@libutils_a_DEPENDENCIES = \ @ENABLE_NETWORK_FALSE@@ENABLE_SOUND_SPEC_FALSE@@NEEDGETOPT_TRUE@@W32READDIR_FALSE@ getopt.$(OBJEXT) @ENABLE_NETWORK_FALSE@@ENABLE_SOUND_SPEC_TRUE@@NEEDGETOPT_FALSE@@W32READDIR_TRUE@libutils_a_DEPENDENCIES = \ @ENABLE_NETWORK_FALSE@@ENABLE_SOUND_SPEC_TRUE@@NEEDGETOPT_FALSE@@W32READDIR_TRUE@ readdir_win.$(OBJEXT) \ @ENABLE_NETWORK_FALSE@@ENABLE_SOUND_SPEC_TRUE@@NEEDGETOPT_FALSE@@W32READDIR_TRUE@ fft.$(OBJEXT) @ENABLE_NETWORK_FALSE@@ENABLE_SOUND_SPEC_TRUE@@NEEDGETOPT_FALSE@@W32READDIR_FALSE@libutils_a_DEPENDENCIES = \ @ENABLE_NETWORK_FALSE@@ENABLE_SOUND_SPEC_TRUE@@NEEDGETOPT_FALSE@@W32READDIR_FALSE@ fft.$(OBJEXT) @ENABLE_NETWORK_FALSE@@ENABLE_SOUND_SPEC_TRUE@@NEEDGETOPT_TRUE@@W32READDIR_TRUE@libutils_a_DEPENDENCIES = \ @ENABLE_NETWORK_FALSE@@ENABLE_SOUND_SPEC_TRUE@@NEEDGETOPT_TRUE@@W32READDIR_TRUE@ readdir_win.$(OBJEXT) \ @ENABLE_NETWORK_FALSE@@ENABLE_SOUND_SPEC_TRUE@@NEEDGETOPT_TRUE@@W32READDIR_TRUE@ fft.$(OBJEXT) \ @ENABLE_NETWORK_FALSE@@ENABLE_SOUND_SPEC_TRUE@@NEEDGETOPT_TRUE@@W32READDIR_TRUE@ getopt.$(OBJEXT) @ENABLE_NETWORK_FALSE@@ENABLE_SOUND_SPEC_TRUE@@NEEDGETOPT_TRUE@@W32READDIR_FALSE@libutils_a_DEPENDENCIES = \ @ENABLE_NETWORK_FALSE@@ENABLE_SOUND_SPEC_TRUE@@NEEDGETOPT_TRUE@@W32READDIR_FALSE@ fft.$(OBJEXT) \ @ENABLE_NETWORK_FALSE@@ENABLE_SOUND_SPEC_TRUE@@NEEDGETOPT_TRUE@@W32READDIR_FALSE@ getopt.$(OBJEXT) @ENABLE_NETWORK_TRUE@@ENABLE_SOUND_SPEC_FALSE@@NEEDGETOPT_FALSE@@W32READDIR_TRUE@libutils_a_DEPENDENCIES = \ @ENABLE_NETWORK_TRUE@@ENABLE_SOUND_SPEC_FALSE@@NEEDGETOPT_FALSE@@W32READDIR_TRUE@ net.$(OBJEXT) \ @ENABLE_NETWORK_TRUE@@ENABLE_SOUND_SPEC_FALSE@@NEEDGETOPT_FALSE@@W32READDIR_TRUE@ readdir_win.$(OBJEXT) @ENABLE_NETWORK_TRUE@@ENABLE_SOUND_SPEC_FALSE@@NEEDGETOPT_FALSE@@W32READDIR_FALSE@libutils_a_DEPENDENCIES = \ @ENABLE_NETWORK_TRUE@@ENABLE_SOUND_SPEC_FALSE@@NEEDGETOPT_FALSE@@W32READDIR_FALSE@ net.$(OBJEXT) @ENABLE_NETWORK_TRUE@@ENABLE_SOUND_SPEC_FALSE@@NEEDGETOPT_TRUE@@W32READDIR_TRUE@libutils_a_DEPENDENCIES = \ @ENABLE_NETWORK_TRUE@@ENABLE_SOUND_SPEC_FALSE@@NEEDGETOPT_TRUE@@W32READDIR_TRUE@ net.$(OBJEXT) \ @ENABLE_NETWORK_TRUE@@ENABLE_SOUND_SPEC_FALSE@@NEEDGETOPT_TRUE@@W32READDIR_TRUE@ readdir_win.$(OBJEXT) \ @ENABLE_NETWORK_TRUE@@ENABLE_SOUND_SPEC_FALSE@@NEEDGETOPT_TRUE@@W32READDIR_TRUE@ getopt.$(OBJEXT) @ENABLE_NETWORK_TRUE@@ENABLE_SOUND_SPEC_FALSE@@NEEDGETOPT_TRUE@@W32READDIR_FALSE@libutils_a_DEPENDENCIES = \ @ENABLE_NETWORK_TRUE@@ENABLE_SOUND_SPEC_FALSE@@NEEDGETOPT_TRUE@@W32READDIR_FALSE@ net.$(OBJEXT) \ @ENABLE_NETWORK_TRUE@@ENABLE_SOUND_SPEC_FALSE@@NEEDGETOPT_TRUE@@W32READDIR_FALSE@ getopt.$(OBJEXT) @ENABLE_NETWORK_TRUE@@ENABLE_SOUND_SPEC_TRUE@@NEEDGETOPT_FALSE@@W32READDIR_TRUE@libutils_a_DEPENDENCIES = \ @ENABLE_NETWORK_TRUE@@ENABLE_SOUND_SPEC_TRUE@@NEEDGETOPT_FALSE@@W32READDIR_TRUE@ net.$(OBJEXT) \ @ENABLE_NETWORK_TRUE@@ENABLE_SOUND_SPEC_TRUE@@NEEDGETOPT_FALSE@@W32READDIR_TRUE@ readdir_win.$(OBJEXT) \ @ENABLE_NETWORK_TRUE@@ENABLE_SOUND_SPEC_TRUE@@NEEDGETOPT_FALSE@@W32READDIR_TRUE@ fft.$(OBJEXT) @ENABLE_NETWORK_TRUE@@ENABLE_SOUND_SPEC_TRUE@@NEEDGETOPT_FALSE@@W32READDIR_FALSE@libutils_a_DEPENDENCIES = \ @ENABLE_NETWORK_TRUE@@ENABLE_SOUND_SPEC_TRUE@@NEEDGETOPT_FALSE@@W32READDIR_FALSE@ net.$(OBJEXT) \ @ENABLE_NETWORK_TRUE@@ENABLE_SOUND_SPEC_TRUE@@NEEDGETOPT_FALSE@@W32READDIR_FALSE@ fft.$(OBJEXT) @ENABLE_NETWORK_TRUE@@ENABLE_SOUND_SPEC_TRUE@@NEEDGETOPT_TRUE@@W32READDIR_TRUE@libutils_a_DEPENDENCIES = \ @ENABLE_NETWORK_TRUE@@ENABLE_SOUND_SPEC_TRUE@@NEEDGETOPT_TRUE@@W32READDIR_TRUE@ net.$(OBJEXT) \ @ENABLE_NETWORK_TRUE@@ENABLE_SOUND_SPEC_TRUE@@NEEDGETOPT_TRUE@@W32READDIR_TRUE@ readdir_win.$(OBJEXT) \ @ENABLE_NETWORK_TRUE@@ENABLE_SOUND_SPEC_TRUE@@NEEDGETOPT_TRUE@@W32READDIR_TRUE@ fft.$(OBJEXT) \ @ENABLE_NETWORK_TRUE@@ENABLE_SOUND_SPEC_TRUE@@NEEDGETOPT_TRUE@@W32READDIR_TRUE@ getopt.$(OBJEXT) @ENABLE_NETWORK_TRUE@@ENABLE_SOUND_SPEC_TRUE@@NEEDGETOPT_TRUE@@W32READDIR_FALSE@libutils_a_DEPENDENCIES = \ @ENABLE_NETWORK_TRUE@@ENABLE_SOUND_SPEC_TRUE@@NEEDGETOPT_TRUE@@W32READDIR_FALSE@ net.$(OBJEXT) \ @ENABLE_NETWORK_TRUE@@ENABLE_SOUND_SPEC_TRUE@@NEEDGETOPT_TRUE@@W32READDIR_FALSE@ fft.$(OBJEXT) \ @ENABLE_NETWORK_TRUE@@ENABLE_SOUND_SPEC_TRUE@@NEEDGETOPT_TRUE@@W32READDIR_FALSE@ getopt.$(OBJEXT) am_libutils_a_OBJECTS = bitset.$(OBJEXT) fft4g.$(OBJEXT) \ mblock.$(OBJEXT) memb.$(OBJEXT) nkflib.$(OBJEXT) \ strtab.$(OBJEXT) support.$(OBJEXT) timer.$(OBJEXT) libutils_a_OBJECTS = $(am_libutils_a_OBJECTS) DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/autoconf/depcomp am__depfiles_maybe = depfiles @AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/bitset.Po ./$(DEPDIR)/fft.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/fft4g.Po ./$(DEPDIR)/getopt.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/mac_readdir.Po ./$(DEPDIR)/mac_util.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/mblock.Po ./$(DEPDIR)/memb.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/net.Po ./$(DEPDIR)/nkflib.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/readdir_win.Po ./$(DEPDIR)/strtab.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/support.Po ./$(DEPDIR)/timer.Po COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ DIST_SOURCES = $(libutils_a_SOURCES) $(EXTRA_libutils_a_SOURCES) DIST_COMMON = $(top_srcdir)/common.makefile.in Makefile.am Makefile.in SOURCES = $(libutils_a_SOURCES) $(EXTRA_libutils_a_SOURCES) all: all-am .SUFFIXES: .SUFFIXES: .c .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/common.makefile.in $(top_srcdir)/configure.in $(ACLOCAL_M4) cd $(top_srcdir) && \ $(AUTOMAKE) --gnu utils/Makefile Makefile: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.in $(top_builddir)/config.status cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) AR = ar clean-noinstLIBRARIES: -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) mostlyclean-compile: -rm -f *.$(OBJEXT) core *.core distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bitset.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fft.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fft4g.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getopt.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mac_readdir.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mac_util.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mblock.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/memb.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/net.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nkflib.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/readdir_win.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strtab.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/support.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/timer.Po@am__quote@ distclean-depend: -rm -rf ./$(DEPDIR) .c.o: @am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ @am__fastdepCC_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ @am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ @am__fastdepCC_TRUE@ fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `test -f '$<' || echo '$(srcdir)/'`$< .c.obj: @am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ @am__fastdepCC_TRUE@ -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ @am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ @am__fastdepCC_TRUE@ fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi` uninstall-info-am: ETAGS = etags ETAGSFLAGS = CTAGS = ctags CTAGSFLAGS = tags: TAGS ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ mkid -fID $$unique TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ test -z "$(ETAGS_ARGS)$$tags$$unique" \ || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$tags $$unique ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ test -z "$(CTAGS_ARGS)$$tags$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$tags $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && cd $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) $$here distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) top_distdir = .. distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) distdir: $(DISTFILES) $(mkinstalldirs) $(distdir)/.. @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ list='$(DISTFILES)'; for file in $$list; do \ case $$file in \ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ esac; \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ $(mkinstalldirs) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ if test -d $$d/$$file; then \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ cp -pR $$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 $(LIBRARIES) 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: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -rm -f Makefile $(CONFIG_CLEAN_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 clean-noinstLIBRARIES mostlyclean-am distclean: distclean-am distclean-am: clean-am distclean-compile distclean-depend \ distclean-generic distclean-tags dvi: dvi-am dvi-am: info: info-am info-am: install-data-am: install-exec-am: install-info: install-info-am install-man: installcheck-am: maintainer-clean: maintainer-clean-am 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-info-am .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-noinstLIBRARIES ctags distclean distclean-compile \ distclean-depend distclean-generic distclean-tags distdir dvi \ dvi-am info info-am install install-am install-data \ install-data-am install-exec install-exec-am install-info \ install-info-am install-man install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \ uninstall-am uninstall-info-am libutils.a: $(libutils_a_OBJECTS) $(libutils_a_DEPENDENCIES) @VCPP_TRUE@ rm -f libutils.a @VCPP_TRUE@ rm -f utils.lib @VCPP_TRUE@ link -lib $(libutils_a_OBJECTS) $(libutils_LIBADD) -out:utils.lib @VCPP_TRUE@ if test -f utils.lib ; then touch $@ ; fi @BORLANDC_TRUE@@VCPP_FALSE@ rm -f libutils.a @BORLANDC_TRUE@@VCPP_FALSE@ rm -f utils.lib @BORLANDC_TRUE@@VCPP_FALSE@ for foo in $(libutils_a_OBJECTS) $(libutils_a_LIBADD);do \ @BORLANDC_TRUE@@VCPP_FALSE@ tlib utils.lib +$$foo; \ @BORLANDC_TRUE@@VCPP_FALSE@ done @BORLANDC_TRUE@@VCPP_FALSE@ if test -f utils.lib ; then touch $@ ; fi @BORLANDC_FALSE@@VCPP_FALSE@@WATCOM_C_TRUE@ rm -f libutils.a @BORLANDC_FALSE@@VCPP_FALSE@@WATCOM_C_TRUE@ rm -f utils.lib @BORLANDC_FALSE@@VCPP_FALSE@@WATCOM_C_TRUE@ for foo in $(libutils_a_OBJECTS) $(libutils_a_LIBADD);do \ @BORLANDC_FALSE@@VCPP_FALSE@@WATCOM_C_TRUE@ wlib -q utils.lib +$$foo; \ @BORLANDC_FALSE@@VCPP_FALSE@@WATCOM_C_TRUE@ done @BORLANDC_FALSE@@VCPP_FALSE@@WATCOM_C_TRUE@ if test -f utils.lib ; then touch $@ ; fi @BORLANDC_FALSE@@VCPP_FALSE@@WATCOM_C_FALSE@ -rm -f libutils.a @BORLANDC_FALSE@@VCPP_FALSE@@WATCOM_C_FALSE@ $(libutils_a_AR) libutils.a $(libutils_a_OBJECTS) $(libutils_a_LIBADD) @BORLANDC_FALSE@@VCPP_FALSE@@WATCOM_C_FALSE@ $(RANLIB) libutils.a clean: rm -f *.$(OBJEXT) rm -f *.$(so) rm -f *.a rm -f *.lib # 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: TiMidity++-2.13.2/utils/bitset.c0100644004711200001440000001670607421005037015503 0ustar tamukiusers/* TiMidity++ -- MIDI to WAVE converter and player Copyright (C) 1999-2002 Masanao Izumo Copyright (C) 1995 Tuukka Toivonen 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA bitset.c Author: Masanao Izumo Create: Sun Mar 02 1997 */ #ifdef HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ #include #include #ifndef NO_STRING_H #include #else #include #endif #include "timidity.h" #include "common.h" #include "bitset.h" #define CUTUP(n) (((n) + BIT_CHUNK_SIZE - 1) & ~(BIT_CHUNK_SIZE - 1)) #define CUTDOWN(n) ((n) & ~(BIT_CHUNK_SIZE - 1)) /* n ӥåȤ 1 */ #define RFILLBITS(n) ((1u << (n)) - 1) /* n ӥåȤ 1 */ #define LFILLBITS(n) (RFILLBITS(n) << (BIT_CHUNK_SIZE - (n))) static void print_uibits(unsigned int x) { unsigned int mask; for(mask = (1u << (BIT_CHUNK_SIZE-1)); mask; mask >>= 1) if(mask & x) putchar('1'); else putchar('0'); } /* bitset ɽ */ void print_bitset(Bitset *bitset) { int i, n; unsigned int mask; n = CUTDOWN(bitset->nbits)/BIT_CHUNK_SIZE; for(i = 0; i < n; i++) { print_uibits(bitset->bits[i]); #if 0 putchar(','); #endif } n = bitset->nbits - CUTDOWN(bitset->nbits); mask = (1u << (BIT_CHUNK_SIZE-1)); while(n--) { if(mask & bitset->bits[i]) putchar('1'); else putchar('0'); mask >>= 1; } } /* * Bitset ν * 塢ƤΥӥåȤ 0 ˽ */ void init_bitset(Bitset *bitset, int nbits) { bitset->bits = (unsigned int *) safe_malloc((CUTUP(nbits) / BIT_CHUNK_SIZE) * sizeof(unsigned int)); bitset->nbits = nbits; memset(bitset->bits, 0, (CUTUP(nbits) / BIT_CHUNK_SIZE) * sizeof(int)); } /* * start ܤΥӥåȤ顢nbit ʬ0 ˥åȤ롣 */ void clear_bitset(Bitset *bitset, int start, int nbits) { int i, j, sbitoff, ebitoff; unsigned int mask; if(nbits == 0 || start < 0 || start >= bitset->nbits) return; if(start + nbits > bitset->nbits) nbits = bitset->nbits - start; i = CUTDOWN(start); sbitoff = start - i; /* ¦ n ӥåܤ饹 */ i /= BIT_CHUNK_SIZE; /* i ܤ */ j = CUTDOWN(start + nbits - 1); ebitoff = start + nbits - j; /* ¦ n ӥåܤޤ */ /* ebitoff := [1 ... BIT_CHUNK_SIZE] */ j /= BIT_CHUNK_SIZE; /* j ܤޤ */ /* ¦ sbitoff ӥåȤޤǤ 1, ʳ 0 */ mask = LFILLBITS(sbitoff); if(i == j) /* 1 Ĥ Chunk */ { /* ¦ ebitoff ʹߤ 1 */ mask |= RFILLBITS(BIT_CHUNK_SIZE - ebitoff); bitset->bits[i] &= mask; return; } bitset->bits[i] &= mask; for(i++; i < j; i++) bitset->bits[i] = 0; mask = RFILLBITS(BIT_CHUNK_SIZE - ebitoff); bitset->bits[i] &= mask; } /* * start ӥåȤ顢nbits ʬbits ˥åȤ */ void set_bitset(Bitset *bitset, const unsigned int *bits, int start, int nbits) { int i, j, lsbitoff, rsbitoff, ebitoff; unsigned int mask; if(nbits == 0 || start < 0 || start >= bitset->nbits) return; if(start + nbits > bitset->nbits) nbits = bitset->nbits - start; i = CUTDOWN(start); lsbitoff = start - i; /* ¦ n ӥåܤ饹 */ rsbitoff = BIT_CHUNK_SIZE - lsbitoff; /* ¦ n ӥåܤ饹 */ i /= BIT_CHUNK_SIZE; /* i ܤ */ j = CUTDOWN(start + nbits - 1); ebitoff = start + nbits - j; /* ¦ n ӥåܤޤ */ /* ebitoff := [1 ... BIT_CHUNK_SIZE] */ j /= BIT_CHUNK_SIZE; /* j ܤޤ */ /* ¦ lsbitoff ӥåȤޤǤ 1, ʳ 0 */ mask = LFILLBITS(lsbitoff); if(i == j) /* 1 Ĥ Chunk */ { mask |= RFILLBITS(BIT_CHUNK_SIZE - ebitoff); bitset->bits[i] = ((~mask & (*bits >> lsbitoff)) | (mask & bitset->bits[i])); return; } /* |1 2 3 4|1 2 3[...] * \ \ \ * \ \ \ * |1 2 3 4|1 2 3 4|1 2 3 4|... */ bitset->bits[i] = ((~mask & (*bits >> lsbitoff)) | (mask & bitset->bits[i])); i++; bits++; for(; i < j; i++) { bitset->bits[i] = ((bits[-1] << rsbitoff) | (bits[0] >> lsbitoff)); bits++; } mask = LFILLBITS(ebitoff); bitset->bits[i] = ((bits[-1] << rsbitoff) | ((mask & bits[0]) >> lsbitoff) | (~mask & bitset->bits[i])); } /* * start ӥåȤ顢nbits ʬ */ void get_bitset(const Bitset *bitset, unsigned int *bits, int start, int nbits) { int i, j, lsbitoff, rsbitoff, ebitoff; memset(bits, 0, CUTUP(nbits) / 8); if(nbits == 0 || start < 0 || start >= bitset->nbits) return; if(start + nbits > bitset->nbits) nbits = bitset->nbits - start; i = CUTDOWN(start); lsbitoff = start - i; /* ¦ n ӥåܤ饹 */ rsbitoff = BIT_CHUNK_SIZE - lsbitoff; /* ¦ n ӥåܤ饹 */ i /= BIT_CHUNK_SIZE; /* i ܤ */ j = CUTDOWN(start + nbits - 1); ebitoff = start + nbits - j; /* ¦ n ӥåܤޤ */ /* ebitoff := [1 ... BIT_CHUNK_SIZE] */ j /= BIT_CHUNK_SIZE; /* j ܤޤ */ if(i == j) /* 1 Ĥ Chunk */ { unsigned int mask; mask = LFILLBITS(lsbitoff) | RFILLBITS(BIT_CHUNK_SIZE - ebitoff); *bits = (~mask & bitset->bits[i]) << lsbitoff; return; } /* |1 2 3 4|1 2 3 4|1 2 3 4|... * / / . / * / / . / * |1 2 3 4|1 2 3[...] */ for(; i < j; i++) { *bits = ((bitset->bits[i] << lsbitoff) | (bitset->bits[i + 1] >> rsbitoff)); bits++; } if(ebitoff < lsbitoff) bits[-1] &= LFILLBITS(BIT_CHUNK_SIZE + ebitoff - lsbitoff); else *bits = (bitset->bits[i] << lsbitoff) & LFILLBITS(ebitoff - lsbitoff); } /* * bitset 1 ӥåȤޤޤƤʤ 0 ֤ * 1 ӥåȤǤޤޤƤ 1 ֤ */ unsigned int has_bitset(const Bitset *bitset) { int i, n; const unsigned int *p; n = CUTUP(bitset->nbits) / BIT_CHUNK_SIZE; p = bitset->bits; for(i = 0; i < n; i++) if(p[i]) return 1; return 0; } int get_bitset1(Bitset *bitset, int n) { int i; if(n < 0 || n >= bitset->nbits) return 0; i = BIT_CHUNK_SIZE - n - 1; return (bitset->bits[n / BIT_CHUNK_SIZE] & (1u << i)) >> i; } void set_bitset1(Bitset *bitset, int n, int bit) { if(n < 0 || n >= bitset->nbits) return; if(bit) bitset->bits[n / BIT_CHUNK_SIZE] |= (1 << (BIT_CHUNK_SIZE - n - 1)); else bitset->bits[n / BIT_CHUNK_SIZE] &= ~(1 << (BIT_CHUNK_SIZE - n - 1)); } #if 0 void main(void) { int i, j; Bitset b; unsigned int bits[3]; init_bitset(&b, 96); b.bits[0] = 0x12345678; b.bits[1] = 0x9abcdef1; b.bits[2] = 0xaaaaaaaa; print_bitset(&b); for(i = 0; i <= 96; i++) { bits[0] = 0xffffffff; bits[1] = 0xffffffff; get_bitset(&b, bits, i, 60); print_uibits(bits[0]);putchar(','); print_uibits(bits[1]); putchar('\n'); } } #endif TiMidity++-2.13.2/utils/bitset.h0100644004711200001440000000415207421005037015500 0ustar tamukiusers/* TiMidity++ -- MIDI to WAVE converter and player Copyright (C) 1999-2002 Masanao Izumo Copyright (C) 1995 Tuukka Toivonen 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA bitset.h Author: Masanao Izumo Create: Sun Mar 02 1997 */ #ifndef ___BITSET_H_ #define ___BITSET_H_ typedef struct _Bitset { int nbits; unsigned int *bits; } Bitset; #define BIT_CHUNK_SIZE ((unsigned int)(8 * sizeof(unsigned int))) /* * Bitset ν * 塢ƤΥӥåȤ 0 ˽ */ extern void init_bitset(Bitset *bitset, int nbits); /* * start ܤΥӥåȤ顢nbit ʬ0 ˥åȤ롣 */ extern void clear_bitset(Bitset *bitset, int start_bit, int nbits); /* * start ӥåȤ顢nbits ʬ */ extern void get_bitset(const Bitset *bitset, unsigned int *bits_return, int start_bit, int nbits); /* get_bitset 1 ӥå */ extern int get_bitset1(Bitset *bitset, int n); /* * start ӥåȤ顢nbits ʬbits ˥åȤ */ extern void set_bitset(Bitset *bitset, const unsigned int *bits, int start_bit, int nbits); /* set_bitset 1 ӥå */ extern void set_bitset1(Bitset *bitset, int n, int bit); /* * bitset 1 ӥåȤޤޤƤʤ 0 ֤ * 1 ӥåȤǤޤޤƤ 0 ʳ֤ͤ */ extern unsigned int has_bitset(const Bitset *bitset); /* bitset ɽ */ extern void print_bitset(Bitset *bitset); #endif /* ___BITSET_H_ */ TiMidity++-2.13.2/utils/fft4g.c0100644004711200001440000011235207421005037015215 0ustar tamukiusers/* EAW - May 11th, 2001: Changed all doubles to floats */ /* Copyright: Copyright(C) 1996-1999 Takuya OOURA email: ooura@mmm.t.u-tokyo.ac.jp download: http://momonga.t.u-tokyo.ac.jp/~ooura/fft.html You may use, copy, modify this code for any purpose and without fee. You may distribute this ORIGINAL package. */ /* Fast Fourier/Cosine/Sine Transform dimension :one data length :power of 2 decimation :frequency radix :4, 2 data :inplace table :use functions cdft: Complex Discrete Fourier Transform rdft: Real Discrete Fourier Transform ddct: Discrete Cosine Transform ddst: Discrete Sine Transform dfct: Cosine Transform of RDFT (Real Symmetric DFT) dfst: Sine Transform of RDFT (Real Anti-symmetric DFT) function prototypes void cdft(int, int, float *, int *, float *); void rdft(int, int, float *, int *, float *); void ddct(int, int, float *, int *, float *); void ddst(int, int, float *, int *, float *); void dfct(int, float *, float *, int *, float *); void dfst(int, float *, float *, int *, float *); -------- Complex DFT (Discrete Fourier Transform) -------- [definition] X[k] = sum_j=0^n-1 x[j]*exp(2*pi*i*j*k/n), 0<=k X[k] = sum_j=0^n-1 x[j]*exp(-2*pi*i*j*k/n), 0<=k ip[0] = 0; // first time only cdft(2*n, 1, a, ip, w); ip[0] = 0; // first time only cdft(2*n, -1, a, ip, w); [parameters] 2*n :data length (int) n >= 1, n = power of 2 a[0...2*n-1] :input/output data (float *) input data a[2*j] = Re(x[j]), a[2*j+1] = Im(x[j]), 0<=j= 2+sqrt(n) strictly, length of ip >= 2+(1<<(int)(log(n+0.5)/log(2))/2). ip[0],ip[1] are pointers of the cos/sin table. w[0...n/2-1] :cos/sin table (float *) w[],ip[] are initialized if ip[0] == 0. [remark] Inverse of cdft(2*n, -1, a, ip, w); is cdft(2*n, 1, a, ip, w); for (j = 0; j <= 2 * n - 1; j++) { a[j] *= 1.0 / n; } . -------- Real DFT / Inverse of Real DFT -------- [definition] RDFT R[k] = sum_j=0^n-1 a[j]*cos(2*pi*j*k/n), 0<=k<=n/2 I[k] = sum_j=0^n-1 a[j]*sin(2*pi*j*k/n), 0 IRDFT (excluding scale) a[k] = (R[0] + R[n/2]*cos(pi*k))/2 + sum_j=1^n/2-1 R[j]*cos(2*pi*j*k/n) + sum_j=1^n/2-1 I[j]*sin(2*pi*j*k/n), 0<=k ip[0] = 0; // first time only rdft(n, 1, a, ip, w); ip[0] = 0; // first time only rdft(n, -1, a, ip, w); [parameters] n :data length (int) n >= 2, n = power of 2 a[0...n-1] :input/output data (float *) output data a[2*k] = R[k], 0<=k input data a[2*j] = R[j], 0<=j= 2+sqrt(n/2) strictly, length of ip >= 2+(1<<(int)(log(n/2+0.5)/log(2))/2). ip[0],ip[1] are pointers of the cos/sin table. w[0...n/2-1] :cos/sin table (float *) w[],ip[] are initialized if ip[0] == 0. [remark] Inverse of rdft(n, 1, a, ip, w); is rdft(n, -1, a, ip, w); for (j = 0; j <= n - 1; j++) { a[j] *= 2.0 / n; } . -------- DCT (Discrete Cosine Transform) / Inverse of DCT -------- [definition] IDCT (excluding scale) C[k] = sum_j=0^n-1 a[j]*cos(pi*j*(k+1/2)/n), 0<=k DCT C[k] = sum_j=0^n-1 a[j]*cos(pi*(j+1/2)*k/n), 0<=k ip[0] = 0; // first time only ddct(n, 1, a, ip, w); ip[0] = 0; // first time only ddct(n, -1, a, ip, w); [parameters] n :data length (int) n >= 2, n = power of 2 a[0...n-1] :input/output data (float *) output data a[k] = C[k], 0<=k= 2+sqrt(n/2) strictly, length of ip >= 2+(1<<(int)(log(n/2+0.5)/log(2))/2). ip[0],ip[1] are pointers of the cos/sin table. w[0...n*5/4-1] :cos/sin table (float *) w[],ip[] are initialized if ip[0] == 0. [remark] Inverse of ddct(n, -1, a, ip, w); is a[0] *= 0.5; ddct(n, 1, a, ip, w); for (j = 0; j <= n - 1; j++) { a[j] *= 2.0 / n; } . -------- DST (Discrete Sine Transform) / Inverse of DST -------- [definition] IDST (excluding scale) S[k] = sum_j=1^n A[j]*sin(pi*j*(k+1/2)/n), 0<=k DST S[k] = sum_j=0^n-1 a[j]*sin(pi*(j+1/2)*k/n), 0 ip[0] = 0; // first time only ddst(n, 1, a, ip, w); ip[0] = 0; // first time only ddst(n, -1, a, ip, w); [parameters] n :data length (int) n >= 2, n = power of 2 a[0...n-1] :input/output data (float *) input data a[j] = A[j], 0 output data a[k] = S[k], 0= 2+sqrt(n/2) strictly, length of ip >= 2+(1<<(int)(log(n/2+0.5)/log(2))/2). ip[0],ip[1] are pointers of the cos/sin table. w[0...n*5/4-1] :cos/sin table (float *) w[],ip[] are initialized if ip[0] == 0. [remark] Inverse of ddst(n, -1, a, ip, w); is a[0] *= 0.5; ddst(n, 1, a, ip, w); for (j = 0; j <= n - 1; j++) { a[j] *= 2.0 / n; } . -------- Cosine Transform of RDFT (Real Symmetric DFT) -------- [definition] C[k] = sum_j=0^n a[j]*cos(pi*j*k/n), 0<=k<=n [usage] ip[0] = 0; // first time only dfct(n, a, t, ip, w); [parameters] n :data length - 1 (int) n >= 2, n = power of 2 a[0...n] :input/output data (float *) output data a[k] = C[k], 0<=k<=n t[0...n/2] :work area (float *) ip[0...*] :work area for bit reversal (int *) length of ip >= 2+sqrt(n/4) strictly, length of ip >= 2+(1<<(int)(log(n/4+0.5)/log(2))/2). ip[0],ip[1] are pointers of the cos/sin table. w[0...n*5/8-1] :cos/sin table (float *) w[],ip[] are initialized if ip[0] == 0. [remark] Inverse of a[0] *= 0.5; a[n] *= 0.5; dfct(n, a, t, ip, w); is a[0] *= 0.5; a[n] *= 0.5; dfct(n, a, t, ip, w); for (j = 0; j <= n; j++) { a[j] *= 2.0 / n; } . -------- Sine Transform of RDFT (Real Anti-symmetric DFT) -------- [definition] S[k] = sum_j=1^n-1 a[j]*sin(pi*j*k/n), 0= 2, n = power of 2 a[0...n-1] :input/output data (float *) output data a[k] = S[k], 0= 2+sqrt(n/4) strictly, length of ip >= 2+(1<<(int)(log(n/4+0.5)/log(2))/2). ip[0],ip[1] are pointers of the cos/sin table. w[0...n*5/8-1] :cos/sin table (float *) w[],ip[] are initialized if ip[0] == 0. [remark] Inverse of dfst(n, a, t, ip, w); is dfst(n, a, t, ip, w); for (j = 1; j <= n - 1; j++) { a[j] *= 2.0 / n; } . Appendix : The cos/sin table is recalculated when the larger table required. w[] and ip[] are compatible with all routines. */ void cdft(int n, int isgn, float *a, int *ip, float *w) { void makewt(int nw, int *ip, float *w); void bitrv2(int n, int *ip, float *a); void bitrv2conj(int n, int *ip, float *a); void cftfsub(int n, float *a, float *w); void cftbsub(int n, float *a, float *w); if (n > (ip[0] << 2)) { makewt(n >> 2, ip, w); } if (n > 4) { if (isgn >= 0) { bitrv2(n, ip + 2, a); cftfsub(n, a, w); } else { bitrv2conj(n, ip + 2, a); cftbsub(n, a, w); } } else if (n == 4) { cftfsub(n, a, w); } } void rdft(int n, int isgn, float *a, int *ip, float *w) { void makewt(int nw, int *ip, float *w); void makect(int nc, int *ip, float *c); void bitrv2(int n, int *ip, float *a); void cftfsub(int n, float *a, float *w); void cftbsub(int n, float *a, float *w); void rftfsub(int n, float *a, int nc, float *c); void rftbsub(int n, float *a, int nc, float *c); int nw, nc; float xi; nw = ip[0]; if (n > (nw << 2)) { nw = n >> 2; makewt(nw, ip, w); } nc = ip[1]; if (n > (nc << 2)) { nc = n >> 2; makect(nc, ip, w + nw); } if (isgn >= 0) { if (n > 4) { bitrv2(n, ip + 2, a); cftfsub(n, a, w); rftfsub(n, a, nc, w + nw); } else if (n == 4) { cftfsub(n, a, w); } xi = a[0] - a[1]; a[0] += a[1]; a[1] = xi; } else { a[1] = 0.5 * (a[0] - a[1]); a[0] -= a[1]; if (n > 4) { rftbsub(n, a, nc, w + nw); bitrv2(n, ip + 2, a); cftbsub(n, a, w); } else if (n == 4) { cftfsub(n, a, w); } } } void ddct(int n, int isgn, float *a, int *ip, float *w) { void makewt(int nw, int *ip, float *w); void makect(int nc, int *ip, float *c); void bitrv2(int n, int *ip, float *a); void cftfsub(int n, float *a, float *w); void cftbsub(int n, float *a, float *w); void rftfsub(int n, float *a, int nc, float *c); void rftbsub(int n, float *a, int nc, float *c); void dctsub(int n, float *a, int nc, float *c); int j, nw, nc; float xr; nw = ip[0]; if (n > (nw << 2)) { nw = n >> 2; makewt(nw, ip, w); } nc = ip[1]; if (n > nc) { nc = n; makect(nc, ip, w + nw); } if (isgn < 0) { xr = a[n - 1]; for (j = n - 2; j >= 2; j -= 2) { a[j + 1] = a[j] - a[j - 1]; a[j] += a[j - 1]; } a[1] = a[0] - xr; a[0] += xr; if (n > 4) { rftbsub(n, a, nc, w + nw); bitrv2(n, ip + 2, a); cftbsub(n, a, w); } else if (n == 4) { cftfsub(n, a, w); } } dctsub(n, a, nc, w + nw); if (isgn >= 0) { if (n > 4) { bitrv2(n, ip + 2, a); cftfsub(n, a, w); rftfsub(n, a, nc, w + nw); } else if (n == 4) { cftfsub(n, a, w); } xr = a[0] - a[1]; a[0] += a[1]; for (j = 2; j < n; j += 2) { a[j - 1] = a[j] - a[j + 1]; a[j] += a[j + 1]; } a[n - 1] = xr; } } void ddst(int n, int isgn, float *a, int *ip, float *w) { void makewt(int nw, int *ip, float *w); void makect(int nc, int *ip, float *c); void bitrv2(int n, int *ip, float *a); void cftfsub(int n, float *a, float *w); void cftbsub(int n, float *a, float *w); void rftfsub(int n, float *a, int nc, float *c); void rftbsub(int n, float *a, int nc, float *c); void dstsub(int n, float *a, int nc, float *c); int j, nw, nc; float xr; nw = ip[0]; if (n > (nw << 2)) { nw = n >> 2; makewt(nw, ip, w); } nc = ip[1]; if (n > nc) { nc = n; makect(nc, ip, w + nw); } if (isgn < 0) { xr = a[n - 1]; for (j = n - 2; j >= 2; j -= 2) { a[j + 1] = -a[j] - a[j - 1]; a[j] -= a[j - 1]; } a[1] = a[0] + xr; a[0] -= xr; if (n > 4) { rftbsub(n, a, nc, w + nw); bitrv2(n, ip + 2, a); cftbsub(n, a, w); } else if (n == 4) { cftfsub(n, a, w); } } dstsub(n, a, nc, w + nw); if (isgn >= 0) { if (n > 4) { bitrv2(n, ip + 2, a); cftfsub(n, a, w); rftfsub(n, a, nc, w + nw); } else if (n == 4) { cftfsub(n, a, w); } xr = a[0] - a[1]; a[0] += a[1]; for (j = 2; j < n; j += 2) { a[j - 1] = -a[j] - a[j + 1]; a[j] -= a[j + 1]; } a[n - 1] = -xr; } } void dfct(int n, float *a, float *t, int *ip, float *w) { void makewt(int nw, int *ip, float *w); void makect(int nc, int *ip, float *c); void bitrv2(int n, int *ip, float *a); void cftfsub(int n, float *a, float *w); void rftfsub(int n, float *a, int nc, float *c); void dctsub(int n, float *a, int nc, float *c); int j, k, l, m, mh, nw, nc; float xr, xi, yr, yi; nw = ip[0]; if (n > (nw << 3)) { nw = n >> 3; makewt(nw, ip, w); } nc = ip[1]; if (n > (nc << 1)) { nc = n >> 1; makect(nc, ip, w + nw); } m = n >> 1; yi = a[m]; xi = a[0] + a[n]; a[0] -= a[n]; t[0] = xi - yi; t[m] = xi + yi; if (n > 2) { mh = m >> 1; for (j = 1; j < mh; j++) { k = m - j; xr = a[j] - a[n - j]; xi = a[j] + a[n - j]; yr = a[k] - a[n - k]; yi = a[k] + a[n - k]; a[j] = xr; a[k] = yr; t[j] = xi - yi; t[k] = xi + yi; } t[mh] = a[mh] + a[n - mh]; a[mh] -= a[n - mh]; dctsub(m, a, nc, w + nw); if (m > 4) { bitrv2(m, ip + 2, a); cftfsub(m, a, w); rftfsub(m, a, nc, w + nw); } else if (m == 4) { cftfsub(m, a, w); } a[n - 1] = a[0] - a[1]; a[1] = a[0] + a[1]; for (j = m - 2; j >= 2; j -= 2) { a[2 * j + 1] = a[j] + a[j + 1]; a[2 * j - 1] = a[j] - a[j + 1]; } l = 2; m = mh; while (m >= 2) { dctsub(m, t, nc, w + nw); if (m > 4) { bitrv2(m, ip + 2, t); cftfsub(m, t, w); rftfsub(m, t, nc, w + nw); } else if (m == 4) { cftfsub(m, t, w); } a[n - l] = t[0] - t[1]; a[l] = t[0] + t[1]; k = 0; for (j = 2; j < m; j += 2) { k += l << 2; a[k - l] = t[j] - t[j + 1]; a[k + l] = t[j] + t[j + 1]; } l <<= 1; mh = m >> 1; for (j = 0; j < mh; j++) { k = m - j; t[j] = t[m + k] - t[m + j]; t[k] = t[m + k] + t[m + j]; } t[mh] = t[m + mh]; m = mh; } a[l] = t[0]; a[n] = t[2] - t[1]; a[0] = t[2] + t[1]; } else { a[1] = a[0]; a[2] = t[0]; a[0] = t[1]; } } void dfst(int n, float *a, float *t, int *ip, float *w) { void makewt(int nw, int *ip, float *w); void makect(int nc, int *ip, float *c); void bitrv2(int n, int *ip, float *a); void cftfsub(int n, float *a, float *w); void rftfsub(int n, float *a, int nc, float *c); void dstsub(int n, float *a, int nc, float *c); int j, k, l, m, mh, nw, nc; float xr, xi, yr, yi; nw = ip[0]; if (n > (nw << 3)) { nw = n >> 3; makewt(nw, ip, w); } nc = ip[1]; if (n > (nc << 1)) { nc = n >> 1; makect(nc, ip, w + nw); } if (n > 2) { m = n >> 1; mh = m >> 1; for (j = 1; j < mh; j++) { k = m - j; xr = a[j] + a[n - j]; xi = a[j] - a[n - j]; yr = a[k] + a[n - k]; yi = a[k] - a[n - k]; a[j] = xr; a[k] = yr; t[j] = xi + yi; t[k] = xi - yi; } t[0] = a[mh] - a[n - mh]; a[mh] += a[n - mh]; a[0] = a[m]; dstsub(m, a, nc, w + nw); if (m > 4) { bitrv2(m, ip + 2, a); cftfsub(m, a, w); rftfsub(m, a, nc, w + nw); } else if (m == 4) { cftfsub(m, a, w); } a[n - 1] = a[1] - a[0]; a[1] = a[0] + a[1]; for (j = m - 2; j >= 2; j -= 2) { a[2 * j + 1] = a[j] - a[j + 1]; a[2 * j - 1] = -a[j] - a[j + 1]; } l = 2; m = mh; while (m >= 2) { dstsub(m, t, nc, w + nw); if (m > 4) { bitrv2(m, ip + 2, t); cftfsub(m, t, w); rftfsub(m, t, nc, w + nw); } else if (m == 4) { cftfsub(m, t, w); } a[n - l] = t[1] - t[0]; a[l] = t[0] + t[1]; k = 0; for (j = 2; j < m; j += 2) { k += l << 2; a[k - l] = -t[j] - t[j + 1]; a[k + l] = t[j] - t[j + 1]; } l <<= 1; mh = m >> 1; for (j = 1; j < mh; j++) { k = m - j; t[j] = t[m + k] + t[m + j]; t[k] = t[m + k] - t[m + j]; } t[0] = t[m + mh]; m = mh; } a[l] = t[0]; } a[0] = 0; } /* -------- initializing routines -------- */ #include void makewt(int nw, int *ip, float *w) { void bitrv2(int n, int *ip, float *a); int j, nwh; float delta, x, y; ip[0] = nw; ip[1] = 1; if (nw > 2) { nwh = nw >> 1; delta = atan(1.0) / nwh; w[0] = 1; w[1] = 0; w[nwh] = cos(delta * nwh); w[nwh + 1] = w[nwh]; if (nwh > 2) { for (j = 2; j < nwh; j += 2) { x = cos(delta * j); y = sin(delta * j); w[j] = x; w[j + 1] = y; w[nw - j] = y; w[nw - j + 1] = x; } bitrv2(nw, ip + 2, w); } } } void makect(int nc, int *ip, float *c) { int j, nch; float delta; ip[1] = nc; if (nc > 1) { nch = nc >> 1; delta = atan(1.0) / nch; c[0] = cos(delta * nch); c[nch] = 0.5 * c[0]; for (j = 1; j < nch; j++) { c[j] = 0.5 * cos(delta * j); c[nc - j] = 0.5 * sin(delta * j); } } } /* -------- child routines -------- */ void bitrv2(int n, int *ip, float *a) { int j, j1, k, k1, l, m, m2; float xr, xi, yr, yi; ip[0] = 0; l = n; m = 1; while ((m << 3) < l) { l >>= 1; for (j = 0; j < m; j++) { ip[m + j] = ip[j] + l; } m <<= 1; } m2 = 2 * m; if ((m << 3) == l) { for (k = 0; k < m; k++) { for (j = 0; j < k; j++) { j1 = 2 * j + ip[k]; k1 = 2 * k + ip[j]; xr = a[j1]; xi = a[j1 + 1]; yr = a[k1]; yi = a[k1 + 1]; a[j1] = yr; a[j1 + 1] = yi; a[k1] = xr; a[k1 + 1] = xi; j1 += m2; k1 += 2 * m2; xr = a[j1]; xi = a[j1 + 1]; yr = a[k1]; yi = a[k1 + 1]; a[j1] = yr; a[j1 + 1] = yi; a[k1] = xr; a[k1 + 1] = xi; j1 += m2; k1 -= m2; xr = a[j1]; xi = a[j1 + 1]; yr = a[k1]; yi = a[k1 + 1]; a[j1] = yr; a[j1 + 1] = yi; a[k1] = xr; a[k1 + 1] = xi; j1 += m2; k1 += 2 * m2; xr = a[j1]; xi = a[j1 + 1]; yr = a[k1]; yi = a[k1 + 1]; a[j1] = yr; a[j1 + 1] = yi; a[k1] = xr; a[k1 + 1] = xi; } j1 = 2 * k + m2 + ip[k]; k1 = j1 + m2; xr = a[j1]; xi = a[j1 + 1]; yr = a[k1]; yi = a[k1 + 1]; a[j1] = yr; a[j1 + 1] = yi; a[k1] = xr; a[k1 + 1] = xi; } } else { for (k = 1; k < m; k++) { for (j = 0; j < k; j++) { j1 = 2 * j + ip[k]; k1 = 2 * k + ip[j]; xr = a[j1]; xi = a[j1 + 1]; yr = a[k1]; yi = a[k1 + 1]; a[j1] = yr; a[j1 + 1] = yi; a[k1] = xr; a[k1 + 1] = xi; j1 += m2; k1 += m2; xr = a[j1]; xi = a[j1 + 1]; yr = a[k1]; yi = a[k1 + 1]; a[j1] = yr; a[j1 + 1] = yi; a[k1] = xr; a[k1 + 1] = xi; } } } } void bitrv2conj(int n, int *ip, float *a) { int j, j1, k, k1, l, m, m2; float xr, xi, yr, yi; ip[0] = 0; l = n; m = 1; while ((m << 3) < l) { l >>= 1; for (j = 0; j < m; j++) { ip[m + j] = ip[j] + l; } m <<= 1; } m2 = 2 * m; if ((m << 3) == l) { for (k = 0; k < m; k++) { for (j = 0; j < k; j++) { j1 = 2 * j + ip[k]; k1 = 2 * k + ip[j]; xr = a[j1]; xi = -a[j1 + 1]; yr = a[k1]; yi = -a[k1 + 1]; a[j1] = yr; a[j1 + 1] = yi; a[k1] = xr; a[k1 + 1] = xi; j1 += m2; k1 += 2 * m2; xr = a[j1]; xi = -a[j1 + 1]; yr = a[k1]; yi = -a[k1 + 1]; a[j1] = yr; a[j1 + 1] = yi; a[k1] = xr; a[k1 + 1] = xi; j1 += m2; k1 -= m2; xr = a[j1]; xi = -a[j1 + 1]; yr = a[k1]; yi = -a[k1 + 1]; a[j1] = yr; a[j1 + 1] = yi; a[k1] = xr; a[k1 + 1] = xi; j1 += m2; k1 += 2 * m2; xr = a[j1]; xi = -a[j1 + 1]; yr = a[k1]; yi = -a[k1 + 1]; a[j1] = yr; a[j1 + 1] = yi; a[k1] = xr; a[k1 + 1] = xi; } k1 = 2 * k + ip[k]; a[k1 + 1] = -a[k1 + 1]; j1 = k1 + m2; k1 = j1 + m2; xr = a[j1]; xi = -a[j1 + 1]; yr = a[k1]; yi = -a[k1 + 1]; a[j1] = yr; a[j1 + 1] = yi; a[k1] = xr; a[k1 + 1] = xi; k1 += m2; a[k1 + 1] = -a[k1 + 1]; } } else { a[1] = -a[1]; a[m2 + 1] = -a[m2 + 1]; for (k = 1; k < m; k++) { for (j = 0; j < k; j++) { j1 = 2 * j + ip[k]; k1 = 2 * k + ip[j]; xr = a[j1]; xi = -a[j1 + 1]; yr = a[k1]; yi = -a[k1 + 1]; a[j1] = yr; a[j1 + 1] = yi; a[k1] = xr; a[k1 + 1] = xi; j1 += m2; k1 += m2; xr = a[j1]; xi = -a[j1 + 1]; yr = a[k1]; yi = -a[k1 + 1]; a[j1] = yr; a[j1 + 1] = yi; a[k1] = xr; a[k1 + 1] = xi; } k1 = 2 * k + ip[k]; a[k1 + 1] = -a[k1 + 1]; a[k1 + m2 + 1] = -a[k1 + m2 + 1]; } } } void cftfsub(int n, float *a, float *w) { void cft1st(int n, float *a, float *w); void cftmdl(int n, int l, float *a, float *w); int j, j1, j2, j3, l; float x0r, x0i, x1r, x1i, x2r, x2i, x3r, x3i; l = 2; if (n > 8) { cft1st(n, a, w); l = 8; while ((l << 2) < n) { cftmdl(n, l, a, w); l <<= 2; } } if ((l << 2) == n) { for (j = 0; j < l; j += 2) { j1 = j + l; j2 = j1 + l; j3 = j2 + l; x0r = a[j] + a[j1]; x0i = a[j + 1] + a[j1 + 1]; x1r = a[j] - a[j1]; x1i = a[j + 1] - a[j1 + 1]; x2r = a[j2] + a[j3]; x2i = a[j2 + 1] + a[j3 + 1]; x3r = a[j2] - a[j3]; x3i = a[j2 + 1] - a[j3 + 1]; a[j] = x0r + x2r; a[j + 1] = x0i + x2i; a[j2] = x0r - x2r; a[j2 + 1] = x0i - x2i; a[j1] = x1r - x3i; a[j1 + 1] = x1i + x3r; a[j3] = x1r + x3i; a[j3 + 1] = x1i - x3r; } } else { for (j = 0; j < l; j += 2) { j1 = j + l; x0r = a[j] - a[j1]; x0i = a[j + 1] - a[j1 + 1]; a[j] += a[j1]; a[j + 1] += a[j1 + 1]; a[j1] = x0r; a[j1 + 1] = x0i; } } } void cftbsub(int n, float *a, float *w) { void cft1st(int n, float *a, float *w); void cftmdl(int n, int l, float *a, float *w); int j, j1, j2, j3, l; float x0r, x0i, x1r, x1i, x2r, x2i, x3r, x3i; l = 2; if (n > 8) { cft1st(n, a, w); l = 8; while ((l << 2) < n) { cftmdl(n, l, a, w); l <<= 2; } } if ((l << 2) == n) { for (j = 0; j < l; j += 2) { j1 = j + l; j2 = j1 + l; j3 = j2 + l; x0r = a[j] + a[j1]; x0i = -a[j + 1] - a[j1 + 1]; x1r = a[j] - a[j1]; x1i = -a[j + 1] + a[j1 + 1]; x2r = a[j2] + a[j3]; x2i = a[j2 + 1] + a[j3 + 1]; x3r = a[j2] - a[j3]; x3i = a[j2 + 1] - a[j3 + 1]; a[j] = x0r + x2r; a[j + 1] = x0i - x2i; a[j2] = x0r - x2r; a[j2 + 1] = x0i + x2i; a[j1] = x1r - x3i; a[j1 + 1] = x1i - x3r; a[j3] = x1r + x3i; a[j3 + 1] = x1i + x3r; } } else { for (j = 0; j < l; j += 2) { j1 = j + l; x0r = a[j] - a[j1]; x0i = -a[j + 1] + a[j1 + 1]; a[j] += a[j1]; a[j + 1] = -a[j + 1] - a[j1 + 1]; a[j1] = x0r; a[j1 + 1] = x0i; } } } void cft1st(int n, float *a, float *w) { int j, k1, k2; float wk1r, wk1i, wk2r, wk2i, wk3r, wk3i; float x0r, x0i, x1r, x1i, x2r, x2i, x3r, x3i; x0r = a[0] + a[2]; x0i = a[1] + a[3]; x1r = a[0] - a[2]; x1i = a[1] - a[3]; x2r = a[4] + a[6]; x2i = a[5] + a[7]; x3r = a[4] - a[6]; x3i = a[5] - a[7]; a[0] = x0r + x2r; a[1] = x0i + x2i; a[4] = x0r - x2r; a[5] = x0i - x2i; a[2] = x1r - x3i; a[3] = x1i + x3r; a[6] = x1r + x3i; a[7] = x1i - x3r; wk1r = w[2]; x0r = a[8] + a[10]; x0i = a[9] + a[11]; x1r = a[8] - a[10]; x1i = a[9] - a[11]; x2r = a[12] + a[14]; x2i = a[13] + a[15]; x3r = a[12] - a[14]; x3i = a[13] - a[15]; a[8] = x0r + x2r; a[9] = x0i + x2i; a[12] = x2i - x0i; a[13] = x0r - x2r; x0r = x1r - x3i; x0i = x1i + x3r; a[10] = wk1r * (x0r - x0i); a[11] = wk1r * (x0r + x0i); x0r = x3i + x1r; x0i = x3r - x1i; a[14] = wk1r * (x0i - x0r); a[15] = wk1r * (x0i + x0r); k1 = 0; for (j = 16; j < n; j += 16) { k1 += 2; k2 = 2 * k1; wk2r = w[k1]; wk2i = w[k1 + 1]; wk1r = w[k2]; wk1i = w[k2 + 1]; wk3r = wk1r - 2 * wk2i * wk1i; wk3i = 2 * wk2i * wk1r - wk1i; x0r = a[j] + a[j + 2]; x0i = a[j + 1] + a[j + 3]; x1r = a[j] - a[j + 2]; x1i = a[j + 1] - a[j + 3]; x2r = a[j + 4] + a[j + 6]; x2i = a[j + 5] + a[j + 7]; x3r = a[j + 4] - a[j + 6]; x3i = a[j + 5] - a[j + 7]; a[j] = x0r + x2r; a[j + 1] = x0i + x2i; x0r -= x2r; x0i -= x2i; a[j + 4] = wk2r * x0r - wk2i * x0i; a[j + 5] = wk2r * x0i + wk2i * x0r; x0r = x1r - x3i; x0i = x1i + x3r; a[j + 2] = wk1r * x0r - wk1i * x0i; a[j + 3] = wk1r * x0i + wk1i * x0r; x0r = x1r + x3i; x0i = x1i - x3r; a[j + 6] = wk3r * x0r - wk3i * x0i; a[j + 7] = wk3r * x0i + wk3i * x0r; wk1r = w[k2 + 2]; wk1i = w[k2 + 3]; wk3r = wk1r - 2 * wk2r * wk1i; wk3i = 2 * wk2r * wk1r - wk1i; x0r = a[j + 8] + a[j + 10]; x0i = a[j + 9] + a[j + 11]; x1r = a[j + 8] - a[j + 10]; x1i = a[j + 9] - a[j + 11]; x2r = a[j + 12] + a[j + 14]; x2i = a[j + 13] + a[j + 15]; x3r = a[j + 12] - a[j + 14]; x3i = a[j + 13] - a[j + 15]; a[j + 8] = x0r + x2r; a[j + 9] = x0i + x2i; x0r -= x2r; x0i -= x2i; a[j + 12] = -wk2i * x0r - wk2r * x0i; a[j + 13] = -wk2i * x0i + wk2r * x0r; x0r = x1r - x3i; x0i = x1i + x3r; a[j + 10] = wk1r * x0r - wk1i * x0i; a[j + 11] = wk1r * x0i + wk1i * x0r; x0r = x1r + x3i; x0i = x1i - x3r; a[j + 14] = wk3r * x0r - wk3i * x0i; a[j + 15] = wk3r * x0i + wk3i * x0r; } } void cftmdl(int n, int l, float *a, float *w) { int j, j1, j2, j3, k, k1, k2, m, m2; float wk1r, wk1i, wk2r, wk2i, wk3r, wk3i; float x0r, x0i, x1r, x1i, x2r, x2i, x3r, x3i; m = l << 2; for (j = 0; j < l; j += 2) { j1 = j + l; j2 = j1 + l; j3 = j2 + l; x0r = a[j] + a[j1]; x0i = a[j + 1] + a[j1 + 1]; x1r = a[j] - a[j1]; x1i = a[j + 1] - a[j1 + 1]; x2r = a[j2] + a[j3]; x2i = a[j2 + 1] + a[j3 + 1]; x3r = a[j2] - a[j3]; x3i = a[j2 + 1] - a[j3 + 1]; a[j] = x0r + x2r; a[j + 1] = x0i + x2i; a[j2] = x0r - x2r; a[j2 + 1] = x0i - x2i; a[j1] = x1r - x3i; a[j1 + 1] = x1i + x3r; a[j3] = x1r + x3i; a[j3 + 1] = x1i - x3r; } wk1r = w[2]; for (j = m; j < l + m; j += 2) { j1 = j + l; j2 = j1 + l; j3 = j2 + l; x0r = a[j] + a[j1]; x0i = a[j + 1] + a[j1 + 1]; x1r = a[j] - a[j1]; x1i = a[j + 1] - a[j1 + 1]; x2r = a[j2] + a[j3]; x2i = a[j2 + 1] + a[j3 + 1]; x3r = a[j2] - a[j3]; x3i = a[j2 + 1] - a[j3 + 1]; a[j] = x0r + x2r; a[j + 1] = x0i + x2i; a[j2] = x2i - x0i; a[j2 + 1] = x0r - x2r; x0r = x1r - x3i; x0i = x1i + x3r; a[j1] = wk1r * (x0r - x0i); a[j1 + 1] = wk1r * (x0r + x0i); x0r = x3i + x1r; x0i = x3r - x1i; a[j3] = wk1r * (x0i - x0r); a[j3 + 1] = wk1r * (x0i + x0r); } k1 = 0; m2 = 2 * m; for (k = m2; k < n; k += m2) { k1 += 2; k2 = 2 * k1; wk2r = w[k1]; wk2i = w[k1 + 1]; wk1r = w[k2]; wk1i = w[k2 + 1]; wk3r = wk1r - 2 * wk2i * wk1i; wk3i = 2 * wk2i * wk1r - wk1i; for (j = k; j < l + k; j += 2) { j1 = j + l; j2 = j1 + l; j3 = j2 + l; x0r = a[j] + a[j1]; x0i = a[j + 1] + a[j1 + 1]; x1r = a[j] - a[j1]; x1i = a[j + 1] - a[j1 + 1]; x2r = a[j2] + a[j3]; x2i = a[j2 + 1] + a[j3 + 1]; x3r = a[j2] - a[j3]; x3i = a[j2 + 1] - a[j3 + 1]; a[j] = x0r + x2r; a[j + 1] = x0i + x2i; x0r -= x2r; x0i -= x2i; a[j2] = wk2r * x0r - wk2i * x0i; a[j2 + 1] = wk2r * x0i + wk2i * x0r; x0r = x1r - x3i; x0i = x1i + x3r; a[j1] = wk1r * x0r - wk1i * x0i; a[j1 + 1] = wk1r * x0i + wk1i * x0r; x0r = x1r + x3i; x0i = x1i - x3r; a[j3] = wk3r * x0r - wk3i * x0i; a[j3 + 1] = wk3r * x0i + wk3i * x0r; } wk1r = w[k2 + 2]; wk1i = w[k2 + 3]; wk3r = wk1r - 2 * wk2r * wk1i; wk3i = 2 * wk2r * wk1r - wk1i; for (j = k + m; j < l + (k + m); j += 2) { j1 = j + l; j2 = j1 + l; j3 = j2 + l; x0r = a[j] + a[j1]; x0i = a[j + 1] + a[j1 + 1]; x1r = a[j] - a[j1]; x1i = a[j + 1] - a[j1 + 1]; x2r = a[j2] + a[j3]; x2i = a[j2 + 1] + a[j3 + 1]; x3r = a[j2] - a[j3]; x3i = a[j2 + 1] - a[j3 + 1]; a[j] = x0r + x2r; a[j + 1] = x0i + x2i; x0r -= x2r; x0i -= x2i; a[j2] = -wk2i * x0r - wk2r * x0i; a[j2 + 1] = -wk2i * x0i + wk2r * x0r; x0r = x1r - x3i; x0i = x1i + x3r; a[j1] = wk1r * x0r - wk1i * x0i; a[j1 + 1] = wk1r * x0i + wk1i * x0r; x0r = x1r + x3i; x0i = x1i - x3r; a[j3] = wk3r * x0r - wk3i * x0i; a[j3 + 1] = wk3r * x0i + wk3i * x0r; } } } void rftfsub(int n, float *a, int nc, float *c) { int j, k, kk, ks, m; float wkr, wki, xr, xi, yr, yi; m = n >> 1; ks = 2 * nc / m; kk = 0; for (j = 2; j < m; j += 2) { k = n - j; kk += ks; wkr = 0.5 - c[nc - kk]; wki = c[kk]; xr = a[j] - a[k]; xi = a[j + 1] + a[k + 1]; yr = wkr * xr - wki * xi; yi = wkr * xi + wki * xr; a[j] -= yr; a[j + 1] -= yi; a[k] += yr; a[k + 1] -= yi; } } void rftbsub(int n, float *a, int nc, float *c) { int j, k, kk, ks, m; float wkr, wki, xr, xi, yr, yi; a[1] = -a[1]; m = n >> 1; ks = 2 * nc / m; kk = 0; for (j = 2; j < m; j += 2) { k = n - j; kk += ks; wkr = 0.5 - c[nc - kk]; wki = c[kk]; xr = a[j] - a[k]; xi = a[j + 1] + a[k + 1]; yr = wkr * xr + wki * xi; yi = wkr * xi - wki * xr; a[j] -= yr; a[j + 1] = yi - a[j + 1]; a[k] += yr; a[k + 1] = yi - a[k + 1]; } a[m + 1] = -a[m + 1]; } void dctsub(int n, float *a, int nc, float *c) { int j, k, kk, ks, m; float wkr, wki, xr; m = n >> 1; ks = nc / n; kk = 0; for (j = 1; j < m; j++) { k = n - j; kk += ks; wkr = c[kk] - c[nc - kk]; wki = c[kk] + c[nc - kk]; xr = wki * a[j] - wkr * a[k]; a[j] = wkr * a[j] + wki * a[k]; a[k] = xr; } a[m] *= c[0]; } void dstsub(int n, float *a, int nc, float *c) { int j, k, kk, ks, m; float wkr, wki, xr; m = n >> 1; ks = nc / n; kk = 0; for (j = 1; j < m; j++) { k = n - j; kk += ks; wkr = c[kk] - c[nc - kk]; wki = c[kk] + c[nc - kk]; xr = wki * a[k] - wkr * a[j]; a[k] = wkr * a[k] + wki * a[j]; a[j] = xr; } a[m] *= c[0]; } TiMidity++-2.13.2/utils/fft4g.h0100644004711200001440000000111507421005037015214 0ustar tamukiusers/* Copyright(C) 1996-1999 Takuya OOURA email: ooura@mmm.t.u-tokyo.ac.jp download: http://momonga.t.u-tokyo.ac.jp/~ooura/fft.html You may use, copy, modify this code for any purpose and without fee. You may distribute this ORIGINAL package. */ extern void cdft(int, int, float *, int *, float *); extern void rdft(int, int, float *, int *, float *); extern void ddct(int, int, float *, int *, float *); extern void ddst(int, int, float *, int *, float *); extern void dfct(int, float *, float *, int *, float *); extern void dfst(int, float *, float *, int *, float *); TiMidity++-2.13.2/utils/tmdy_getopt.h0100644004711200001440000001203310055547346016555 0ustar tamukiusers/* This file is from getopt of glibc 2.2.2 * And it is modified for TiMidity++ support at 01/19, 2002 * by Masanao Izumo . */ /* Declarations for getopt. Copyright (C) 1989,90,91,92,93,94,96,97,98,99 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. The GNU C 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with the GNU C Library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef __TMDY_GETOPT_H__ #define __TMDY_GETOPT_H__ #if defined(HAVE_UNISTD_H) && !defined(__WATCOMC__) /* getopt() declaration here */ #include #else /* For communication from `getopt' to the caller. When `getopt' finds an option that takes an argument, the argument value is returned here. Also, when `ordering' is RETURN_IN_ORDER, each non-option ARGV-element is returned here. */ extern char *optarg; /* Index in ARGV of the next element to be scanned. This is used for communication to and from the caller and for communication between successive calls to `getopt'. On entry to `getopt', zero means this is the first call; initialize. When `getopt' returns -1, this is the index of the first of the non-option elements that the caller should itself scan. Otherwise, `optind' communicates from one call to the next how much of ARGV has been scanned so far. */ extern int optind; /* Callers store zero here to inhibit the error message `getopt' prints for unrecognized options. */ extern int opterr; /* Set to an option character which was unrecognized. */ extern int optopt; extern int getopt (int __argc, char *const *__argv, const char *__shortopts); #endif /* */ #ifdef HAVE_GETOPT_H /* gtopt_long() declared here */ #include #else /* Describe the long-named options requested by the application. The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector of `struct option' terminated by an element containing a name which is zero. The field `has_arg' is: no_argument (or 0) if the option does not take an argument, required_argument (or 1) if the option requires an argument, optional_argument (or 2) if the option takes an optional argument. If the field `flag' is not NULL, it points to a variable that is set to the value given in the field `val' when the option is found, but left unchanged if the option is not found. To have a long-named option do something other than set an `int' to a compiled-in constant, such as set a value from `optarg', set the option's `flag' field to zero and its `val' field to a nonzero value (the equivalent single-letter option character, if there is one). For long options that have a zero `flag' field, `getopt' returns the contents of the `val' field. */ struct option { const char *name; /* has_arg can't be an enum because some compilers complain about type mismatches in all the code that assumes it is an int. */ int has_arg; int *flag; int val; }; /* Names for the values of the `has_arg' field of `struct option'. */ # define no_argument 0 # define required_argument 1 # define optional_argument 2 /* Get definitions and prototypes for functions to process the arguments in ARGV (ARGC of them, minus the program name) for options given in OPTS. Return the option character from OPTS just read. Return -1 when there are no more options. For unrecognized options, or options missing arguments, `optopt' is set to the option letter, and '?' is returned. The OPTS string is a list of characters which are recognized option letters, optionally followed by colons, specifying that that letter takes an argument, to be placed in `optarg'. If a letter in OPTS is followed by two colons, its argument is optional. This behavior is specific to the GNU `getopt'. The argument `--' causes premature termination of argument scanning, explicitly telling `getopt' that there are no more options. If OPTS begins with `--', then non-option arguments are treated as arguments to the option '\0'. This behavior is specific to the GNU `getopt'. */ extern int getopt_long (int __argc, char *const *__argv, const char *__shortopts, const struct option *__longopts, int *__longind); extern int getopt_long_only (int __argc, char *const *__argv, const char *__shortopts, const struct option *__longopts, int *__longind); #endif /* */ #endif TiMidity++-2.13.2/utils/mblock.c0100644004711200001440000000734507515660472015475 0ustar tamukiusers/* TiMidity++ -- MIDI to WAVE converter and player Copyright (C) 1999-2002 Masanao Izumo Copyright (C) 1995 Tuukka Toivonen 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ #include #include #ifndef NO_STRING_H #include #else #include #endif #ifdef HAVE_UNISTD_H #include #endif /* HAVE_UNISTD_H */ #include "timidity.h" #include "common.h" #include "mblock.h" static MBlockNode *free_mblock_list = NULL; #define ADDRALIGN 8 /* #define DEBUG */ void init_mblock(MBlockList *mblock) { mblock->first = NULL; mblock->allocated = 0; } static MBlockNode *new_mblock_node(size_t n) { MBlockNode *p; if(n > MIN_MBLOCK_SIZE) { if((p = (MBlockNode *)safe_malloc(n + sizeof(MBlockNode))) == NULL) return NULL; p->block_size = n; } else if(free_mblock_list == NULL) { if((p = (MBlockNode *)safe_malloc(sizeof(MBlockNode) + MIN_MBLOCK_SIZE)) == NULL) return NULL; p->block_size = MIN_MBLOCK_SIZE; } else { p = free_mblock_list; free_mblock_list = free_mblock_list->next; } p->offset = 0; p->next = NULL; return p; } static int enough_block_memory(MBlockList *mblock, size_t n) { size_t newoffset; if(mblock->first == NULL) return 0; newoffset = mblock->first->offset + n; if(newoffset < mblock->first->offset) /* exceed representable in size_t */ return 0; if(newoffset > mblock->first->block_size) return 0; return 1; } void *new_segment(MBlockList *mblock, size_t nbytes) { MBlockNode *p; void *addr; /* round up to ADDRALIGN */ nbytes = ((nbytes + ADDRALIGN - 1) & ~(ADDRALIGN - 1)); if(!enough_block_memory(mblock, nbytes)) { p = new_mblock_node(nbytes); p->next = mblock->first; mblock->first = p; mblock->allocated += p->block_size; } else p = mblock->first; addr = (void *)(p->buffer + p->offset); p->offset += nbytes; #ifdef DEBUG if(((unsigned long)addr) & (ADDRALIGN-1)) { fprintf(stderr, "Bad address: 0x%x\n", addr); exit(1); } #endif /* DEBUG */ return addr; } static void reuse_mblock1(MBlockNode *p) { if(p->block_size > MIN_MBLOCK_SIZE) free(p); else /* p->block_size <= MIN_MBLOCK_SIZE */ { p->next = free_mblock_list; free_mblock_list = p; } } void reuse_mblock(MBlockList *mblock) { MBlockNode *p; if((p = mblock->first) == NULL) return; /* There is nothing to collect memory */ while(p) { MBlockNode *tmp; tmp = p; p = p->next; reuse_mblock1(tmp); } init_mblock(mblock); } char *strdup_mblock(MBlockList *mblock, const char *str) { int len; char *p; len = strlen(str); p = (char *)new_segment(mblock, len + 1); /* for '\0' */ memcpy(p, str, len + 1); return p; } int free_global_mblock(void) { int cnt; cnt = 0; while(free_mblock_list) { MBlockNode *tmp; tmp = free_mblock_list; free_mblock_list = free_mblock_list->next; free(tmp); cnt++; } return cnt; } TiMidity++-2.13.2/utils/mblock.h0100644004711200001440000000405307421005037015455 0ustar tamukiusers/* TiMidity++ -- MIDI to WAVE converter and player Copyright (C) 1999-2002 Masanao Izumo Copyright (C) 1995 Tuukka Toivonen 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef ___MBLOCK_H_ #define ___MBLOCK_H_ /* Memory block for decreasing malloc * * +------+ +------+ +-------+ * |BLOCK1|--->|BLOCK2|---> ... --->|BLOCK N|---> NULL * +------+ +------+ +-------+ * * * BLOCK: * +-----------------------+ * | memory 1 | * | | * +-----------------------+ * | memory 2 | * +-----------------------+ * | memory 3 | * | | * | | * +-----------------------+ * | unused ... | * +-----------------------+ */ #define MIN_MBLOCK_SIZE 8192 typedef struct _MBlockNode { size_t block_size; size_t offset; struct _MBlockNode *next; #ifndef MBLOCK_NOPAD void *pad; #endif /* MBLOCK_NOPAD */ char buffer[1]; } MBlockNode; typedef struct _MBlockList { MBlockNode *first; size_t allocated; } MBlockList; extern void init_mblock(MBlockList *mblock); extern void *new_segment(MBlockList *mblock, size_t nbytes); extern void reuse_mblock(MBlockList *mblock); extern char *strdup_mblock(MBlockList *mblock, const char *str); extern int free_global_mblock(void); #endif /* ___MBLOCK_H_ */ TiMidity++-2.13.2/utils/memb.c0100644004711200001440000001303107421005037015115 0ustar tamukiusers/* TiMidity++ -- MIDI to WAVE converter and player Copyright (C) 1999-2002 Masanao Izumo Copyright (C) 1995 Tuukka Toivonen 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ #include #include #ifndef NO_STRING_H #include #else #include #endif #include "timidity.h" #include "memb.h" void init_memb(MemBuffer *b) { memset(b, 0, sizeof(MemBuffer)); } void delete_memb(MemBuffer *b) { reuse_mblock(&b->pool); memset(b, 0, sizeof(MemBuffer)); } void rewind_memb(MemBuffer *b) { if(b->head != NULL) { b->cur = b->head; b->cur->pos = 0; } } void push_memb(MemBuffer *b, char *buff, long buff_size) { b->total_size += buff_size; if(b->head == NULL) { b->head = b->tail = b->cur = (MemBufferNode *)new_segment(&b->pool, MIN_MBLOCK_SIZE); b->head->next = NULL; b->head->size = b->head->pos = 0; } while(buff_size > 0) { long n; MemBufferNode *p; p = b->tail; n = (long)(MEMBASESIZE - p->size); if(n == 0) { p = (MemBufferNode *)new_segment(&b->pool, MIN_MBLOCK_SIZE); b->tail->next = p; b->tail = p; p->next = NULL; p->size = p->pos = 0; n = MEMBASESIZE; } if(n > buff_size) n = buff_size; memcpy(p->base + p->size, buff, n); p->size += n; buff_size -= n; buff += n; } } long read_memb(MemBuffer *b, char *buff, long buff_size) { long n; if(b->head == NULL) return 0; if(b->cur == NULL) rewind_memb(b); if(b->cur->next == NULL && b->cur->pos == b->cur->size) return 0; n = 0; while(n < buff_size) { long i; MemBufferNode *p; p = b->cur; if(p->pos == p->size) { if(p->next == NULL) break; b->cur = p->next; b->cur->pos = 0; continue; } i = p->size - p->pos; if(i > buff_size - n) i = buff_size - n; memcpy(buff + n, p->base + p->pos, i); n += i; p->pos += i; } return n; } long skip_read_memb(MemBuffer *b, long size) { long n; if(size <= 0 || b->head == NULL) return 0; if(b->cur == NULL) rewind_memb(b); if(b->cur->next == NULL && b->cur->pos == b->cur->size) return 0; n = 0; while(n < size) { long i; MemBufferNode *p; p = b->cur; if(p->pos == p->size) { if(p->next == NULL) break; b->cur = p->next; b->cur->pos = 0; continue; } i = p->size - p->pos; if(i > size - n) i = size - n; n += i; p->pos += i; } return n; } typedef struct _URL_memb { char common[sizeof(struct _URL)]; MemBuffer *b; long pos; int autodelete; } URL_memb; static long url_memb_read(URL url, void *buff, long n); static int url_memb_fgetc(URL url); static long url_memb_seek(URL url, long offset, int whence); static long url_memb_tell(URL url); static void url_memb_close(URL url); URL memb_open_stream(MemBuffer *b, int autodelete) { URL_memb *url; url = (URL_memb *)alloc_url(sizeof(URL_memb)); if(url == NULL) { if(autodelete) delete_memb(b); url_errno = errno; return NULL; } /* common members */ URLm(url, type) = URL_extension_t; URLm(url, url_read) = url_memb_read; URLm(url, url_gets) = NULL; URLm(url, url_fgetc) = url_memb_fgetc; URLm(url, url_seek) = url_memb_seek; URLm(url, url_tell) = url_memb_tell; URLm(url, url_close) = url_memb_close; /* private members */ url->b = b; url->pos = 0; url->autodelete = autodelete; rewind_memb(b); return (URL)url; } static long url_memb_read(URL url, void *buff, long n) { URL_memb *urlp = (URL_memb *)url; if((n = read_memb(urlp->b, buff, n)) > 0) urlp->pos += n; return n; } static int url_memb_fgetc(URL url) { URL_memb *urlp = (URL_memb *)url; MemBuffer *b = urlp->b; MemBufferNode *p; p = b->cur; if(p == NULL) return EOF; while(p->pos == p->size) { if(p->next == NULL) return EOF; p = b->cur = p->next; p->pos = 0; } urlp->pos++; return (int)((unsigned char *)p->base)[p->pos++]; } static long url_memb_seek(URL url, long offset, int whence) { URL_memb *urlp = (URL_memb *)url; MemBuffer *b = urlp->b; long ret, newpos = 0, n; ret = urlp->pos; switch(whence) { case SEEK_SET: newpos = offset; break; case SEEK_CUR: newpos = ret + offset; break; case SEEK_END: newpos = b->total_size + offset; break; } if(newpos < 0) newpos = 0; else if(newpos > b->total_size) newpos = b->total_size; n = newpos - ret; if(n < 0) { rewind_memb(b); n = newpos; urlp->pos = 0; } urlp->pos += skip_read_memb(b, n); return ret; } static long url_memb_tell(URL url) { return ((URL_memb *)url)->pos; } static void url_memb_close(URL url) { URL_memb *urlp = (URL_memb *)url; if(urlp->autodelete) { delete_memb(urlp->b); free(urlp->b); } free(url); } TiMidity++-2.13.2/utils/memb.h0100644004711200001440000000352507421005037015131 0ustar tamukiusers/* TiMidity++ -- MIDI to WAVE converter and player Copyright (C) 1999-2002 Masanao Izumo Copyright (C) 1995 Tuukka Toivonen 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef ___MEMB_H_ #define ___MEMB_H_ #include "mblock.h" #include "url.h" typedef struct _MemBufferNode { struct _MemBufferNode *next; /* link to next buffer node */ int size; /* size of base */ int pos; /* current read position */ char base[1]; } MemBufferNode; #define MEMBASESIZE (MIN_MBLOCK_SIZE - sizeof(MemBufferNode)) typedef struct _MemBuffer { MemBufferNode *head; /* start buffer node pointer */ MemBufferNode *tail; /* last buffer node pointer */ MemBufferNode *cur; /* current buffer node pointer */ long total_size; MBlockList pool; } MemBuffer; extern void init_memb(MemBuffer *b); extern void push_memb(MemBuffer *b, char *buff, long buff_size); extern long read_memb(MemBuffer *b, char *buff, long buff_size); extern long skip_read_memb(MemBuffer *b, long size); extern void rewind_memb(MemBuffer *b); extern void delete_memb(MemBuffer *b); extern URL memb_open_stream(MemBuffer *b, int autodelete); #endif /* ___MEMB_H_ */ TiMidity++-2.13.2/utils/nkflib.c0100644004711200001440000020714710053327122015454 0ustar tamukiusers/* TiMidity++ -- MIDI to WAVE converter and player Copyright (C) 1999-2002 Masanao Izumo Copyright (C) 1995 Tuukka Toivonen 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ #include "timidity.h" #ifdef JAPANESE /** Network Kanji Filter. (PDS Version) ************************************************************************ ** Copyright (C) 1987, Fujitsu LTD. (Itaru ICHIKAWA) ** Ϣ衧 ʳٻ̸ꡡեȣ ** E-Mail Address: ichikawa@flab.fujitsu.co.jp ** Copyright (C) 1996,1998 ** Ϣ衧 ΰؾ󹩳ز mine/X0208 support ** E-Mail Address: kono@ie.u-ryukyu.ac.jp ** Ϣ衧 COW for DOS & Win16 & Win32 & OS/2 ** E-Mail Address: GHG00637@niftyserve.or.p ** ΥΤʤʣ̡ѡޤ ** κݤˤϡï׸򼨤ʬĤȡ ** ۤ仨Ͽʤɤ䤤碌ɬפޤ ** ΥץˤĤƤä˲ݾڤ⤷ʤ餺 ** Everyone is permitted to do anything on this program ** including copying, modifying, improving. ** as long as you don't try to pretend that you wrote it. ** i.e., the above copyright notice has to appear in all copies. ** You don't have to ask before copying or publishing. ** THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE. ***********************************************************************/ /* ʲΥϡnkf ʸǤ褦¤饤֥Ǥ롣 nkf_conv(ʸ,ʸout ⡼) ʸ NULL ȤȤϡʸ롣 Х : ѴϤʸΤΰϤ٤ȤäƤȡ ʤȡХ롣 nkf_convert(ʸ󡢽ʸ󡢽ʸκ礭 in ⡼ɡout ⡼) kanji_conv ˽स롣ʸκ礭Ǥ롣 礭ʾˤʤäȤϤʾʸνϤǤڤ롣 ⡼ nkf convert Ϳ륪ץͿʸ󡣶Ƕڤäƻꤹ롣 ƥץ: Υץ˴ؤƤߤΤȤ nkf ˽सΤȤ롣 ̵ݾڤǤΤǡѤξϼǤäƤ뤳ȡ Ѽ 1997.02 */ /* ̵̤ʤȤ ¾Ѥʤ󥿡ե static ˤ ѥ Warning å褦 ANSI C ηˤ ʸ unsigned char * SFILE ߤ褦ˤ SFILE ñ input_f == FALSE convert ȡȾѥ SJIS EUC ȽǤƤޤХ(ͤä)ľ ʤ顤SJIS Ⱦѥ 2 ʸ EUC ϶̤Ǥʤ 礬롥ΤȤ SJIS ȤѴ뤳Ȥˤ EUC_STRICT_CHECK EUC-Japan ɤ˥å 褦ˤ ɤ߹ʸǤ褦ˤ Ѽ б 1997 */ /* 1.7١ѹ Ѽ 2000.10 */ /* ⤷EUC-Japan δʥå򤹤 EUC_STRICT_CHECK * Ƥ1 ХȤǤ EUC-Japan ̤ʸޤޤƤ * EUC ȤߤʤʤʤäƤޤޤ¾ΥץǴɤ EUC Ѵ * 硤EUC ̤إޥåפǽޤ */ /* #define EUC_STRICT_CHECK */ #if 0 static char *CopyRight = "Copyright (C) 1987, FUJITSU LTD. (I.Ichikawa),1998 S. Kono, COW"; static char *Version = "1.7"; static char *Patchlevel = "0/9711/Shinji Kono"; #endif /* ** ** ** ** USAGE: nkf [flags] [file] ** ** Flags: ** b Output is bufferred (DEFAULT) ** u Output is unbufferred ** ** t no operation ** ** j Outout code is JIS 7 bit (DEFAULT SELECT) ** s Output code is MS Kanji (DEFAULT SELECT) ** e Output code is AT&T JIS (DEFAULT SELECT) ** l Output code is JIS 7bit and ISO8859-1 Latin-1 ** ** m MIME conversion for ISO-2022-JP ** i_ Output sequence to designate JIS-kanji (DEFAULT_J) ** o_ Output sequence to designate single-byte roman characters (DEFAULT_R) ** ** r {de/en}crypt ROT13/47 ** ** v display Version ** ** T Text mode output (for MS-DOS) ** ** x Do not convert X0201 kana into X0208 ** Z Convert X0208 alphabet to ASCII ** ** f60 fold option ** ** m MIME decode ** B try to fix broken JIS, missing Escape ** B[1-9] broken level ** ** O Output to 'nkf.out' file ** d Delete \r in line feed ** c Add \r in line feed **/ /******************************/ /* ǥեȤνϥ */ /* Select DEFAULT_CODE */ #define DEFAULT_CODE_JIS /* #define DEFAULT_CODE_SJIS */ /* #define DEFAULT_CODE_EUC */ /******************************/ #if (defined(__TURBOC__) || defined(LSI_C)) && !defined(MSDOS) #define MSDOS #endif #include #include #ifndef NO_STRING_H #include #else #include #endif #ifdef MSDOS #ifdef LSI_C #define setbinmode(fp) fsetbin(fp) #else /* Microsoft C, Turbo C */ #define setbinmode(fp) setmode(fileno(fp), O_BINARY) #endif #else /* UNIX,OS/2 */ #define setbinmode(fp) #endif #ifdef _IOFBF /* SysV and MSDOS */ #define setvbuffer(fp, buf, size) setvbuf(fp, buf, _IOFBF, size) #else /* BSD */ #define setvbuffer(fp, buf, size) setbuffer(fp, buf, size) #endif #include "common.h" #include "nkflib.h" #define VOIDVOID 0 #ifndef FALSE #define FALSE 0 #endif /* FALSE */ #ifndef TRUE #define TRUE 1 #endif /* TRUE */ /* state of output_mode and input_mode */ #define ASCII 0 #define X0208 1 #define X0201 2 #define NO_X0201 3 #define JIS_INPUT 4 #define SJIS_INPUT 5 #define LATIN1_INPUT 6 #define FIXED_MIME 7 #define DOUBLE_SPACE -2 #define EUC_INPUT 8 #define NL 0x0a #define ESC 0x1b #define SPACE 0x20 #define AT 0x40 #define SSP 0xa0 #define DEL 0x7f #define SI 0x0f #define SO 0x0e #define SSO 0x8e #define HOLD_SIZE 32 #define IOBUF_SIZE 16384 #define DEFAULT_J 'B' #define DEFAULT_R 'B' #define SJ0162 0x00e1 /* 01 - 62 ku offset */ #define SJ6394 0x0161 /* 63 - 94 ku offset */ /* SFILE begin */ /* ʸ FILE ߤ˰ٹ */ /* nkf δѴեФƤΤбƤΤǤ ʸǻȤ褦ˤ뤿Υ󥿡եǤ롣 бƤ뵡ǽϾʤɬפʤΤäƤʤäơ nkf Ǥ̣ΤʤΤǤ SFILE FILE ߤʤΤʸեߤ˰褦ˤ롣 SFILE Ȥˤɬץ󤹤뤳ȡssopen mode=="new" ޤ "auto" ꤷƤʤХɬפϤʤSFILE ľ Ϥ꤬ФƤǤ SEOF EOF ߤʤΡ ssopen open ߤʴؿǡ sf : SFILE ѿ st : ʸ maxsize : ʸ󤬵ƤǤ礭sputc ¤Ρ maxsize -1 ꤹȤν̵뤹褦ˤʤ롣 ΤȤϡɬװʾʸ sputc ʤ褦˵Ĥʤ Фʤʤ mode : newstrstdoutstdin ʸǤ롣 㤨 mode="new stdout" newstr ϼưŪʸΥ maxsize 롣 maxsize < 1 ΤȤϥǥեȤͤ롣 stdout SFILE ɸ stdout Ȥʤʸꤹ롣 stdin SFILE ɸ stdin Ȥʤʸꤹ롣 sclose close ߤʴؿǡnewstr ǥץ󤵤ƤȤϡ ʸ free Ǿõ롣 sgetcsungetcsputcsputchar Ϥ줾 getcungetcputcputchar 롣 sf NULL λ SEOF ֤ */ typedef struct __SFILE { unsigned char *pointer; /* ʸ󸽺ߤΥݥ */ unsigned char *head; /* ʸκǽΰ */ unsigned char *tail; /* ʸεƤκǸΰ */ char mode[20]; /* ʸ󥪡ץ⡼ newstr,stdout,stdin */ /* "newstr stdin" ȹ碌Ϥʤ */ } SFILE; #define SEOF -1 static SFILE *sstdout=NULL; static SFILE *sstdin=NULL; /* Never used ? */ #ifndef BUFSIZ #define BUFSIZ 1024 #endif /* BUFSIZ */ static char sfile_buffer[BUFSIZ]; #ifndef SAFE_CONVERT_LENGTH #define SAFE_CONVERT_LENGTH(len) (2 * (len) + 7) #endif /* SAFE_CONVERT_LENGTH */ /* Functions */ static SFILE *ssopen(SFILE *, char *string,signed int maxsize,char *md); static void sclose(SFILE *sf); static int sgetc(SFILE *sf); static int sungetc(int c,SFILE *sf); static int sputc(int c,SFILE *sf); #define sputchar(c) sputc(c,sstdout) /* nkf С */ char *nkf_convert(char *si,char *so,int maxsize,char *in_mode,char *out_mode); char *nkf_conv(char *si,char *so,char *out_mode); static int check_kanji_code(unsigned char *p); /* MIME preprocessor */ #undef STRICT_MIME /* do stupid strict mime integrity check */ #define GETC(p) ((!mime_mode)?sgetc(p):mime_getc(p)) #define UNGETC(c,p) ((!mime_mode)?sungetc(c,p):mime_ungetc(c)) #ifdef EASYWIN /*Easy Win */ extern POINT _BufferSize; #endif /* function prototype */ static int noconvert(SFILE *f); static int kanji_convert(SFILE *f); static int h_conv(SFILE *f,int c2,int c1); static int push_hold_buf(int c2,int c1); static int s_iconv(int c2,int c1); static int e_oconv(int c2,int c1); static int s_oconv(int c2,int c1); static int j_oconv(int c2,int c1); static int line_fold(int c2,int c1); static int pre_convert(int c1,int c2); static int mime_begin(SFILE *f); static int mime_getc(SFILE *f); static int mime_ungetc(unsigned int c); static int mime_integrity(SFILE *f,unsigned char *p); static int base64decode(int c); static int usage(void); static void arguments(char *c); static void reinit(); /* buffers */ static char stdibuf[IOBUF_SIZE]; static char stdobuf[IOBUF_SIZE]; static unsigned char hold_buf[HOLD_SIZE*2]; static int hold_count; /* MIME preprocessor fifo */ #define MIME_BUF_SIZE (1024) /* 2^n ring buffer */ #define MIME_BUF_MASK (MIME_BUF_SIZE-1) #define Fifo(n) mime_buf[(n)&MIME_BUF_MASK] static unsigned char mime_buf[MIME_BUF_SIZE]; static unsigned int mime_top = 0; static unsigned int mime_last = 0; /* decoded */ static unsigned int mime_input = 0; /* undecoded */ /* flags */ static int unbuf_f = FALSE; static int estab_f = FALSE; static int nop_f = FALSE; static int binmode_f = TRUE; /* binary mode */ static int rot_f = FALSE; /* rot14/43 mode */ static int input_f = FALSE; /* non fixed input code */ static int alpha_f = FALSE; /* convert JIx0208 alphbet to ASCII */ static int mime_f = TRUE; /* convert MIME B base64 or Q */ static int mimebuf_f = FALSE; /* MIME buffered input */ static int broken_f = FALSE; /* convert ESC-less broken JIS */ static int iso8859_f = FALSE; /* ISO8859 through */ #if defined(MSDOS) || defined(__OS2__) static int x0201_f = TRUE; /* Assume JISX0201 kana */ #else static int x0201_f = NO_X0201; /* Assume NO JISX0201 */ #endif /* X0208 -> ASCII converter */ static int c1_return; /* fold parameter */ static int line = 0; /* chars in line */ static int prev = 0; static int fold_f = FALSE; static int fold_len = 0; /* options */ static char kanji_intro = DEFAULT_J, ascii_intro = DEFAULT_R; /* Folding */ int line_fold(); #define FOLD_MARGIN 10 #define DEFAULT_FOLD 60 /* converters */ #ifdef DEFAULT_CODE_JIS # define DEFAULT_CONV j_oconv #endif #ifdef DEFAULT_CODE_SJIS # define DEFAULT_CONV s_oconv #endif #ifdef DEFAULT_CODE_EUC # define DEFAULT_CONV e_oconv #endif static int (*iconv)(int c2,int c1); /* s_iconv or oconv */ static int (*oconv)(int c2,int c1) = DEFAULT_CONV; /* [ejs]_oconv */ /* Global states */ static int output_mode = ASCII, /* output kanji mode */ input_mode = ASCII, /* input kanji mode */ shift_mode = FALSE; /* TRUE shift out, or X0201 */ static int mime_mode = FALSE; /* MIME mode B base64, Q hex */ /* X0201 / X0208 conversion tables */ /* X0201 kana conversion table */ /* 90-9F A0-DF */ unsigned char cv[]= { 0x21,0x21,0x21,0x23,0x21,0x56,0x21,0x57, 0x21,0x22,0x21,0x26,0x25,0x72,0x25,0x21, 0x25,0x23,0x25,0x25,0x25,0x27,0x25,0x29, 0x25,0x63,0x25,0x65,0x25,0x67,0x25,0x43, 0x21,0x3c,0x25,0x22,0x25,0x24,0x25,0x26, 0x25,0x28,0x25,0x2a,0x25,0x2b,0x25,0x2d, 0x25,0x2f,0x25,0x31,0x25,0x33,0x25,0x35, 0x25,0x37,0x25,0x39,0x25,0x3b,0x25,0x3d, 0x25,0x3f,0x25,0x41,0x25,0x44,0x25,0x46, 0x25,0x48,0x25,0x4a,0x25,0x4b,0x25,0x4c, 0x25,0x4d,0x25,0x4e,0x25,0x4f,0x25,0x52, 0x25,0x55,0x25,0x58,0x25,0x5b,0x25,0x5e, 0x25,0x5f,0x25,0x60,0x25,0x61,0x25,0x62, 0x25,0x64,0x25,0x66,0x25,0x68,0x25,0x69, 0x25,0x6a,0x25,0x6b,0x25,0x6c,0x25,0x6d, 0x25,0x6f,0x25,0x73,0x21,0x2b,0x21,0x2c, 0x00,0x00}; /* X0201 kana conversion table for daguten */ /* 90-9F A0-DF */ unsigned char dv[]= { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x25,0x2c,0x25,0x2e, 0x25,0x30,0x25,0x32,0x25,0x34,0x25,0x36, 0x25,0x38,0x25,0x3a,0x25,0x3c,0x25,0x3e, 0x25,0x40,0x25,0x42,0x25,0x45,0x25,0x47, 0x25,0x49,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x25,0x50,0x25,0x53, 0x25,0x56,0x25,0x59,0x25,0x5c,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00}; /* X0201 kana conversion table for han-daguten */ /* 90-9F A0-DF */ unsigned char ev[]= { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x25,0x51,0x25,0x54, 0x25,0x57,0x25,0x5a,0x25,0x5d,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00}; /* X0208 kigou conversion table */ /* 0x8140 - 0x819e */ unsigned char fv[] = { 0x00,0x00,0x00,0x00,0x2c,0x2e,0x00,0x3a, 0x3b,0x3f,0x21,0x00,0x00,0x27,0x60,0x00, 0x5e,0x00,0x5f,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x2d,0x00,0x2f, 0x5c,0x00,0x00,0x7c,0x00,0x00,0x60,0x27, 0x22,0x22,0x28,0x29,0x00,0x00,0x5b,0x5d, 0x7b,0x7d,0x3c,0x3e,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x2b,0x2d,0x00,0x00, 0x00,0x3d,0x00,0x3c,0x3e,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x24,0x00,0x00,0x25,0x23,0x26,0x2a,0x40, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 } ; /* SFILE Ϣؿ */ static SFILE * ssopen(SFILE *sf, char *string, signed int maxsize, char *md) { char *st; strcpy(sf->mode,md); if (strstr(sf->mode,"newstr")) { if(maxsize <= sizeof(sfile_buffer)) st = sfile_buffer; else st = (char *)safe_malloc(maxsize); } else st=string; sf->pointer=sf->head=(unsigned char *)st; if (strstr(sf->mode,"stdout")) sstdout=sf; else if (strstr(sf->mode,"stdin")) { sstdin=sf; maxsize=strlen((char *)st); } sf->tail=sf->head+maxsize; return sf; } static void sclose(SFILE *sf) { if (sf==NULL) return; if (strstr(sf->mode,"stdout")) sstdout=NULL; if (strstr(sf->mode,"stdin")) sstdin=NULL; if (strstr(sf->mode,"newstr") && sf->head != (unsigned char *)sfile_buffer) free(sf->head); } static int sgetc(SFILE *sf) { if (sf==NULL) return SEOF; if(sf->pointertail) return (int)*sf->pointer++; return SEOF; } static int sungetc(int c, SFILE *sf) { if (sf==NULL) return SEOF; if (sf->headpointer) { *--sf->pointer=(unsigned char)c; return c; } else return SEOF; } static int sputc(int c, SFILE *sf) { if (sf==NULL) return SEOF; if (sf->pointertail) return (int)(*sf->pointer++=(unsigned char)c); return SEOF; } /* public ؿ start */ /* nkf Сȴؿ */ /* si must be terminated with '\0' */ char * nkf_convert(char *si, char *so, int maxsize, char *in_mode, char *out_mode) { /* */ SFILE *fi,*fo; SFILE xfi,xfo; int a; reinit(); /* ѡ */ if(maxsize == -1) maxsize = SAFE_CONVERT_LENGTH(strlen(si)); else if(maxsize == 0) return si; fi = &xfi; fo = &xfo; if (so!=NULL) { ssopen(fi,si,0,"stdin"); ssopen(fo,so,maxsize,"stdout"); } else { ssopen(fi,si,0,"stdin"); ssopen(fo,so,maxsize,"newstr stdout"); } /* ѿǥե */ unbuf_f = FALSE; estab_f = FALSE; rot_f = FALSE; /* rot14/43 mode */ input_f = FALSE; /* non fixed input code */ alpha_f = FALSE; /* convert JIx0208 alphbet to ASCII */ mime_f = FALSE; /* convert MIME base64 */ broken_f = FALSE; /* convert ESC-less broken JIS */ iso8859_f = FALSE; /* ISO8859 through */ #ifdef MSDOS x0201_f = TRUE; /* Assume JISX0201 kana */ #else x0201_f = NO_X0201; /* Assume NO JISX0201 */ #endif line = 0; /* chars in line */ prev = 0; fold_f = FALSE; fold_len = 0; kanji_intro = DEFAULT_J; ascii_intro = DEFAULT_R; output_mode = ASCII; /* output kanji mode */ input_mode = ASCII; /* input kanji mode */ shift_mode = FALSE; /* TRUE shift out, or X0201 */ mime_mode = FALSE; /* MIME mode B base64, Q hex */ #if 0 /* No X0201->X0208 conversion Ⱦѥʤͭ*/ x0201_f = FALSE; #else /* ȾѥʤѤˤ */ x0201_f = TRUE; #endif /* ץ mode */ oconv=e_oconv; if (strstr(out_mode,"EUCK")||strstr(out_mode,"euck")||strstr(out_mode,"ujisk")){ /*Hankaku Enable (For WRD File )*/ oconv=e_oconv; /* No X0201->X0208 conversion Ⱦѥʤͭ*/ x0201_f = FALSE; } else if (strstr(out_mode,"SJISK")||strstr(out_mode,"sjisk")){ /*Hankaku Enable (For WRD File )*/ oconv=s_oconv; /* No X0201->X0208 conversion Ⱦѥʤͭ*/ x0201_f = FALSE; } else if (strstr(out_mode,"JISK")||strstr(out_mode,"jisk")){ /*Hankaku Enable (For WRD File )*/ oconv=j_oconv; /* No X0201->X0208 conversion Ⱦѥʤͭ*/ x0201_f = FALSE; } else if (strstr(out_mode,"EUC")||strstr(out_mode,"euc")||strstr(out_mode,"ujis")) oconv=e_oconv; else if (strstr(out_mode,"SJIS")||strstr(out_mode,"sjis")) oconv=s_oconv; else if (strstr(out_mode,"JIS")||strstr(out_mode,"jis")) oconv=j_oconv; /* ɤ߹ߥɤΥå */ input_f = -1; if(in_mode != NULL) { if(strstr(in_mode,"EUC")||strstr(in_mode,"euc")||strstr(in_mode,"ujis")) input_f = JIS_INPUT; else if (strstr(in_mode,"SJIS")||strstr(in_mode,"sjis")) input_f = SJIS_INPUT; else if (strstr(in_mode,"JIS")||strstr(in_mode,"jis")) input_f = JIS_INPUT; } if(input_f == -1) { /* Auto detect */ input_f = check_kanji_code((unsigned char *)si); if(input_f == -1) input_f = SJIS_INPUT; else if(input_f == EUC_INPUT) input_f = JIS_INPUT; if(input_f == SJIS_INPUT && x0201_f == NO_X0201) x0201_f = TRUE; } /* С */ kanji_convert(fi); /* */ sputchar('\0'); if (so==NULL) { /* Copy `fo' buffer to `si' */ a = fo->pointer - fo->head; /* Stored length */ if(a > maxsize) a = maxsize; memcpy(si, fo->head, a); /* Do copy */ so = si; } sclose(fi); sclose(fo); return so; } char * nkf_conv(char *si, char *so, char *mode) { return nkf_convert(si,so,-1,NULL,mode); } /* public ؿ end */ #define IS_SJIS_HANKAKU(c) (0xa0 <= (c) && (c) <= 0xdf) #define IS_SJIS_BYTE1(c) ((0x81 <= (c) && (c) <= 0x9f) ||\ (0xe0 <= (c) && (c) <= 0xfc)) #define IS_SJIS_BYTE2(c) ((0x40 <= (c) && (c) <= 0x7e) ||\ (0x80 <= (c) && (c) <= 0xfc)) #define IS_EUC_BYTE1(c) (0xa1 <= (c) && (c) <= 0xf4) #ifdef EUC_STRICT_CHECK #define IS_EUC_BYTE2(c) (0xa1 <= (c) && (c) <= 0xfe) #else #define IS_EUC_BYTE2(c) (0xa0 <= (c) && (c) <= 0xff) #endif /* EUC_STRICT_CHECK */ #ifdef EUC_STRICT_CHECK #define EUC_GAP_LIST_SIZE (16*2) static unsigned int euc_gap_list[EUC_GAP_LIST_SIZE] = { 0xa2af, 0xa2b9, 0xa2c2, 0xa2c9, 0xa2d1, 0xa2db, 0xa2eb, 0xa2f1, 0xa2fa, 0xa2fd, 0xa3a1, 0xa3af, 0xa3ba, 0xa3c0, 0xa3db, 0xa3e0, 0xa3fb, 0xa3fe, 0xa4f4, 0xa4fe, 0xa5f7, 0xa5fe, 0xa6b9, 0xa6c0, 0xa6d9, 0xa6fe, 0xa7c2, 0xa7d0, 0xa7f2, 0xa7fe, 0xa8c1, 0xaffe }; #endif /* EUC_STRICT_CHECK */ static int check_kanji_code(unsigned char *p) { int c1, c2, mode; int noteuc; /* check JIS or ASCII code */ mode = ASCII; while(*p) { if(*p < SPACE || *p >= DEL) { if(*p == ESC) return JIS_INPUT; mode = -1; /* None ASCII */ break; } p++; } if(mode == ASCII) return ASCII; /* EUC or SJIS */ noteuc = 0; while(*p) { /* skip ASCII */ while(*p && *p <= DEL) p++; if(!*p) return -1; c1 = p[0]; c2 = p[1]; if(c2 == 0) { if(IS_SJIS_HANKAKU(c1)) return SJIS_INPUT; return -1; } if(IS_SJIS_HANKAKU(c1)) { #ifdef EUC_STRICT_CHECK unsigned int c; #endif /* EUC_STRICT_CHECK */ /* 0xa0 0xa1 0xdf 0xf4 0xfe |<-----+---- SH -------->| | | SH: SJIS-HANKAKU |<------- E1 ----------->| | E1: EUC (MSB) |<--------E2------------------->| E2: EUC (LSB) */ if(!IS_EUC_BYTE1(c1) || !IS_EUC_BYTE2(c2)) return SJIS_INPUT; if(!IS_SJIS_HANKAKU(c2)) /* (0xdf..0xfe] */ return EUC_INPUT; #ifdef EUC_STRICT_CHECK if(!noteuc) { int i; /* Checking more strictly */ c = (((unsigned int)c1)<<8 | (unsigned int)c2); for(i = 0; i < EUC_GAP_LIST_SIZE; i += 2) if(euc_gap_list[i] <= c && c <= euc_gap_list[i + 1]) { noteuc = 1; break; } } #endif /* EUC_STRICT_CHECK */ p += 2; } else if(IS_SJIS_BYTE1(c1) && IS_SJIS_BYTE2(c2)) { if(!(IS_EUC_BYTE1(c1) && IS_EUC_BYTE2(c2))) return SJIS_INPUT; p += 2; } else if(IS_EUC_BYTE1(c1) && IS_EUC_BYTE2(c2)) { return EUC_INPUT; } else p++; /* What? Is this japanese? Try check again. */ } if(noteuc) return SJIS_INPUT; return -1; } #ifdef EUC_STRICT_CHECK static void fix_euc_code(unsigned char *s, int len) { int i, j, c; for(i = 0; i < len - 1; i++) { if(s[i] & 0x80) { c = (((unsigned int)s[i])<<8 | (unsigned int)s[i + 1]); for(j = 0; j < EUC_GAP_LIST_SIZE; j += 2) if(euc_gap_list[j] <= c && c <= euc_gap_list[j + 1]) { s[i] = 0xa1; s[i + 1] = 0xa1; break; } i++; } } } #endif /* EUC_STRICT_CHECK */ static int file_out = FALSE; static int add_cr = FALSE; static int del_cr = FALSE; static int end_check; #if 0 #ifndef PERL_XS int main(argc, argv) int argc; char **argv; { FILE *fin; char *cp; #ifdef EASYWIN /*Easy Win */ _BufferSize.y = 400;/*Set Scroll Buffer Size*/ #endif for (argc--,argv++; (argc > 0) && **argv == '-'; argc--, argv++) { cp = *argv; arguments(cp); } if(iso8859_f && (oconv != j_oconv || !x0201_f )) { fprintf(stderr,"Mixed ISO8859/JISX0201/SJIS/EUC output is not allowed.\n"); exit(1); } if(binmode_f == TRUE) #ifdef __OS2__ if(freopen("","wb",stdout) == NULL) return (-1); #else setbinmode(stdout); #endif if(unbuf_f) setbuf(stdout, (char *) NULL); else setvbuffer(stdout, stdobuf, IOBUF_SIZE); if(argc == 0) { if(binmode_f == TRUE) #ifdef __OS2__ if(freopen("","rb",stdin) == NULL) return (-1); #else setbinmode(stdin); #endif setvbuffer(stdin, stdibuf, IOBUF_SIZE); if(nop_f) noconvert(stdin); else kanji_convert(stdin); } else { while (argc--) { if((fin = fopen(*argv++, "r")) == NULL) { perror(*--argv); return(-1); } else { /* reopen file for stdout */ if(file_out == TRUE){ if(argc == 1 ) { if(freopen(*argv++, "w", stdout) == NULL) { perror(*--argv); return (-1); } argc--; } else { if(freopen("nkf.out", "w", stdout) == NULL) { perror(*--argv); return (-1); } } if(binmode_f == TRUE) { #ifdef __OS2__ if(freopen("","wb",stdout) == NULL) return (-1); #else setbinmode(stdout); #endif } } if(binmode_f == TRUE) #ifdef __OS2__ if(freopen("","rb",fin) == NULL) return (-1); #else setbinmode(fin); #endif setvbuffer(fin, stdibuf, IOBUF_SIZE); if(nop_f) noconvert(fin); else kanji_convert(fin); fclose(fin); } } } #ifdef EASYWIN /*Easy Win */ if(file_out == FALSE) scanf("%d",&end_check); else fclose(stdout); #else /* for Other OS */ if(file_out == TRUE) fclose(stdout); #endif return (0); } #endif void arguments(char *cp) { while (*cp) { switch (*cp++) { case 'b': /* buffered mode */ unbuf_f = FALSE; continue; case 'u': /* non bufferd mode */ unbuf_f = TRUE; continue; case 't': /* transparent mode */ nop_f = TRUE; continue; case 'j': /* JIS output */ case 'n': oconv = j_oconv; continue; case 'e': /* AT&T EUC output */ oconv = e_oconv; continue; case 's': /* SJIS output */ oconv = s_oconv; continue; case 'l': /* ISO8859 Latin-1 support, no conversion */ iso8859_f = TRUE; /* Only compatible with ISO-2022-JP */ input_f = LATIN1_INPUT; continue; case 'i': /* Kanji IN ESC-$-@/B */ if(*cp=='@'||*cp=='B') kanji_intro = *cp++; continue; case 'o': /* ASCII IN ESC-(-J/B */ if(*cp=='J'||*cp=='B'||*cp=='H') ascii_intro = *cp++; continue; case 'r': rot_f = TRUE; continue; #if defined(MSDOS) || defined(__OS2__) case 'T': binmode_f = FALSE; continue; #endif #ifndef PERL_XS case 'v': usage(); exit(1); break; #endif /* Input code assumption */ case 'J': /* JIS input */ case 'E': /* AT&T EUC input */ input_f = JIS_INPUT; continue; case 'S': /* MS Kanji input */ input_f = SJIS_INPUT; if(x0201_f==NO_X0201) x0201_f=TRUE; continue; case 'Z': /* Convert X0208 alphabet to asii */ /* bit:0 Convert X0208 bit:1 Convert Kankaku to one space bit:2 Convert Kankaku to two spaces */ if('9'>= *cp && *cp>='0') alpha_f |= 1<<(*cp++ -'0'); else alpha_f |= TRUE; continue; case 'x': /* Convert X0201 kana to X0208 or X0201 Conversion */ x0201_f = FALSE; /* No X0201->X0208 conversion */ /* accept X0201 ESC-(-I in JIS, EUC, MS Kanji SI/SO in JIS, EUC, MS Kanji SSO in EUC, JIS, not in MS Kanji MS Kanji (0xa0-0xdf) output X0201 ESC-(-I in JIS (0x20-0x5f) SSO in EUC (0xa0-0xdf) 0xa0-0xd in MS Kanji (0xa0-0xdf) */ continue; case 'X': /* Assume X0201 kana */ /* Default value is NO_X0201 for EUC/MS-Kanji mix */ x0201_f = TRUE; continue; case 'f': /* folding -f60 or -f */ fold_f = TRUE; fold_len = atoi(cp); if(!(0= *cp && *cp>='0') broken_f |= 1<<(*cp++ -'0'); else broken_f |= TRUE; continue; #ifndef PERL_XS case 'O':/* for Output file */ file_out = TRUE; continue; #endif case 'c':/* add cr code */ add_cr = TRUE; continue; case 'd':/* delete cr code */ del_cr = TRUE; continue; default: /* bogus option but ignored */ continue; } } } #endif int noconvert(f) SFILE *f; { int c; while ((c = sgetc(f)) != EOF) sputchar(c); return 1; } int kanji_convert(SFILE *f) { int c1, c2; c2 = 0; if(input_f == JIS_INPUT || input_f == LATIN1_INPUT) { estab_f = TRUE; iconv = oconv; } else if(input_f == SJIS_INPUT) { estab_f = TRUE; iconv = s_iconv; } else { estab_f = FALSE; iconv = oconv; } input_mode = ASCII; output_mode = ASCII; shift_mode = FALSE; #define NEXT continue /* no output, get next */ #define SEND ; /* output c1 and c2, get next */ #define LAST break /* end of loop, go closing */ while ((c1 = GETC(f)) != EOF) { if(c2) { /* second byte */ if(c2 > DEL) { /* in case of 8th bit is on */ if(!estab_f) { /* in case of not established yet */ if(c1 > SSP) { /* It is still ambiguious */ h_conv(f, c2, c1); c2 = 0; NEXT; } else if(c1 < AT) { /* ignore bogus code */ c2 = 0; NEXT; } else { /* established */ /* it seems to be MS Kanji */ estab_f = TRUE; iconv = s_iconv; SEND; } } else /* in case of already established */ if(c1 < AT) { /* ignore bogus code */ c2 = 0; NEXT; } else SEND; } else /* 7 bit code */ /* it might be kanji shitfted */ if((c1 == DEL) || (c1 <= SPACE)) { /* ignore bogus first code */ c2 = 0; NEXT; } else SEND; } else { /* first byte */ if(c1 > DEL) { /* 8 bit code */ if(!estab_f && !iso8859_f) { /* not established yet */ if(c1 < SSP) { /* it seems to be MS Kanji */ estab_f = TRUE; iconv = s_iconv; } else if(c1 < 0xe0) { /* it seems to be EUC */ estab_f = TRUE; iconv = oconv; } else { /* still ambiguious */ } c2 = c1; NEXT; } else { /* estab_f==TRUE */ if(iso8859_f) { SEND; } else if(SSP<=c1 && c1<0xe0 && iconv == s_iconv) { /* SJIS X0201 Case... */ /* This is too arrogant, but ... */ if(x0201_f==NO_X0201) { iconv = oconv; c2 = c1; NEXT; } else if(x0201_f) { if(dv[(c1-SSP)*2]||ev[(c1-SSP)*2]) { /* look ahead for X0201/X0208conversion */ if((c2 = GETC(f)) == EOF) { (*oconv)(cv[(c1-SSP)*2],cv[(c1-SSP)*2+1]); LAST; } else if(c2==(0xde)) { /* */ (*oconv)(dv[(c1-SSP)*2],dv[(c1-SSP)*2+1]); c2=0; NEXT; } else if(c2==(0xdf)&&ev[(c1-SSP)*2]) { /* Ⱦ */ (*oconv)(ev[(c1-SSP)*2],ev[(c1-SSP)*2+1]); c2=0; NEXT; } UNGETC(c2,f); c2 = 0; } (*oconv)(cv[(c1-SSP)*2],cv[(c1-SSP)*2+1]); NEXT; } else SEND; } else if(c1==SSO && iconv != s_iconv) { /* EUC X0201 Case */ /* This is too arrogant if(x0201_f == NO_X0201) { estab_f = FALSE; c2 = 0; NEXT; } */ c1 = GETC(f); /* skip SSO */ euc_1byte_check: if(x0201_f && SSP<=c1 && c1<0xe0) { if(dv[(c1-SSP)*2]||ev[(c1-SSP)*2]) { if((c2 = GETC(f)) == EOF) { (*oconv)(cv[(c1-SSP)*2],cv[(c1-SSP)*2+1]); LAST; } /* forward lookup /Ⱦ */ if(c2 != SSO) { UNGETC(c2,f); c2 = 0; (*oconv)(cv[(c1-SSP)*2],cv[(c1-SSP)*2+1]); NEXT; } else if((c2 = GETC(f)) == EOF) { (*oconv)(cv[(c1-SSP)*2],cv[(c1-SSP)*2+1]); (*oconv)(0,SSO); LAST; } else if(c2==(0xde)) { /* */ (*oconv)(dv[(c1-SSP)*2],dv[(c1-SSP)*2+1]); c2=0; NEXT; } else if(c2==(0xdf)&&ev[(c1-SSP)*2]) { /* Ⱦ */ (*oconv)(ev[(c1-SSP)*2],ev[(c1-SSP)*2+1]); c2=0; NEXT; } else { (*oconv)(cv[(c1-SSP)*2],cv[(c1-SSP)*2+1]); /* we have to check this c2 */ /* and no way to push back SSO */ c1 = c2; c2 = 0; goto euc_1byte_check; } } (*oconv)(cv[(c1-SSP)*2],cv[(c1-SSP)*2+1]); NEXT; } else SEND; } else if(c1 < SSP && iconv != s_iconv) { /* strange code in EUC */ iconv = s_iconv; /* try SJIS */ c2 = c1; NEXT; } else { /* already established */ c2 = c1; NEXT; } } } else if((c1 > SPACE) && (c1 != DEL)) { /* in case of Roman characters */ if(shift_mode) { c1 |= 0x80; /* output 1 shifted byte */ if(x0201_f && (!iso8859_f||input_mode==X0201) && SSP<=c1 && c1<0xe0 ) { if(dv[(c1-SSP)*2]||ev[(c1-SSP)*2]) { if((c2 = GETC(f)) == EOF) { (*oconv)(cv[(c1-SSP)*2],cv[(c1-SSP)*2+1]); LAST; } else if(c2==(0xde&0x7f)) { /* */ (*oconv)(dv[(c1-SSP)*2],dv[(c1-SSP)*2+1]); c2=0; NEXT; } else if(c2==(0xdf&0x7f)&&ev[(c1-SSP)*2]) { /* Ⱦ */ (*oconv)(ev[(c1-SSP)*2],ev[(c1-SSP)*2+1]); c2=0; NEXT; } UNGETC(c2,f); c2 = 0; } (*oconv)(cv[(c1-SSP)*2],cv[(c1-SSP)*2+1]); NEXT; } else SEND; } else if(c1 == '(' && broken_f && input_mode == X0208 && !mime_mode ) { /* Try to recover missing escape */ if((c1 = GETC(f)) == EOF) { (*oconv)(0, '('); LAST; } else { if(c1 == 'B' || c1 == 'J' || c1 == 'H') { input_mode = ASCII; shift_mode = FALSE; NEXT; } else { (*oconv)(0, '('); /* do not modify various input_mode */ /* It can be vt100 sequence */ SEND; } } } else if(input_mode == X0208) { /* in case of Kanji shifted */ c2 = c1; NEXT; /* goto next_byte */ } else if(c1 == '=' && mime_f && !mime_mode ) { if((c1 = sgetc(f)) == EOF) { (*oconv)(0, '='); LAST; } else if(c1 == '?') { /* =? is mime conversion start sequence */ if(mime_begin(f) == EOF) /* check in detail */ LAST; else NEXT; } else { (*oconv)(0, '='); sungetc(c1,f); NEXT; } } else if(c1 == '$' && broken_f && !mime_mode) { /* try to recover missing escape */ if((c1 = GETC(f)) == EOF) { (*oconv)(0, '$'); LAST; } else if(c1 == '@'|| c1 == 'B') { /* in case of Kanji in ESC sequence */ input_mode = X0208; shift_mode = FALSE; NEXT; } else { /* sorry */ (*oconv)(0, '$'); (*oconv)(0, c1); NEXT; } } else SEND; } else if(c1 == SI) { shift_mode = FALSE; NEXT; } else if(c1 == SO) { shift_mode = TRUE; NEXT; } else if(c1 == ESC ) { if((c1 = GETC(f)) == EOF) { (*oconv)(0, ESC); LAST; } else if(c1 == '$') { if((c1 = GETC(f)) == EOF) { (*oconv)(0, ESC); (*oconv)(0, '$'); LAST; } else if(c1 == '@'|| c1 == 'B') { /* This is kanji introduction */ input_mode = X0208; shift_mode = FALSE; NEXT; } else if(c1 == '(') { if((c1 = GETC(f)) == EOF) { (*oconv)(0, ESC); (*oconv)(0, '$'); (*oconv)(0, '('); LAST; } else if(c1 == '@'|| c1 == 'B') { /* This is kanji introduction */ input_mode = X0208; shift_mode = FALSE; NEXT; } else { (*oconv)(0, ESC); (*oconv)(0, '$'); (*oconv)(0, '('); (*oconv)(0, c1); NEXT; } } else if(broken_f&0x2) { input_mode = X0208; shift_mode = FALSE; NEXT; } else { (*oconv)(0, ESC); (*oconv)(0, '$'); (*oconv)(0, c1); NEXT; } } else if(c1 == '(') { if((c1 = GETC(f)) == EOF) { (*oconv)(0, ESC); (*oconv)(0, '('); LAST; } else { if(c1 == 'I') { /* This is X0201 kana introduction */ input_mode = X0201; shift_mode = X0201; NEXT; } else if(c1 == 'B' || c1 == 'J' || c1 == 'H') { /* This is X0208 kanji introduction */ input_mode = ASCII; shift_mode = FALSE; NEXT; } else if(broken_f&0x2) { input_mode = ASCII; shift_mode = FALSE; NEXT; } else { (*oconv)(0, ESC); (*oconv)(0, '('); /* maintain various input_mode here */ SEND; } } } else { /* lonely ESC */ (*oconv)(0, ESC); SEND; } } else if(c1 == NL && broken_f&4) { input_mode = ASCII; SEND; } else SEND; } /* send: */ if(input_mode == X0208) (*oconv)(c2, c1); /* this is JIS, not SJIS/EUC case */ else (*iconv)(c2, c1); /* can be EUC/SJIS */ c2 = 0; continue; /* goto next_word */ } /* epilogue */ (*iconv)(EOF, 0); return 1; } int h_conv(SFILE *f, int c2, int c1) { int wc; /** it must NOT be in the kanji shifte sequence */ /** it must NOT be written in JIS7 */ /** and it must be after 2 byte 8bit code */ hold_count = 0; push_hold_buf(c2, c1); c2 = 0; while ((c1 = GETC(f)) != EOF) { if(c2) { /* second byte */ if(!estab_f) { /* not established */ if(c1 > SSP) { /* it is still ambiguious yet */ SEND; } else if(c1 < AT) { /* ignore bogus first byte */ c2 = 0; SEND; } else { /* now established */ /* it seems to be MS Kanji */ estab_f = TRUE; iconv = s_iconv; SEND; } } else SEND; } else { /* First byte */ if(c1 > DEL) { /* 8th bit is on */ if(c1 < SSP) { /* it seems to be MS Kanji */ estab_f = TRUE; iconv = s_iconv; } else if(c1 < 0xe0) { /* it seems to be EUC */ estab_f = TRUE; iconv = oconv; } else { /* still ambiguious */ } c2 = c1; NEXT; } else /* 7 bit code , then send without any process */ SEND; } /* send: */ if((push_hold_buf(c2, c1) == EOF) || estab_f) break; c2 = 0; continue; } /** now, ** 1) EOF is detected, or ** 2) Code is established, or ** 3) Buffer is FULL (but last word is pushed) ** ** in 1) and 3) cases, we continue to use ** Kanji codes by oconv and leave estab_f unchanged. **/ for (wc = 0; wc < hold_count; wc += 2) { c2 = hold_buf[wc]; c1 = hold_buf[wc+1]; (*iconv)(c2, c1); } return VOIDVOID; } int push_hold_buf(int c2, int c1) { if(hold_count >= HOLD_SIZE*2) return (EOF); hold_buf[hold_count++] = c2; hold_buf[hold_count++] = c1; return ((hold_count >= HOLD_SIZE*2) ? EOF : hold_count); } int s_iconv(int c2, int c1) { if((c2 == EOF) || (c2 == 0)) { /* NOP */ } else { c2 = c2 + c2 - ((c2 <= 0x9f) ? SJ0162 : SJ6394); if(c1 < 0x9f) c1 = c1 - ((c1 > DEL) ? SPACE : 0x1f); else { c1 = c1 - 0x7e; c2++; } } (*oconv)(c2, c1); return 1; } int e_oconv(int c2, int c1) { c2 = pre_convert(c1,c2); c1 = c1_return; if(fold_f) { switch(line_fold(c2,c1)) { case '\n': if(add_cr == TRUE) { sputchar('\r'); c1 = '\n'; } sputchar('\n'); break; case 0: return VOIDVOID; case '\r': c1 = '\n'; c2 = 0; break; case '\t': case ' ': c1 = ' '; c2 = 0; break; } } if(c2==DOUBLE_SPACE) { sputchar(' '); sputchar(' '); return VOIDVOID; } if(c2 == EOF) return VOIDVOID; else if(c2 == 0 && (c1&0x80)) { sputchar(SSO); sputchar(c1); } else if(c2 == 0) { if(c1 == '\n' && add_cr == TRUE) sputchar('\r'); if(c1 != '\r') sputchar(c1); else if(del_cr == FALSE) sputchar(c1); } else { if((c1<0x20 || 0x7e> 1) + ((c2 <= 0x5e) ? 0x71 : 0xb1))); sputchar((c1 + ((c2 & 1) ? ((c1 < 0x60) ? 0x1f : 0x20) : 0x7e))); } return VOIDVOID; } int j_oconv(int c2, int c1) { c2 = pre_convert(c1,c2); c1 = c1_return; if(fold_f) { switch(line_fold(c2,c1)) { case '\n': if(output_mode) { sputchar(ESC); sputchar('('); sputchar(ascii_intro); } if(add_cr == TRUE) { sputchar('\r'); c1 = '\n'; } sputchar('\n'); output_mode = ASCII; break; case '\r': c1 = '\n'; c2 = 0; break; case '\t': case ' ': c1 = ' '; c2 = 0; break; case 0: return VOIDVOID; } } if(c2 == EOF) { if(output_mode) { sputchar(ESC); sputchar('('); sputchar(ascii_intro); } } else if(c2 == 0 && (c1 & 0x80)) { if(input_mode==X0201 || !iso8859_f) { if(output_mode!=X0201) { sputchar(ESC); sputchar('('); sputchar('I'); output_mode = X0201; } c1 &= 0x7f; } else { /* iso8859 introduction, or 8th bit on */ /* Can we convert in 7bit form using ESC-'-'-A ? Is this popular? */ } sputchar(c1); } else if(c2 == 0) { if(output_mode) { sputchar(ESC); sputchar('('); sputchar(ascii_intro); output_mode = ASCII; } if(c1 == '\n' && add_cr == TRUE) sputchar('\r'); if(c1 != '\r') sputchar(c1); else if(del_cr == FALSE) sputchar(c1); } else if(c2 == DOUBLE_SPACE) { if(output_mode) { sputchar(ESC); sputchar('('); sputchar(ascii_intro); output_mode = ASCII; } sputchar(' '); if(c1 == '\n' && add_cr == TRUE) sputchar('\r'); if(c1 != '\r') sputchar(c1); else if(del_cr == FALSE) sputchar(c1); } else { if(output_mode != X0208) { sputchar(ESC); sputchar('$'); sputchar(kanji_intro); output_mode = X0208; } if(c1<0x20 || 0x7e0x80 Japanese (X0208/X0201) <0x80 ASCII \n new line ' ' space This fold algorthm does not preserve heading space in a line. This is the main difference from fmt. */ int line_fold(int c2, int c1) { int prev0; if(c1=='\r') return 0; /* ignore cr */ if(c1== 8) { if(line>0) line--; return 1; } if(c2==EOF && line != 0) /* close open last line */ return '\n'; /* new line */ if(c1=='\n') { if(prev == c1) { /* duplicate newline */ if(line) { line = 0; return '\n'; /* output two newline */ } else { line = 0; return 1; } } else { if(prev&0x80) { /* Japanese? */ prev = c1; return 0; /* ignore given single newline */ } else if(prev==' ') { return 0; } else { prev = c1; if(++line<=fold_len) return ' '; else { line = 0; return '\r'; /* fold and output nothing */ } } } } if(c1=='\f') { prev = '\n'; if(line==0) return 1; line = 0; return '\n'; /* output newline and clear */ } /* X0208 kankaku or ascii space */ if( (c2==0&&c1==' ')|| (c2==0&&c1=='\t')|| (c2==DOUBLE_SPACE)|| (c2=='!'&& c1=='!')) { if(prev == ' ') { return 0; /* remove duplicate spaces */ } prev = ' '; if(++line<=fold_len) return ' '; /* output ASCII space only */ else { prev = ' '; line = 0; return '\r'; /* fold and output nothing */ } } prev0 = prev; /* we still need this one... , but almost done */ prev = c1; if(c2 || (SSP<=c1 && c1<=0xdf)) prev |= 0x80; /* this is Japanese */ line += (c2==0)?1:2; if(line<=fold_len) { /* normal case */ return 1; } if(line>=fold_len+FOLD_MARGIN) { /* too many kinsou suspension */ line = (c2==0)?1:2; return '\n'; /* We can't wait, do fold now */ } /* simple kinsoku rules return 1 means no folding */ if(c2==0) { if(c1==0xde) return 1; /* */ if(c1==0xdf) return 1; /* */ if(c1==0xa4) return 1; /* */ if(c1==0xa3) return 1; /* */ if(c1==0xa1) return 1; /* */ if(c1==0xb0) return 1; /* - */ if(SSP<=c1 && c1<=0xdf) { /* X0201 */ line = 1; return '\n';/* add one new line before this character */ } /* fold point in ASCII { [ ( */ if(( c1!=')'&& c1!=']'&& c1!='}'&& c1!='.'&& c1!=','&& c1!='!'&& c1!='?'&& c1!='/'&& c1!=':'&& c1!=';')&& ((prev0=='\n')|| (prev0==' ')|| /* ignored new line */ (prev0&0x80)) /* X0208 - ASCII */ ) { line = 1; return '\n';/* add one new line before this character */ } return 1; /* default no fold in ASCII */ } else { if(c2=='!') { if(c1=='"') return 1; /* */ if(c1=='#') return 1; /* */ if(c1=='$') return 1; /* */ if(c1=='%') return 1; /* */ if(c1=='\'') return 1; /* */ if(c1=='(') return 1; /* */ if(c1==')') return 1; /* */ if(c1=='*') return 1; /* */ if(c1=='+') return 1; /* */ if(c1==',') return 1; /* */ } line = 2; return '\n'; /* add one new line before this character */ } } int pre_convert(int c1, int c2) { if(c2) c1 &= 0x7f; c1_return = c1; if(c2==EOF) return c2; c2 &= 0x7f; if(rot_f) { if(c2) { c1 = rot47(c1); c2 = rot47(c2); } else { if(!(c1 & 0x80)) c1 = rot13(c1); } c1_return = c1; } /* JISX0208 Alphabet */ if(alpha_f && c2 == 0x23 ) return 0; /* JISX0208 Kigou */ if(alpha_f && c2 == 0x21 ) { if(0x21==c1) { if(alpha_f&0x2) { c1_return = ' '; return 0; } else if(alpha_f&0x4) { c1_return = ' '; return DOUBLE_SPACE; } else { return c2; } } else if(0x20' ';i++) { /* start at =? */ if( ((r[i] = c1 = sgetc(f))==EOF) || nkf_toupper(c1) != p[i] ) { /* pattern fails, try next one */ q = p; while (p = mime_pattern[++j]) { for(k=2;k i */ if(p[k]!=q[k]) break; if(k==i && nkf_toupper(c1)==p[k]) break; } if(p) continue; /* found next one, continue */ /* all fails, output from recovery buffer */ sungetc(c1,f); for(j=0;j> 4) & 0x03); if(c2 != '=') { Fifo(mime_last++) = cc; cc = ((t2 << 4) & 0x0f0) | ((t3 >> 2) & 0x0f); if(c3 != '=') { Fifo(mime_last++) = cc; cc = ((t3 << 6) & 0x0c0) | (t4 & 0x3f); if(c4 != '=') Fifo(mime_last++) = cc; } } else { return c1; } return Fifo(mime_top++); } int mime_ungetc(c) unsigned int c; { Fifo(mime_last++) = c; return c; } #ifdef STRICT_MIME int mime_integrity(SFILE *f, unsigned char *p) { int c,d; unsigned int q; /* In buffered mode, read until =? or NL or buffer full */ mime_input = mime_top; mime_last = mime_top; while(*p) Fifo(mime_input++) = *p++; d = 0; q = mime_input; while((c=sgetc(f))!=EOF) { if(((mime_input-mime_top)&MIME_BUF_MASK)==0) break; if(c=='=' && d=='?') { /* checked. skip header, start decode */ Fifo(mime_input++) = c; mime_input = q; return 1; } if(!( (c=='+'||c=='/'|| c=='=' || c=='?' || ('a'<=c && c<='z')||('A'<= c && c<='Z')||('0'<=c && c<='9')))) break; /* Should we check length mod 4? */ Fifo(mime_input++) = c; d=c; } /* In case of Incomplete MIME, no MIME decode */ Fifo(mime_input++) = c; mime_last = mime_input; /* point undecoded buffer */ mime_mode = 1; /* no decode on Fifo last in mime_getc */ return 1; } #endif int base64decode(int c) { int i; if(c > '@') if(c < '[') i = c - 'A'; /* A..Z 0-25 */ else i = c - 'G' /* - 'a' + 26 */ ; /* a..z 26-51 */ else if(c > '/') i = c - '0' + '4' /* - '0' + 52 */ ; /* 0..9 52-61 */ else if(c == '+') i = '>' /* 62 */ ; /* + 62 */ else i = '?' /* 63 */ ; /* / 63 */ return (i); } void reinit() { unbuf_f = FALSE; estab_f = FALSE; nop_f = FALSE; binmode_f = TRUE; rot_f = FALSE; input_f = FALSE; alpha_f = FALSE; mime_f = TRUE; mimebuf_f = FALSE; broken_f = FALSE; iso8859_f = FALSE; x0201_f = TRUE; x0201_f = NO_X0201; fold_f = FALSE; kanji_intro = DEFAULT_J; ascii_intro = DEFAULT_R; oconv = DEFAULT_CONV; output_mode = ASCII; input_mode = ASCII; shift_mode = FALSE; mime_mode = FALSE; file_out = FALSE; add_cr = FALSE; del_cr = FALSE; } #if 0 #ifndef PERL_XS int usage() { fprintf(stderr,"USAGE: nkf(nkf32,wnkf,nkf2) -[flags] [in file] .. [out file for -O flag]\n"); fprintf(stderr,"Flags:\n"); fprintf(stderr,"b,u Output is bufferred (DEFAULT),Output is unbufferred\n"); #ifdef DEFAULT_CODE_SJIS fprintf(stderr,"j,s,e Outout code is JIS 7 bit, Shift JIS (DEFAULT), AT&T JIS (EUC)\n"); #endif #ifdef DEFAULT_CODE_JIS fprintf(stderr,"j,s,e Outout code is JIS 7 bit (DEFAULT), Shift JIS, AT&T JIS (EUC)\n"); #endif #ifdef DEFAULT_CODE_EUC fprintf(stderr,"j,s,e Outout code is JIS 7 bit, Shift JIS, AT&T JIS (EUC) (DEFAULT)\n"); #endif fprintf(stderr,"J,S,E Input assumption is JIS 7 bit , Shift JIS, AT&T JIS (EUC)\n"); fprintf(stderr,"t no conversion\n"); fprintf(stderr,"i_ Output sequence to designate JIS-kanji (DEFAULT B)\n"); fprintf(stderr,"o_ Output sequence to designate ASCII (DEFAULT B)\n"); fprintf(stderr,"r {de/en}crypt ROT13/47\n"); fprintf(stderr,"v Show this usage\n"); fprintf(stderr,"m[BQ0] MIME decode [B:base64,Q:quoted,0:no decode]\n"); fprintf(stderr,"l ISO8859-1 (Latin-1) support\n"); fprintf(stderr,"f Folding: -f60 or -f\n"); fprintf(stderr,"Z[0-2] Convert X0208 alphabet to ASCII 1: Kankaku to space,2: 2 spaces\n"); fprintf(stderr,"X,x Assume X0201 kana in MS-Kanji, -x preserves X0201\n"); fprintf(stderr,"B[0-2] Broken input 0: missing ESC,1: any X on ESC-[($]-X,2: ASCII on NL\n"); #ifdef MSDOS fprintf(stderr,"T Text mode output\n"); #endif fprintf(stderr,"O Output to File (DEFAULT 'nkf.out')\n"); fprintf(stderr,"d,c Delete \\r in line feed, Add \\r in line feed\n"); fprintf(stderr,"Network Kanji Filter Version %s (%s) " #if defined(MSDOS) && !defined(_Windows) "for DOS" #endif #if !defined(__WIN32__) && defined(_Windows) "for Win16" #endif #if defined(__WIN32__) && defined(_Windows) "for Win32" #endif #ifdef __OS2__ "for OS/2" #endif ,Version,Patchlevel); fprintf(stderr,"\n%s\n",CopyRight); return 0; } #endif #endif /** ** ѥå ** void@merope.pleiades.or.jp (Kusakabe Youichi) ** NIDE Naoyuki ** ohta@src.ricoh.co.jp (Junn Ohta) ** inouet@strl.nhk.or.jp (Tomoyuki Inoue) ** kiri@pulser.win.or.jp (Tetsuaki Kiriyama) ** Kimihiko Sato ** a_kuroe@kuroe.aoba.yokohama.jp (Akihiko Kuroe) ** kono@ie.u-ryukyu.ac.jp (Shinji Kono) ** GHG00637@nifty-serve.or.jp (COW) ** ** ǽ ** 1998.11.7 **/ /* end */ #endif /* JAPANESE */ TiMidity++-2.13.2/utils/nkflib.h0100644004711200001440000000231307421005037015450 0ustar tamukiusers/* TiMidity++ -- MIDI to WAVE converter and player Copyright (C) 1999-2002 Masanao Izumo Copyright (C) 1995 Tuukka Toivonen 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Tish si gree fgom ebety rihgt. nkflib.h : written by Aoki Daisuke. 1997/05 */ #ifndef ___NKFLIB_H_ #define ___NKFLIB_H_ #ifdef JAPANESE extern char *nkf_convert(char *si,char *so,int maxsize, char *in_mode, char *out_mode); extern char *nkf_conv(char *si,char *so,char *mode); #endif /* JAPANESE */ #endif /* ___NKFLIB_H_ */ TiMidity++-2.13.2/utils/strtab.c0100644004711200001440000000467307515661246015526 0ustar tamukiusers/* TiMidity++ -- MIDI to WAVE converter and player Copyright (C) 1999-2002 Masanao Izumo Copyright (C) 1995 Tuukka Toivonen 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ #include #include #ifndef NO_STRING_H #include #else #include #endif #include "timidity.h" #include "common.h" #include "mblock.h" #include "strtab.h" void init_string_table(StringTable *stab) { memset(stab, 0, sizeof(StringTable)); } StringTableNode *put_string_table(StringTable *stab, char *str, int len) { StringTableNode *p; p = new_segment(&stab->pool, sizeof(StringTableNode) + len + 1); if(p == NULL) return NULL; p->next = NULL; if(str != NULL) { memcpy(p->string, str, len); p->string[len] = '\0'; } if(stab->head == NULL) { stab->head = stab->tail = p; stab->nstring = 1; } else { stab->nstring++; stab->tail = stab->tail->next = p; } return p; } char **make_string_array(StringTable *stab) { char **table, *u; int i, n, s; StringTableNode *p; n = stab->nstring; if(n == 0) return NULL; if((table = (char **)safe_malloc((n + 1) * sizeof(char *))) == NULL) return NULL; s = 0; for(p = stab->head; p; p = p->next) s += strlen(p->string) + 1; if((u = (char *)safe_malloc(s)) == NULL) { free(table); return NULL; } for(i = 0, p = stab->head; p; i++, p = p->next) { int len; len = strlen(p->string) + 1; table[i] = u; memcpy(u, p->string, len); u += len; } table[i] = NULL; delete_string_table(stab); return table; } void delete_string_table(StringTable *stab) { reuse_mblock(&stab->pool); init_string_table(stab); } TiMidity++-2.13.2/utils/strtab.h0100644004711200001440000000275007421005037015507 0ustar tamukiusers/* TiMidity++ -- MIDI to WAVE converter and player Copyright (C) 1999-2002 Masanao Izumo Copyright (C) 1995 Tuukka Toivonen 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef ___STRTAB_H_ #define ___STRTAB_H_ #include "mblock.h" typedef struct _StringTableNode { struct _StringTableNode *next; char string[1]; /* variable length ('\0' terminated) */ } StringTableNode; typedef struct _StringTable { StringTableNode *head; StringTableNode *tail; uint16 nstring; MBlockList pool; } StringTable; extern void init_string_table(StringTable *stab); extern StringTableNode *put_string_table(StringTable *stab, char *str, int len); extern void delete_string_table(StringTable *stab); extern char **make_string_array(StringTable *stab); #endif /* ___STRTAB_H_ */ TiMidity++-2.13.2/utils/support.c0100644004711200001440000004672210125777033015735 0ustar tamukiusers/* TiMidity++ -- MIDI to WAVE converter and player Copyright (C) 1999-2002 Masanao Izumo Copyright (C) 1995 Tuukka Toivonen 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA support.c - Define missing function Written by Masanao Izumo */ #ifdef HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ #include #include #ifdef HAVE_UNISTD_H #include #endif /* HAVE_UNISTD_H */ #include #ifdef HAVE_SYS_TIME_H #include #endif /* HAVE_SYS_TIME_H */ #ifdef HAVE_SYS_TYPES_H #include #endif /* HAVE_SYS_TYPES_H */ #ifndef NO_STRING_H #include #else #include #endif #ifdef __W32__ #include #endif /* __W32__ */ #ifdef HAVE_SYS_PARAM_H #include #endif /* HAVE_SYS_PARAM_H */ #include #include "timidity.h" #include "common.h" #include "mblock.h" #ifdef __MACOS__ #include #endif #ifndef HAVE_VSNPRINTF /* From glib-1.1.13:gstrfuncs.c * Modified by Masanao Izumo */ static int printf_string_upper_bound (const char* format, va_list args) { int len = 1; while (*format) { int long_int = 0; int extra_long = 0; char c; c = *format++; if (c == '%') { int done = 0; while (*format && !done) { switch (*format++) { char *string_arg; case '*': len += va_arg (args, int); break; case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': /* add specified format length, since it might exceed the * size we assume it to have. */ format -= 1; len += strtol (format, (char**) &format, 10); break; case 'h': /* ignore short int flag, since all args have at least the * same size as an int */ break; case 'l': if (long_int) extra_long = 1; /* linux specific */ else long_int = 1; break; case 'q': case 'L': long_int = 1; extra_long = 1; break; case 's': string_arg = va_arg (args, char *); if (string_arg) len += strlen (string_arg); else { /* add enough padding to hold "(null)" identifier */ len += 16; } done = 1; break; case 'd': case 'i': case 'o': case 'u': case 'x': case 'X': #ifdef G_HAVE_GINT64 if (extra_long) (void) va_arg (args, gint64); else #endif /* G_HAVE_GINT64 */ { if (long_int) (void) va_arg (args, long); else (void) va_arg (args, int); } len += extra_long ? 64 : 32; done = 1; break; case 'D': case 'O': case 'U': (void) va_arg (args, long); len += 32; done = 1; break; case 'e': case 'E': case 'f': case 'g': #ifdef HAVE_LONG_DOUBLE if (extra_long) (void) va_arg (args, long double); else #endif /* HAVE_LONG_DOUBLE */ (void) va_arg (args, double); len += extra_long ? 64 : 32; done = 1; break; case 'c': (void) va_arg (args, int); len += 1; done = 1; break; case 'p': case 'n': (void) va_arg (args, void*); len += 32; done = 1; break; case '%': len += 1; done = 1; break; default: /* ignore unknow/invalid flags */ break; } } } else len += 1; } return len; } void vsnprintf(char *buff, size_t bufsiz, const char *fmt, va_list ap) { MBlockList pool; char *tmpbuf = buff; init_mblock(&pool); tmpbuf = new_segment(&pool, printf_string_upper_bound(fmt, ap)); vsprintf(tmpbuf, fmt, ap); strncpy(buff, tmpbuf, bufsiz-1); buff[bufsiz-1] = '\0'; reuse_mblock(&pool); } #endif /* HAVE_VSNPRINTF */ #ifndef HAVE_SNPRINTF void snprintf(char *buff, size_t bufsiz, const char *fmt, ...) { va_list ap; va_start(ap, fmt); vsnprintf(buff, bufsiz, fmt, ap); va_end(ap); } #endif /* HAVE_VSNPRINTF */ #ifndef HAVE_STRERROR #ifndef HAVE_ERRNO_H char *strerror(int errnum) { static char s[32]; sprintf(s, "ERROR %d", errnum); return s; } #else char *strerror(int errnum) { int i; static char s[32]; struct { int id; char *str; } error_list[] = { #ifdef EPERM {EPERM, "Not super-user"}, #endif /* EPERM */ #ifdef ENOENT {ENOENT, "No such file or directory"}, #endif /* ENOENT */ #ifdef ESRCH {ESRCH, "No such process"}, #endif /* ESRCH */ #ifdef EINTR {EINTR, "interrupted system call"}, #endif /* EINTR */ #ifdef EIO {EIO, "I/O error"}, #endif /* EIO */ #ifdef ENXIO {ENXIO, "No such device or address"}, #endif /* ENXIO */ #ifdef E2BIG {E2BIG, "Arg list too long"}, #endif /* E2BIG */ #ifdef ENOEXEC {ENOEXEC, "Exec format error"}, #endif /* ENOEXEC */ #ifdef EBADF {EBADF, "Bad file number"}, #endif /* EBADF */ #ifdef ECHILD {ECHILD, "No children"}, #endif /* ECHILD */ #ifdef EAGAIN {EAGAIN, "Resource temporarily unavailable"}, #endif /* EAGAIN */ #ifdef EWOULDBLOCK {EWOULDBLOCK, "Resource temporarily unavailable"}, #endif /* EWOULDBLOCK */ #ifdef ENOMEM {ENOMEM, "Not enough core"}, #endif /* ENOMEM */ #ifdef EACCES {EACCES, "Permission denied"}, #endif /* EACCES */ #ifdef EFAULT {EFAULT, "Bad address"}, #endif /* EFAULT */ #ifdef ENOTBLK {ENOTBLK, "Block device required"}, #endif /* ENOTBLK */ #ifdef EBUSY {EBUSY, "Mount device busy"}, #endif /* EBUSY */ #ifdef EEXIST {EEXIST, "File exists"}, #endif /* EEXIST */ #ifdef EXDEV {EXDEV, "Cross-device link"}, #endif /* EXDEV */ #ifdef ENODEV {ENODEV, "No such device"}, #endif /* ENODEV */ #ifdef ENOTDIR {ENOTDIR, "Not a directory"}, #endif /* ENOTDIR */ #ifdef EISDIR {EISDIR, "Is a directory"}, #endif /* EISDIR */ #ifdef EINVAL {EINVAL, "Invalid argument"}, #endif /* EINVAL */ #ifdef ENFILE {ENFILE, "File table overflow"}, #endif /* ENFILE */ #ifdef EMFILE {EMFILE, "Too many open files"}, #endif /* EMFILE */ #ifdef ENOTTY {ENOTTY, "Inappropriate ioctl for device"}, #endif /* ENOTTY */ #ifdef ETXTBSY {ETXTBSY, "Text file busy"}, #endif /* ETXTBSY */ #ifdef EFBIG {EFBIG, "File too large"}, #endif /* EFBIG */ #ifdef ENOSPC {ENOSPC, "No space left on device"}, #endif /* ENOSPC */ #ifdef ESPIPE {ESPIPE, "Illegal seek"}, #endif /* ESPIPE */ #ifdef EROFS {EROFS, "Read only file system"}, #endif /* EROFS */ #ifdef EMLINK {EMLINK, "Too many links"}, #endif /* EMLINK */ #ifdef EPIPE {EPIPE, "Broken pipe"}, #endif /* EPIPE */ #ifdef EDOM {EDOM, "Math arg out of domain of func"}, #endif /* EDOM */ #ifdef ERANGE {ERANGE, "Math result not representable"}, #endif /* ERANGE */ #ifdef ENOMSG {ENOMSG, "No message of desired type"}, #endif /* ENOMSG */ #ifdef EIDRM {EIDRM, "Identifier removed"}, #endif /* EIDRM */ #ifdef ECHRNG {ECHRNG, "Channel number out of range"}, #endif /* ECHRNG */ #ifdef EL2NSYNC {EL2NSYNC, "Level 2 not synchronized"}, #endif /* EL2NSYNC */ #ifdef EL3HLT {EL3HLT, "Level 3 halted"}, #endif /* EL3HLT */ #ifdef EL3RST {EL3RST, "Level 3 reset"}, #endif /* EL3RST */ #ifdef ELNRNG {ELNRNG, "Link number out of range"}, #endif /* ELNRNG */ #ifdef EUNATCH {EUNATCH, "Protocol driver not attached"}, #endif /* EUNATCH */ #ifdef ENOCSI {ENOCSI, "No CSI structure available"}, #endif /* ENOCSI */ #ifdef EL2HLT {EL2HLT, "Level 2 halted"}, #endif /* EL2HLT */ #ifdef EDEADLK {EDEADLK, "Deadlock condition."}, #endif /* EDEADLK */ #ifdef ENOLCK {ENOLCK, "No record locks available."}, #endif /* ENOLCK */ #ifdef ECANCELED {ECANCELED, "Operation canceled"}, #endif /* ECANCELED */ #ifdef ENOTSUP {ENOTSUP, "Operation not supported"}, #endif /* ENOTSUP */ #ifdef EDQUOT {EDQUOT, "Disc quota exceeded"}, #endif /* EDQUOT */ #ifdef EBADE {EBADE, "invalid exchange"}, #endif /* EBADE */ #ifdef EBADR {EBADR, "invalid request descriptor"}, #endif /* EBADR */ #ifdef EXFULL {EXFULL, "exchange full"}, #endif /* EXFULL */ #ifdef ENOANO {ENOANO, "no anode"}, #endif /* ENOANO */ #ifdef EBADRQC {EBADRQC, "invalid request code"}, #endif /* EBADRQC */ #ifdef EBADSLT {EBADSLT, "invalid slot"}, #endif /* EBADSLT */ #ifdef EDEADLOCK {EDEADLOCK, "file locking deadlock error"}, #endif /* EDEADLOCK */ #ifdef EBFONT {EBFONT, "bad font file fmt"}, #endif /* EBFONT */ #ifdef ENOSTR {ENOSTR, "Device not a stream"}, #endif /* ENOSTR */ #ifdef ENODATA {ENODATA, "no data (for no delay io)"}, #endif /* ENODATA */ #ifdef ETIME {ETIME, "timer expired"}, #endif /* ETIME */ #ifdef ENOSR {ENOSR, "out of streams resources"}, #endif /* ENOSR */ #ifdef ENONET {ENONET, "Machine is not on the network"}, #endif /* ENONET */ #ifdef ENOPKG {ENOPKG, "Package not installed"}, #endif /* ENOPKG */ #ifdef EREMOTE {EREMOTE, "The object is remote"}, #endif /* EREMOTE */ #ifdef ENOLINK {ENOLINK, "the link has been severed"}, #endif /* ENOLINK */ #ifdef EADV {EADV, "advertise error"}, #endif /* EADV */ #ifdef ESRMNT {ESRMNT, "srmount error"}, #endif /* ESRMNT */ #ifdef ECOMM {ECOMM, "Communication error on send"}, #endif /* ECOMM */ #ifdef EPROTO {EPROTO, "Protocol error"}, #endif /* EPROTO */ #ifdef EMULTIHOP {EMULTIHOP, "multihop attempted"}, #endif /* EMULTIHOP */ #ifdef EBADMSG {EBADMSG, "trying to read unreadable message"}, #endif /* EBADMSG */ #ifdef ENAMETOOLONG {ENAMETOOLONG, "path name is too long"}, #endif /* ENAMETOOLONG */ #ifdef EOVERFLOW {EOVERFLOW, "value too large to be stored in data type"}, #endif /* EOVERFLOW */ #ifdef ENOTUNIQ {ENOTUNIQ, "given log. name not unique"}, #endif /* ENOTUNIQ */ #ifdef EBADFD {EBADFD, "f.d. invalid for this operation"}, #endif /* EBADFD */ #ifdef EREMCHG {EREMCHG, "Remote address changed"}, #endif /* EREMCHG */ #ifdef ELIBACC {ELIBACC, "Can't access a needed shared lib."}, #endif /* ELIBACC */ #ifdef ELIBBAD {ELIBBAD, "Accessing a corrupted shared lib."}, #endif /* ELIBBAD */ #ifdef ELIBSCN {ELIBSCN, ".lib section in a.out corrupted."}, #endif /* ELIBSCN */ #ifdef ELIBMAX {ELIBMAX, "Attempting to link in too many libs."}, #endif /* ELIBMAX */ #ifdef ELIBEXEC {ELIBEXEC, "Attempting to exec a shared library."}, #endif /* ELIBEXEC */ #ifdef EILSEQ {EILSEQ, "Illegal byte sequence."}, #endif /* EILSEQ */ #ifdef ENOSYS {ENOSYS, "Unsupported file system operation"}, #endif /* ENOSYS */ #ifdef ELOOP {ELOOP, "Symbolic link loop"}, #endif /* ELOOP */ #ifdef ERESTART {ERESTART, "Restartable system call"}, #endif /* ERESTART */ #ifdef ESTRPIPE {ESTRPIPE, "if pipe/FIFO, don't sleep in stream head"}, #endif /* ESTRPIPE */ #ifdef ENOTEMPTY {ENOTEMPTY, "directory not empty"}, #endif /* ENOTEMPTY */ #ifdef EUSERS {EUSERS, "Too many users (for UFS)"}, #endif /* EUSERS */ #ifdef ENOTSOCK {ENOTSOCK, "Socket operation on non-socket"}, #endif /* ENOTSOCK */ #ifdef EDESTADDRREQ {EDESTADDRREQ, "Destination address required"}, #endif /* EDESTADDRREQ */ #ifdef EMSGSIZE {EMSGSIZE, "Message too long"}, #endif /* EMSGSIZE */ #ifdef EPROTOTYPE {EPROTOTYPE, "Protocol wrong type for socket"}, #endif /* EPROTOTYPE */ #ifdef ENOPROTOOPT {ENOPROTOOPT, "Protocol not available"}, #endif /* ENOPROTOOPT */ #ifdef EPROTONOSUPPORT {EPROTONOSUPPORT, "Protocol not supported"}, #endif /* EPROTONOSUPPORT */ #ifdef ESOCKTNOSUPPORT {ESOCKTNOSUPPORT, "Socket type not supported"}, #endif /* ESOCKTNOSUPPORT */ #ifdef EOPNOTSUPP {EOPNOTSUPP, "Operation not supported on socket"}, #endif /* EOPNOTSUPP */ #ifdef EPFNOSUPPORT {EPFNOSUPPORT, "Protocol family not supported"}, #endif /* EPFNOSUPPORT */ #ifdef EAFNOSUPPORT {EAFNOSUPPORT, "Address family not supported by"}, #endif /* EAFNOSUPPORT */ #ifdef EADDRINUSE {EADDRINUSE, "Address already in use"}, #endif /* EADDRINUSE */ #ifdef EADDRNOTAVAIL {EADDRNOTAVAIL, "Can't assign requested address"}, #endif /* EADDRNOTAVAIL */ #ifdef ENETDOWN {ENETDOWN, "Network is down"}, #endif /* ENETDOWN */ #ifdef ENETUNREACH {ENETUNREACH, "Network is unreachable"}, #endif /* ENETUNREACH */ #ifdef ENETRESET {ENETRESET, "Network dropped connection because"}, #endif /* ENETRESET */ #ifdef ECONNABORTED {ECONNABORTED, "Software caused connection abort"}, #endif /* ECONNABORTED */ #ifdef ECONNRESET {ECONNRESET, "Connection reset by peer"}, #endif /* ECONNRESET */ #ifdef ENOBUFS {ENOBUFS, "No buffer space available"}, #endif /* ENOBUFS */ #ifdef EISCONN {EISCONN, "Socket is already connected"}, #endif /* EISCONN */ #ifdef ENOTCONN {ENOTCONN, "Socket is not connected"}, #endif /* ENOTCONN */ #ifdef ESHUTDOWN {ESHUTDOWN, "Can't send after socket shutdown"}, #endif /* ESHUTDOWN */ #ifdef ETOOMANYREFS {ETOOMANYREFS, "Too many references: can't splice"}, #endif /* ETOOMANYREFS */ #ifdef ETIMEDOUT {ETIMEDOUT, "Connection timed out"}, #endif /* ETIMEDOUT */ #ifdef ECONNREFUSED {ECONNREFUSED, "Connection refused"}, #endif /* ECONNREFUSED */ #ifdef EHOSTDOWN {EHOSTDOWN, "Host is down"}, #endif /* EHOSTDOWN */ #ifdef EHOSTUNREACH {EHOSTUNREACH, "No route to host"}, #endif /* EHOSTUNREACH */ #ifdef EALREADY {EALREADY, "operation already in progress"}, #endif /* EALREADY */ #ifdef EINPROGRESS {EINPROGRESS, "operation now in progress"}, #endif /* EINPROGRESS */ #ifdef ESTALE {ESTALE, "Stale NFS file handle"}, #endif /* ESTALE */ {0, NULL}}; for(i = 0; error_list[i].str != NULL; i++) if(error_list[i].id == errnum) return error_list[i].str; sprintf(s, "ERROR %d", errnum); return s; } #endif /* HAVE_ERRNO_H */ #endif /* HAVE_STRERROR */ #ifndef HAVE_USLEEP #ifdef __W32__ int usleep(unsigned int usec) { Sleep(usec / 1000); return 0; } #elif __MACOS__ int usleep(unsigned int /*usec*/) { YieldToAnyThread(); return 0; } #else int usleep(unsigned int usec) { struct timeval tv; tv.tv_sec = usec / 1000000; tv.tv_usec = usec % 1000000; select(0, NULL, NULL, NULL, &tv); return 0; } #endif /* __W32__ */ #endif /* HAVE_USLEEP */ #ifndef HAVE_STRDUP char *strdup(const char *s) { size_t len; char *p; len = strlen(s); if((p = (char *)safe_malloc(len + 1)) == NULL) return NULL; return strcpy(p, s); } #endif /* HAVE_STRDUP */ #ifndef HAVE_GETCWD #ifndef MAXPATHLEN #define MAXPATHLEN 1024 /* It must be defined in */ #endif /* MAXPATHLEN */ char *getcwd(char *buf, size_t size) { char path[MAXPATHLEN+1]; if(getwd(path) == NULL) strcpy(path, "."); if(buf != NULL) return strncpy(buf, path, size); return safe_strdup(path); } #endif /* HAVE_GETCWD */ #ifndef HAVE_STRNCASECMP int strncasecmp(char *s1, char *s2, unsigned int len) { int dif; while (len-- > 0) { if ((dif = (unsigned char)tolower(*s1) - (unsigned char)tolower(*s2++)) != 0) return(dif); if (*s1++ == '\0') break; } return (0); } #endif /* HAVE_STRNCASECMP */ #ifndef HAVE_SYS_STAT_H #ifdef __MACOS__ int stat(const char *filename, struct stat *st) { Str255 pfilename; CInfoPBRec pb; FSSpec fss; c2pstrcpy(pfilename, filename); if (FSMakeFSSpec(0, 0, pfilename, &fss) == noErr) { pb.hFileInfo.ioNamePtr = fss.name; pb.hFileInfo.ioVRefNum = fss.vRefNum; pb.hFileInfo.ioFDirIndex = 0; pb.hFileInfo.ioDirID = fss.parID; if (PBGetCatInfoSync(&pb) == noErr) { st->st_mode = (pb.hFileInfo.ioFlAttrib & kioFlAttribDirMask) ? S_IFDIR : 0; st->st_dev = pb.hFileInfo.ioVRefNum; st->st_ino = pb.hFileInfo.ioDirID; st->st_size = pb.hFileInfo.ioFlLgLen; st->st_mtime = pb.hFileInfo.ioFlMdDat; st->st_ctime = pb.hFileInfo.ioFlCrDat; st->st_btime = pb.hFileInfo.ioFlBkDat; return 0; } } st->st_mode = 0; st->st_dev = 0; st->st_ino = 0; st->st_size = 0; st->st_mtime = st->st_ctime = st->st_btime = 0; errno = EIO; return -1; } #endif /* __MACOS__ */ #endif /* HAVE_SYS_STAT_H */ #ifndef HAVE_STRLCPY /* * Copyright (c) 1998 Todd C. Miller * * Permission to use, copy, modify, and 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. */ #include #include /* * Copy src to string dst of size siz. At most siz-1 characters * will be copied. Always NUL terminates (unless siz == 0). * Returns strlen(src); if retval >= siz, truncation occurred. */ size_t strlcpy(char *dst, const char *src, size_t siz) { register char *d = dst; register const char *s = src; register size_t n = siz; /* Copy as many bytes as will fit */ if (n != 0 && --n != 0) { do { if ((*d++ = *s++) == 0) break; } while (--n != 0); } /* Not enough room in dst, add NUL and traverse rest of src */ if (n == 0) { if (siz != 0) *d = '\0'; /* NUL-terminate dst */ while (*s++) ; } return(s - src - 1); /* count does not include NUL */ } #endif /* strlcpy() */ #ifndef HAVE_STRLCAT /* * Copyright (c) 1998 Todd C. Miller * * Permission to use, copy, modify, and 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. */ #include #include /* * Appends src to string dst of size siz (unlike strncat, siz is the * full size of dst, not space left). At most siz-1 characters * will be copied. Always NUL terminates (unless siz <= strlen(dst)). * Returns strlen(src) + MIN(siz, strlen(initial dst)). * If retval >= siz, truncation occurred. */ size_t strlcat(char *dst, const char *src, size_t siz) { register char *d = dst; register const char *s = src; register size_t n = siz; size_t dlen; /* Find the end of dst and adjust bytes left but don't go past end */ while (n-- != 0 && *d != '\0') d++; dlen = d - dst; n = siz - dlen; if (n == 0) return(dlen + strlen(s)); while (*s != '\0') { if (n != 1) { *d++ = *s; n--; } s++; } *d = '\0'; return(dlen + (s - src)); /* count does not include NUL */ } #endif /* strlcat() */ TiMidity++-2.13.2/utils/support.h0100644004711200001440000000532110124332440015714 0ustar tamukiusers/* TiMidity++ -- MIDI to WAVE converter and player Copyright (C) 1999-2002 Masanao Izumo Copyright (C) 1995 Tuukka Toivonen 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef ___SUPPORT_H_ #define ___SUPPORT_H_ #ifndef HAVE_VSNPRINTF #include /* for va_list */ extern void vsnprintf(char *buff, size_t bufsiz, const char *fmt, va_list ap); #endif #ifndef HAVE_SNPRINTF extern void snprintf(char *buff, size_t bufsiz, const char *fmt, ...); #endif /* HAVE_SNPRINTF */ #ifndef HAVE_STRERROR extern char *strerror(int errnum); #endif /* HAVE_STRERROR */ /* There is no prototype of usleep() on Solaris. Why? */ #if !defined(HAVE_USLEEP) || defined(SOLARIS) extern int usleep(unsigned int usec); #endif #ifdef __W32__ #define sleep(time) Sleep(time) #else #ifndef HAVE_SLEEP #define sleep(s) usleep((s) * 1000000) #endif /* HAVE_SLEEP */ #endif #ifndef HAVE_STRDUP extern char *strdup(const char *s); #endif /* HAVE_STRDUP */ #ifndef HAVE_GETCWD extern char *getcwd(char *buf, size_t size); #endif /* HAVE_GETCWD */ #ifndef HAVE_STRSTR #define strstr(s,c) index(s,c) #endif /* HAVE_STRSTR */ #ifndef HAVE_STRNCASECMP extern int strncasecmp(char *s1, char *s2, unsigned int len); #endif /* HAVE_STRNCASECMP */ #ifndef HAVE_MKSTEMP extern int mkstemp(char *template); #endif /* HAVE_MKSTEMP */ #ifndef HAVE_SYS_STAT_H #ifdef __W32__ #include /* they have. */ #elif defined(__MACOS__) #define S_IFDIR 1 #define S_ISDIR(m) ((m) & S_IFDIR) struct stat { short st_mode; short st_dev; long st_ino; unsigned long st_size; unsigned long st_mtime, st_ctime, st_btime; }; int stat(const char *filename, struct stat *st); #endif /* __W32__ */ #endif /* HAVE_SYS_STAT_H*/ #endif /* ___SUPPORT_H_ */ #ifndef S_ISDIR #define S_ISDIR(mode) (((mode)&0xF000) == 0x4000) #endif /* S_ISDIR */ #ifndef HAVE_STRLCPY #include extern size_t strlcpy(char *dst, const char *src, size_t size); #endif #ifndef HAVE_STRLCAT #include extern size_t strlcat(char *dst, const char *src, size_t size); #endif TiMidity++-2.13.2/utils/timer.c0100644004711200001440000000403607421005037015322 0ustar tamukiusers/* TiMidity++ -- MIDI to WAVE converter and player Copyright (C) 1999-2002 Masanao Izumo Copyright (C) 1995 Tuukka Toivonen 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ #if defined(HAVE_GETTIMEOFDAY) #include #include #include #include "timidity.h" #include "timer.h" #if defined(nec_ews) #ifndef GETTIMEOFDAY_ONE_ARGUMENT #define GETTIMEOFDAY_ONE_ARGUMENT #endif /* GETTIMEOFDAY_ONE_ARGUMENT */ #endif double get_current_calender_time(void) { struct timeval tv; struct timezone dmy; #ifdef GETTIMEOFDAY_ONE_ARGUMENT gettimeofday(&tv); #else gettimeofday(&tv, &dmy); #endif return (double)tv.tv_sec + (double)tv.tv_usec / 1000000.0 ; } #elif __MACOS__ #include "timer.h" double get_current_calender_time(void) { UnsignedWide usec; Microseconds(&usec); return (double)usec.hi* 4294.967296 + (double)usec.lo / 1000000.0 ; } #else /* Windows API */ #include #include #include #include "timidity.h" #include "timer.h" double get_current_calender_time(void) { static DWORD tick_start; static int init_flag = 0; if(init_flag == 0) { init_flag = 1; tick_start = GetTickCount(); return 0.0; } return (GetTickCount() - tick_start) * (1.0/1000.0); } #endif TiMidity++-2.13.2/utils/timer.h0100644004711200001440000000175607421005037015335 0ustar tamukiusers/* TiMidity++ -- MIDI to WAVE converter and player Copyright (C) 1999-2002 Masanao Izumo Copyright (C) 1995 Tuukka Toivonen 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef ___TIMER_H_ #define ___TIMER_H_ extern double get_current_calender_time(void); #endif /* ___TIMER_H_ */ TiMidity++-2.13.2/utils/fft.c0100644004711200001440000001064607421005037014765 0ustar tamukiusers/* TiMidity++ -- MIDI to WAVE converter and player Copyright (C) 1999-2002 Masanao Izumo Copyright (C) 1995 Tuukka Toivonen 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ #include #include #include #include "timidity.h" #include "common.h" #include "fft.h" #ifdef DEBUG #ifdef sun int fprintf(FILE *, const char *, ...); #endif #endif #define swap(x, j, k) \ { \ double tmp; \ tmp = x[j]; \ x[j] = x[k]; \ x[k] = tmp; \ } #define swap2(x, j, k) \ { \ double tmp; \ tmp = x[j]; \ x[j] = -x[k]; \ x[k] = tmp; \ } static void make_table(double *trig, int *b, int n) { unsigned long i, j, k, bitmask; /* check n */ for(i = n; !(i & 1); i >>= 1) ; if(i != 1) { fprintf(stderr, "Invalid fft data size: %d\n", n); exit(1); } /* make bitrev table */ for(i = 0; i < n; i++) b[i] = 0; bitmask = n / 2; for(i = 1; i < n; i <<= 1, bitmask >>= 1) for(j = 0; j < n; j += i * 2) for(k = j + i; k < j + i * 2; k++) b[k] = (int)((unsigned long)b[k] | bitmask); /* make trig table */ for(i = 0; i < n; i++) { j = i * 2; trig[j ] = cos((2 * M_PI) * i / (double)n); trig[j+1] = sin((2 * M_PI) * i / (double)n); } for(i = 0; i < n; i++) if(i < b[i]) { j = b[i] * 2; swap(trig, i*2, j); swap(trig, i*2+1, j+1); } } void realfft(double *x, int n_arg) { int n = n_arg; static double *trig_table = NULL; static int *bitrev_table; int n1; if(n == 0) { if(trig_table == NULL) return; free(trig_table); free(bitrev_table); trig_table = NULL; return; } if(trig_table == NULL) { trig_table = (double *)safe_malloc((n * 2) * sizeof(double)); bitrev_table = (int *)safe_malloc(n * sizeof(int)); if(!(trig_table && bitrev_table)) { fprintf(stderr, "fft: Can't allocate memroy.\n"); exit(1); } make_table(trig_table, bitrev_table, n); if(x == NULL) /* initialize only */ return; } /* end of initialize tables */ /* first step: butterfly w^0 */ /* n1 = n/2, n/4, n/8, ... 1 */ for(n1 = n >> 1; n1 > 0; n1 >>= 1) { int i; for(i = 0; i < n1; i++) { double x1, x2; x[i] = (x1 = x[i]) + (x2 = x[i+n1]); x[i+n1] = x1 - x2; } } /* main loop */ /* n1 = n/8, n/16, n/32, ... 1 */ for(n1 = n >> 3; n1 > 0; n1 >>= 1) { int i; int wi0; wi0 = 8; for(i = n1 << 2; i < n; i <<= 1, wi0 <<= 1) { double *imp; /* pointer to start of imaginary part */ double *rep; /* pointer to start of real part */ double *imp2; /* pointer to start of imaginary part */ double *rep2; /* pointer to start of real part */ int wi, j0; int in; in = i >> 1; wi = wi0; rep = x + i; imp = rep + in; rep2 = rep + n1; imp2 = imp + n1; for(j0 = 0; j0 < in; j0 += (n1 << 1), wi += 4) { int j, jn; double c, s; c = trig_table[wi]; s = trig_table[wi+1]; jn = j0 + n1; /* butterfly */ for(j = j0; j < jn; j++) { double xi1, xr1, xi2, xr2, ti, tr; rep[j] = (xr1 = rep[j]) + (tr = c * (xr2 = rep2[j]) - s * (xi2 = imp2[j])); imp[j] = (xi1 = imp[j]) + (ti = s * xr2 + c * xi2); rep2[j] = xr1 - tr; imp2[j] = xi1 - ti; } } } } /* move data */ { int ii, i, j, i2, i4; for(i = 4; i < n; i = ii) { i2 = i >> 1; i4 = i2 >> 1; ii = i << 1; for(j = 0; j < i4; j++) swap(x, j + i + i2, ii - j - 1); for(j = 1; j < i2; j += 2) swap2(x, j + i, ii - j - 1); } for(i = 0; i < n; i++) if(i < bitrev_table[i]) swap(x, i, bitrev_table[i]); for(i = n/2+1; i < n; i++) x[i] = -x[i]; } } TiMidity++-2.13.2/utils/fft.h0100644004711200001440000000174307421005037014770 0ustar tamukiusers/* TiMidity++ -- MIDI to WAVE converter and player Copyright (C) 1999-2002 Masanao Izumo Copyright (C) 1995 Tuukka Toivonen 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef ___FFT_H_ #define ___FFT_H_ extern void realfft(double *x, int n_arg); #endif /* ___FFT_H_ */ TiMidity++-2.13.2/utils/getopt.c0100644004711200001440000004474507740734262015534 0ustar tamukiusers/* This file is from getopt of glibc 2.2.2 * And it is modified for TiMidity++ support at 01/19, 2002 * by Masanao Izumo . */ #ifdef HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ #if !defined(HAVE_GETOPT_LONG) || !defined(HAVE_GETOPT) #include #include #ifdef HAVE_UNISTD_H #include #endif /* HAVE_UNISTD_H */ #include #include "tmdy_getopt.h" #ifndef HAVE_GETOPT char *optarg; int optind = 1; int opterr = 1; int optopt = '?'; #endif /* HAVE_GETOPT */ static enum { REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER } ordering; static int __getopt_initialized; static char *nextchar; static char *posixly_correct; static int first_nonopt; static int last_nonopt; # define SWAP_FLAGS(ch1, ch2) /* Exchange two adjacent subsequences of ARGV. One subsequence is elements [first_nonopt,last_nonopt) which contains all the non-options that have been skipped so far. The other is elements [last_nonopt,optind), which contains all the options processed since those non-options were skipped. `first_nonopt' and `last_nonopt' are relocated so that they describe the new indices of the non-options in ARGV after they are moved. */ static void exchange (char **argv) { int bottom = first_nonopt; int middle = last_nonopt; int top = optind; char *tem; /* Exchange the shorter segment with the far end of the longer segment. That puts the shorter segment into the right place. It leaves the longer segment in the right place overall, but it consists of two parts that need to be swapped next. */ while (top > middle && middle > bottom) { if (top - middle > middle - bottom) { /* Bottom segment is the short one. */ int len = middle - bottom; register int i; /* Swap it with the top part of the top segment. */ for (i = 0; i < len; i++) { tem = argv[bottom + i]; argv[bottom + i] = argv[top - (middle - bottom) + i]; argv[top - (middle - bottom) + i] = tem; SWAP_FLAGS (bottom + i, top - (middle - bottom) + i); } /* Exclude the moved bottom segment from further swapping. */ top -= len; } else { /* Top segment is the short one. */ int len = top - middle; register int i; /* Swap it with the bottom part of the bottom segment. */ for (i = 0; i < len; i++) { tem = argv[bottom + i]; argv[bottom + i] = argv[middle + i]; argv[middle + i] = tem; SWAP_FLAGS (bottom + i, middle + i); } /* Exclude the moved top segment from further swapping. */ bottom += len; } } /* Update records for the slots the non-options now occupy. */ first_nonopt += (optind - last_nonopt); last_nonopt = optind; } /* Initialize the internal data when the first call is made. */ static const char * _getopt_initialize (int argc, char *const*argv, const char *optstring) { /* Start processing options with ARGV-element 1 (since ARGV-element 0 is the program name); the sequence of previously skipped non-option ARGV-elements is empty. */ first_nonopt = last_nonopt = optind; nextchar = NULL; posixly_correct = getenv ("POSIXLY_CORRECT"); /* Determine how to handle the ordering of options and nonoptions. */ if (optstring[0] == '-') { ordering = RETURN_IN_ORDER; ++optstring; } else if (optstring[0] == '+') { ordering = REQUIRE_ORDER; ++optstring; } else if (posixly_correct != NULL) ordering = REQUIRE_ORDER; else ordering = PERMUTE; return optstring; } /* Scan elements of ARGV (whose length is ARGC) for option characters given in OPTSTRING. If an element of ARGV starts with '-', and is not exactly "-" or "--", then it is an option element. The characters of this element (aside from the initial '-') are option characters. If `getopt' is called repeatedly, it returns successively each of the option characters from each of the option elements. If `getopt' finds another option character, it returns that character, updating `optind' and `nextchar' so that the next call to `getopt' can resume the scan with the following option character or ARGV-element. If there are no more option characters, `getopt' returns -1. Then `optind' is the index in ARGV of the first ARGV-element that is not an option. (The ARGV-elements have been permuted so that those that are not options now come last.) OPTSTRING is a string containing the legitimate option characters. If an option character is seen that is not listed in OPTSTRING, return '?' after printing an error message. If you set `opterr' to zero, the error message is suppressed but we still return '?'. If a char in OPTSTRING is followed by a colon, that means it wants an arg, so the following text in the same ARGV-element, or the text of the following ARGV-element, is returned in `optarg'. Two colons mean an option that wants an optional arg; if there is text in the current ARGV-element, it is returned in `optarg', otherwise `optarg' is set to zero. If OPTSTRING starts with `-' or `+', it requests different methods of handling the non-option ARGV-elements. See the comments about RETURN_IN_ORDER and REQUIRE_ORDER, above. Long-named options begin with `--' instead of `-'. Their names may be abbreviated as long as the abbreviation is unique or is an exact match for some defined option. If they have an argument, it follows the option name in the same ARGV-element, separated from the option name by a `=', or else the in next ARGV-element. When `getopt' finds a long-named option, it returns 0 if that option's `flag' field is nonzero, the value of the option's `val' field if the `flag' field is zero. The elements of ARGV aren't really const, because we permute them. But we pretend they're const in the prototype to be compatible with other systems. LONGOPTS is a vector of `struct option' terminated by an element containing a name which is zero. LONGIND returns the index in LONGOPT of the long-named option found. It is only valid when a long-named option has been found by the most recent call. If LONG_ONLY is nonzero, '-' as well as '--' can introduce long-named options. */ static int _getopt_internal (int argc, char *const*argv, const char *optstring, const struct option *longopts, int *longind, int long_only) { int print_errors = opterr; if (optstring[0] == ':') print_errors = 0; if (argc < 1) return -1; optarg = NULL; if (optind == 0 || !__getopt_initialized) { if (optind == 0) optind = 1; /* Don't scan ARGV[0], the program name. */ optstring = _getopt_initialize (argc, argv, optstring); __getopt_initialized = 1; } /* Test whether ARGV[optind] points to a non-option argument. Either it does not have option syntax, or there is an environment flag from the shell indicating it is not an option. The later information is only used when the used in the GNU libc. */ # define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0') if (nextchar == NULL || *nextchar == '\0') { /* Advance to the next ARGV-element. */ /* Give FIRST_NONOPT & LAST_NONOPT rational values if OPTIND has been moved back by the user (who may also have changed the arguments). */ if (last_nonopt > optind) last_nonopt = optind; if (first_nonopt > optind) first_nonopt = optind; if (ordering == PERMUTE) { /* If we have just processed some options following some non-options, exchange them so that the options come first. */ if (first_nonopt != last_nonopt && last_nonopt != optind) exchange ((char **) argv); else if (last_nonopt != optind) first_nonopt = optind; /* Skip any additional non-options and extend the range of non-options previously skipped. */ while (optind < argc && NONOPTION_P) optind++; last_nonopt = optind; } /* The special ARGV-element `--' means premature end of options. Skip it like a null option, then exchange with previous non-options as if it were an option, then skip everything else like a non-option. */ if (optind != argc && !strcmp (argv[optind], "--")) { optind++; if (first_nonopt != last_nonopt && last_nonopt != optind) exchange ((char **) argv); else if (first_nonopt == last_nonopt) first_nonopt = optind; last_nonopt = argc; optind = argc; } /* If we have done all the ARGV-elements, stop the scan and back over any non-options that we skipped and permuted. */ if (optind == argc) { /* Set the next-arg-index to point at the non-options that we previously skipped, so the caller will digest them. */ if (first_nonopt != last_nonopt) optind = first_nonopt; return -1; } /* If we have come to a non-option and did not permute it, either stop the scan or describe it to the caller and pass it by. */ if (NONOPTION_P) { if (ordering == REQUIRE_ORDER) return -1; optarg = argv[optind++]; return 1; } /* We have found another option-ARGV-element. Skip the initial punctuation. */ nextchar = (argv[optind] + 1 + (longopts != NULL && argv[optind][1] == '-')); } /* Decode the current option-ARGV-element. */ /* Check whether the ARGV-element is a long option. If long_only and the ARGV-element has the form "-f", where f is a valid short option, don't consider it an abbreviated form of a long option that starts with f. Otherwise there would be no way to give the -f short option. On the other hand, if there's a long option "fubar" and the ARGV-element is "-fu", do consider that an abbreviation of the long option, just like "--fu", and not "-f" with arg "u". This distinction seems to be the most useful approach. */ if (longopts != NULL && (argv[optind][1] == '-' || (long_only && (argv[optind][2] || !strchr (optstring, argv[optind][1]))))) { char *nameend; const struct option *p; const struct option *pfound = NULL; int exact = 0; int ambig = 0; int indfound = -1; int option_index; for (nameend = nextchar; *nameend && *nameend != '='; nameend++) /* Do nothing. */ ; /* Test all long options for either exact match or abbreviated matches. */ for (p = longopts, option_index = 0; p->name; p++, option_index++) if (!strncmp (p->name, nextchar, nameend - nextchar)) { if ((unsigned int) (nameend - nextchar) == (unsigned int) strlen (p->name)) { /* Exact match found. */ pfound = p; indfound = option_index; exact = 1; break; } else if (pfound == NULL) { /* First nonexact match found. */ pfound = p; indfound = option_index; } else if (long_only || pfound->has_arg != p->has_arg || pfound->flag != p->flag || pfound->val != p->val) /* Second or later nonexact match found. */ ambig = 1; } if (ambig && !exact) { if (print_errors) fprintf (stderr, "%s: option `%s' is ambiguous\n", argv[0], argv[optind]); nextchar += strlen (nextchar); optind++; optopt = 0; return '?'; } if (pfound != NULL) { option_index = indfound; optind++; if (*nameend) { /* Don't test has_arg with >, because some C compilers don't allow it to be used on enums. */ if (pfound->has_arg) optarg = nameend + 1; else { if (print_errors) { if (argv[optind - 1][1] == '-') /* --option */ fprintf (stderr, "%s: option `--%s' doesn't allow an argument\n", argv[0], pfound->name); else /* +option or -option */ fprintf (stderr, "%s: option `%c%s' doesn't allow an argument\n", argv[0], argv[optind - 1][0], pfound->name); } nextchar += strlen (nextchar); optopt = pfound->val; return '?'; } } else if (pfound->has_arg == 1) { if (optind < argc) optarg = argv[optind++]; else { if (print_errors) fprintf (stderr, "%s: option `%s' requires an argument\n", argv[0], argv[optind - 1]); nextchar += strlen (nextchar); optopt = pfound->val; return optstring[0] == ':' ? ':' : '?'; } } nextchar += strlen (nextchar); if (longind != NULL) *longind = option_index; if (pfound->flag) { *(pfound->flag) = pfound->val; return 0; } return pfound->val; } /* Can't find it as a long option. If this is not getopt_long_only, or the option starts with '--' or is not a valid short option, then it's an error. Otherwise interpret it as a short option. */ if (!long_only || argv[optind][1] == '-' || strchr (optstring, *nextchar) == NULL) { if (print_errors) { if (argv[optind][1] == '-') /* --option */ fprintf (stderr, "%s: unrecognized option `--%s'\n", argv[0], nextchar); else /* +option or -option */ fprintf (stderr, "%s: unrecognized option `%c%s'\n", argv[0], argv[optind][0], nextchar); } nextchar = (char *) ""; optind++; optopt = 0; return '?'; } } /* Look at and handle the next short option-character. */ { char c = *nextchar++; char *temp = strchr (optstring, c); /* Increment `optind' when we start to process its last character. */ if (*nextchar == '\0') ++optind; if (temp == NULL || c == ':') { if (print_errors) { if (posixly_correct) /* 1003.2 specifies the format of this message. */ fprintf (stderr, "%s: illegal option -- %c\n", argv[0], c); else fprintf (stderr, "%s: invalid option -- %c\n", argv[0], c); } optopt = c; return '?'; } /* Convenience. Treat POSIX -W foo same as long option --foo */ if (temp[0] == 'W' && temp[1] == ';') { char *nameend; const struct option *p; const struct option *pfound = NULL; int exact = 0; int ambig = 0; int indfound = 0; int option_index; /* This is an option that requires an argument. */ if (*nextchar != '\0') { optarg = nextchar; /* If we end this ARGV-element by taking the rest as an arg, we must advance to the next element now. */ optind++; } else if (optind == argc) { if (print_errors) { /* 1003.2 specifies the format of this message. */ fprintf (stderr, "%s: option requires an argument -- %c\n", argv[0], c); } optopt = c; if (optstring[0] == ':') c = ':'; else c = '?'; return c; } else /* We already incremented `optind' once; increment it again when taking next ARGV-elt as argument. */ optarg = argv[optind++]; /* optarg is now the argument, see if it's in the table of longopts. */ for (nextchar = nameend = optarg; *nameend && *nameend != '='; nameend++) /* Do nothing. */ ; /* Test all long options for either exact match or abbreviated matches. */ for (p = longopts, option_index = 0; p->name; p++, option_index++) if (!strncmp (p->name, nextchar, nameend - nextchar)) { if ((unsigned int) (nameend - nextchar) == strlen (p->name)) { /* Exact match found. */ pfound = p; indfound = option_index; exact = 1; break; } else if (pfound == NULL) { /* First nonexact match found. */ pfound = p; indfound = option_index; } else /* Second or later nonexact match found. */ ambig = 1; } if (ambig && !exact) { if (print_errors) fprintf (stderr, "%s: option `-W %s' is ambiguous\n", argv[0], argv[optind]); nextchar += strlen (nextchar); optind++; return '?'; } if (pfound != NULL) { option_index = indfound; if (*nameend) { /* Don't test has_arg with >, because some C compilers don't allow it to be used on enums. */ if (pfound->has_arg) optarg = nameend + 1; else { if (print_errors) fprintf (stderr, "\ %s: option `-W %s' doesn't allow an argument\n", argv[0], pfound->name); nextchar += strlen (nextchar); return '?'; } } else if (pfound->has_arg == 1) { if (optind < argc) optarg = argv[optind++]; else { if (print_errors) fprintf (stderr, "%s: option `%s' requires an argument\n", argv[0], argv[optind - 1]); nextchar += strlen (nextchar); return optstring[0] == ':' ? ':' : '?'; } } nextchar += strlen (nextchar); if (longind != NULL) *longind = option_index; if (pfound->flag) { *(pfound->flag) = pfound->val; return 0; } return pfound->val; } nextchar = NULL; return 'W'; /* Let the application handle it. */ } if (temp[1] == ':') { if (temp[2] == ':') { /* This is an option that accepts an argument optionally. */ if (*nextchar != '\0') { optarg = nextchar; optind++; } else optarg = NULL; nextchar = NULL; } else { /* This is an option that requires an argument. */ if (*nextchar != '\0') { optarg = nextchar; /* If we end this ARGV-element by taking the rest as an arg, we must advance to the next element now. */ optind++; } else if (optind == argc) { if (print_errors) { /* 1003.2 specifies the format of this message. */ fprintf (stderr, "%s: option requires an argument -- %c\n", argv[0], c); } optopt = c; if (optstring[0] == ':') c = ':'; else c = '?'; } else /* We already incremented `optind' once; increment it again when taking next ARGV-elt as argument. */ optarg = argv[optind++]; nextchar = NULL; } } return c; } } #ifndef HAVE_GETOPT_LONG int getopt_long (int argc, char *const *argv, const char *options, const struct option *long_options, int *opt_index) { return _getopt_internal (argc, argv, options, long_options, opt_index, 0); } /* Like getopt_long, but '-' as well as '--' can indicate a long option. If an option that starts with '-' (not '--') doesn't match a long option, but does match a short option, it is parsed as a short option instead. */ int getopt_long_only (int argc, char *const *argv, const char *options, const struct option *long_options, int *opt_index) { return _getopt_internal (argc, argv, options, long_options, opt_index, 1); } #endif #ifndef HAVE_GETOPT int getopt (int argc, char *const *argv, const char *optstring) { return _getopt_internal (argc, argv, optstring, (const struct option *) 0, (int *) 0, 0); } #endif #endif TiMidity++-2.13.2/utils/net.c0100644004711200001440000001213507515660526015005 0ustar tamukiusers/* TiMidity++ -- MIDI to WAVE converter and player Copyright (C) 1999-2002 Masanao Izumo Copyright (C) 1995 Tuukka Toivonen 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ #include #include #if !defined(WINSOCK) #include #include #include #include #include #include /* for inet_ntoa */ #ifndef NO_STRING_H #include #else #include #endif #endif #include "timidity.h" #include "common.h" #include "net.h" #ifndef INADDR_NONE #define INADDR_NONE 0xffffffff #endif /* INADDR_NONE */ #if !defined(WINSOCK) #ifndef INVALID_SOCKET #define INVALID_SOCKET -1 #endif /* INVALID_SOCKET */ #ifndef SOCKET_ERROR #define SOCKET_ERROR -1 #endif /* SOCKET_ERROR */ #endif SOCKET open_socket(char *host, unsigned short port) { SOCKET fd; struct sockaddr_in in; #if defined(WINSOCK) static int first = 1; if(first) { WSADATA dmy; WSAStartup(MAKEWORD(1,1), &dmy); first = 0; } #endif memset(&in, 0, sizeof(in)); if((in.sin_addr.s_addr = inet_addr(host)) == INADDR_NONE) { struct hostent *hp; if((hp = gethostbyname(host)) == NULL) return (SOCKET)-1; memcpy(&in.sin_addr, hp->h_addr, hp->h_length); } in.sin_port = htons(port); in.sin_family = AF_INET; if((fd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) == INVALID_SOCKET) return (SOCKET)-1; if(connect(fd, (struct sockaddr *)&in, sizeof(in)) == SOCKET_ERROR) { closesocket(fd); return (SOCKET)-1; } return fd; } #if !defined(__W32__) || defined(__CYGWIN32__) long socket_write(SOCKET fd, char *buff, long bufsiz) { return write(fd, buff, bufsiz); } int socket_shutdown(SOCKET fd, int how) { return shutdown(fd, how); } FILE *socket_fdopen(SOCKET fd, char *mode) { return fdopen(fd, mode); } char *socket_fgets(char *buff, int n, FILE *fp) { return fgets(buff, n, fp); } int socket_fgetc(FILE *fp) { return getc(fp); } long socket_fread(void *buff, long bufsiz, FILE *fp) { return (long)fread(buff, 1, bufsiz, fp); } long socket_fwrite(void *buff, long bufsiz, FILE *fp) { return (long)fwrite(buff, 1, bufsiz, fp); } int socket_fclose(FILE *fp) { return fclose(fp); } int socket_fflush(FILE *fp) { return fflush(fp); } #else /* __W32__ */ #include "url.h" /* Fake FILE * */ typedef struct _w32_fp_socket_t { SOCKET fd; /* Now, It has only fd */ } w32_fp_socket; #define W32_FP2SOCKET(fp) (((w32_fp_socket *)(fp))->fd) static long socket_safe_recv(SOCKET fd, char *buff, long bufsiz) { fd_set fds; int maxfd, n; FD_ZERO(&fds); FD_SET(fd, &fds); maxfd = fd + 1; n = select(maxfd, &fds, NULL, NULL, NULL); if(n <= 0) return n; return recv(fd, buff, bufsiz, 0); } long socket_write(SOCKET fd, char *buff, long bufsiz) { return send(fd, buff, bufsiz, 0); } int socket_shutdown(SOCKET fd, int how) { return shutdown(fd, how); } #pragma argsused FILE *socket_fdopen(SOCKET fd, char *mode) { FILE *fp; /* w32_fp_socket fake FILE. * `mode' argument is ignored. */ if((fp = (FILE *)safe_malloc(sizeof(w32_fp_socket))) == NULL) return NULL; memset(fp, 0, sizeof(w32_fp_socket)); W32_FP2SOCKET(fp) = fd; return fp; } static int socket_getc(SOCKET fd) { int n; unsigned char c; n = socket_safe_recv(fd, (char *)&c, 1); if(n <= 0) return EOF; return (int)c; } char *socket_fgets(char *buff, int n, FILE *fp) { SOCKET fd = W32_FP2SOCKET(fp); int len; n--; /* for '\0' */ if(n == 0) *buff = '\0'; if(n <= 0) return buff; len = 0; while(len < n) { int c; c = socket_getc(fd); if(c == -1) break; buff[len++] = c; if(c == url_newline_code) break; } if(len == 0) return NULL; buff[len] = '\0'; return buff; } int socket_fgetc(FILE *fp) { SOCKET fd = W32_FP2SOCKET(fp); return socket_getc(fd); } long socket_fread(void *buff, long bufsiz, FILE *fp) { SOCKET fd = W32_FP2SOCKET(fp); return socket_safe_recv(fd, buff, bufsiz); } long socket_fwrite(void *buff, long bufsiz, FILE *fp) { SOCKET fd = W32_FP2SOCKET(fp); return socket_write(fd, buff, bufsiz); } int socket_fclose(FILE *fp) { SOCKET fd = W32_FP2SOCKET(fp); int ret; ret = closesocket(fd); free(fp); return ret; } int socket_fflush(FILE *fp) { return 0; } #endif TiMidity++-2.13.2/utils/net.h0100644004711200001440000000317107421005037014774 0ustar tamukiusers/* TiMidity++ -- MIDI to WAVE converter and player Copyright (C) 1999-2002 Masanao Izumo Copyright (C) 1995 Tuukka Toivonen 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef ___NET_H_ #define ___NET_H_ #if defined(WINSOCK) #include #else typedef int SOCKET; #define closesocket(fd) close(fd) #define WSADATA int #define MAKEWORD(a,b) #define WSAStartup(a,b) #define WSACleanup() #endif extern SOCKET open_socket(char *host, unsigned short port); extern int socket_shutdown(SOCKET fd, int how); extern long socket_write(SOCKET fd, char *buff, long bufsiz); extern FILE *socket_fdopen(SOCKET fd, char *mode); extern char *socket_fgets(char *buff, int n, FILE *fp); extern int socket_fgetc(FILE *fp); extern long socket_fread(void *buff, long bufsiz, FILE *fp); extern long socket_fwrite(void *buff, long bufsiz, FILE *fp); extern int socket_fflush(FILE *fp); extern int socket_fclose(FILE *fp); #endif /* ___NET_H_ */ TiMidity++-2.13.2/utils/mac_util.c0100644004711200001440000001612210003327310015765 0ustar tamukiusers/* TiMidity++ -- MIDI to WAVE converter and player Copyright (C) 1999-2002 Masanao Izumo Copyright (C) 1995 Tuukka Toivonen 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Macintosh interface for TiMidity by T.Nogami mac_util.c */ #ifdef HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ #include #include #include #include #include "mac_util.h" OSErr GetFullPath( const FSSpec* spec, Str255 fullPath) { CInfoPBRec myPB; Str255 dirName; OSErr myErr; fullPath[0] = '\0'; BlockMoveData(spec->name, fullPath, spec->name[spec->name[0]]+1 ); myPB.dirInfo.ioNamePtr = dirName; myPB.dirInfo.ioVRefNum = spec->vRefNum; myPB.dirInfo.ioDrParID = spec->parID; myPB.dirInfo.ioFDirIndex = -1; do{ myPB.dirInfo.ioDrDirID = myPB.dirInfo.ioDrParID; myErr = PBGetCatInfoSync(&myPB); dirName[0]++; dirName[ dirName[0] ]=':'; if( dirName[0]+fullPath[0]>=254 ){ fullPath[0]=0; return 1; } BlockMoveData(fullPath+1, dirName+dirName[0]+1, fullPath[0]); dirName[0]+=fullPath[0]; BlockMoveData(dirName, fullPath, dirName[0]+1); }while( !(myPB.dirInfo.ioDrDirID == fsRtDirID) ); return noErr; } void StopAlertMessage(Str255 s) { ParamText(s,"\p","\p","\p"); StopAlert(128,0); } void LDeselectAll(ListHandle lHandle) { Cell cell={0,0}; while(LGetSelect(true, &cell, lHandle)){ LSetSelect(false, cell, lHandle); } } void TEReadFile(char* filename, TEHandle te) { FILE *in; //clear TE TESetSelect(0, (**te).teLength, te); TEDelete(te); //read if( (in=fopen(filename, "rb"))==0 ){ char *s="No document."; TEInsert(s, strlen(s), te); }else{ char buf[80]; int len; while(fgets( buf, 80, in)){ len=strlen(buf); if( buf[len-1]==0xA ){ buf[len-1]=0xD; //len--; } TEInsert(buf, len, te); } fclose(in); } } /***********************/ #pragma mark - void SetDialogItemValue(DialogPtr dialog, short item, short value) { short itemType; ControlHandle itemHandle; Rect itemRect; GetDialogItem(dialog, item, &itemType, (Handle*)&itemHandle, &itemRect); SetControlValue(itemHandle, value); } short GetDialogItemValue(DialogPtr dialog, short item ) { short itemType; ControlHandle itemHandle; Rect itemRect; GetDialogItem(dialog, item, &itemType, (Handle*)&itemHandle, &itemRect); return GetControlValue(itemHandle); } void SetDialogTEValue(DialogRef dialog, short item, int value) { Str255 s; NumToString(value, s); mySetDialogItemText(dialog, item, s); } int GetDialogTEValue(DialogRef dialog, short item ) { Str255 s; myGetDialogItemText(dialog, item, s); return atof(p2cstr(s)); } short ToggleDialogItem(DialogPtr dialog, short item ) { short itemType, value; ControlHandle itemHandle; Rect itemRect; GetDialogItem(dialog, item, &itemType, (Handle*)&itemHandle, &itemRect); value=GetControlValue(itemHandle); SetControlValue(itemHandle, !value); return !value; } void myGetDialogItemText(DialogPtr theDialog, short itemNo, Str255 s) { short itemType; Handle item; Rect box; GetDialogItem(theDialog, itemNo, &itemType, &item, &box); GetDialogItemText(item, s); } void mySetDialogItemText(DialogRef theDialog, short itemNo, const Str255 text) { short itemType; Handle item; Rect box; GetDialogItem(theDialog, itemNo, &itemType, &item, &box); SetDialogItemText(item, text); } void SetDialogControlTitle(DialogRef theDialog, short itemNo, const Str255 text) { short itemType; Handle item; Rect box; GetDialogItem(theDialog, itemNo, &itemType, &item, &box); SetControlTitle((ControlRef)item, text); } void SetDialogItemHilite(DialogRef dialog, short item, short value) { short itemType; ControlRef itemHandle; Rect itemRect; GetDialogItem(dialog, item, &itemType, (Handle *)&itemHandle, &itemRect); HiliteControl(itemHandle, value); } // ************************************************ void mac_TransPathSeparater(const char str[], char out[]) { int i; for( i=0; str[i]!=0; i++ ){ if( str[i]=='/' ){ out[i]=':'; } else { out[i]=str[i]; } } } #if 0 char** sys_errlist_() { static char s[80]; static char* ps=s; static char** ret=&ps; /* if( errno==ENOENT ) strcpy(s,"File not Found."); else */ /* ENOENT vanished at CWPro2 */ if( errno==ENOSPC ) strcpy(s,"Out of Space."); else snprintf(s, 80, "error no.%d", errno); return(ret-errno); } #endif /*0*/ // ************************************************** #pragma mark - /* special fgets */ /* allow \r as return code */ char* mac_fgets( char buf[], int n, FILE* file) { int c,i; if( n==0 ) return 0; for( i=0; i0 && buf[i-1]==EOF ){ buf[i-1]=0; i--; } if( i==0 && c==EOF && feof(file) ) return 0; if( i==1 && buf[0]=='\n' ){ /* probably dos LF (Unix blank line?)*/ return mac_fgets( buf, n, file); } else if( buf[i-1]=='\n' ){ /*unix*/ return buf; } else if( buf[i-1]=='\r' ){ /*mac or dos*/ buf[i-1]='\n'; return buf; } return buf; /* for safty*/ } void *mac_memchr (const void *s, int c, size_t n) { char* buf=(char*)s; int i; for( i=0; i Copyright (C) 1995 Tuukka Toivonen 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Macintosh interface for TiMidity by T.Nogami mac_util.h */ #ifndef MACUTIL__ #define MACUTIL__ OSErr GetFullPath( const FSSpec*, Str255 fullPath); void StopAlertMessage(Str255); void SetDialogItemValue(DialogPtr dialog, short item, short value); short GetDialogItemValue(DialogPtr dialog, short item ); void SetDialogTEValue(DialogRef dialog, short item, int value); int GetDialogTEValue(DialogRef dialog, short item ); short ToggleDialogItem(DialogPtr dialog, short item ); void myGetDialogItemText(DialogPtr theDialog, short itemNo, Str255 s); void mySetDialogItemText(DialogRef theDialog, short itemNo, const Str255 text); void SetDialogControlTitle(DialogRef theDialog, short itemNo, const Str255 text); void SetDialogItemHilite(DialogRef dialog, short item, short value); void mac_TransPathSeparater(const char str[], char out[]); void LDeselectAll(ListHandle); void TEReadFile(char* filename, TEHandle te); #include #include /* CodeWarrior dose not have these macro, so I wrote */ #define ENOENT 9990 #define EINVAL 9991 #define EINTR 9992 #define EPERM 9993 #define EACCES 9994 #define ENOTDIR 9995 #define ENOSPC dskFulErr /*this function is very tricky. Replace sys_errlist[errno] --> "error no.(errorno)" Because CodeWarrior does not support sys_errlist[]. If your compiler supports, you need not applend this file. */ //char** sys_errlist_(); //#define sys_errlist sys_errlist_() char* strdup(const char*); //char* strncasecmp(const char*, const char*, int); #define strcasecmp mac_strcasecmp //#define strncasecmp mac_strncasecmp int mac_strcasecmp(const char *s1, const char *s2); int mac_strncasecmp(const char *s1, const char *s2, size_t n ); int strtailcasecmp(const char *s1, const char *s2); char* mac_fgets( char *buf, int n, FILE* file); void* mac_memchr( const void *s, int c, size_t n); /* hacking standard function */ #define fgets mac_fgets #define memchr mac_memchr #endif /*MACUTIL__*/ TiMidity++-2.13.2/utils/mac_readdir.c0100644004711200001440000000240407421005037016431 0ustar tamukiusers/* TiMidity++ -- MIDI to WAVE converter and player Copyright (C) 1999-2002 Masanao Izumo Copyright (C) 1995 Tuukka Toivonen 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Macintosh interface for TiMidity by T.Nogami mac_readdir.c Macintosh readdir */ #ifdef HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ #include "mac_readdir.h" DIR *opendir(const char * /*name*/) { return NULL; //dummy } int closedir(DIR * /*dir*/) { return 0; //dummy } struct dirent* readdir( DIR * /*p*/) { return NULL; //dummy } TiMidity++-2.13.2/utils/mac_readdir.h0100644004711200001440000000256107421005037016442 0ustar tamukiusers/* TiMidity++ -- MIDI to WAVE converter and player Copyright (C) 1999-2002 Masanao Izumo Copyright (C) 1995 Tuukka Toivonen 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Macintosh interface for TiMidity by T.Nogami mac_readdir.h Macintosh readdir */ #ifndef MAC_READDIR_H #define MAC_READDIR_H typedef struct{ int i; }DIR; struct dirent { long d_ino; //__kernel_off_t d_off; unsigned short d_reclen; char d_name[256]; /* We must not include limits.h! */ }; DIR *opendir(const char *name); int closedir(DIR *dir); struct dirent* readdir(DIR *dir); #endif //MAC_READDIR_H TiMidity++-2.13.2/utils/readdir.h0100644004711200001440000000455207421005037015624 0ustar tamukiusers/* TiMidity++ -- MIDI to WAVE converter and player Copyright (C) 1999-2002 Masanao Izumo Copyright (C) 1995 Tuukka Toivonen 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA readdir.h Structures and types used to implement opendir/readdir/closedir on Windows 95/NT. */ #ifndef ___READDIR_H_ #define ___READDIR_H_ #include #include #include #include /* Borland C++ */ #ifdef __BORLANDC__ #include #endif /* __BORLANDC__ */ #if 0 #define API_EXPORT(type) __declspec(dllexport) type __stdcall #else #define API_EXPORT(type) type #endif /* struct dirent - same as Unix */ struct dirent { long d_ino; /* inode (always 1 in WIN32) */ off_t d_off; /* offset to this dirent */ unsigned short d_reclen; /* length of d_name */ char d_name[_MAX_FNAME+1]; /* filename (null terminated) */ }; /* typedef DIR - not the same as Unix */ typedef struct { long handle; /* _findfirst/_findnext handle */ short offset; /* offset into directory */ short finished; /* 1 if there are not more files */ #ifdef __BORLANDC__ struct ffblk fileinfo;/* from _findfirst/_findnext */ #else struct _finddata_t fileinfo;/* from _findfirst/_findnext */ #endif /* __BORLANDC__ */ char *dir; /* the dir we are reading */ struct dirent dent; /* the dirent to return */ } DIR; /* Function prototypes */ extern API_EXPORT(DIR *) opendir(const char *); extern API_EXPORT(struct dirent *) readdir(DIR *); extern API_EXPORT(int) closedir(DIR *); #ifdef __BORLANDC__ #define _findfirst(x,y) findfirst((x),(y),0) #define _findnext(x,y) findnext((y)) #endif /* __BORLANDC__ */ #endif /* ___READDIR_H_ */ TiMidity++-2.13.2/utils/readdir_win.c0100644004711200001440000000635107515661124016504 0ustar tamukiusers/* TiMidity++ -- MIDI to WAVE converter and player Copyright (C) 1999-2002 Masanao Izumo Copyright (C) 1995 Tuukka Toivonen 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA readdir.c */ #ifdef HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ #ifdef HAVE_MALLOC_H #include #endif #ifndef NO_STRING_H #include #else #include #endif #include "timidity.h" #include "common.h" #ifdef __W32__ #include "readdir.h" /********************************************************************** * Implement dirent-style opendir/readdir/closedir on Window 95/NT * * Functions defined are opendir(), readdir() and closedir() with the * same prototypes as the normal dirent.h implementation. * * Does not implement telldir(), seekdir(), rewinddir() or scandir(). * The dirent struct is compatible with Unix, except that d_ino is * always 1 and d_off is made up as we go along. * * The DIR typedef is not compatible with Unix. **********************************************************************/ API_EXPORT(DIR *) opendir(const char *dir) { DIR *dp; char *filespec; long handle; int index; filespec = safe_malloc(strlen(dir) + 2 + 1); strcpy(filespec, dir); index = strlen(filespec) - 1; if (index >= 0 && (filespec[index] == '/' || filespec[index] == '\\')) filespec[index] = '\0'; strcat(filespec, "/*"); dp = (DIR *)safe_malloc(sizeof(DIR)); dp->offset = 0; dp->finished = 0; dp->dir = safe_strdup(dir); if ((handle = _findfirst(filespec, &(dp->fileinfo))) < 0) { if (errno == ENOENT) dp->finished = 1; else return NULL; } dp->handle = handle; free(filespec); return dp; } API_EXPORT(struct dirent *) readdir(DIR *dp) { if (!dp || dp->finished) return NULL; if (dp->offset != 0) { if (_findnext(dp->handle, &(dp->fileinfo)) < 0) { dp->finished = 1; return NULL; } } dp->offset++; #ifdef __BORLANDC__ /* Borland C++ */ strncpy(dp->dent.d_name, dp->fileinfo.ff_name, _MAX_FNAME); #else strncpy(dp->dent.d_name, dp->fileinfo.name, _MAX_FNAME); #endif /* __BORLANDC__ */ dp->dent.d_name[_MAX_FNAME] = '\0'; dp->dent.d_ino = 1; dp->dent.d_reclen = strlen(dp->dent.d_name); dp->dent.d_off = dp->offset; return &(dp->dent); } API_EXPORT(int) closedir(DIR *dp) { if (!dp) return 0; #ifndef __BORLANDC__ _findclose(dp->handle); #endif if (dp->dir) free(dp->dir); if (dp) free(dp); return 0; } #endif /* __W32__ */ TiMidity++-2.13.2/libarc/0040755004711200001440000000000010031564160014130 5ustar tamukiusersTiMidity++-2.13.2/libarc/Makefile.am0100644004711200001440000000447710056744110016177 0ustar tamukiusers# TiMidity++ -- MIDI to WAVE converter and player # Copyright (C) 1999-2002 Masanao Izumo # Copyright (C) 1995 Tuukka Toivonen # # 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA include $(top_srcdir)/common.makefile.in INCLUDES = \ -I$(top_srcdir)/timidity \ -I$(top_srcdir)/utils \ $(EXTRAINCS) noinst_LIBRARIES = libarc.a libarc_a_SOURCES = \ arc.c \ arc.h \ arc_lzh.c \ arc_mime.c \ arc_tar.c \ arc_zip.c \ deflate.c \ explode.c \ explode.h \ inflate.c \ unlzh.c \ unlzh.h \ url.c \ url.h \ url_b64decode.c \ url_buff.c \ url_cache.c \ url_dir.c \ url_file.c \ url_hqxdecode.c \ url_inflate.c \ url_mem.c \ url_pipe.c \ url_qsdecode.c \ url_uudecode.c \ zip.h EXTRA_libarc_a_SOURCES = \ url_http.c \ url_ftp.c \ url_news.c \ url_newsgroup.c if ENABLE_NETWORK NET_OBJS = \ url_http.$(OBJEXT) \ url_ftp.$(OBJEXT) \ url_news.$(OBJEXT) \ url_newsgroup.$(OBJEXT) endif libarc_a_LIBADD = $(NET_OBJS) libarc.a: $(libarc_a_OBJECTS) $(libarc_a_DEPENDENCIES) if VCPP rm -f libarc.a rm -f arc.lib link -lib $(libarc_a_OBJECTS) $(libarc_a_LIBADD) -out:arc.lib if test -f arc.lib ; then touch $@ ; fi else if BORLANDC rm -f libarc.a rm -f arc.lib for foo in $(libarc_a_OBJECTS) $(libarc_a_LIBADD);do \ tlib arc.lib +$$foo; \ done if test -f arc.lib ; then touch $@ ; fi else if WATCOM_C rm -f libarc.a rm -f arc.lib for foo in $(libarc_a_OBJECTS) $(libarc_a_LIBADD);do \ wlib -q arc.lib +$$foo; \ done if test -f arc.lib ; then touch $@ ; fi else -rm -f libarc.a $(libarc_a_AR) libarc.a $(libarc_a_OBJECTS) $(libarc_a_LIBADD) $(RANLIB) libarc.a endif endif endif clean: rm -f *.$(OBJEXT) rm -f *.$(so) rm -f *.a rm -f *.lib TiMidity++-2.13.2/libarc/Makefile.in0100644004711200001440000005371410124332436016206 0ustar tamukiusers# Makefile.in generated by automake 1.7.6 from Makefile.am. # @configure_input@ # Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 # 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@ # TiMidity++ -- MIDI to WAVE converter and player # Copyright (C) 1999-2002 Masanao Izumo # Copyright (C) 1995 Tuukka Toivonen # # 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # Define follows if you want to change. # Note that the definition of beginning with just one `#' implies # default value from configure. srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = .. am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ 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 = : host_triplet = @host@ pkgdatadir = @pkgdatadir@ #CC= @CC@ #CFLAGS = @CFLAGS@ # For pentium gcc # For PGCC #CPPFLAGS = @CPPFLAGS@ #DEFS = @DEFS@ #LDFLAGS = @LDFLAGS@ #LIBS = @LIBS@ #SHLD = @SHLD@ #SHCFLAGS = @SHCFLAGS@ #@SET_MAKE@ #prefix = @prefix@ #exec_prefix = @exec_prefix@ #bindir = @bindir@ #libdir = @libdir@ #datadir = @datadir@ #mandir = @mandir@ pkglibdir = @pkglibdir@ ACLOCAL = @ACLOCAL@ ALSA_CFLAGS = @ALSA_CFLAGS@ ALSA_LIBS = @ALSA_LIBS@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AO_CFLAGS = @AO_CFLAGS@ AO_LIBS = @AO_LIBS@ ARTS_CFLAGS = @ARTS_CFLAGS@ ARTS_CONFIG = @ARTS_CONFIG@ ARTS_LIBS = @ARTS_LIBS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ A_so_libs = @A_so_libs@ BORLANDC_FALSE = @BORLANDC_FALSE@ BORLANDC_LDFLAGS = @BORLANDC_LDFLAGS@ BORLANDC_START = @BORLANDC_START@ BORLANDC_TRUE = @BORLANDC_TRUE@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGNUS_FALSE = @CYGNUS_FALSE@ CYGNUS_TRUE = @CYGNUS_TRUE@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ELFILES = @ELFILES@ EMACS = @EMACS@ ENABLE_ALSASEQ_FALSE = @ENABLE_ALSASEQ_FALSE@ ENABLE_ALSASEQ_TRUE = @ENABLE_ALSASEQ_TRUE@ ENABLE_DYNAMIC_TCLTK_FALSE = @ENABLE_DYNAMIC_TCLTK_FALSE@ ENABLE_DYNAMIC_TCLTK_TRUE = @ENABLE_DYNAMIC_TCLTK_TRUE@ ENABLE_DYNAMIC_XAW_FALSE = @ENABLE_DYNAMIC_XAW_FALSE@ ENABLE_DYNAMIC_XAW_TRUE = @ENABLE_DYNAMIC_XAW_TRUE@ ENABLE_EMACS_FALSE = @ENABLE_EMACS_FALSE@ ENABLE_EMACS_TRUE = @ENABLE_EMACS_TRUE@ ENABLE_GTK_FALSE = @ENABLE_GTK_FALSE@ ENABLE_GTK_TRUE = @ENABLE_GTK_TRUE@ ENABLE_MOTIF_FALSE = @ENABLE_MOTIF_FALSE@ ENABLE_MOTIF_TRUE = @ENABLE_MOTIF_TRUE@ ENABLE_NCURSES_FALSE = @ENABLE_NCURSES_FALSE@ ENABLE_NCURSES_TRUE = @ENABLE_NCURSES_TRUE@ ENABLE_NETWORK_FALSE = @ENABLE_NETWORK_FALSE@ ENABLE_NETWORK_TRUE = @ENABLE_NETWORK_TRUE@ ENABLE_PLUGIN_FALSE = @ENABLE_PLUGIN_FALSE@ ENABLE_PLUGIN_TRUE = @ENABLE_PLUGIN_TRUE@ ENABLE_PORTMIDISYN_FALSE = @ENABLE_PORTMIDISYN_FALSE@ ENABLE_PORTMIDISYN_TRUE = @ENABLE_PORTMIDISYN_TRUE@ ENABLE_SERVER_FALSE = @ENABLE_SERVER_FALSE@ ENABLE_SERVER_TRUE = @ENABLE_SERVER_TRUE@ ENABLE_SLANG_FALSE = @ENABLE_SLANG_FALSE@ ENABLE_SLANG_TRUE = @ENABLE_SLANG_TRUE@ ENABLE_SOUND_SPEC_FALSE = @ENABLE_SOUND_SPEC_FALSE@ ENABLE_SOUND_SPEC_TRUE = @ENABLE_SOUND_SPEC_TRUE@ ENABLE_TCLTK_FALSE = @ENABLE_TCLTK_FALSE@ ENABLE_TCLTK_TRUE = @ENABLE_TCLTK_TRUE@ ENABLE_VT100_FALSE = @ENABLE_VT100_FALSE@ ENABLE_VT100_TRUE = @ENABLE_VT100_TRUE@ ENABLE_W32GUI_FALSE = @ENABLE_W32GUI_FALSE@ ENABLE_W32GUI_TRUE = @ENABLE_W32GUI_TRUE@ ENABLE_W32G_SYN_FALSE = @ENABLE_W32G_SYN_FALSE@ ENABLE_W32G_SYN_TRUE = @ENABLE_W32G_SYN_TRUE@ ENABLE_WINSYN_FALSE = @ENABLE_WINSYN_FALSE@ ENABLE_WINSYN_TRUE = @ENABLE_WINSYN_TRUE@ ENABLE_WRD_FALSE = @ENABLE_WRD_FALSE@ ENABLE_WRD_TRUE = @ENABLE_WRD_TRUE@ ENABLE_XAW_FALSE = @ENABLE_XAW_FALSE@ ENABLE_XAW_TRUE = @ENABLE_XAW_TRUE@ ENABLE_XSKIN_FALSE = @ENABLE_XSKIN_FALSE@ ENABLE_XSKIN_TRUE = @ENABLE_XSKIN_TRUE@ ESD_CFLAGS = @ESD_CFLAGS@ ESD_CONFIG = @ESD_CONFIG@ ESD_LIBS = @ESD_LIBS@ EXEEXT = @EXEEXT@ EXTRALIBS = @EXTRALIBS@ GTK_CFLAGS = @GTK_CFLAGS@ GTK_CONFIG = @GTK_CONFIG@ GTK_LIBS = @GTK_LIBS@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INTERFACE_SRCS = @INTERFACE_SRCS@ LDFLAGS = @LDFLAGS@ LIBFLAC_CFLAGS = @LIBFLAC_CFLAGS@ LIBFLAC_LIBS = @LIBFLAC_LIBS@ LIBOBJS = @LIBOBJS@ LIBOGGFLAC_CFLAGS = @LIBOGGFLAC_CFLAGS@ LIBOGGFLAC_LIBS = @LIBOGGFLAC_LIBS@ LIBS = @LIBS@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ MAKEINFO = @MAKEINFO@ MSYS_FALSE = @MSYS_FALSE@ MSYS_TRUE = @MSYS_TRUE@ NEEDDLOPEN_FALSE = @NEEDDLOPEN_FALSE@ NEEDDLOPEN_TRUE = @NEEDDLOPEN_TRUE@ NEEDGETOPT_FALSE = @NEEDGETOPT_FALSE@ NEEDGETOPT_TRUE = @NEEDGETOPT_TRUE@ NETSRCS = @NETSRCS@ OBJEXT = @OBJEXT@ OGG_CFLAGS = @OGG_CFLAGS@ OGG_LIBS = @OGG_LIBS@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PKG_CONFIG = @PKG_CONFIG@ P_so_libs = @P_so_libs@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ SHCFLAGS = @SHCFLAGS@ SHELL = @SHELL@ SHLD = @SHLD@ STRIP = @STRIP@ SYSEXTRAS = @SYSEXTRAS@ T_so_libs = @T_so_libs@ VCPP_FALSE = @VCPP_FALSE@ VCPP_LDFLAGS = @VCPP_LDFLAGS@ VCPP_TRUE = @VCPP_TRUE@ VERSION = @VERSION@ VORBISENC_LIBS = @VORBISENC_LIBS@ VORBISFILE_LIBS = @VORBISFILE_LIBS@ VORBIS_CFLAGS = @VORBIS_CFLAGS@ VORBIS_LIBS = @VORBIS_LIBS@ W32READDIR_FALSE = @W32READDIR_FALSE@ W32READDIR_TRUE = @W32READDIR_TRUE@ WATCOM_C_FALSE = @WATCOM_C_FALSE@ WATCOM_C_TRUE = @WATCOM_C_TRUE@ WATCOM_LDFLAGS = @WATCOM_LDFLAGS@ WISH = @WISH@ W_so_libs = @W_so_libs@ X_CFLAGS = @X_CFLAGS@ X_EXTRA_LIBS = @X_EXTRA_LIBS@ X_LIBS = @X_LIBS@ X_PRE_LIBS = @X_PRE_LIBS@ a_so_libs = @a_so_libs@ ac_ct_CC = @ac_ct_CC@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ datadir = @datadir@ dynamic_targets = @dynamic_targets@ e_so_libs = @e_so_libs@ exec_prefix = @exec_prefix@ g_so_libs = @g_so_libs@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ i_so_libs = @i_so_libs@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ k_so_libs = @k_so_libs@ libdir = @libdir@ libexecdir = @libexecdir@ lispdir = @lispdir@ localstatedir = @localstatedir@ m_so_libs = @m_so_libs@ mandir = @mandir@ n_so_libs = @n_so_libs@ oldincludedir = @oldincludedir@ p_so_libs = @p_so_libs@ prefix = @prefix@ program_transform_name = @program_transform_name@ r_so_libs = @r_so_libs@ s_so_libs = @s_so_libs@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ so = @so@ sysconfdir = @sysconfdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ tcltk_dep = @tcltk_dep@ timidity_LDFLAGS = @timidity_LDFLAGS@ w_so_libs = @w_so_libs@ #INSTALL = @INSTALL@ # Where to install the patches, config files. PKGDATADIR = $(pkgdatadir) # Where to install the Tcl code and the bitmaps. # It also contains bitmaps which are shared with XAW interface. PKGLIBDIR = $(pkglibdir) # Where to install the dynamic link interface. SHLIB_DIR = $(pkglibdir) # Where to install timidity.el ELISP_DIR = $(lispdir) # If you want to change TCL_DIR, please do follows. # * Add -DTKPROGPATH=\"$(TCL_DIR)/tkmidity.tcl\" to CPPFLAGS. # * Make a symbolic link $(PKGLIBDIR)/bitmaps to $(TCL_DIR)/bitmaps TCL_DIR = $(PKGLIBDIR) # Define the timidity default file search path. DEF_DEFAULT_PATH = -DDEFAULT_PATH=\"$(PKGDATADIR)\" # You sould not change follows definitions. DEF_PKGDATADIR = -DPKGDATADIR=\"$(PKGDATADIR)\" DEF_PKGLIBDIR = -DPKGLIBDIR=\"$(PKGLIBDIR)\" DEF_SHLIB_DIR = -DSHLIB_DIR=\"$(SHLIB_DIR)\" BITMAP_DIR = $(TCL_DIR)/bitmaps INCLUDES = \ -I$(top_srcdir)/timidity \ -I$(top_srcdir)/utils \ $(EXTRAINCS) noinst_LIBRARIES = libarc.a libarc_a_SOURCES = \ arc.c \ arc.h \ arc_lzh.c \ arc_mime.c \ arc_tar.c \ arc_zip.c \ deflate.c \ explode.c \ explode.h \ inflate.c \ unlzh.c \ unlzh.h \ url.c \ url.h \ url_b64decode.c \ url_buff.c \ url_cache.c \ url_dir.c \ url_file.c \ url_hqxdecode.c \ url_inflate.c \ url_mem.c \ url_pipe.c \ url_qsdecode.c \ url_uudecode.c \ zip.h EXTRA_libarc_a_SOURCES = \ url_http.c \ url_ftp.c \ url_news.c \ url_newsgroup.c @ENABLE_NETWORK_TRUE@NET_OBJS = \ @ENABLE_NETWORK_TRUE@ url_http.$(OBJEXT) \ @ENABLE_NETWORK_TRUE@ url_ftp.$(OBJEXT) \ @ENABLE_NETWORK_TRUE@ url_news.$(OBJEXT) \ @ENABLE_NETWORK_TRUE@ url_newsgroup.$(OBJEXT) libarc_a_LIBADD = $(NET_OBJS) subdir = libarc ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 mkinstalldirs = $(SHELL) $(top_srcdir)/autoconf/mkinstalldirs CONFIG_HEADER = $(top_builddir)/config.h $(top_builddir)/interface.h CONFIG_CLEAN_FILES = LIBRARIES = $(noinst_LIBRARIES) libarc_a_AR = $(AR) cru @ENABLE_NETWORK_TRUE@libarc_a_DEPENDENCIES = url_http.$(OBJEXT) \ @ENABLE_NETWORK_TRUE@ url_ftp.$(OBJEXT) url_news.$(OBJEXT) \ @ENABLE_NETWORK_TRUE@ url_newsgroup.$(OBJEXT) @ENABLE_NETWORK_FALSE@libarc_a_DEPENDENCIES = am_libarc_a_OBJECTS = arc.$(OBJEXT) arc_lzh.$(OBJEXT) arc_mime.$(OBJEXT) \ arc_tar.$(OBJEXT) arc_zip.$(OBJEXT) deflate.$(OBJEXT) \ explode.$(OBJEXT) inflate.$(OBJEXT) unlzh.$(OBJEXT) \ url.$(OBJEXT) url_b64decode.$(OBJEXT) url_buff.$(OBJEXT) \ url_cache.$(OBJEXT) url_dir.$(OBJEXT) url_file.$(OBJEXT) \ url_hqxdecode.$(OBJEXT) url_inflate.$(OBJEXT) url_mem.$(OBJEXT) \ url_pipe.$(OBJEXT) url_qsdecode.$(OBJEXT) \ url_uudecode.$(OBJEXT) libarc_a_OBJECTS = $(am_libarc_a_OBJECTS) DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/autoconf/depcomp am__depfiles_maybe = depfiles @AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/arc.Po ./$(DEPDIR)/arc_lzh.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/arc_mime.Po ./$(DEPDIR)/arc_tar.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/arc_zip.Po ./$(DEPDIR)/deflate.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/explode.Po ./$(DEPDIR)/inflate.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/unlzh.Po ./$(DEPDIR)/url.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/url_b64decode.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/url_buff.Po ./$(DEPDIR)/url_cache.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/url_dir.Po ./$(DEPDIR)/url_file.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/url_ftp.Po ./$(DEPDIR)/url_hqxdecode.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/url_http.Po ./$(DEPDIR)/url_inflate.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/url_mem.Po ./$(DEPDIR)/url_news.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/url_newsgroup.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/url_pipe.Po ./$(DEPDIR)/url_qsdecode.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/url_uudecode.Po COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ DIST_SOURCES = $(libarc_a_SOURCES) $(EXTRA_libarc_a_SOURCES) DIST_COMMON = $(top_srcdir)/common.makefile.in Makefile.am Makefile.in SOURCES = $(libarc_a_SOURCES) $(EXTRA_libarc_a_SOURCES) all: all-am .SUFFIXES: .SUFFIXES: .c .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/common.makefile.in $(top_srcdir)/configure.in $(ACLOCAL_M4) cd $(top_srcdir) && \ $(AUTOMAKE) --gnu libarc/Makefile Makefile: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.in $(top_builddir)/config.status cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) AR = ar clean-noinstLIBRARIES: -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) mostlyclean-compile: -rm -f *.$(OBJEXT) core *.core distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/arc.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/arc_lzh.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/arc_mime.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/arc_tar.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/arc_zip.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/deflate.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/explode.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/inflate.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/unlzh.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/url.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/url_b64decode.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/url_buff.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/url_cache.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/url_dir.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/url_file.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/url_ftp.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/url_hqxdecode.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/url_http.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/url_inflate.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/url_mem.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/url_news.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/url_newsgroup.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/url_pipe.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/url_qsdecode.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/url_uudecode.Po@am__quote@ distclean-depend: -rm -rf ./$(DEPDIR) .c.o: @am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ @am__fastdepCC_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ @am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ @am__fastdepCC_TRUE@ fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `test -f '$<' || echo '$(srcdir)/'`$< .c.obj: @am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ @am__fastdepCC_TRUE@ -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ @am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ @am__fastdepCC_TRUE@ fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi` uninstall-info-am: ETAGS = etags ETAGSFLAGS = CTAGS = ctags CTAGSFLAGS = tags: TAGS ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ mkid -fID $$unique TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ test -z "$(ETAGS_ARGS)$$tags$$unique" \ || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$tags $$unique ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ test -z "$(CTAGS_ARGS)$$tags$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$tags $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && cd $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) $$here distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) top_distdir = .. distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) distdir: $(DISTFILES) $(mkinstalldirs) $(distdir)/.. @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ list='$(DISTFILES)'; for file in $$list; do \ case $$file in \ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ esac; \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ $(mkinstalldirs) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ if test -d $$d/$$file; then \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ cp -pR $$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 $(LIBRARIES) 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: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -rm -f Makefile $(CONFIG_CLEAN_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 clean-noinstLIBRARIES mostlyclean-am distclean: distclean-am distclean-am: clean-am distclean-compile distclean-depend \ distclean-generic distclean-tags dvi: dvi-am dvi-am: info: info-am info-am: install-data-am: install-exec-am: install-info: install-info-am install-man: installcheck-am: maintainer-clean: maintainer-clean-am 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-info-am .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-noinstLIBRARIES ctags distclean distclean-compile \ distclean-depend distclean-generic distclean-tags distdir dvi \ dvi-am info info-am install install-am install-data \ install-data-am install-exec install-exec-am install-info \ install-info-am install-man install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \ uninstall-am uninstall-info-am libarc.a: $(libarc_a_OBJECTS) $(libarc_a_DEPENDENCIES) @VCPP_TRUE@ rm -f libarc.a @VCPP_TRUE@ rm -f arc.lib @VCPP_TRUE@ link -lib $(libarc_a_OBJECTS) $(libarc_a_LIBADD) -out:arc.lib @VCPP_TRUE@ if test -f arc.lib ; then touch $@ ; fi @BORLANDC_TRUE@@VCPP_FALSE@ rm -f libarc.a @BORLANDC_TRUE@@VCPP_FALSE@ rm -f arc.lib @BORLANDC_TRUE@@VCPP_FALSE@ for foo in $(libarc_a_OBJECTS) $(libarc_a_LIBADD);do \ @BORLANDC_TRUE@@VCPP_FALSE@ tlib arc.lib +$$foo; \ @BORLANDC_TRUE@@VCPP_FALSE@ done @BORLANDC_TRUE@@VCPP_FALSE@ if test -f arc.lib ; then touch $@ ; fi @BORLANDC_FALSE@@VCPP_FALSE@@WATCOM_C_TRUE@ rm -f libarc.a @BORLANDC_FALSE@@VCPP_FALSE@@WATCOM_C_TRUE@ rm -f arc.lib @BORLANDC_FALSE@@VCPP_FALSE@@WATCOM_C_TRUE@ for foo in $(libarc_a_OBJECTS) $(libarc_a_LIBADD);do \ @BORLANDC_FALSE@@VCPP_FALSE@@WATCOM_C_TRUE@ wlib -q arc.lib +$$foo; \ @BORLANDC_FALSE@@VCPP_FALSE@@WATCOM_C_TRUE@ done @BORLANDC_FALSE@@VCPP_FALSE@@WATCOM_C_TRUE@ if test -f arc.lib ; then touch $@ ; fi @BORLANDC_FALSE@@VCPP_FALSE@@WATCOM_C_FALSE@ -rm -f libarc.a @BORLANDC_FALSE@@VCPP_FALSE@@WATCOM_C_FALSE@ $(libarc_a_AR) libarc.a $(libarc_a_OBJECTS) $(libarc_a_LIBADD) @BORLANDC_FALSE@@VCPP_FALSE@@WATCOM_C_FALSE@ $(RANLIB) libarc.a clean: rm -f *.$(OBJEXT) rm -f *.$(so) rm -f *.a rm -f *.lib # 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: TiMidity++-2.13.2/libarc/arc.c0100644004711200001440000006244510125651536015061 0ustar tamukiusers/* TiMidity++ -- MIDI to WAVE converter and player Copyright (C) 1999-2002 Masanao Izumo Copyright (C) 1995 Tuukka Toivonen 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ #ifndef NO_STRING_H #include #else #include #endif #include #include "timidity.h" #include "common.h" #include "arc.h" #include "strtab.h" #include "zip.h" #include "unlzh.h" #include "explode.h" char *arc_lib_version = ARC_LIB_VERSION; #define GZIP_ASCIIFLAG (1u<<0) #define GZIP_MULTIPARTFLAG (1u<<1) #define GZIP_EXTRAFLAG (1u<<2) #define GZIP_FILEFLAG (1u<<3) #define GZIP_COMMFLAG (1u<<4) #define GZIP_ENCFLAG (1u<<5) #ifndef TRUE #define TRUE 1 #endif /* TRUE */ #ifndef FALSE #define FALSE 0 #endif /* FALSE */ #define ABORT -1 ArchiveHandler arc_handler; static MBlockList arc_buffer; typedef struct _ArchiveFileList { char *archive_name; ArchiveEntryNode *entry_list; struct _ArchiveFileList *next; } ArchiveFileList; static ArchiveFileList *arc_filelist = NULL; static struct { char *ext; int type; } archive_ext_list[] = { {".tar", ARCHIVE_TAR}, {".tar.gz", ARCHIVE_TGZ}, {".tgz", ARCHIVE_TGZ}, {".zip", ARCHIVE_ZIP}, {".neo", ARCHIVE_ZIP}, {".lzh", ARCHIVE_LZH}, {".lha", ARCHIVE_LZH}, {".mime", ARCHIVE_MIME}, {PATH_STRING, ARCHIVE_DIR}, {NULL, -1} }; int skip_gzip_header(URL url) { unsigned char flags; int m1, method; /* magic */ m1 = url_getc(url); if(m1 == 0) { url_skip(url, 128 - 1); m1 = url_getc(url); } if(m1 != 0x1f) return -1; if(url_getc(url) != 0x8b) return -1; /* method */ method = url_getc(url); switch(method) { case 8: /* deflated */ method = ARCHIVEC_DEFLATED; break; default: return -1; } /* flags */ flags = url_getc(url); if(flags & GZIP_ENCFLAG) return -1; /* time */ url_getc(url); url_getc(url); url_getc(url); url_getc(url); url_getc(url); /* extra flags */ url_getc(url); /* OS type */ if(flags & GZIP_MULTIPARTFLAG) { /* part number */ url_getc(url); url_getc(url); } if(flags & GZIP_EXTRAFLAG) { unsigned short len; int i; /* extra field */ len = url_getc(url); len |= ((unsigned short)url_getc(url)) << 8; for(i = 0; i < len; i++) url_getc(url); } if(flags & GZIP_FILEFLAG) { /* file name */ int c; do { c = url_getc(url); if(c == EOF) return -1; } while(c != '\0'); } if(flags & GZIP_COMMFLAG) { /* comment */ int c; do { c = url_getc(url); if(c == EOF) return -1; } while(c != '\0'); } return method; } int parse_gzip_header_bytes(char *gz, long maxparse, int *hdrsiz) { URL url = url_mem_open(gz, maxparse, 0); int method; if(!url) return -1; method = skip_gzip_header(url); *hdrsiz = url_tell(url); url_close(url); return method; } void (* arc_error_handler)(char *error_message) = NULL; static void arc_cant_open(char *s) { if(arc_error_handler != NULL) { char buff[BUFSIZ]; snprintf(buff, sizeof(buff), "%s: Can't open", s); arc_error_handler(buff); } } int get_archive_type(char *archive_name) { int i, len; char *p; int archive_name_length, delim; #ifdef SUPPORT_SOCKET int type = url_check_type(archive_name); if(type == URL_news_t) return ARCHIVE_MIME; if(type == URL_newsgroup_t) return ARCHIVE_NEWSGROUP; #endif /* SUPPORT_SOCKET */ if(strncmp(archive_name, "mail:", 5) == 0 || strncmp(archive_name, "mime:", 5) == 0) return ARCHIVE_MIME; if((p = strrchr(archive_name, '#')) != NULL) { archive_name_length = p - archive_name; delim = '#'; } else { archive_name_length = strlen(archive_name); delim = '\0'; } for(i = 0; archive_ext_list[i].ext; i++) { len = strlen(archive_ext_list[i].ext); if(len <= archive_name_length && strncasecmp(archive_name + archive_name_length - len, archive_ext_list[i].ext, len) == 0 && archive_name[archive_name_length] == delim) return archive_ext_list[i].type; /* Found */ } if(url_check_type(archive_name) == URL_dir_t) return ARCHIVE_DIR; return -1; /* Not found */ } static ArchiveFileList *find_arc_filelist(char *basename) { ArchiveFileList *p; for(p = arc_filelist; p; p = p->next) { if(strcmp(basename, p->archive_name) == 0) return p; } return NULL; } ArchiveEntryNode *arc_parse_entry(URL url, int archive_type) { ArchiveEntryNode *entry_first, *entry_last, *entry; ArchiveEntryNode *(* next_header_entry)(void); int gzip_method; URL orig; orig = NULL; switch(archive_type) { case ARCHIVE_TAR: next_header_entry = next_tar_entry; break; case ARCHIVE_TGZ: gzip_method = skip_gzip_header(url); if(gzip_method != ARCHIVEC_DEFLATED) { url_close(url); return NULL; } orig = url; if((url = url_inflate_open(orig, -1, 0)) == NULL) return NULL; next_header_entry = next_tar_entry; break; case ARCHIVE_ZIP: next_header_entry = next_zip_entry; break; case ARCHIVE_LZH: next_header_entry = next_lzh_entry; break; case ARCHIVE_MIME: if(!IS_URL_SEEK_SAFE(url)) { orig = url; if((url = url_cache_open(orig, 0)) == NULL) return NULL; } next_header_entry = next_mime_entry; break; default: return NULL; } arc_handler.isfile = (url->type == URL_file_t); arc_handler.url = url; arc_handler.counter = 0; entry_first = entry_last = NULL; arc_handler.pos = 0; while((entry = next_header_entry()) != NULL) { if(entry_first != NULL) entry_last->next = entry; else entry_first = entry_last = entry; while(entry_last->next) entry_last = entry_last->next; arc_handler.counter++; } url_close(url); if(orig) url_close(orig); return entry_first; /* Note that NULL if no archive file */ } static ArchiveFileList *add_arc_filelist(char *basename, int archive_type) { URL url; ArchiveFileList *afl; ArchiveEntryNode *entry; switch(archive_type) { case ARCHIVE_TAR: case ARCHIVE_TGZ: case ARCHIVE_ZIP: case ARCHIVE_LZH: case ARCHIVE_MIME: break; default: return NULL; } if((url = url_open(basename)) == NULL) { arc_cant_open(basename); return NULL; } entry = arc_parse_entry(url, archive_type); afl = (ArchiveFileList *)safe_malloc(sizeof(ArchiveFileList)); afl->archive_name = safe_strdup(basename); afl->entry_list = entry; afl->next = arc_filelist; arc_filelist = afl; return afl; } static ArchiveFileList *regist_archive(char *archive_filename) { int archive_type; if((archive_type = get_archive_type(archive_filename)) < 0) return NULL; /* Unknown archive */ archive_filename = url_expand_home_dir(archive_filename); if(find_arc_filelist(archive_filename)) return NULL; /* Already registerd */ return add_arc_filelist(archive_filename, archive_type); } static int arc_expand_newfile(StringTable *s, ArchiveFileList *afl, char *pattern) { ArchiveEntryNode *entry; char *p; for(entry = afl->entry_list; entry; entry = entry->next) { if(arc_case_wildmat(entry->name, pattern)) { p = new_segment(&arc_buffer, strlen(afl->archive_name) + strlen(entry->name) + 2); strcpy(p, afl->archive_name); strcat(p, "#"); strcat(p, entry->name); if(put_string_table(s, p, strlen(p)) == NULL) return -1; } } return 0; } char **expand_archive_names(int *nfiles_in_out, char **files) { int i, nfiles, arc_type; char *infile_name; char *base, *pattern, *p, buff[BUFSIZ]; char *one_file[1]; int one; ArchiveFileList *afl; /* Recusive global */ static MBlockList *pool; static StringTable stab; static int error_flag = 0; static int depth = 0; if(depth == 0) { error_flag = 0; init_string_table(&stab); pool = &arc_buffer; } nfiles = *nfiles_in_out; for(i = 0; i < nfiles; i++) { infile_name = url_expand_home_dir(files[i]); if((p = strrchr(infile_name, '#')) == NULL) { base = infile_name; pattern = "*"; } else { int len = p - infile_name; base = new_segment(pool, len + 1); /* +1 for '\0' */ memcpy(base, infile_name, len); base[len] = '\0'; pattern = p + 1; } if((afl = find_arc_filelist(base)) != NULL) { if(arc_expand_newfile(&stab, afl, pattern) == -1) goto abort_expand; continue; } arc_type = get_archive_type(base); if(arc_type == -1) { if(put_string_table(&stab, infile_name, strlen(infile_name)) == NULL) goto abort_expand; continue; } #ifdef SUPPORT_SOCKET if(arc_type == ARCHIVE_NEWSGROUP) { URL url; int len1, len2; char *news_prefix; if((url = url_newsgroup_open(base)) == NULL) { arc_cant_open(base); continue; } strncpy(buff, base, sizeof(buff)-1); p = strchr(buff + 7, '/') + 1; /* news://..../ */ *p = '\0'; news_prefix = strdup_mblock(pool, buff); len1 = strlen(news_prefix); while(url_gets(url, buff, sizeof(buff))) { len2 = strlen(buff); p = (char *)new_segment(pool, len1 + len2 + 1); strcpy(p, news_prefix); strcpy(p + len1, buff); one_file[0] = p; one = 1; depth++; expand_archive_names(&one, one_file); depth--; } url_close(url); if(error_flag) goto abort_expand; continue; } #endif /* SUPPORT_SOCKET */ if(arc_type == ARCHIVE_DIR) { URL url; int len1, len2; if((url = url_dir_open(base)) == NULL) { arc_cant_open(base); continue; } if(strncmp(base, "dir:", 4) == 0) base += 4; len1 = strlen(base); if(IS_PATH_SEP(base[len1 - 1])) len1--; while(url_gets(url, buff, sizeof(buff))) { if(strcmp(buff, ".") == 0 || strcmp(buff, "..") == 0) continue; len2 = strlen(buff); p = (char *)new_segment(pool, len1 + len2 + 2); strcpy(p, base); p[len1] = PATH_SEP; strcpy(p + len1 + 1, buff); one_file[0] = p; one = 1; depth++; expand_archive_names(&one, one_file); depth--; } url_close(url); if(error_flag) goto abort_expand; continue; } if((afl = add_arc_filelist(base, arc_type)) != NULL) { if(arc_expand_newfile(&stab, afl, pattern) == -1) goto abort_expand; } } if(depth) return NULL; *nfiles_in_out = stab.nstring; reuse_mblock(pool); return make_string_array(&stab); /* It is possible NULL */ abort_expand: error_flag = 1; if(depth) return NULL; delete_string_table(&stab); free_global_mblock(); *nfiles_in_out = 0; return NULL; } ArchiveEntryNode *new_entry_node(char *name, int len) { ArchiveEntryNode *entry; entry = (ArchiveEntryNode *)safe_malloc(sizeof(ArchiveEntryNode)); memset(entry, 0, sizeof(ArchiveEntryNode)); entry->name = (char *)safe_malloc(len + 1); memcpy(entry->name, name, len); entry->name[len] = '\0'; return entry; } void free_entry_node(ArchiveEntryNode *entry) { free(entry->name); if(entry->cache != NULL) free(entry->cache); free(entry); } static char *compress_buff; long compress_buff_len; static long arc_compress_func(char *buff, long size, void *user_val) { if(compress_buff_len <= 0) return 0; if(size > compress_buff_len) size = compress_buff_len; memcpy(buff, compress_buff, size); compress_buff += size; compress_buff_len -= size; return size; } void *arc_compress(void *buff, long bufsiz, int compress_level, long *compressed_size) { DeflateHandler compressor; long allocated, offset, space, nbytes; char *compressed; compress_buff = (char *)buff; compress_buff_len = bufsiz; compressor = open_deflate_handler(arc_compress_func, NULL, compress_level); allocated = 1024; compressed = (char *)safe_malloc(allocated); offset = 0; space = allocated; while((nbytes = zip_deflate(compressor, compressed + offset, space)) > 0) { offset += nbytes; space -= nbytes; if(space == 0) { space = allocated; allocated += space; compressed = (char *)safe_realloc(compressed, allocated); } } close_deflate_handler(compressor); if(offset == 0) { free(buff); return NULL; } *compressed_size = offset; return compressed; } void *arc_decompress(void *buff, long bufsiz, long *decompressed_size) { InflateHandler decompressor; long allocated, offset, space, nbytes; char *decompressed; compress_buff = (char *)buff; compress_buff_len = bufsiz; decompressor = open_inflate_handler(arc_compress_func, NULL); allocated = 1024; decompressed = (char *)safe_malloc(allocated); offset = 0; space = allocated; while((nbytes = zip_inflate(decompressor, decompressed + offset, space)) > 0) { offset += nbytes; space -= nbytes; if(space == 0) { space = allocated; allocated += space; decompressed = (char *)safe_realloc(decompressed, allocated); } } close_inflate_handler(decompressor); if(offset == 0) { free(buff); return NULL; } *decompressed_size = offset; return decompressed; } void free_archive_files(void) { ArchiveEntryNode *entry, *ecur; ArchiveFileList *acur; while(arc_filelist) { acur = arc_filelist; arc_filelist = arc_filelist->next; entry = acur->entry_list; while(entry) { ecur = entry; entry = entry->next; free_entry_node(ecur); } free(acur->archive_name); free(acur); } } /****************************************************************************** * url_arc *****************************************************************************/ typedef struct _URL_arc { char common[sizeof(struct _URL)]; URL instream; long pos, size; int comptype; void *decoder; } URL_arc; static long url_arc_read(URL url, void *buff, long n); static long url_arc_tell(URL url); static void url_arc_close(URL url); static long archiver_read_func(char *buff, long buff_size, void *v) { URL_arc *url; long n; url = (URL_arc *)v; if(url->size < 0) n = buff_size; else { n = url->size - url->pos; if(n > buff_size) n = buff_size; } if(n <= 0) return 0; n = url_read(url->instream, buff, n); if(n <= 0) return n; return n; } URL url_arc_open(char *name) { URL_arc *url; char *base, *p; int len; ArchiveFileList *afl; ArchiveEntryNode *entry; URL instream; if((p = strrchr(name, '#')) == NULL) return NULL; len = p - name; base = new_segment(&arc_buffer, len + 1); memcpy(base, name, len); base[len] = '\0'; base = url_expand_home_dir(base); if((afl = find_arc_filelist(base)) == NULL) afl = regist_archive(base); if(afl == NULL) return NULL; reuse_mblock(&arc_buffer); /* free `base' */ name += len + 1; while(name[0] == '/') name++; /* skip '/'s right after # */ for(entry = afl->entry_list; entry; entry = entry->next) { if(strcasecmp(entry->name, name) == 0) break; } if(entry == NULL) return NULL; if(entry->cache != NULL) instream = url_mem_open((char *)entry->cache + entry->start, entry->compsize, 0); else { if((instream = url_file_open(base)) == NULL) return NULL; url_seek(instream, entry->start, 0); } url = (URL_arc *)alloc_url(sizeof(URL_arc)); if(url == NULL) { url_errno = errno; return NULL; } /* open decoder */ switch(entry->comptype) { case ARCHIVEC_STORED: /* No compression */ case ARCHIVEC_LZHED_LH0: /* -lh0- */ case ARCHIVEC_LZHED_LZ4: /* -lz4- */ url->decoder = NULL; case ARCHIVEC_DEFLATED: /* deflate */ url->decoder = (void *)open_inflate_handler(archiver_read_func, url); if(url->decoder == NULL) { url_arc_close((URL)url); return NULL; } break; case ARCHIVEC_IMPLODED_LIT8: case ARCHIVEC_IMPLODED_LIT4: case ARCHIVEC_IMPLODED_NOLIT8: case ARCHIVEC_IMPLODED_NOLIT4: url->decoder = (void *)open_explode_handler(archiver_read_func, entry->comptype - ARCHIVEC_IMPLODED - 1, entry->compsize, entry->origsize, url); if(url->decoder == NULL) { url_arc_close((URL)url); return NULL; } break; case ARCHIVEC_LZHED_LH1: /* -lh1- */ case ARCHIVEC_LZHED_LH2: /* -lh2- */ case ARCHIVEC_LZHED_LH3: /* -lh3- */ case ARCHIVEC_LZHED_LH4: /* -lh4- */ case ARCHIVEC_LZHED_LH5: /* -lh5- */ case ARCHIVEC_LZHED_LZS: /* -lzs- */ case ARCHIVEC_LZHED_LZ5: /* -lz5- */ case ARCHIVEC_LZHED_LHD: /* -lhd- */ case ARCHIVEC_LZHED_LH6: /* -lh6- */ case ARCHIVEC_LZHED_LH7: /* -lh7- */ url->decoder = (void *)open_unlzh_handler( archiver_read_func, lzh_methods[entry->comptype - ARCHIVEC_LZHED - 1], entry->compsize, entry->origsize, url); if(url->decoder == NULL) { url_arc_close((URL)url); return NULL; } break; default: url_arc_close((URL)url); return NULL; } /* common members */ URLm(url, type) = URL_arc_t; URLm(url, url_read) = url_arc_read; URLm(url, url_gets) = NULL; URLm(url, url_fgetc) = NULL; URLm(url, url_seek) = NULL; URLm(url, url_tell) = url_arc_tell; URLm(url, url_close) = url_arc_close; /* private members */ url->instream = instream; url->pos = 0; url->size = entry->origsize; url->comptype = entry->comptype; return (URL)url; } static long url_arc_read(URL url, void *vp, long bufsiz) { URL_arc *urlp = (URL_arc *)url; long n = 0; int comptype; void *decoder; char *buff = (char *)vp; if(urlp->pos == -1) return 0; comptype = urlp->comptype; decoder = urlp->decoder; switch(comptype) { case ARCHIVEC_STORED: case ARCHIVEC_LZHED_LH0: /* -lh0- */ case ARCHIVEC_LZHED_LZ4: /* -lz4- */ n = archiver_read_func(buff, bufsiz, (void *)urlp); break; case ARCHIVEC_DEFLATED: n = zip_inflate((InflateHandler)decoder, buff, bufsiz); break; case ARCHIVEC_IMPLODED_LIT8: case ARCHIVEC_IMPLODED_LIT4: case ARCHIVEC_IMPLODED_NOLIT8: case ARCHIVEC_IMPLODED_NOLIT4: n = explode((ExplodeHandler)decoder, buff, bufsiz); break; case ARCHIVEC_LZHED_LH1: /* -lh1- */ case ARCHIVEC_LZHED_LH2: /* -lh2- */ case ARCHIVEC_LZHED_LH3: /* -lh3- */ case ARCHIVEC_LZHED_LH4: /* -lh4- */ case ARCHIVEC_LZHED_LH5: /* -lh5- */ case ARCHIVEC_LZHED_LZS: /* -lzs- */ case ARCHIVEC_LZHED_LZ5: /* -lz5- */ case ARCHIVEC_LZHED_LHD: /* -lhd- */ case ARCHIVEC_LZHED_LH6: /* -lh6- */ case ARCHIVEC_LZHED_LH7: /* -lh7- */ n = unlzh((UNLZHHandler)decoder, buff, bufsiz); break; case ARCHIVEC_UU: /* uu encoded */ case ARCHIVEC_B64: /* base64 encoded */ case ARCHIVEC_QS: /* quoted string encoded */ case ARCHIVEC_HQX: /* HQX encoded */ n = url_read((URL)decoder, buff, bufsiz); break; } if(n > 0) urlp->pos += n; return n; } static long url_arc_tell(URL url) { return ((URL_arc *)url)->pos; } static void url_arc_close(URL url) { URL_arc *urlp = (URL_arc *)url; void *decoder; int save_errno = errno; /* 1. close decoder * 2. close decode_stream * 3. free url */ decoder = urlp->decoder; if(decoder != NULL) { switch(urlp->comptype) { case ARCHIVEC_DEFLATED: close_inflate_handler((InflateHandler)decoder); break; case ARCHIVEC_IMPLODED_LIT8: case ARCHIVEC_IMPLODED_LIT4: case ARCHIVEC_IMPLODED_NOLIT8: case ARCHIVEC_IMPLODED_NOLIT4: close_explode_handler((ExplodeHandler)decoder); break; case ARCHIVEC_LZHED_LH1: /* -lh1- */ case ARCHIVEC_LZHED_LH2: /* -lh2- */ case ARCHIVEC_LZHED_LH3: /* -lh3- */ case ARCHIVEC_LZHED_LH4: /* -lh4- */ case ARCHIVEC_LZHED_LH5: /* -lh5- */ case ARCHIVEC_LZHED_LZS: /* -lzs- */ case ARCHIVEC_LZHED_LZ5: /* -lz5- */ case ARCHIVEC_LZHED_LHD: /* -lhd- */ case ARCHIVEC_LZHED_LH6: /* -lh6- */ case ARCHIVEC_LZHED_LH7: /* -lh7- */ close_unlzh_handler((UNLZHHandler)decoder); break; case ARCHIVEC_UU: /* uu encoded */ case ARCHIVEC_B64: /* base64 encoded */ case ARCHIVEC_QS: /* quoted string encoded */ case ARCHIVEC_HQX: /* HQX encoded */ url_close((URL)decoder); break; } } if(urlp->instream != NULL) url_close(urlp->instream); free(urlp); errno = save_errno; } /************** wildmat ***************/ /* What character marks an inverted character class? */ #define NEGATE_CLASS '!' /* Is "*" a common pattern? */ #define OPTIMIZE_JUST_STAR /* Do tar(1) matching rules, which ignore a trailing slash? */ #undef MATCH_TAR_PATTERN /* Define if case is ignored */ #define MATCH_CASE_IGNORE #include #define TEXT_CASE_CHAR(c) (toupper(c)) #define CHAR_CASE_COMP(a, b) (TEXT_CASE_CHAR(a) == TEXT_CASE_CHAR(b)) static char *ParseHex(char *p, int *val) { int i, v; *val = 0; for(i = 0; i < 2; i++) { v = *p++; if('0' <= v && v <= '9') v = v - '0'; else if('A' <= v && v <= 'F') v = v - 'A' + 10; else if('a' <= v && v <= 'f') v = v - 'a' + 10; else return NULL; *val = (*val << 4 | v); } return p; } /* * Match text and p, return TRUE, FALSE, or ABORT. */ static int DoMatch(char *text, char *p) { register int last; register int matched; register int reverse; for ( ; *p; text++, p++) { if (*text == '\0' && *p != '*') return ABORT; switch (*p) { case '\\': p++; if(*p == 'x') { int c; if((p = ParseHex(++p, &c)) == NULL) return ABORT; if(*text != c) return FALSE; continue; } /* Literal match with following character. */ /* FALLTHROUGH */ default: if (*text != *p) return FALSE; continue; case '?': /* Match anything. */ continue; case '*': while (*++p == '*') /* Consecutive stars act just like one. */ continue; if (*p == '\0') /* Trailing star matches everything. */ return TRUE; while (*text) if ((matched = DoMatch(text++, p)) != FALSE) return matched; return ABORT; case '[': reverse = p[1] == NEGATE_CLASS ? TRUE : FALSE; if (reverse) /* Inverted character class. */ p++; matched = FALSE; if (p[1] == ']' || p[1] == '-') if (*++p == *text) matched = TRUE; for (last = *p; *++p && *p != ']'; last = *p) /* This next line requires a good C compiler. */ if (*p == '-' && p[1] != ']' ? *text <= *++p && *text >= last : *text == *p) matched = TRUE; if (matched == reverse) return FALSE; continue; } } #ifdef MATCH_TAR_PATTERN if (*text == '/') return TRUE; #endif /* MATCH_TAR_ATTERN */ return *text == '\0'; } static int DoCaseMatch(char *text, char *p) { register int last; register int matched; register int reverse; for(; *p; text++, p++) { if(*text == '\0' && *p != '*') return ABORT; switch (*p) { case '\\': p++; if(*p == 'x') { int c; if((p = ParseHex(++p, &c)) == NULL) return ABORT; if(!CHAR_CASE_COMP(*text, c)) return FALSE; continue; } /* Literal match with following character. */ /* FALLTHROUGH */ default: if(!CHAR_CASE_COMP(*text, *p)) return FALSE; continue; case '?': /* Match anything. */ continue; case '*': while(*++p == '*') /* Consecutive stars act just like one. */ continue; if(*p == '\0') /* Trailing star matches everything. */ return TRUE; while(*text) if((matched = DoCaseMatch(text++, p)) != FALSE) return matched; return ABORT; case '[': reverse = p[1] == NEGATE_CLASS ? TRUE : FALSE; if(reverse) /* Inverted character class. */ p++; matched = FALSE; if(p[1] == ']' || p[1] == '-') { if(*++p == *text) matched = TRUE; } for(last = TEXT_CASE_CHAR(*p); *++p && *p != ']'; last = TEXT_CASE_CHAR(*p)) { /* This next line requires a good C compiler. */ if(*p == '-' && p[1] != ']') { p++; if(TEXT_CASE_CHAR(*text) <= TEXT_CASE_CHAR(*p) && TEXT_CASE_CHAR(*text) >= last) matched = TRUE; } else { if(CHAR_CASE_COMP(*text, *p)) matched = TRUE; } } if(matched == reverse) return FALSE; continue; } } #ifdef MATCH_TAR_PATTERN if (*text == '/') return TRUE; #endif /* MATCH_TAR_ATTERN */ return *text == '\0'; } /* ** User-level routine. Returns TRUE or FALSE. */ int arc_wildmat(char *text, char *p) { #ifdef OPTIMIZE_JUST_STAR if (p[0] == '*' && p[1] == '\0') return TRUE; #endif /* OPTIMIZE_JUST_STAR */ return DoMatch(text, p) == TRUE; } int arc_case_wildmat(char *text, char *p) { #ifdef OPTIMIZE_JUST_STAR if (p[0] == '*' && p[1] == '\0') return TRUE; #endif /* OPTIMIZE_JUST_STAR */ return DoCaseMatch(text, p) == TRUE; } TiMidity++-2.13.2/libarc/arc.h0100644004711200001440000001120407421005037015043 0ustar tamukiusers/* TiMidity++ -- MIDI to WAVE converter and player Copyright (C) 1999-2002 Masanao Izumo Copyright (C) 1995 Tuukka Toivonen 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef ___LIBARC_H_ #define ___LIBARC_H_ /* Archive library */ #include "url.h" #include "mblock.h" #define ARC_LIB_VERSION "2.0.1" #define ARC_DEFLATE_LEVEL 6 /* 1:Compress faster .. 9:Compress better */ #define ARC_ENTRY_HASHSIZE 63 /* * Interfaces */ extern char **expand_archive_names(int *nfiles_in_out, char **files); /* Regist all archive files in `files_in_out', and expand the archive */ extern URL url_arc_open(char *name); /* Open input stream from archive. `name' format must be "filename#entry". */ extern void free_archive_files(void); /* Call once at the last */ /* utilities */ extern int skip_gzip_header(URL url); extern int parse_gzip_header_bytes(char *gz, long maxparse, int *hdrsiz); extern int get_archive_type(char *archive_name); extern void *arc_compress(void *buff, long bufsiz, int compress_level, long *compressed_size); extern void *arc_decompress(void *buff, long bufsiz, long *decompressed_size); extern int arc_case_wildmat(char *text, char *p); extern int arc_wildmat(char *text, char *p); extern void (* arc_error_handler)(char *error_message); /* * Internal library usage only */ typedef struct _ArchiveEntryNode { struct _ArchiveEntryNode *next; /* next entry */ char *name; /* Name of this entry */ int comptype; /* Compression/Encoding type */ long compsize; /* Compressed size */ long origsize; /* Uncompressed size */ long start; /* Offset start point */ void *cache; /* Cached data */ } ArchiveEntryNode; typedef struct _ArchiveHandler { int isfile; URL url; /* Input stream */ int counter;/* counter to extract the entry*/ long pos; } ArchiveHandler; extern ArchiveHandler arc_handler; extern ArchiveEntryNode *arc_parse_entry(URL url, int archive_type); extern ArchiveEntryNode *new_entry_node(char *name, int len); extern ArchiveEntryNode *next_tar_entry(void); extern ArchiveEntryNode *next_zip_entry(void); extern ArchiveEntryNode *next_lzh_entry(void); extern ArchiveEntryNode *next_mime_entry(void); extern void free_entry_node(ArchiveEntryNode *entry); /* Compression/Encoding type */ enum { ARCHIVEC_STORED, /* No compression */ ARCHIVEC_PATHNAME, /* Pathname (Contents exists there) */ ARCHIVEC_COMPRESSED, /* Compressed */ ARCHIVEC_PACKED, /* Packed */ ARCHIVEC_DEFLATED, /* Deflate */ ARCHIVEC_SHRUNKED, /* Shrunked */ ARCHIVEC_REDUCED1, /* Reduced with compression factor 1 */ ARCHIVEC_REDUCED2, /* Reduced with compression factor 2 */ ARCHIVEC_REDUCED3, /* Reduced with compression factor 3 */ ARCHIVEC_REDUCED4, /* Reduced with compression factor 4 */ ARCHIVEC_IMPLODED, /* Implode base-tag */ ARCHIVEC_IMPLODED_LIT8, /* 8K sliding window (coded) */ ARCHIVEC_IMPLODED_LIT4, /* 4K sliding window (coded) */ ARCHIVEC_IMPLODED_NOLIT8, /* 8K sliding window (uncoded) */ ARCHIVEC_IMPLODED_NOLIT4, /* 4K sliding window (uncoded) */ ARCHIVEC_LZHED, /* LZH base-tag */ ARCHIVEC_LZHED_LH0, /* -lh0- (ARCHIVE_STORED) */ ARCHIVEC_LZHED_LH1, /* -lh1- */ ARCHIVEC_LZHED_LH2, /* -lh2- */ ARCHIVEC_LZHED_LH3, /* -lh3- */ ARCHIVEC_LZHED_LH4, /* -lh4- */ ARCHIVEC_LZHED_LH5, /* -lh5- */ ARCHIVEC_LZHED_LZS, /* -lzs- */ ARCHIVEC_LZHED_LZ5, /* -lz5- */ ARCHIVEC_LZHED_LZ4, /* -lz4- (ARCHIVE_STORED) */ ARCHIVEC_LZHED_LHD, /* -lhd- (Directory, No compression data) */ ARCHIVEC_LZHED_LH6, /* -lh6- */ ARCHIVEC_LZHED_LH7, /* -lh7- */ /* Encode for MIME */ ARCHIVEC_UU, /* uu encoded */ ARCHIVEC_B64, /* base64 encoded */ ARCHIVEC_QS, /* quoted string encoded */ ARCHIVEC_HQX /* HQX encoded */ }; /* archive_type */ enum { ARCHIVE_TAR, ARCHIVE_TGZ, ARCHIVE_ZIP, ARCHIVE_LZH, ARCHIVE_DIR, ARCHIVE_MIME, ARCHIVE_NEWSGROUP }; #endif /* ___LIBARC_H_ */ TiMidity++-2.13.2/libarc/arc_lzh.c0100644004711200001440000002660307421005037015724 0ustar tamukiusers/* TiMidity++ -- MIDI to WAVE converter and player Copyright (C) 1999-2002 Masanao Izumo Copyright (C) 1995 Tuukka Toivonen 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ #include #ifndef NO_STRING_H #include #else #include #endif #include #include "timidity.h" #include "arc.h" #define boolean int #ifndef FALSE # define FALSE 0 #endif #ifndef TRUE # define TRUE 1 #endif #define DELIM ('/') #define DELIM2 (0xff) #define LZHEADER_STRAGE 4096 #define FILENAME_LENGTH 1024 #define I_HEADER_SIZE 0 #define I_HEADER_CHECKSUM 1 #define I_METHOD 2 #define I_PACKED_SIZE 7 #define I_ORIGINAL_SIZE 11 #define I_LAST_MODIFIED_STAMP 15 #define I_ATTRIBUTE 19 #define I_HEADER_LEVEL 20 #define I_NAME_LENGTH 21 #define I_NAME 22 #define EXTEND_GENERIC 0 #define EXTEND_UNIX 'U' #define EXTEND_MSDOS 'M' #define EXTEND_MACOS 'm' #define EXTEND_OS9 '9' #define EXTEND_OS2 '2' #define EXTEND_OS68K 'K' #define EXTEND_OS386 '3' /* OS-9000??? */ #define EXTEND_HUMAN 'H' #define EXTEND_CPM 'C' #define EXTEND_FLEX 'F' #define EXTEND_RUNSER 'R' /* this OS type is not official */ #define EXTEND_TOWNSOS 'T' #define EXTEND_XOSK 'X' static char *get_ptr; #define setup_get(PTR) (get_ptr = (PTR)) #define get_byte() (*get_ptr++ & 0xff) #define skip_byte() get_ptr++ static unsigned short get_word(void) { int b0, b1; b0 = get_byte(); b1 = get_byte(); return (b1 << 8) + b0; } static long get_longword(void) { long b0, b1, b2, b3; b0 = get_byte(); b1 = get_byte(); b2 = get_byte(); b3 = get_byte(); return (b3 << 24) + (b2 << 16) + (b1 << 8) + b0; } static void msdos_to_unix_filename(char *name, int len) { int i; #ifdef MULTIBYTE_CHAR for(i = 0; i < len; i ++) { int c1, c2; c1 = (int)(unsigned char)name[i]; c2 = (int)(unsigned char)name[i+1]; if(MULTIBYTE_FIRST_P(c1) && MULTIBYTE_SECOND_P(c2)) i++; else if(c1 == '\\') name[i] = '/'; else if(isupper(c1)) name[i] = tolower(c1); } #else for(i = 0; i < len; i ++) { int c; c = (int)(unsigned char)name[i]; if(c == '\\') name[i] = '/'; else if(isupper(c)) name[i] = tolower(c); } #endif } static void generic_to_unix_filename(char *name, int len) { register int i; boolean lower_case_used = FALSE; #ifdef MULTIBYTE_CHAR for(i = 0; i < len; i ++) { int c1, c2; c1 = (int)(unsigned char)name[i]; c2 = (int)(unsigned char)name[i+1]; if(MULTIBYTE_FIRST_P(c1) && MULTIBYTE_SECOND_P(c2)) i ++; else if(islower(c1)) { lower_case_used = TRUE; break; } } for(i = 0; i < len; i ++) { int c1, c2; c1 = (int)(unsigned char)name[i]; c2 = (int)(unsigned char)name[i+1]; if(MULTIBYTE_FIRST_P(c1) && MULTIBYTE_SECOND_P(c2)) i++; else if(c1 == '\\') name[i] = '/'; else if(!lower_case_used && isupper(c1)) name[i] = tolower(c1); } #else for(i = 0; i < len; i ++) { int c; c = (int)(unsigned char)name[i]; if(islower(c)) { lower_case_used = TRUE; break; } } for(i = 0; i < len; i ++) { int c; c = (int)(unsigned char)name[i]; if(c == '\\') name[i] = '/'; else if(!lower_case_used && isupper(c)) name[i] = tolower(c); } #endif } static void macos_to_unix_filename(char *name, int len) { register int i; for(i = 0; i < len; i ++) { if(name[i] == ':') name[i] = '/'; else if(name[i] == '/') name[i] = ':'; } } #ifdef MULTIBYTE_CHAR #define iskanji(c) (c & 0x80) #endif /* MULTIBYTE_CHAR */ static unsigned char *convdelim(unsigned char *path, unsigned char delim) { unsigned char c; unsigned char *p; #ifdef MULTIBYTE_CHAR int kflg; kflg = 0; #endif for(p = path; (c = *p) != 0; p++) { #ifdef MULTIBYTE_CHAR if(kflg) { kflg = 0; } else if(iskanji(c)) { kflg = 1; } else #endif if(c == '\\' || c == DELIM || c == DELIM2) { *p = delim; path = p + 1; } } return path; } ArchiveEntryNode *next_lzh_entry(void) { ArchiveEntryNode *entry; URL url; int header_size; char data[LZHEADER_STRAGE]; char dirname[FILENAME_LENGTH]; char filename[FILENAME_LENGTH]; int dir_length, name_length; int i; char *ptr; int header_level; char method_id[5]; long compsize, origsize; int extend_type; int hdrsiz; int macbin_check; extern char *lzh_methods[]; url = arc_handler.url; macbin_check = (arc_handler.counter == 0); retry_read: dir_length = 0; name_length = 0; #if 0 if((header_size = url_getc(url)) == EOF) return NULL; if(header_size == 0) { if(macbin_check) { macbin_check = 0; url_skip(url, 128-1); if(arc_handler.isfile) arc_handler.pos += 128; goto retry_read; } return NULL; } macbin_check = 0; if(url_read(url, data + I_HEADER_CHECKSUM, header_size - 1) < header_size - 1) return NULL; #else /* a little cleverer lzh check */ if(macbin_check){ /* for(i=0;i= 6){ if(*(data + i - 4) == '-' && *(data + i - 3) == 'l' && *(data + i - 2) == 'h' && *(data + i - 0) == '-') { int j; if(arc_handler.isfile) arc_handler.pos += i - 6; for(j = 0; j<= 6; j++) *(data + j) = *(data + i - 6 + j); header_size = (int)(unsigned char)(*(data + i - 6)); if(header_size == 0) return NULL; if(url_read(url, data + 7, header_size - 7) < header_size - 7) return NULL; break; } } } if(i >= LZHEADER_STRAGE) return NULL; } else { if((header_size = url_getc(url)) == EOF) return NULL; if(url_read(url, data + I_HEADER_CHECKSUM, header_size - 1) < header_size - 1) return NULL; } macbin_check = 0; #endif hdrsiz = header_size; setup_get(data + I_HEADER_LEVEL); header_level = get_byte(); if(header_level != 2) { if(url_read(url, data + header_size, 2) < 2) return NULL; hdrsiz += 2; } setup_get(data + I_HEADER_CHECKSUM); skip_byte(); /* checksum */ memcpy(method_id, data + I_METHOD, sizeof(method_id)); setup_get(data + I_PACKED_SIZE); compsize = get_longword(); origsize = get_longword(); get_longword(); /* last_modified_stamp */ skip_byte(); /* attribute */ if((header_level = get_byte()) != 2) { name_length = get_byte(); for(i = 0; i < name_length; i ++) filename[i] =(char)get_byte(); filename[name_length] = '\0'; } if(header_size - name_length >= 24) { /* EXTEND FORMAT */ get_word(); /* crc */ extend_type = get_byte(); } else if(header_size - name_length == 22) { /* Generic with CRC */ get_word(); /* crc */ extend_type = EXTEND_GENERIC; } else if(header_size - name_length == 20) { /* Generic no CRC */ extend_type = EXTEND_GENERIC; } else return NULL; if(extend_type == EXTEND_UNIX && header_level == 0) { skip_byte(); /* minor_version */ get_longword(); /* unix_last_modified_stamp */ get_word(); /* unix_mode */ get_word(); /* unix_uid */ get_word(); /* unix_gid */ goto parse_ok; } if(header_level > 0) { /* Extend Header */ if(header_level != 2) setup_get(data + header_size); ptr = get_ptr; while((header_size = get_word()) != 0) { if(header_level != 2) { if(data + LZHEADER_STRAGE - get_ptr < header_size) return NULL; if(url_read(url, get_ptr, header_size) < header_size) return NULL; hdrsiz += header_size; } switch(get_byte()) { case 0: /* * header crc */ setup_get(get_ptr + header_size - 3); break; case 1: /* * filename */ name_length = header_size - 3; if(name_length >= sizeof(filename) - 1) return NULL; for(i = 0; i < name_length; i++) filename[i] =(char)get_byte (); filename[name_length] = '\0'; break; case 2: /* * directory */ dir_length = header_size - 3; if(dir_length >= sizeof(dirname) - 1) return NULL; for(i = 0; i < dir_length; i++) dirname[i] = (char)get_byte (); dirname[dir_length] = '\0'; convdelim((unsigned char *)dirname, DELIM); break; case 0x40: /* * MS-DOS attribute */ if(extend_type == EXTEND_MSDOS || extend_type == EXTEND_HUMAN || extend_type == EXTEND_GENERIC) get_word(); /* attribute */ break; case 0x50: /* * UNIX permission */ if(extend_type == EXTEND_UNIX) get_word(); /* unix_mode */ break; case 0x51: /* * UNIX gid and uid */ if(extend_type == EXTEND_UNIX) { get_word(); /* unix_gid */ get_word(); /* unix_uid */ } break; case 0x52: /* * UNIX group name */ setup_get(get_ptr + header_size - 3); break; case 0x53: /* * UNIX user name */ setup_get(get_ptr + header_size - 3); break; case 0x54: /* * UNIX last modified time */ if(extend_type == EXTEND_UNIX) get_longword(); /* unix_last_modified_stamp */ break; default: /* * other headers */ setup_get(get_ptr + header_size - 3); break; } } if(header_level != 2 && get_ptr - ptr != 2) { compsize -= get_ptr - ptr - 2; header_size += get_ptr - ptr - 2; } } if(dir_length) { name_length += dir_length; if(name_length >= sizeof(filename) - 1) return NULL; strcat(dirname, filename); strcpy(filename, dirname); } switch(extend_type) { case EXTEND_MSDOS: msdos_to_unix_filename(filename, name_length); case EXTEND_HUMAN: ; /* ignored */ break; #ifdef OSK case EXTEND_OS68K: case EXTEND_XOSK: #endif case EXTEND_UNIX: break; case EXTEND_MACOS: macos_to_unix_filename(filename, name_length); break; default: generic_to_unix_filename(filename, name_length); } parse_ok: if(strncmp("-lhd-", method_id, 5) == 0) { if(arc_handler.isfile) arc_handler.pos += hdrsiz; goto retry_read; /* Skip directory entry */ } for(i = 0; lzh_methods[i]; i++) if(strncmp(method_id, lzh_methods[i], sizeof(method_id)) == 0) break; if(!lzh_methods[i]) return NULL; entry = new_entry_node(filename, name_length); if(entry == NULL) return NULL; entry->comptype = i + ARCHIVEC_LZHED + 1; entry->compsize = compsize; entry->origsize = origsize; if(arc_handler.isfile) { arc_handler.pos += hdrsiz; entry->start = arc_handler.pos; entry->cache = NULL; url_skip(url, compsize); arc_handler.pos += compsize; } else { long n; entry->start = 0; entry->cache = url_dump(url, compsize, &n); if(n != compsize) { free_entry_node(entry); return NULL; } } return entry; } TiMidity++-2.13.2/libarc/arc_mime.c0100644004711200001440000003357310003327244016057 0ustar tamukiusers/* TiMidity++ -- MIDI to WAVE converter and player Copyright (C) 1999-2002 Masanao Izumo Copyright (C) 1995 Tuukka Toivonen 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ #include #include #ifndef NO_STRING_H #include #else #include #endif #include "timidity.h" #include "mblock.h" #include "zip.h" #include "arc.h" extern char *safe_strdup(const char *); #ifndef MAX_CHECK_LINES #define MAX_CHECK_LINES 1024 #endif /* MAX_CHECK_LINES */ struct StringStackElem { struct StringStackElem *next; char str[1]; /* variable length */ }; struct StringStack { struct StringStackElem *elem; MBlockList pool; }; static void init_string_stack(struct StringStack *stk); static void push_string_stack(struct StringStack *stk, char *str, int len); static char *top_string_stack(struct StringStack *stk); static void pop_string_stack(struct StringStack *stk); static void delete_string_stack(struct StringStack *stk); struct MIMEHeaderStream { URL url; char *field; char *value; char *line; int bufflen; int eof; MBlockList pool; }; static void init_mime_stream(struct MIMEHeaderStream *hdr, URL url); static int next_mime_header(struct MIMEHeaderStream *hdr); static void end_mime_stream(struct MIMEHeaderStream *hdr); static int seek_next_boundary(URL url, char *boundary, long *endpoint); static int whole_read_line(URL url, char *buff, int bufsiz); static void *arc_mime_decode(void *data, long size, int comptype, long *newsize); ArchiveEntryNode *next_mime_entry(void) { ArchiveEntryNode *head, *tail; URL url; int part; struct StringStack boundary; struct MIMEHeaderStream hdr; int c; if(arc_handler.counter != 0) return NULL; head = tail = NULL; url = arc_handler.url; /* url_seek must be safety */ init_string_stack(&boundary); url_rewind(url); c = url_getc(url); if(c != '\0') url_rewind(url); else url_skip(url, 128-1); /* skip macbin header */ part = 1; for(;;) { char *new_boundary, *encoding, *name, *filename; char *p; MBlockList pool; long data_start, data_end, savepoint; int last_check, comptype, arctype; void *part_data; long part_data_size; new_boundary = encoding = name = filename = NULL; init_mblock(&pool); init_mime_stream(&hdr, url); while(next_mime_header(&hdr)) { if(strncmp(hdr.field, "Content-", 8) != 0) continue; if(strcmp(hdr.field + 8, "Type") == 0) { if((p = strchr(hdr.value, ';')) == NULL) continue; *p++ = '\0'; while(*p == ' ') p++; if(strncasecmp(hdr.value, "multipart/mixed", 15) == 0) { /* Content-Type: multipart/mixed; boundary="XXXX" */ if(strncasecmp(p, "boundary=", 9) == 0) { p += 9; if(*p == '"') { p++; new_boundary = p; if((p = strchr(p, '"')) == NULL) continue; } else { new_boundary = p; while(*p > '"' && *p < 0x7f) p++; } *p = '\0'; new_boundary = strdup_mblock(&pool, new_boundary); } } else if(strcasecmp(hdr.value, "multipart/mixed") == 0) { /* Content-Type: XXXX/YYYY; name="ZZZZ" */ if(strncasecmp(p, "name=\"", 6) == 0) { p += 6; name = p; if((p = strchr(p, '"')) == NULL) continue; *p = '\0'; name = strdup_mblock(&pool, name); } } } else if(strcmp(hdr.field + 8, "Disposition") == 0) { if((p = strchr(hdr.value, ';')) == NULL) continue; *p++ = '\0'; while(*p == ' ') p++; if((p = strstr(p, "filename=\"")) == NULL) continue; p += 10; filename = p; if((p = strchr(p, '"')) == NULL) continue; *p = '\0'; filename = strdup_mblock(&pool, filename); } else if(strcmp(hdr.field + 8, "Transfer-Encoding") == 0) { /* Content-Transfer-Encoding: X */ /* X := X-uuencode, base64, quoted-printable, ... */ encoding = strdup_mblock(&pool, hdr.value); } } if(hdr.eof) { reuse_mblock(&pool); end_mime_stream(&hdr); delete_string_stack(&boundary); return head; } if(filename == NULL) filename = name; if(new_boundary) push_string_stack(&boundary, new_boundary, strlen(new_boundary)); data_start = url_tell(url); last_check = seek_next_boundary(url, top_string_stack(&boundary), &data_end); savepoint = url_tell(url); /* find data type */ comptype = -1; if(encoding != NULL) { if(strcmp("base64", encoding) == 0) comptype = ARCHIVEC_B64; else if(strcmp("quoted-printable", encoding) == 0) comptype = ARCHIVEC_QS; else if(strcmp("X-uuencode", encoding) == 0) { char buff[BUFSIZ]; int i; comptype = ARCHIVEC_UU; url_seek(url, data_start, SEEK_SET); url_set_readlimit(url, data_end - data_start); /* find '^begin \d\d\d \S+' */ for(i = 0; i < MAX_CHECK_LINES; i++) { if(whole_read_line(url, buff, sizeof(buff)) == -1) break; /* ?? */ if(strncmp(buff, "begin ", 6) == 0) { data_start = url_tell(url); p = strchr(buff + 6, ' '); if(p != NULL) filename = strdup_mblock(&pool, p + 1); break; } } url_set_readlimit(url, -1); } } if(comptype == -1) { char buff[BUFSIZ]; int i; url_seek(url, data_start, SEEK_SET); url_set_readlimit(url, data_end - data_start); for(i = 0; i < MAX_CHECK_LINES; i++) { if(whole_read_line(url, buff, sizeof(buff)) == -1) break; /* ?? */ if(strncmp(buff, "begin ", 6) == 0) { comptype = ARCHIVEC_UU; data_start = url_tell(url); p = strchr(buff + 6, ' '); if(p != NULL) filename = strdup_mblock(&pool, p + 1); break; } else if((strncmp(buff, "(This file", 10) == 0) || (strncmp(buff, "(Convert with", 13) == 0)) { int c; while((c = url_getc(url)) != EOF) { if(c == ':') { comptype = ARCHIVEC_HQX; data_start = url_tell(url); break; } else if(c == '\n') { if(++i >= MAX_CHECK_LINES) break; } } if(comptype != -1) break; } } url_set_readlimit(url, -1); } if(comptype == -1) comptype = ARCHIVEC_STORED; if(filename == NULL) { char buff[32]; sprintf(buff, "part%d", part); filename = strdup_mblock(&pool, buff); arctype = -1; } else { arctype = get_archive_type(filename); switch(arctype) { case ARCHIVE_TAR: case ARCHIVE_TGZ: case ARCHIVE_ZIP: case ARCHIVE_LZH: break; default: arctype = -1; break; } } if(data_start == data_end) { ArchiveEntryNode *entry; entry = new_entry_node(filename, strlen(filename)); entry->comptype = ARCHIVEC_STORED; entry->compsize = 0; entry->origsize = 0; entry->start = 0; entry->cache = safe_strdup(""); if(head == NULL) head = tail = entry; else tail = tail->next = entry; goto next_entry; } url_seek(url, data_start, SEEK_SET); part_data = url_dump(url, data_end - data_start, &part_data_size); part_data = arc_mime_decode(part_data, part_data_size, comptype, &part_data_size); if(part_data == NULL) goto next_entry; if(arctype == -1) { int gzmethod, gzhdrsiz, len, gz; ArchiveEntryNode *entry; len = strlen(filename); if(len >= 3 && strcasecmp(filename + len - 3, ".gz") == 0) { gz = 1; filename[len - 3] = '\0'; } else gz = 0; entry = new_entry_node(filename, strlen(filename)); if(gz) gzmethod = parse_gzip_header_bytes(part_data, part_data_size, &gzhdrsiz); else gzmethod = -1; if(gzmethod == ARCHIVEC_DEFLATED) { entry->comptype = ARCHIVEC_DEFLATED; entry->compsize = part_data_size - gzhdrsiz; entry->origsize = -1; entry->start = gzhdrsiz; entry->cache = part_data; } else { entry->comptype = ARCHIVEC_DEFLATED; entry->origsize = part_data_size; entry->start = 0; entry->cache = arc_compress(part_data, part_data_size, ARC_DEFLATE_LEVEL, &entry->compsize); free(part_data); if(entry->cache == NULL) { free_entry_node(entry); goto next_entry; } } if(head == NULL) head = tail = entry; else tail = tail->next = entry; } else { URL arcurl; ArchiveEntryNode *entry; ArchiveHandler orig; arcurl = url_mem_open(part_data, part_data_size, 1); orig = arc_handler; /* save */ entry = arc_parse_entry(arcurl, arctype); arc_handler = orig; /* restore */ if(head == NULL) head = tail = entry; else tail = tail->next = entry; while(tail->next) tail = tail->next; } next_entry: url_seek(url, savepoint, SEEK_SET); part++; reuse_mblock(&pool); end_mime_stream(&hdr); if(last_check) { pop_string_stack(&boundary); if(top_string_stack(&boundary) == NULL) break; } } delete_string_stack(&boundary); return head; } static void init_string_stack(struct StringStack *stk) { stk->elem = NULL; init_mblock(&stk->pool); } static void push_string_stack(struct StringStack *stk, char *str, int len) { struct StringStackElem *elem; elem = (struct StringStackElem *) new_segment(&stk->pool, sizeof(struct StringStackElem) + len + 1); memcpy(elem->str, str, len); elem->str[len] = '\0'; elem->next = stk->elem; stk->elem = elem; } static char *top_string_stack(struct StringStack *stk) { if(stk->elem == NULL) return NULL; return stk->elem->str; } static void pop_string_stack(struct StringStack *stk) { if(stk->elem == NULL) return; stk->elem = stk->elem->next; } static void delete_string_stack(struct StringStack *stk) { reuse_mblock(&stk->pool); } static void init_mime_stream(struct MIMEHeaderStream *hdr, URL url) { hdr->url = url; hdr->field = hdr->value = hdr->line = NULL; hdr->eof = 0; init_mblock(&hdr->pool); } static int whole_read_line(URL url, char *buff, int bufsiz) { int len; if(url_gets(url, buff, bufsiz) == NULL) return -1; len = strlen(buff); if(len == 0) return 0; if(buff[len - 1] == '\n') { buff[--len] = '\0'; if(len > 0 && buff[len - 1] == '\r') buff[--len] = '\0'; } else { /* skip line */ int c; do { c = url_getc(url); } while(c != EOF && c != '\n'); } return len; } static int next_mime_header(struct MIMEHeaderStream *hdr) { int len, c, n; char *p; if(hdr->eof) return 0; if(hdr->line == NULL) { hdr->line = (char *)new_segment(&hdr->pool, MIN_MBLOCK_SIZE); len = whole_read_line(hdr->url, hdr->line, MIN_MBLOCK_SIZE); if(len <= 0) { if(len == -1) hdr->eof = 1; return 0; } hdr->field = (char *)new_segment(&hdr->pool, MIN_MBLOCK_SIZE); hdr->bufflen = 0; } if((hdr->bufflen = strlen(hdr->line)) == 0) return 0; memcpy(hdr->field, hdr->line, hdr->bufflen); hdr->field[hdr->bufflen] = '\0'; for(;;) { len = whole_read_line(hdr->url, hdr->line, MIN_MBLOCK_SIZE); if(len <= 0) { if(len == -1) hdr->eof = 1; break; } c = *hdr->line; if(c == '>' || ('A' <= c && c <= 'Z') || ('a' <= c && c <= 'z')) break; if(c != ' ' && c != '\t') return 0; /* ?? */ n = MIN_MBLOCK_SIZE - 1 - hdr->bufflen; if(n > 0) { int i; if(len > n) len = n; /* s/\t/ /g; */ p = hdr->line; for(i = 0; i < len; i++) if(p[i] == '\t') p[i] = ' '; memcpy(hdr->field + hdr->bufflen, p, len); hdr->bufflen += len; hdr->field[hdr->bufflen] = '\0'; } } p = hdr->field; while(*p && *p != ':') p++; if(!*p) return 0; *p++ = '\0'; while(*p && *p == ' ') p++; hdr->value = p; return 1; } static void end_mime_stream(struct MIMEHeaderStream *hdr) { reuse_mblock(&hdr->pool); } static int seek_next_boundary(URL url, char *boundary, long *endpoint) { MBlockList pool; char *buff; int blen, ret; if(boundary == NULL) { url_seek(url, 0, SEEK_END); *endpoint = url_tell(url); return 0; } init_mblock(&pool); buff = (char *)new_segment(&pool, MIN_MBLOCK_SIZE); blen = strlen(boundary); ret = 0; for(;;) { int len; *endpoint = url_tell(url); if((len = whole_read_line(url, buff, MIN_MBLOCK_SIZE)) < 0) break; if(len < blen + 2) continue; if(buff[0] == '-' && buff[1] == '-' && strncmp(buff + 2, boundary, blen) == 0) { if(buff[blen + 2] == '-' && buff[blen + 3] == '-') ret = 1; break; } } reuse_mblock(&pool); return ret; } static void *arc_mime_decode(void *data, long size, int comptype, long *newsize) { URL url; if(comptype == ARCHIVEC_STORED) return data; if(data == NULL) return NULL; if((url = url_mem_open(data, size, 1)) == NULL) return NULL; switch(comptype) { case ARCHIVEC_UU: /* uu encoded */ url = url_uudecode_open(url, 1); break; case ARCHIVEC_B64: /* base64 encoded */ url = url_b64decode_open(url, 1); break; case ARCHIVEC_QS: /* quoted string encoded */ url = url_hqxdecode_open(url, 1, 1); break; case ARCHIVEC_HQX: /* HQX encoded */ url = url_qsdecode_open(url, 1); break; default: url_close(url); return NULL; } data = url_dump(url, -1, newsize); url_close(url); return data; } TiMidity++-2.13.2/libarc/arc_tar.c0100644004711200001440000000767607421005037015726 0ustar tamukiusers/* TiMidity++ -- MIDI to WAVE converter and player Copyright (C) 1999-2002 Masanao Izumo Copyright (C) 1995 Tuukka Toivonen 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ #include #include #include #ifndef NO_STRING_H #include #else #include #endif #include "timidity.h" #include "mblock.h" #include "zip.h" #include "arc.h" #define TARBLKSIZ 512 #define TARHDRSIZ 512 static long octal_value(char *s, int len); static int tar_checksum(char *hdr); ArchiveEntryNode *next_tar_entry(void) { char hdr[TARHDRSIZ]; long size, sizeb; ArchiveEntryNode *entry; URL url; int flen; int macbin_check; url = arc_handler.url; macbin_check = (arc_handler.counter == 0); retry_read: if(!macbin_check) { if(url_read(url, hdr, TARHDRSIZ) != TARHDRSIZ) return NULL; } else { int c = url_getc(url); if(c == 0) { url_skip(url, 127); if(arc_handler.isfile) arc_handler.pos += 128; if(url_read(url, hdr, TARHDRSIZ) != TARHDRSIZ) return NULL; } else { hdr[0] = c; if(url_read(url, hdr+1, TARHDRSIZ-1) != TARHDRSIZ-1) return NULL; } } macbin_check = 0; if(hdr[0] == '\0') return NULL; if(!tar_checksum(hdr)) return NULL; size = octal_value(hdr + 124, 12); flen = strlen(hdr); if(size == 0 && flen > 0 && hdr[flen - 1] == '/') { if(arc_handler.isfile) arc_handler.pos += TARHDRSIZ; goto retry_read; } entry = new_entry_node(hdr, flen); if(entry == NULL) return NULL; sizeb = (((size) + (TARBLKSIZ-1)) & ~(TARBLKSIZ-1)); if(arc_handler.isfile) { arc_handler.pos += TARHDRSIZ; entry->comptype = ARCHIVEC_STORED; entry->compsize = entry->origsize = size; entry->start = arc_handler.pos; url_skip(url, sizeb); arc_handler.pos += sizeb; } else { void *data; long n; data = url_dump(url, size, &n); if(size != n) { if(data != NULL) free(data); free_entry_node(entry); return NULL; } entry->cache = arc_compress(data, size, ARC_DEFLATE_LEVEL, &entry->compsize); free(data); entry->comptype = ARCHIVEC_DEFLATED; entry->origsize = size; entry->start = 0; url_skip(url, sizeb - size); } return entry; } static long octal_value(char *s, int len) { long val; while(len > 0 && !isdigit((int)(unsigned char)*s)) { s++; len--; } val = 0; while(len > 0 && isdigit((int)(unsigned char)*s)) { val = ((val<<3) | (*s - '0')); s++; len--; } return val; } static int tar_checksum(char *hdr) { int i; long recorded_sum; long unsigned_sum; /* the POSIX one :-) */ long signed_sum; /* the Sun one :-( */ recorded_sum = octal_value(hdr + 148, 8); unsigned_sum = 0; signed_sum = 0; for(i = 0; i < TARBLKSIZ; i++) { unsigned_sum += 0xFF & hdr[i]; signed_sum += hdr[i]; } /* Adjust checksum to count the "chksum" field as blanks. */ for(i = 0; i < 8; i++) { unsigned_sum -= 0xFF & hdr[148 + i]; signed_sum -= hdr[i]; } unsigned_sum += ' ' * 8; signed_sum += ' ' * 8; return unsigned_sum == recorded_sum || signed_sum == recorded_sum; } TiMidity++-2.13.2/libarc/arc_zip.c0100644004711200001440000001243507421005037015727 0ustar tamukiusers/* TiMidity++ -- MIDI to WAVE converter and player Copyright (C) 1999-2002 Masanao Izumo Copyright (C) 1995 Tuukka Toivonen 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ #include #include #include "timidity.h" #include "arc.h" #define LOCSIG 0x04034b50 #define EXTLOCSIG 0x08074b50L static unsigned short get_short(char *s) { unsigned char *p = (unsigned char *)s; return ((unsigned short)p[0] | (unsigned short)p[1]<<8); } static unsigned long get_long(char *s) { unsigned char *p = (unsigned char *)s; return ((unsigned long)p[0] | (unsigned long)p[1]<<8 | (unsigned long)p[2]<<16 | (unsigned long)p[3]<<24); } ArchiveEntryNode *next_zip_entry(void) { unsigned long magic; unsigned short flen, elen, hdrsiz; URL url; long compsize, origsize; char buff[BUFSIZ]; ArchiveEntryNode *entry; int method; unsigned short flags; int macbin_check; url = arc_handler.url; macbin_check = (arc_handler.counter == 0); retry_read: if(url_read(url, buff, 4) != 4) return NULL; hdrsiz = 4; magic = get_long(buff); if(magic == EXTLOCSIG) { /* ignored */ if(url_read(url, buff, 20) != 20) return NULL; magic = get_long(buff + 16); hdrsiz += 20; } else if(macbin_check && buff[0] == '0') { macbin_check = 0; url_skip(url, 128-4); if(arc_handler.isfile) arc_handler.pos += 128; goto retry_read; } if(magic != LOCSIG) return NULL; /* Version needed to extract */ url_skip(url, 2); hdrsiz += 2; /* General purpose bit flag */ if(url_read(url, buff, 2) != 2) return NULL; flags = get_short(buff); hdrsiz += 2; /* Compression method */ if(url_read(url, buff, 2) != 2) return NULL; method = get_short(buff); hdrsiz += 2; switch(method) { case 0: /* The file is stored (no compression) */ method = ARCHIVEC_STORED; break; case 1: /* The file is Shrunk */ method = ARCHIVEC_SHRUNKED; break; case 2: /* The file is Reduced with compression factor 1 */ method = ARCHIVEC_REDUCED1; break; case 3: /* The file is Reduced with compression factor 2 */ method = ARCHIVEC_REDUCED2; break; case 4: /* The file is Reduced with compression factor 3 */ method = ARCHIVEC_REDUCED3; break; case 5: /* The file is Reduced with compression factor 4 */ method = ARCHIVEC_REDUCED4; break; case 6: /* The file is Imploded */ if(flags & 4) { if(flags & 2) method = ARCHIVEC_IMPLODED_LIT8; else method = ARCHIVEC_IMPLODED_LIT4; } else if(flags & 2) method = ARCHIVEC_IMPLODED_NOLIT8; else method = ARCHIVEC_IMPLODED_NOLIT4; break; case 7: /* Reserved for Tokenizing compression algorithm */ method = -1; break; case 8: /* The file is Deflated */ method = ARCHIVEC_DEFLATED; break; default: return NULL; } /* Last mod file time */ url_skip(url, 2); hdrsiz += 2; /* Last mod file date */ url_skip(url, 2); hdrsiz += 2; /* CRC-32 */ url_skip(url, 4); hdrsiz += 4; /* Compressed size */ if(url_read(url, buff, 4) != 4) return NULL; hdrsiz += 4; compsize = (long)get_long(buff); /* Uncompressed size */ if(url_read(url, buff, 4) != 4) return NULL; hdrsiz += 4; origsize = (long)get_long(buff); /* Filename length */ if(url_read(url, buff, 2) != 2) return NULL; hdrsiz += 2; flen = get_short(buff); if(flen >= sizeof(buff)-1) return NULL; /* Extra field length */ if(url_read(url, buff, 2) != 2) return NULL; hdrsiz += 2; elen = get_short(buff); /* filename */ if(url_read(url, buff, flen) != flen) return NULL; hdrsiz += flen; buff[flen] = '\0'; if(compsize == 0 && flen > 0 && (buff[flen - 1] == '/' || buff[flen - 1] == '\\')) { url_skip(url, elen); hdrsiz += elen; if(arc_handler.isfile) arc_handler.pos += hdrsiz; goto retry_read; } entry = new_entry_node(buff, flen); if(entry == NULL) return NULL; entry->comptype = method; entry->origsize = origsize; entry->compsize = compsize; /* Extra field */ url_skip(url, elen); hdrsiz += elen; if(arc_handler.isfile) { arc_handler.pos += hdrsiz; entry->start = arc_handler.pos; entry->cache = NULL; url_skip(url, compsize); arc_handler.pos += compsize; } else { long n; entry->start = 0; entry->cache = url_dump(url, compsize, &n); if(n != compsize) { free_entry_node(entry); return NULL; } } return entry; } TiMidity++-2.13.2/libarc/deflate.c0100644004711200001440000020336507515653724015730 0ustar tamukiusers/* TiMidity++ -- MIDI to WAVE converter and player Copyright (C) 1999-2002 Masanao Izumo Copyright (C) 1995 Tuukka Toivonen 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ /* deflate.c -- compress data using the deflation algorithm * Copyright (C) 1992-1993 Jean-loup Gailly * This is free software; you can redistribute it and/or modify it under the * terms of the GNU General Public License, see the file COPYING. */ /* * PURPOSE * * Identify new text as repetitions of old text within a fixed- * length sliding window trailing behind the new text. * * DISCUSSION * * The "deflation" process depends on being able to identify portions * of the input text which are identical to earlier input (within a * sliding window trailing behind the input currently being processed). * * The most straightforward technique turns out to be the fastest for * most input files: try all possible matches and select the longest. * The key feature of this algorithm is that insertions into the string * dictionary are very simple and thus fast, and deletions are avoided * completely. Insertions are performed at each input character, whereas * string matches are performed only when the previous match ends. So it * is preferable to spend more time in matches to allow very fast string * insertions and avoid deletions. The matching algorithm for small * strings is inspired from that of Rabin & Karp. A brute force approach * is used to find longer strings when a small match has been found. * A similar algorithm is used in comic (by Jan-Mark Wams) and freeze * (by Leonid Broukhis). * A previous version of this file used a more sophisticated algorithm * (by Fiala and Greene) which is guaranteed to run in linear amortized * time, but has a larger average cost, uses more memory and is patented. * However the F&G algorithm may be faster for some highly redundant * files if the parameter max_chain_length (described below) is too large. * * ACKNOWLEDGEMENTS * * The idea of lazy evaluation of matches is due to Jan-Mark Wams, and * I found it in 'freeze' written by Leonid Broukhis. * Thanks to many info-zippers for bug reports and testing. * * REFERENCES * * APPNOTE.TXT documentation file in PKZIP 1.93a distribution. * * A description of the Rabin and Karp algorithm is given in the book * "Algorithms" by R. Sedgewick, Addison-Wesley, p252. * * Fiala,E.R., and Greene,D.H. * Data Compression with Finite Windows, Comm.ACM, 32,4 (1989) 490-595 * * INTERFACE * * void lm_init (void) * Initialize the "longest match" routines for a new file * * ulg deflate (void) * Processes a new input file and return its compressed length. Sets * the compressed length, crc, deflate flags and internal file * attributes. */ #include #include #ifndef NO_STRING_H #include #else #include #endif #include #define FULL_SEARCH /* #define UNALIGNED_OK */ /* #define DEBUG */ #include "timidity.h" #include "common.h" #include "mblock.h" #include "zip.h" #define local static #define MIN_MATCH 3 #define MAX_MATCH 258 /* The minimum and maximum match lengths */ #define BITS 16 /* Compile with MEDIUM_MEM to reduce the memory requirements or * with SMALL_MEM to use as little memory as possible. Use BIG_MEM if the * entire input file can be held in memory (not possible on 16 bit systems). * Warning: defining these symbols affects HASH_BITS (see below) and thus * affects the compression ratio. The compressed output * is still correct, and might even be smaller in some cases. */ #ifdef SMALL_MEM # define LIT_BUFSIZE 0x2000 # define HASH_BITS 13 /* Number of bits used to hash strings */ #else #ifdef MEDIUM_MEM # define LIT_BUFSIZE 0x4000 # define HASH_BITS 14 #else # define LIT_BUFSIZE 0x8000 # define HASH_BITS 15 /* For portability to 16 bit machines, do not use values above 15. */ #endif #endif #if LIT_BUFSIZE > INBUFSIZ error cannot overlay l_buf and inbuf #endif #if (WSIZE<<1) > (1< BITS-1 error: cannot overlay head with tab_prefix1 #endif #define DIST_BUFSIZE LIT_BUFSIZE #define HASH_SIZE (unsigned)(1<= HASH_BITS */ /* Data structure describing a single value and its code string. */ typedef struct ct_data { union { ush freq; /* frequency count */ ush code; /* bit string */ } fc; union { ush dad; /* father node in Huffman tree */ ush len; /* length of bit string */ } dl; } ct_data; #define Freq fc.freq #define Code fc.code #define Dad dl.dad #define Len dl.len typedef struct tree_desc { ct_data near *dyn_tree; /* the dynamic tree */ ct_data near *static_tree; /* corresponding static tree or NULL */ int near *extra_bits; /* extra bits for each code or NULL */ int extra_base; /* base index for extra_bits */ int elems; /* max number of elements in the tree */ int max_length; /* max bit length for the codes */ int max_code; /* largest code with non zero frequency */ } tree_desc; local int near extra_lbits[LENGTH_CODES] /* extra bits for each length code */ = {0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0}; local int near extra_dbits[D_CODES] /* extra bits for each distance code */ = {0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13}; local int near extra_blbits[BL_CODES]/* extra bits for each bit length code */ = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7}; local uch near bl_order[BL_CODES] = {16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15}; /* The lengths of the bit length codes are sent in order of decreasing * probability, to avoid transmitting the lengths for unused bit length codes. */ /* Values for max_lazy_match, good_match and max_chain_length, depending on * the desired pack level (0..9). The values given below have been tuned to * exclude worst case performance for pathological files. Better values may be * found for specific files. */ local struct { ush good_length; /* reduce lazy search above this match length */ ush max_lazy; /* do not perform lazy search above this match length */ ush nice_length; /* quit search above this match length */ ush max_chain; } configuration_table[10] = { /* good lazy nice chain */ /* 0 */ {0, 0, 0, 0}, /* store only */ /* 1 */ {4, 4, 8, 4}, /* maximum speed, no lazy matches */ /* 2 */ {4, 5, 16, 8}, /* 3 */ {4, 6, 32, 32}, /* 4 */ {4, 4, 16, 16}, /* lazy matches */ /* 5 */ {8, 16, 32, 32}, /* 6 */ {8, 16, 128, 128}, /* 7 */ {8, 32, 128, 256}, /* 8 */ {32, 128, 258, 1024}, /* 9 */ {32, 258, 258, 4096}}; /* maximum compression */ struct deflate_buff_queue { struct deflate_buff_queue *next; unsigned len; uch *ptr; }; local struct deflate_buff_queue *free_queue = NULL; local void reuse_queue(struct deflate_buff_queue *p) { p->next = free_queue; free_queue = p; } local struct deflate_buff_queue *new_queue(void) { struct deflate_buff_queue *p; if(free_queue) { p = free_queue; free_queue = free_queue->next; } else p = (struct deflate_buff_queue *) safe_malloc(sizeof(struct deflate_buff_queue) + OUTBUFSIZ); p->next = NULL; p->len = 0; p->ptr = (uch *)p + sizeof(struct deflate_buff_queue); return p; } struct _DeflateHandler { void *user_val; long (* read_func)(char *buf, long size, void *user_val); int initflag; struct deflate_buff_queue *qhead; struct deflate_buff_queue *qtail; uch outbuf[OUTBUFSIZ]; unsigned outcnt, outoff; int complete; #define window_size ((ulg)2*WSIZE) uch window[window_size]; ush d_buf[DIST_BUFSIZE]; /* buffer for distances */ uch l_buf[INBUFSIZ + INBUF_EXTRA]; /* buffer for literals or lengths */ ush prev[1L<= 4. */ int compr_level; /* compression level (1..9) */ unsigned near good_match; /* Use a faster search when the previous match is longer than this */ #ifndef FULL_SEARCH int near nice_match; /* Stop searching when current match exceeds this */ #endif ct_data near dyn_ltree[HEAP_SIZE]; /* literal and length tree */ ct_data near dyn_dtree[2*D_CODES+1]; /* distance tree */ ct_data near static_ltree[L_CODES+2]; /* The static literal tree. Since the bit lengths are imposed, there is no * need for the L_CODES extra codes used during heap construction. However * The codes 286 and 287 are needed to build a canonical tree (see ct_init * below). */ ct_data near static_dtree[D_CODES]; /* The static distance tree. (Actually a trivial tree since all codes use * 5 bits.) */ ct_data near bl_tree[2*BL_CODES+1];/* Huffman tree for the bit lengths */ tree_desc near l_desc; tree_desc near d_desc; tree_desc near bl_desc; ush near bl_count[MAX_BITS+1]; /* number of codes at each bit length for an optimal tree */ int near heap[2*L_CODES+1]; /* heap used to build the Huffman trees */ int heap_len; /* number of elements in the heap */ int heap_max; /* element of largest frequency */ /* The sons of heap[n] are heap[2*n] and heap[2*n+1]. heap[0] is not used. * The same heap array is used to build all trees. */ uch near depth[2*L_CODES+1]; /* Depth of each subtree used as tie breaker for trees of equal frequency */ uch length_code[MAX_MATCH-MIN_MATCH+1]; /* length code for each normalized match length (0 == MIN_MATCH) */ uch dist_code[512]; /* distance codes. The first 256 values correspond to the distances * 3 .. 258, the last 256 values correspond to the top 8 bits of * the 15 bit distances. */ int near base_length[LENGTH_CODES]; /* First normalized length for each code (0 = MIN_MATCH) */ int near base_dist[D_CODES]; /* First normalized distance for each code (0 = distance of 1) */ uch near flag_buf[(LIT_BUFSIZE/8)]; /* flag_buf is a bit array distinguishing literals from lengths in * l_buf, thus indicating the presence or absence of a distance. */ unsigned last_lit; /* running index in l_buf */ unsigned last_dist; /* running index in d_buf */ unsigned last_flags;/* running index in flag_buf */ uch flags; /* current flags not yet saved in flag_buf */ uch flag_bit; /* current bit used in flags */ ulg opt_len; /* bit length of current block with optimal trees */ ulg static_len; /* bit length of current block with static trees */ }; local void lm_init(DeflateHandler); local int longest_match(DeflateHandler,unsigned cur_match); local void fill_window(DeflateHandler); local void deflate_fast(DeflateHandler); local void deflate_better(DeflateHandler); local long qcopy(DeflateHandler encoder, char *buff, long buff_size); local void ct_init(DeflateHandler); local void init_block(DeflateHandler); local void pqdownheap(DeflateHandler,ct_data near *, int); local void gen_bitlen(DeflateHandler,tree_desc near *); local void gen_codes(DeflateHandler,ct_data near *, int); local void build_tree(DeflateHandler,tree_desc near *); local void scan_tree(DeflateHandler,ct_data near *, int); local void send_tree(DeflateHandler,ct_data near *, int); local int build_bl_tree(DeflateHandler); local void send_all_trees(DeflateHandler,int,int,int); local void flush_block(DeflateHandler,int); local int ct_tally(DeflateHandler,int,int); local void compress_block(DeflateHandler,ct_data near *, ct_data near *); local void send_bits(DeflateHandler,int,int); local unsigned bi_reverse(unsigned, int); local void bi_windup(DeflateHandler); local void qoutbuf(DeflateHandler); #ifdef DEBUG local void error(char *m) { fprintf(stderr, "%s\n", m); exit(1); } #define Assert(cond,msg) {if(!(cond)) error(msg);} local int verbose = 0; /* verbose */ local void check_match (DeflateHandler,unsigned, unsigned, int); #else #define Assert(cond,msg) #endif #ifndef MAX #define MAX(a,b) (a >= b ? a : b) #endif /* MAX */ #define head(i) ((encoder->prev+WSIZE)[i]) /* put_byte is used for the compressed output, put_ubyte for the * uncompressed output. However unlzw() uses window for its * suffix table instead of its output buffer, so it does not use put_ubyte * (to be cleaned up). */ #define put_byte(c) {encoder->outbuf[encoder->outoff + encoder->outcnt++] = \ (uch)(c); if(encoder->outoff + encoder->outcnt == OUTBUFSIZ) \ qoutbuf(encoder);} /* Output a 16 bit value, lsb first */ #define put_short(w) \ { if(encoder->outoff + encoder->outcnt < OUTBUFSIZ - 2) { \ encoder->outbuf[encoder->outoff+encoder->outcnt++] = (uch) ((w) & 0xff); \ encoder->outbuf[encoder->outoff+encoder->outcnt++] = (uch) ((ush)(w) >> 8); \ } else { put_byte((uch)((w) & 0xff)); put_byte((uch)((ush)(w) >> 8)); }} /* =========================================================================== * Update a hash value with the given input byte * IN assertion: all calls to to UPDATE_HASH are made with consecutive * input characters, so that a running hash key can be computed from the * previous key instead of complete recalculation each time. */ #define UPDATE_HASH(h,c) (h = (((h)<ins_h, encoder->window[(s) + MIN_MATCH-1]), \ encoder->prev[(s) & WMASK] =match_head = head(encoder->ins_h), \ head(encoder->ins_h) = (s)) #define SEND_CODE(c, tree) send_bits(encoder, (tree)[c].Code, (tree)[c].Len) /* Send a code of the given tree. c and tree must not have side effects */ #define D_CODE(dist) ((dist)<256 ? encoder->dist_code[dist] : encoder->dist_code[256+((dist)>>7)]) /* Mapping from a distance to a distance code. dist is the distance - 1 and * must not have side effects. dist_code[256] and dist_code[257] are never * used. */ /* =========================================================================== * Compares to subtrees, using the tree depth as tie breaker when * the subtrees have equal frequency. This minimizes the worst case length. */ #define SMALLER(tree, n, m) \ ((tree)[n].Freq < (tree)[m].Freq || \ ((tree)[n].Freq == (tree)[m].Freq && encoder->depth[n] <= encoder->depth[m])) /* =========================================================================== * Initialize the "longest match" routines for a new file */ local void lm_init(DeflateHandler encoder) { register unsigned j; /* Initialize the hash table. */ #if defined(MAXSEG_64K) && HASH_BITS == 15 for(j = 0; j < HASH_SIZE; j++) head(j) = NIL; #else memset((char*)&head(0), 0, HASH_SIZE*sizeof(head(0))); #endif /* prev will be initialized on the fly */ /* Set the default configuration parameters: */ encoder->max_lazy_match = configuration_table[encoder->compr_level].max_lazy; encoder->good_match = configuration_table[encoder->compr_level].good_length; #ifndef FULL_SEARCH encoder->nice_match = configuration_table[encoder->compr_level].nice_length; #endif encoder->max_chain_length = configuration_table[encoder->compr_level].max_chain; encoder->strstart = 0; encoder->block_start = 0L; encoder->lookahead = encoder->read_func((char*)encoder->window, (long)(sizeof(int)<=2 ? (unsigned)WSIZE : 2*WSIZE), encoder->user_val); if(encoder->lookahead == 0 || encoder->lookahead == (unsigned)EOF) { encoder->eofile = 1; encoder->lookahead = 0; return; } encoder->eofile = 0; /* Make sure that we always have enough lookahead. This is important * if input comes from a device such as a tty. */ while(encoder->lookahead < MIN_LOOKAHEAD && !encoder->eofile) fill_window(encoder); encoder->ins_h = 0; for(j=0; jins_h, encoder->window[j]); /* If lookahead < MIN_MATCH, ins_h is garbage, but this is * not important since only literal bytes will be emitted. */ } /* =========================================================================== * Set match_start to the longest match starting at the given string and * return its length. Matches shorter or equal to prev_length are discarded, * in which case the result is equal to prev_length and match_start is * garbage. * IN assertions: cur_match is the head of the hash chain for the current * string (strstart) and its distance is <= MAX_DIST, and prev_length >= 1 */ local int longest_match(DeflateHandler encoder, unsigned cur_match) { unsigned chain_length = encoder->max_chain_length; /* max hash chain length */ register uch *scan = encoder->window + encoder->strstart; /* current string */ register uch *match; /* matched string */ register int len; /* length of current match */ int best_len = encoder->prev_length; /* best match length so far */ unsigned limit = (encoder->strstart > (unsigned)MAX_DIST ? encoder->strstart - (unsigned)MAX_DIST : NIL); /* Stop when cur_match becomes <= limit. To simplify the code, * we prevent matches with the string of window index 0. */ #if HASH_BITS < 8 || MAX_MATCH != 258 error: Code too clever #endif #ifdef UNALIGNED_OK /* Compare two bytes at a time. Note: this is not always beneficial. * Try with and without -DUNALIGNED_OK to check. */ register uch *strend = encoder->window + encoder->strstart + MAX_MATCH - 1; register ush scan_start = *(ush*)scan; register ush scan_end = *(ush*)(scan+best_len-1); #else register uch *strend = encoder->window + encoder->strstart + MAX_MATCH; register uch scan_end1 = scan[best_len-1]; register uch scan_end = scan[best_len]; #endif /* Do not waste too much time if we already have a good match: */ if(encoder->prev_length >= encoder->good_match) { chain_length >>= 2; } Assert(encoder->strstart <= window_size-MIN_LOOKAHEAD, "insufficient lookahead"); do { Assert(cur_match < encoder->strstart, "no future"); match = encoder->window + cur_match; /* Skip to next match if the match length cannot increase * or if the match length is less than 2: */ #if (defined(UNALIGNED_OK) && MAX_MATCH == 258) /* This code assumes sizeof(unsigned short) == 2. Do not use * UNALIGNED_OK if your compiler uses a different size. */ if(*(ush*)(match+best_len-1) != scan_end || *(ush*)match != scan_start) continue; /* It is not necessary to compare scan[2] and match[2] since they are * always equal when the other bytes match, given that the hash keys * are equal and that HASH_BITS >= 8. Compare 2 bytes at a time at * strstart+3, +5, ... up to strstart+257. We check for insufficient * lookahead only every 4th comparison; the 128th check will be made * at strstart+257. If MAX_MATCH-2 is not a multiple of 8, it is * necessary to put more guard bytes at the end of the window, or * to check more often for insufficient lookahead. */ scan++, match++; do { } while(*(ush*)(scan+=2) == *(ush*)(match+=2) && *(ush*)(scan+=2) == *(ush*)(match+=2) && *(ush*)(scan+=2) == *(ush*)(match+=2) && *(ush*)(scan+=2) == *(ush*)(match+=2) && scan < strend); /* The funny "do {}" generates better code on most compilers */ /* Here, scan <= window+strstart+257 */ Assert(scan <= encoder->window+(unsigned)(window_size-1), "wild scan"); if(*scan == *match) scan++; len = (MAX_MATCH - 1) - (int)(strend-scan); scan = strend - (MAX_MATCH-1); #else /* UNALIGNED_OK */ if(match[best_len] != scan_end || match[best_len-1] != scan_end1 || *match != *scan || *++match != scan[1]) continue; /* The check at best_len-1 can be removed because it will be made * again later. (This heuristic is not always a win.) * It is not necessary to compare scan[2] and match[2] since they * are always equal when the other bytes match, given that * the hash keys are equal and that HASH_BITS >= 8. */ scan += 2, match++; /* We check for insufficient lookahead only every 8th comparison; * the 256th check will be made at strstart+258. */ do { } while(*++scan == *++match && *++scan == *++match && *++scan == *++match && *++scan == *++match && *++scan == *++match && *++scan == *++match && *++scan == *++match && *++scan == *++match && scan < strend); len = MAX_MATCH - (int)(strend - scan); scan = strend - MAX_MATCH; #endif /* UNALIGNED_OK */ if(len > best_len) { encoder->match_start = cur_match; best_len = len; #ifdef FULL_SEARCH if(len >= MAX_MATCH) break; #else if(len >= encoder->nice_match) break; #endif /* FULL_SEARCH */ #ifdef UNALIGNED_OK scan_end = *(ush*)(scan+best_len-1); #else scan_end1 = scan[best_len-1]; scan_end = scan[best_len]; #endif } } while((cur_match = encoder->prev[cur_match & WMASK]) > limit && --chain_length != 0); return best_len; } #ifdef DEBUG /* =========================================================================== * Check that the match at match_start is indeed a match. */ local void check_match(DeflateHandler encoder, unsigned start, unsigned match, int length) { /* check that the match is indeed a match */ if(memcmp((char*)encoder->window + match, (char*)encoder->window + start, length) != EQUAL) { fprintf(stderr, " start %d, match %d, length %d\n", start, match, length); error("invalid match"); } if(verbose > 1) { fprintf(stderr,"\\[%d,%d]", start-match, length); do { putc(encoder->window[start++], stderr); } while(--length != 0); } } #else # define check_match(encoder, start, match, length) #endif /* =========================================================================== * Fill the window when the lookahead becomes insufficient. * Updates strstart and lookahead, and sets eofile if end of input file. * IN assertion: lookahead < MIN_LOOKAHEAD && strstart + lookahead > 0 * OUT assertions: at least one byte has been read, or eofile is set; * file reads are performed for at least two bytes (required for the * translate_eol option). */ local void fill_window(DeflateHandler encoder) { register unsigned n, m; unsigned more = (unsigned)(window_size - (ulg)encoder->lookahead - (ulg)encoder->strstart); /* Amount of free space at the end of the window. */ /* If the window is almost full and there is insufficient lookahead, * move the upper half to the lower one to make room in the upper half. */ if(more == (unsigned)EOF) { /* Very unlikely, but possible on 16 bit machine if strstart == 0 * and lookahead == 1 (input done one byte at time) */ more--; } else if(encoder->strstart >= WSIZE+MAX_DIST) { /* By the IN assertion, the window is not empty so we can't confuse * more == 0 with more == 64K on a 16 bit machine. */ Assert(window_size == (ulg)2*WSIZE, "no sliding with BIG_MEM"); memcpy((char*)encoder->window, (char*)encoder->window+WSIZE, (unsigned)WSIZE); encoder->match_start -= WSIZE; encoder->strstart -= WSIZE; /* we now have strstart >= MAX_DIST: */ encoder->block_start -= (long) WSIZE; for(n = 0; n < HASH_SIZE; n++) { m = head(n); head(n) = (ush)(m >= WSIZE ? m-WSIZE : NIL); } for(n = 0; n < WSIZE; n++) { m = encoder->prev[n]; encoder->prev[n] = (ush)(m >= WSIZE ? m-WSIZE : NIL); /* If n is not on any hash chain, prev[n] is garbage but * its value will never be used. */ } more += WSIZE; } /* At this point, more >= 2 */ if(!encoder->eofile) { n = encoder->read_func((char*)encoder->window+encoder->strstart + encoder->lookahead, (long)more, encoder->user_val); if(n == 0 || n == (unsigned)EOF) { encoder->eofile = 1; } else { encoder->lookahead += n; } } } /* =========================================================================== * Processes a new input file and return its compressed length. This * function does not perform lazy evaluationof matches and inserts * new strings in the dictionary only for unmatched strings or for short * matches. It is used only for the fast compression options. */ local void deflate_fast(DeflateHandler encoder) { /* encoder->prev_length = MIN_MATCH-1; encoder->match_length = 0; */ while(encoder->lookahead != 0 && encoder->qhead == NULL) { int flush; /* set if current block must be flushed */ /* Insert the string window[strstart .. strstart+2] in the * dictionary, and set hash_head to the head of the hash chain: */ INSERT_STRING(encoder->strstart, encoder->hash_head); /* Find the longest match, discarding those <= prev_length. * At this point we have always match_length < MIN_MATCH */ if(encoder->hash_head != NIL && encoder->strstart - encoder->hash_head <= MAX_DIST) { /* To simplify the code, we prevent matches with the string * of window index 0 (in particular we have to avoid a match * of the string with itself at the start of the input file). */ encoder->match_length = longest_match(encoder, encoder->hash_head); /* longest_match() sets match_start */ if(encoder->match_length > encoder->lookahead) encoder->match_length = encoder->lookahead; } if(encoder->match_length >= MIN_MATCH) { check_match(encoder, encoder->strstart, encoder->match_start, encoder->match_length); flush = ct_tally(encoder, encoder->strstart - encoder->match_start, encoder->match_length - MIN_MATCH); encoder->lookahead -= encoder->match_length; /* Insert new strings in the hash table only if the match length * is not too large. This saves time but degrades compression. */ if(encoder->match_length <= encoder->max_lazy_match) { encoder->match_length--; /* string at strstart already in hash table */ do { encoder->strstart++; INSERT_STRING(encoder->strstart, encoder->hash_head); /* strstart never exceeds WSIZE-MAX_MATCH, so there are * always MIN_MATCH bytes ahead. If lookahead < MIN_MATCH * these bytes are garbage, but it does not matter since * the next lookahead bytes will be emitted as literals. */ } while(--encoder->match_length != 0); encoder->strstart++; } else { encoder->strstart += encoder->match_length; encoder->match_length = 0; encoder->ins_h = encoder->window[encoder->strstart]; UPDATE_HASH(encoder->ins_h, encoder->window[encoder->strstart + 1]); #if MIN_MATCH != 3 Call UPDATE_HASH() MIN_MATCH-3 more times #endif } } else { /* No match, output a literal byte */ Tracevv((stderr,"%c",encoder->window[encoder->strstart])); flush = ct_tally (encoder, 0, encoder->window[encoder->strstart]); encoder->lookahead--; encoder->strstart++; } if(flush) { flush_block(encoder, 0); encoder->block_start = (long)encoder->strstart; } /* Make sure that we always have enough lookahead, except * at the end of the input file. We need MAX_MATCH bytes * for the next match, plus MIN_MATCH bytes to insert the * string following the next match. */ while(encoder->lookahead < MIN_LOOKAHEAD && !encoder->eofile) fill_window(encoder); } } local void deflate_better(DeflateHandler encoder) { /* Process the input block. */ while(encoder->lookahead != 0 && encoder->qhead == NULL) { /* Insert the string window[strstart .. strstart+2] in the * dictionary, and set hash_head to the head of the hash chain: */ INSERT_STRING(encoder->strstart, encoder->hash_head); /* Find the longest match, discarding those <= prev_length. */ encoder->prev_length = encoder->match_length; encoder->prev_match = encoder->match_start; encoder->match_length = MIN_MATCH-1; if(encoder->hash_head != NIL && encoder->prev_length < encoder->max_lazy_match && encoder->strstart - encoder->hash_head <= MAX_DIST) { /* To simplify the code, we prevent matches with the string * of window index 0 (in particular we have to avoid a match * of the string with itself at the start of the input file). */ encoder->match_length = longest_match(encoder, encoder->hash_head); /* longest_match() sets match_start */ if(encoder->match_length > encoder->lookahead) encoder->match_length = encoder->lookahead; /* Ignore a length 3 match if it is too distant: */ if(encoder->match_length == MIN_MATCH && encoder->strstart - encoder->match_start > TOO_FAR){ /* If prev_match is also MIN_MATCH, match_start is garbage * but we will ignore the current match anyway. */ encoder->match_length--; } } /* If there was a match at the previous step and the current * match is not better, output the previous match: */ if(encoder->prev_length >= MIN_MATCH && encoder->match_length <= encoder->prev_length) { int flush; /* set if current block must be flushed */ check_match(encoder, encoder->strstart-1, encoder->prev_match, encoder->prev_length); flush = ct_tally(encoder, encoder->strstart-1-encoder->prev_match, encoder->prev_length - MIN_MATCH); /* Insert in hash table all strings up to the end of the match. * strstart-1 and strstart are already inserted. */ encoder->lookahead -= encoder->prev_length-1; encoder->prev_length -= 2; do { encoder->strstart++; INSERT_STRING(encoder->strstart, encoder->hash_head); /* strstart never exceeds WSIZE-MAX_MATCH, so there are * always MIN_MATCH bytes ahead. If lookahead < MIN_MATCH * these bytes are garbage, but it does not matter since the * next lookahead bytes will always be emitted as literals. */ } while(--encoder->prev_length != 0); encoder->match_available = 0; encoder->match_length = MIN_MATCH-1; encoder->strstart++; if(flush) { flush_block(encoder, 0); encoder->block_start = (long)encoder->strstart; } } else if(encoder->match_available) { /* If there was no match at the previous position, output a * single literal. If there was a match but the current match * is longer, truncate the previous match to a single literal. */ Tracevv((stderr,"%c",encoder->window[encoder->strstart-1])); if(ct_tally (encoder, 0, encoder->window[encoder->strstart-1])) { flush_block(encoder, 0); encoder->block_start = (long)encoder->strstart; } encoder->strstart++; encoder->lookahead--; } else { /* There is no previous match to compare with, wait for * the next step to decide. */ encoder->match_available = 1; encoder->strstart++; encoder->lookahead--; } /* Make sure that we always have enough lookahead, except * at the end of the input file. We need MAX_MATCH bytes * for the next match, plus MIN_MATCH bytes to insert the * string following the next match. */ while(encoder->lookahead < MIN_LOOKAHEAD && !encoder->eofile) fill_window(encoder); } } /*ARGSUSED*/ static long default_read_func(char *buf, long size, void *v) { return (long)fread(buf, 1, size, stdin); } DeflateHandler open_deflate_handler( long (* read_func)(char *buf, long size, void *user_val), void *user_val, int level) { DeflateHandler encoder; if(level < 1 || level > 9) return NULL; /* error("bad compression level"); */ encoder = (DeflateHandler)safe_malloc(sizeof(struct _DeflateHandler)); if(encoder == NULL) return NULL; memset(encoder, 0, sizeof(struct _DeflateHandler)); encoder->compr_level = level; if(read_func == NULL) encoder->read_func = default_read_func; else encoder->read_func = read_func; encoder->user_val = user_val; return encoder; } void close_deflate_handler(DeflateHandler encoder) { free(encoder); } local void init_deflate(DeflateHandler encoder) { if(encoder->eofile) return; encoder->bi_buf = 0; encoder->bi_valid = 0; ct_init(encoder); lm_init(encoder); encoder->qhead = NULL; encoder->outcnt = 0; if(encoder->compr_level <= 3) { encoder->prev_length = MIN_MATCH - 1; encoder->match_length = 0; } else { encoder->match_length = MIN_MATCH - 1; encoder->match_available = 0; } encoder->complete = 0; } /* =========================================================================== * Same as above, but achieves better compression. We use a lazy * evaluation for matches: a match is finally adopted only if there is * no better match at the next window position. */ long zip_deflate(DeflateHandler encoder, char *buff, long buff_size) { long n; if(!encoder->initflag) { init_deflate(encoder); encoder->initflag = 1; if(encoder->lookahead == 0) { /* empty */ encoder->complete = 1; return 0; } } if((n = qcopy(encoder, buff, buff_size)) == buff_size) return buff_size; if(encoder->complete) return n; if(encoder->compr_level <= 3) /* optimized for speed */ deflate_fast(encoder); else deflate_better(encoder); if(encoder->lookahead == 0) { if(encoder->match_available) ct_tally(encoder, 0, encoder->window[encoder->strstart - 1]); flush_block(encoder, 1); encoder->complete = 1; } return n + qcopy(encoder, buff + n, buff_size - n); } local long qcopy(DeflateHandler encoder, char *buff, long buff_size) { struct deflate_buff_queue *q; long n, i; n = 0; q = encoder->qhead; while(q != NULL && n < buff_size) { i = buff_size - n; if(i > q->len) i = q->len; memcpy(buff + n, q->ptr, i); q->ptr += i; q->len -= i; n += i; if(q->len == 0) { struct deflate_buff_queue *p; p = q; q = q->next; reuse_queue(p); } } encoder->qhead = q; if(n == buff_size) return n; if(encoder->outoff < encoder->outcnt) { i = buff_size - n; if(i > encoder->outcnt - encoder->outoff) i = encoder->outcnt - encoder->outoff; memcpy(buff + n, encoder->outbuf + encoder->outoff, i); encoder->outoff += i; n += i; if(encoder->outcnt == encoder->outoff) encoder->outcnt = encoder->outoff = 0; } return n; } /* =========================================================================== * Allocate the match buffer, initialize the various tables and save the * location of the internal file attribute (ascii/binary) and method * (DEFLATE/STORE). */ local void ct_init(DeflateHandler encoder) { int n; /* iterates over tree elements */ int bits; /* bit counter */ int length; /* length value */ int code; /* code value */ int dist; /* distance index */ if(encoder->static_dtree[0].Len != 0) return; /* ct_init already called */ encoder->l_desc.dyn_tree = encoder->dyn_ltree; encoder->l_desc.static_tree = encoder->static_ltree; encoder->l_desc.extra_bits = extra_lbits; encoder->l_desc.extra_base = LITERALS + 1; encoder->l_desc.elems = L_CODES; encoder->l_desc.max_length = MAX_BITS; encoder->l_desc.max_code = 0; encoder->d_desc.dyn_tree = encoder->dyn_dtree; encoder->d_desc.static_tree = encoder->static_dtree; encoder->d_desc.extra_bits = extra_dbits; encoder->d_desc.extra_base = 0; encoder->d_desc.elems = D_CODES; encoder->d_desc.max_length = MAX_BITS; encoder->d_desc.max_code = 0; encoder->bl_desc.dyn_tree = encoder->bl_tree; encoder->bl_desc.static_tree = NULL; encoder->bl_desc.extra_bits = extra_blbits; encoder->bl_desc.extra_base = 0; encoder->bl_desc.elems = BL_CODES; encoder->bl_desc.max_length = MAX_BL_BITS; encoder->bl_desc.max_code = 0; /* Initialize the mapping length (0..255) -> length code (0..28) */ length = 0; for(code = 0; code < LENGTH_CODES-1; code++) { encoder->base_length[code] = length; for(n = 0; n < (1<length_code[length++] = (uch)code; } } Assert (length == 256, "ct_init: length != 256"); /* Note that the length 255 (match length 258) can be represented * in two different ways: code 284 + 5 bits or code 285, so we * overwrite length_code[255] to use the best encoding: */ encoder->length_code[length-1] = (uch)code; /* Initialize the mapping dist (0..32K) -> dist code (0..29) */ dist = 0; for(code = 0 ; code < 16; code++) { encoder->base_dist[code] = dist; for(n = 0; n < (1<dist_code[dist++] = (uch)code; } } Assert (dist == 256, "ct_init: dist != 256"); dist >>= 7; /* from now on, all distances are divided by 128 */ for( ; code < D_CODES; code++) { encoder->base_dist[code] = dist << 7; for(n = 0; n < (1<<(extra_dbits[code]-7)); n++) { encoder->dist_code[256 + dist++] = (uch)code; } } Assert (dist == 256, "ct_init: 256+dist != 512"); /* Construct the codes of the static literal tree */ for(bits = 0; bits <= MAX_BITS; bits++) encoder->bl_count[bits] = 0; n = 0; while(n <= 143) encoder->static_ltree[n++].Len = 8, encoder->bl_count[8]++; while(n <= 255) encoder->static_ltree[n++].Len = 9, encoder->bl_count[9]++; while(n <= 279) encoder->static_ltree[n++].Len = 7, encoder->bl_count[7]++; while(n <= 287) encoder->static_ltree[n++].Len = 8, encoder->bl_count[8]++; /* Codes 286 and 287 do not exist, but we must include them in the * tree construction to get a canonical Huffman tree (longest code * all ones) */ gen_codes(encoder, (ct_data near *)encoder->static_ltree, L_CODES+1); /* The static distance tree is trivial: */ for(n = 0; n < D_CODES; n++) { encoder->static_dtree[n].Len = 5; encoder->static_dtree[n].Code = bi_reverse(n, 5); } /* Initialize the first block of the first file: */ init_block(encoder); } /* =========================================================================== * Initialize a new block. */ local void init_block(DeflateHandler encoder) { int n; /* iterates over tree elements */ /* Initialize the trees. */ for(n = 0; n < L_CODES; n++) encoder->dyn_ltree[n].Freq = 0; for(n = 0; n < D_CODES; n++) encoder->dyn_dtree[n].Freq = 0; for(n = 0; n < BL_CODES; n++) encoder->bl_tree[n].Freq = 0; encoder->dyn_ltree[END_BLOCK].Freq = 1; encoder->opt_len = encoder->static_len = 0L; encoder->last_lit = encoder->last_dist = encoder->last_flags = 0; encoder->flags = 0; encoder->flag_bit = 1; } /* =========================================================================== * Restore the heap property by moving down the tree starting at node k, * exchanging a node with the smallest of its two sons if necessary, stopping * when the heap property is re-established (each father smaller than its * two sons). */ local void pqdownheap( DeflateHandler encoder, ct_data near *tree, /* the tree to restore */ int k) /* node to move down */ { int v = encoder->heap[k]; int j = k << 1; /* left son of k */ while(j <= encoder->heap_len) { /* Set j to the smallest of the two sons: */ if(j < encoder->heap_len && SMALLER(tree, encoder->heap[j+1], encoder->heap[j])) j++; /* Exit if v is smaller than both sons */ if(SMALLER(tree, v, encoder->heap[j])) break; /* Exchange v with the smallest son */ encoder->heap[k] = encoder->heap[j]; k = j; /* And continue down the tree, setting j to the left son of k */ j <<= 1; } encoder->heap[k] = v; } /* =========================================================================== * Compute the optimal bit lengths for a tree and update the total bit length * for the current block. * IN assertion: the fields freq and dad are set, heap[heap_max] and * above are the tree nodes sorted by increasing frequency. * OUT assertions: the field len is set to the optimal bit length, the * array bl_count contains the frequencies for each bit length. * The length opt_len is updated; static_len is also updated if stree is * not null. */ local void gen_bitlen( DeflateHandler encoder, tree_desc near *desc) /* the tree descriptor */ { ct_data near *tree = desc->dyn_tree; int near *extra = desc->extra_bits; int base = desc->extra_base; int max_code = desc->max_code; int max_length = desc->max_length; ct_data near *stree = desc->static_tree; int h; /* heap index */ int n, m; /* iterate over the tree elements */ int bits; /* bit length */ int xbits; /* extra bits */ ush f; /* frequency */ int overflow = 0; /* number of elements with bit length too large */ for(bits = 0; bits <= MAX_BITS; bits++) encoder->bl_count[bits] = 0; /* In a first pass, compute the optimal bit lengths (which may * overflow in the case of the bit length tree). */ tree[encoder->heap[encoder->heap_max]].Len = 0; /* root of the heap */ for(h = encoder->heap_max+1; h < HEAP_SIZE; h++) { n = encoder->heap[h]; bits = tree[tree[n].Dad].Len + 1; if(bits > max_length) bits = max_length, overflow++; tree[n].Len = (ush)bits; /* We overwrite tree[n].Dad which is no longer needed */ if(n > max_code) continue; /* not a leaf node */ encoder->bl_count[bits]++; xbits = 0; if(n >= base) xbits = extra[n-base]; f = tree[n].Freq; encoder->opt_len += (ulg)f * (bits + xbits); if(stree) encoder->static_len += (ulg)f * (stree[n].Len + xbits); } if(overflow == 0) return; Trace((stderr,"\nbit length overflow\n")); /* This happens for example on obj2 and pic of the Calgary corpus */ /* Find the first bit length which could increase: */ do { bits = max_length-1; while(encoder->bl_count[bits] == 0) bits--; encoder->bl_count[bits]--; /* move one leaf down the tree */ encoder->bl_count[bits+1] += 2; /* move one overflow item as its brother */ encoder->bl_count[max_length]--; /* The brother of the overflow item also moves one step up, * but this does not affect bl_count[max_length] */ overflow -= 2; } while(overflow > 0); /* Now recompute all bit lengths, scanning in increasing frequency. * h is still equal to HEAP_SIZE. (It is simpler to reconstruct all * lengths instead of fixing only the wrong ones. This idea is taken * from 'ar' written by Haruhiko Okumura.) */ for(bits = max_length; bits != 0; bits--) { n = encoder->bl_count[bits]; while(n != 0) { m = encoder->heap[--h]; if(m > max_code) continue; if(tree[m].Len != (unsigned) bits) { Trace((stderr,"code %d bits %d->%d\n", m, tree[m].Len, bits)); encoder->opt_len += ((long)bits-(long)tree[m].Len)*(long)tree[m].Freq; tree[m].Len = (ush)bits; } n--; } } } /* =========================================================================== * Generate the codes for a given tree and bit counts (which need not be * optimal). * IN assertion: the array bl_count contains the bit length statistics for * the given tree and the field len is set for all tree elements. * OUT assertion: the field code is set for all tree elements of non * zero code length. */ local void gen_codes( DeflateHandler encoder, ct_data near *tree, /* the tree to decorate */ int max_code) /* largest code with non zero frequency */ { ush next_code[MAX_BITS+1]; /* next code value for each bit length */ ush code = 0; /* running code value */ int bits; /* bit index */ int n; /* code index */ /* The distribution counts are first used to generate the code values * without bit reversal. */ for(bits = 1; bits <= MAX_BITS; bits++) { next_code[bits] = code = (code + encoder->bl_count[bits-1]) << 1; } /* Check that the bit counts in bl_count are consistent. The last code * must be all ones. */ Assert (code + encoder->bl_count[MAX_BITS]-1 == (1<dyn_tree; ct_data near *stree = desc->static_tree; int elems = desc->elems; int n, m; /* iterate over heap elements */ int max_code = -1; /* largest code with non zero frequency */ int node = elems; /* next internal node of the tree */ /* Construct the initial heap, with least frequent element in * heap[SMALLEST]. The sons of heap[n] are heap[2*n] and heap[2*n+1]. * heap[0] is not used. */ encoder->heap_len = 0; encoder->heap_max = HEAP_SIZE; for(n = 0; n < elems; n++) { if(tree[n].Freq != 0) { encoder->heap[++encoder->heap_len] = max_code = n; encoder->depth[n] = 0; } else { tree[n].Len = 0; } } /* The pkzip format requires that at least one distance code exists, * and that at least one bit should be sent even if there is only one * possible code. So to avoid special checks later on we force at least * two codes of non zero frequency. */ while(encoder->heap_len < 2) { int new = encoder->heap[++encoder->heap_len] = (max_code < 2 ? ++max_code : 0); tree[new].Freq = 1; encoder->depth[new] = 0; encoder->opt_len--; if(stree) encoder->static_len -= stree[new].Len; /* new is 0 or 1 so it does not have extra bits */ } desc->max_code = max_code; /* The elements heap[heap_len/2+1 .. heap_len] are leaves of the tree, * establish sub-heaps of increasing lengths: */ for(n = encoder->heap_len/2; n >= 1; n--) pqdownheap(encoder, tree, n); /* Construct the Huffman tree by repeatedly combining the least two * frequent nodes. */ do { n = encoder->heap[SMALLEST]; encoder->heap[SMALLEST] = encoder->heap[encoder->heap_len--]; pqdownheap(encoder, tree, SMALLEST); m = encoder->heap[SMALLEST]; /* m = node of next least frequency */ /* keep the nodes sorted by frequency */ encoder->heap[--encoder->heap_max] = n; encoder->heap[--encoder->heap_max] = m; /* Create a new node father of n and m */ tree[node].Freq = tree[n].Freq + tree[m].Freq; encoder->depth[node] = (uch)(MAX(encoder->depth[n], encoder->depth[m]) + 1); tree[n].Dad = tree[m].Dad = (ush)node; /* and insert the new node in the heap */ encoder->heap[SMALLEST] = node++; pqdownheap(encoder, tree, SMALLEST); } while(encoder->heap_len >= 2); encoder->heap[--encoder->heap_max] = encoder->heap[SMALLEST]; /* At this point, the fields freq and dad are set. We can now * generate the bit lengths. */ gen_bitlen(encoder, (tree_desc near *)desc); /* The field len is now set, we can generate the bit codes */ gen_codes (encoder, (ct_data near *)tree, max_code); } /* =========================================================================== * Scan a literal or distance tree to determine the frequencies of the codes * in the bit length tree. Updates opt_len to take into account the repeat * counts. (The contribution of the bit length codes will be added later * during the construction of bl_tree.) */ local void scan_tree( DeflateHandler encoder, ct_data near *tree, /* the tree to be scanned */ int max_code) /* and its largest code of non zero frequency */ { int n; /* iterates over all tree elements */ int prevlen = -1; /* last emitted length */ int curlen; /* length of current code */ int nextlen = tree[0].Len; /* length of next code */ int count = 0; /* repeat count of the current code */ int max_count = 7; /* max repeat count */ int min_count = 4; /* min repeat count */ if(nextlen == 0) max_count = 138, min_count = 3; tree[max_code+1].Len = (ush)0xffff; /* guard */ for(n = 0; n <= max_code; n++) { curlen = nextlen; nextlen = tree[n+1].Len; if(++count < max_count && curlen == nextlen) { continue; } else if(count < min_count) { encoder->bl_tree[curlen].Freq += count; } else if(curlen != 0) { if(curlen != prevlen) encoder->bl_tree[curlen].Freq++; encoder->bl_tree[REP_3_6].Freq++; } else if(count <= 10) { encoder->bl_tree[REPZ_3_10].Freq++; } else { encoder->bl_tree[REPZ_11_138].Freq++; } count = 0; prevlen = curlen; if(nextlen == 0) { max_count = 138, min_count = 3; } else if(curlen == nextlen) { max_count = 6, min_count = 3; } else { max_count = 7, min_count = 4; } } } /* =========================================================================== * Send a literal or distance tree in compressed form, using the codes in * bl_tree. */ local void send_tree( DeflateHandler encoder, ct_data near *tree, /* the tree to be scanned */ int max_code) /* and its largest code of non zero frequency */ { int n; /* iterates over all tree elements */ int prevlen = -1; /* last emitted length */ int curlen; /* length of current code */ int nextlen = tree[0].Len; /* length of next code */ int count = 0; /* repeat count of the current code */ int max_count = 7; /* max repeat count */ int min_count = 4; /* min repeat count */ /* tree[max_code+1].Len = -1; */ /* guard already set */ if(nextlen == 0) max_count = 138, min_count = 3; for(n = 0; n <= max_code; n++) { curlen = nextlen; nextlen = tree[n+1].Len; if(++count < max_count && curlen == nextlen) { continue; } else if(count < min_count) { do { SEND_CODE(curlen, encoder->bl_tree); } while(--count != 0); } else if(curlen != 0) { if(curlen != prevlen) { SEND_CODE(curlen, encoder->bl_tree); count--; } Assert(count >= 3 && count <= 6, " 3_6?"); SEND_CODE(REP_3_6, encoder->bl_tree); send_bits(encoder, count-3, 2); } else if(count <= 10) { SEND_CODE(REPZ_3_10, encoder->bl_tree); send_bits(encoder, count-3, 3); } else { SEND_CODE(REPZ_11_138, encoder->bl_tree); send_bits(encoder, count-11, 7); } count = 0; prevlen = curlen; if(nextlen == 0) { max_count = 138, min_count = 3; } else if(curlen == nextlen) { max_count = 6, min_count = 3; } else { max_count = 7, min_count = 4; } } } /* =========================================================================== * Construct the Huffman tree for the bit lengths and return the index in * bl_order of the last bit length code to send. */ local int build_bl_tree(DeflateHandler encoder) { int max_blindex; /* index of last bit length code of non zero freq */ /* Determine the bit length frequencies for literal and distance trees */ scan_tree(encoder, (ct_data near *)encoder->dyn_ltree, encoder->l_desc.max_code); scan_tree(encoder, (ct_data near *)encoder->dyn_dtree, encoder->d_desc.max_code); /* Build the bit length tree: */ build_tree(encoder, (tree_desc near *)(&encoder->bl_desc)); /* opt_len now includes the length of the tree representations, except * the lengths of the bit lengths codes and the 5+5+4 bits for the counts. */ /* Determine the number of bit length codes to send. The pkzip format * requires that at least 4 bit length codes be sent. (appnote.txt says * 3 but the actual value used is 4.) */ for(max_blindex = BL_CODES-1; max_blindex >= 3; max_blindex--) { if(encoder->bl_tree[bl_order[max_blindex]].Len != 0) break; } /* Update opt_len to include the bit length tree and counts */ encoder->opt_len += 3*(max_blindex+1) + 5+5+4; Tracev((stderr, "\ndyn trees: dyn %ld, stat %ld", encoder->opt_len, encoder->static_len)); return max_blindex; } /* =========================================================================== * Send the header for a block using dynamic Huffman trees: the counts, the * lengths of the bit length codes, the literal tree and the distance tree. * IN assertion: lcodes >= 257, dcodes >= 1, blcodes >= 4. */ local void send_all_trees( DeflateHandler encoder, int lcodes, int dcodes, int blcodes) /* number of codes for each tree */ { int rank; /* index in bl_order */ Assert (lcodes >= 257 && dcodes >= 1 && blcodes >= 4, "not enough codes"); Assert (lcodes <= L_CODES && dcodes <= D_CODES && blcodes <= BL_CODES, "too many codes"); Tracev((stderr, "\nbl counts: ")); send_bits(encoder, lcodes-257, 5); /* not +255 as stated in appnote.txt */ send_bits(encoder, dcodes-1, 5); send_bits(encoder, blcodes-4, 4); /* not -3 as stated in appnote.txt */ for(rank = 0; rank < blcodes; rank++) { Tracev((stderr, "\nbl code %2d ", bl_order[rank])); send_bits(encoder, encoder->bl_tree[bl_order[rank]].Len, 3); } /* send the literal tree */ send_tree(encoder, (ct_data near *)encoder->dyn_ltree,lcodes-1); /* send the distance tree */ send_tree(encoder, (ct_data near *)encoder->dyn_dtree,dcodes-1); } /* =========================================================================== * Determine the best encoding for the current block: dynamic trees, static * trees or store, and output the encoded block to the zip file. */ local void flush_block( DeflateHandler encoder, int eof) /* true if this is the last block for a file */ { ulg opt_lenb, static_lenb; /* opt_len and static_len in bytes */ int max_blindex; /* index of last bit length code of non zero freq */ ulg stored_len; /* length of input block */ stored_len = (ulg)(encoder->strstart - encoder->block_start); encoder->flag_buf[encoder->last_flags] = encoder->flags; /* Save the flags for the last 8 items */ /* Construct the literal and distance trees */ build_tree(encoder, (tree_desc near *)(&encoder->l_desc)); Tracev((stderr, "\nlit data: dyn %ld, stat %ld", encoder->opt_len, encoder->static_len)); build_tree(encoder, (tree_desc near *)(&encoder->d_desc)); Tracev((stderr, "\ndist data: dyn %ld, stat %ld", encoder->opt_len, encoder->static_len)); /* At this point, opt_len and static_len are the total bit lengths of * the compressed block data, excluding the tree representations. */ /* Build the bit length tree for the above two trees, and get the index * in bl_order of the last bit length code to send. */ max_blindex = build_bl_tree(encoder); /* Determine the best encoding. Compute first the block length in bytes */ opt_lenb = (encoder->opt_len +3+7)>>3; static_lenb = (encoder->static_len+3+7)>>3; Trace((stderr, "\nopt %lu(%lu) stat %lu(%lu) stored %lu lit %u dist %u ", opt_lenb, encoder->opt_len, static_lenb, encoder->static_len, stored_len, encoder->last_lit, encoder->last_dist)); if(static_lenb <= opt_lenb) opt_lenb = static_lenb; if(stored_len + 4 <= opt_lenb /* 4: two words for the lengths */ && encoder->block_start >= 0L) { unsigned int i; uch *p; /* The test buf != NULL is only necessary if LIT_BUFSIZE > WSIZE. * Otherwise we can't have processed more than WSIZE input bytes since * the last block flush, because compression would have been * successful. If LIT_BUFSIZE <= WSIZE, it is never too late to * transform a block into a stored block. */ send_bits(encoder, (STORED_BLOCK<<1)+eof, 3); /* send block type */ bi_windup(encoder); /* align on byte boundary */ put_short((ush)stored_len); put_short((ush)~stored_len); /* copy block */ p = &encoder->window[(unsigned)encoder->block_start]; for(i = 0; i < stored_len; i++) put_byte(p[i]); } else if(static_lenb == opt_lenb) { send_bits(encoder, (STATIC_TREES<<1)+eof, 3); compress_block(encoder, (ct_data near *)encoder->static_ltree, (ct_data near *)encoder->static_dtree); } else { send_bits(encoder, (DYN_TREES<<1)+eof, 3); send_all_trees(encoder, encoder->l_desc.max_code+1, encoder->d_desc.max_code+1, max_blindex+1); compress_block(encoder, (ct_data near *)encoder->dyn_ltree, (ct_data near *)encoder->dyn_dtree); } init_block(encoder); if(eof) bi_windup(encoder); } /* =========================================================================== * Save the match info and tally the frequency counts. Return true if * the current block must be flushed. */ local int ct_tally( DeflateHandler encoder, int dist, /* distance of matched string */ int lc) /* match length-MIN_MATCH or unmatched char (if dist==0) */ { encoder->l_buf[encoder->last_lit++] = (uch)lc; if(dist == 0) { /* lc is the unmatched char */ encoder->dyn_ltree[lc].Freq++; } else { /* Here, lc is the match length - MIN_MATCH */ dist--; /* dist = match distance - 1 */ Assert((ush)dist < (ush)MAX_DIST && (ush)lc <= (ush)(MAX_MATCH-MIN_MATCH) && (ush)D_CODE(dist) < (ush)D_CODES, "ct_tally: bad match"); encoder->dyn_ltree[encoder->length_code[lc]+LITERALS+1].Freq++; encoder->dyn_dtree[D_CODE(dist)].Freq++; encoder->d_buf[encoder->last_dist++] = (ush)dist; encoder->flags |= encoder->flag_bit; } encoder->flag_bit <<= 1; /* Output the flags if they fill a byte: */ if((encoder->last_lit & 7) == 0) { encoder->flag_buf[encoder->last_flags++] = encoder->flags; encoder->flags = 0; encoder->flag_bit = 1; } /* Try to guess if it is profitable to stop the current block here */ if(encoder->compr_level > 2 && (encoder->last_lit & 0xfff) == 0) { /* Compute an upper bound for the compressed length */ ulg out_length = (ulg)encoder->last_lit*8L; ulg in_length = (ulg)encoder->strstart - encoder->block_start; int dcode; for(dcode = 0; dcode < D_CODES; dcode++) { out_length += (ulg)encoder->dyn_dtree[dcode].Freq * (5L + extra_dbits[dcode]); } out_length >>= 3; Trace((stderr,"\nlast_lit %u, last_dist %u, in %ld, out ~%ld(%ld%%) ", encoder->last_lit, encoder->last_dist, in_length, out_length, 100L - out_length*100L/in_length)); if(encoder->last_dist < encoder->last_lit/2 && out_length < in_length/2) return 1; } return (encoder->last_lit == LIT_BUFSIZE-1 || encoder->last_dist == DIST_BUFSIZE); /* We avoid equality with LIT_BUFSIZE because of wraparound at 64K * on 16 bit machines and because stored blocks are restricted to * 64K-1 bytes. */ } /* =========================================================================== * Send the block data compressed using the given Huffman trees */ local void compress_block( DeflateHandler encoder, ct_data near *ltree, /* literal tree */ ct_data near *dtree) /* distance tree */ { unsigned dist; /* distance of matched string */ int lc; /* match length or unmatched char (if dist == 0) */ unsigned lx = 0; /* running index in l_buf */ unsigned dx = 0; /* running index in d_buf */ unsigned fx = 0; /* running index in flag_buf */ uch flag = 0; /* current flags */ unsigned code; /* the code to send */ int extra; /* number of extra bits to send */ if(encoder->last_lit != 0) do { if((lx & 7) == 0) flag = encoder->flag_buf[fx++]; lc = encoder->l_buf[lx++]; if((flag & 1) == 0) { SEND_CODE(lc, ltree); /* send a literal byte */ Tracecv(isgraph(lc), (stderr," '%c' ", lc)); } else { /* Here, lc is the match length - MIN_MATCH */ code = encoder->length_code[lc]; SEND_CODE(code+LITERALS+1, ltree); /* send the length code */ extra = extra_lbits[code]; if(extra != 0) { lc -= encoder->base_length[code]; send_bits(encoder, lc, extra); /* send the extra length bits */ } dist = encoder->d_buf[dx++]; /* Here, dist is the match distance - 1 */ code = D_CODE(dist); Assert (code < D_CODES, "bad d_code"); SEND_CODE(code, dtree); /* send the distance code */ extra = extra_dbits[code]; if(extra != 0) { dist -= encoder->base_dist[code]; send_bits(encoder, dist, extra); /* send the extra distance bits */ } } /* literal or match pair ? */ flag >>= 1; } while(lx < encoder->last_lit); SEND_CODE(END_BLOCK, ltree); } /* =========================================================================== * Send a value on a given number of bits. * IN assertion: length <= 16 and value fits in length bits. */ #define Buf_size (8 * sizeof(ush)) /* bit size of bi_buf */ local void send_bits( DeflateHandler encoder, int value, /* value to send */ int length) /* number of bits */ { /* If not enough room in bi_buf, use (valid) bits from bi_buf and * (16 - bi_valid) bits from value, leaving (width - (16-bi_valid)) * unused bits in value. */ if(encoder->bi_valid > Buf_size - length) { encoder->bi_buf |= (value << encoder->bi_valid); put_short(encoder->bi_buf); encoder->bi_buf = (ush)value >> (Buf_size - encoder->bi_valid); encoder->bi_valid += length - Buf_size; } else { encoder->bi_buf |= value << encoder->bi_valid; encoder->bi_valid += length; } } /* =========================================================================== * Reverse the first len bits of a code, using straightforward code (a faster * method would use a table) * IN assertion: 1 <= len <= 15 */ local unsigned bi_reverse( unsigned code, /* the value to invert */ int len) /* its bit length */ { register unsigned res = 0; do { res |= code & 1; code >>= 1, res <<= 1; } while(--len > 0); return res >> 1; } /* =========================================================================== * Write out any remaining bits in an incomplete byte. */ local void bi_windup(DeflateHandler encoder) { if(encoder->bi_valid > 8) { put_short(encoder->bi_buf); } else if(encoder->bi_valid > 0) { put_byte(encoder->bi_buf); } encoder->bi_buf = 0; encoder->bi_valid = 0; } local void qoutbuf(DeflateHandler encoder) { if(encoder->outcnt != 0) { struct deflate_buff_queue *q; q = new_queue(); if(encoder->qhead == NULL) encoder->qhead = encoder->qtail = q; else encoder->qtail = encoder->qtail->next = q; q->len = encoder->outcnt - encoder->outoff; memcpy(q->ptr, encoder->outbuf + encoder->outoff, q->len); encoder->outcnt = encoder->outoff = 0; } } TiMidity++-2.13.2/libarc/explode.c0100644004711200001440000007050707515607166015763 0ustar tamukiusers/* TiMidity++ -- MIDI to WAVE converter and player Copyright (C) 1999-2002 Masanao Izumo Copyright (C) 1995 Tuukka Toivonen 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ /* explode.c -- put in the public domain by Mark Adler version c15, 6 July 1996 */ /* You can do whatever you like with this source file, though I would prefer that if you modify it and redistribute it that you include comments to that effect with your name and the date. Thank you. History: vers date who what ---- --------- -------------- ------------------------------------ c1 30 Mar 92 M. Adler explode that uses huft_build from inflate (this gives over a 70% speed improvement over the original unimplode.c, which decoded a bit at a time) c2 4 Apr 92 M. Adler fixed bug for file sizes a multiple of 32k. c3 10 Apr 92 M. Adler added a little memory tracking if DEBUG c4 11 Apr 92 M. Adler added NOMEMCPY do kill use of memcpy() c5 21 Apr 92 M. Adler added the WSIZE #define to allow reducing the 32K window size for specialized applications. c6 31 May 92 M. Adler added typecasts to eliminate some warnings c7 27 Jun 92 G. Roelofs added more typecasts. c8 17 Oct 92 G. Roelofs changed ULONG/UWORD/byte to ulg/ush/uch. c9 19 Jul 93 J. Bush added more typecasts (to return values); made l[256] array static for Amiga. c10 8 Oct 93 G. Roelofs added used_csize for diagnostics; added buf and unshrink arguments to flush(); undef'd various macros at end for Turbo C; removed NEXTBYTE macro (now in unzip.h) and bytebuf variable (not used); changed memset() to memzero(). c11 9 Jan 94 M. Adler fixed incorrect used_csize calculation. c12 9 Apr 94 G. Roelofs fixed split comments on preprocessor lines to avoid bug in Encore compiler. c13 25 Aug 94 M. Adler fixed distance-length comment (orig c9 fix) c14 22 Nov 95 S. Maxwell removed unnecessary "static" on auto array c15 6 Jul 96 W. Haidinger added ulg typecasts to flush() calls */ /* Explode imploded (PKZIP method 6 compressed) data. This compression method searches for as much of the current string of bytes (up to a length of ~320) in the previous 4K or 8K bytes. If it doesn't find any matches (of at least length 2 or 3), it codes the next byte. Otherwise, it codes the length of the matched string and its distance backwards from the current position. Single bytes ("literals") are preceded by a one (a single bit) and are either uncoded (the eight bits go directly into the compressed stream for a total of nine bits) or Huffman coded with a supplied literal code tree. If literals are coded, then the minimum match length is three, otherwise it is two. There are therefore four kinds of imploded streams: 8K search with coded literals (min match = 3), 4K search with coded literals (min match = 3), 8K with uncoded literals (min match = 2), and 4K with uncoded literals (min match = 2). The kind of stream is identified in two bits of a general purpose bit flag that is outside of the compressed stream. Distance-length pairs for matched strings are preceded by a zero bit (to distinguish them from literals) and are always coded. The distance comes first and is either the low six (4K) or low seven (8K) bits of the distance (uncoded), followed by the high six bits of the distance coded. Then the length is six bits coded (0..63 + min match length), and if the maximum such length is coded, then it's followed by another eight bits (uncoded) to be added to the coded length. This gives a match length range of 2..320 or 3..321 bytes. The literal, length, and distance codes are all represented in a slightly compressed form themselves. What is sent are the lengths of the codes for each value, which is sufficient to construct the codes. Each byte of the code representation is the code length (the low four bits representing 1..16), and the number of values sequentially with that length (the high four bits also representing 1..16). There are 256 literal code values (if literals are coded), 64 length code values, and 64 distance code values, in that order at the beginning of the compressed stream. Each set of code values is preceded (redundantly) with a byte indicating how many bytes are in the code description that follows, in the range 1..256. The codes themselves are decoded using tables made by huft_build() from the bit lengths. That routine and its comments are in the inflate.c module. */ #include #include #ifndef NO_STRING_H #include #else #include #endif #include "timidity.h" #include "mblock.h" #include "explode.h" #include "zip.h" struct _ExplodeHandler { void *user_val; long (* read_func)(char *buf, long size, void *user_val); int method; int initflag; unsigned insize; /* valid bytes in inbuf */ unsigned inptr; /* index of next byte to be processed in inbuf */ uch inbuf[INBUFSIZ]; ulg bit_buf; /* bit buffer */ ulg bit_len; /* bits in bit buffer */ uch slide[WSIZE]; struct huft *tb; /* literal, length, and distance tables */ struct huft *tl; struct huft *td; int bb; /* number of bits decoded by those */ int bl; int bd; unsigned u, n, d, w; long s; /* original size */ long csize; /* compressed size */ unsigned l[256]; /* bit lengths for codes */ MBlockList pool; int eof; }; /* routines here */ static int get_tree(ExplodeHandler decoder, unsigned *l, unsigned n); static int fill_inbuf(ExplodeHandler decoder); static long explode_lit8(ExplodeHandler decoder, char *buff, long size); static long explode_lit4(ExplodeHandler decoder, char *buff, long size); static long explode_nolit8(ExplodeHandler decoder,char *buff, long size); static long explode_nolit4(ExplodeHandler decoder,char *buff, long size); /* The implode algorithm uses a sliding 4K or 8K byte window on the uncompressed stream to find repeated byte strings. This is implemented here as a circular buffer. The index is updated simply by incrementing and then and'ing with 0x0fff (4K-1) or 0x1fff (8K-1). Here, the 32K buffer of inflate is used, and it works just as well to always have a 32K circular buffer, so the index is anded with 0x7fff. This is done to allow the window to also be used as the output buffer. */ /* This must be supplied in an external module useable like "uch slide[8192];" or "uch *slide;", where the latter would be malloc'ed. In unzip, slide[] is actually a 32K area for use by inflate, which uses a 32K sliding window. */ /* Tables for length and distance */ static ush cplen2[] = {2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65}; static ush cplen3[] = {3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66}; static ush extra[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8}; static ush cpdist4[] = {1, 65, 129, 193, 257, 321, 385, 449, 513, 577, 641, 705, 769, 833, 897, 961, 1025, 1089, 1153, 1217, 1281, 1345, 1409, 1473, 1537, 1601, 1665, 1729, 1793, 1857, 1921, 1985, 2049, 2113, 2177, 2241, 2305, 2369, 2433, 2497, 2561, 2625, 2689, 2753, 2817, 2881, 2945, 3009, 3073, 3137, 3201, 3265, 3329, 3393, 3457, 3521, 3585, 3649, 3713, 3777, 3841, 3905, 3969, 4033}; static ush cpdist8[] = {1, 129, 257, 385, 513, 641, 769, 897, 1025, 1153, 1281, 1409, 1537, 1665, 1793, 1921, 2049, 2177, 2305, 2433, 2561, 2689, 2817, 2945, 3073, 3201, 3329, 3457, 3585, 3713, 3841, 3969, 4097, 4225, 4353, 4481, 4609, 4737, 4865, 4993, 5121, 5249, 5377, 5505, 5633, 5761, 5889, 6017, 6145, 6273, 6401, 6529, 6657, 6785, 6913, 7041, 7169, 7297, 7425, 7553, 7681, 7809, 7937, 8065}; /* Macros for inflate() bit peeking and grabbing. The usage is: NEEDBITS(j) x = GETBITS(j) DUMPBITS(j) where NEEDBITS makes sure that b has at least j bits in it, and DUMPBITS removes the bits from b. The macros use the variable k for the number of bits in b. Normally, b and k are register variables for speed. */ #define NEXTBYTE (decoder->inptr < decoder->insize ? decoder->inbuf[decoder->inptr++] : fill_inbuf(decoder)) #define MASK_BITS(n) ((((ulg)1)<<(n))-1) #define NEEDBITS(n) {while(decoder->bit_len<(n)){decoder->bit_buf|=((ulg)NEXTBYTE)<bit_len;decoder->bit_len+=8;}} #define GETBITS(n) ((ulg)decoder->bit_buf & MASK_BITS(n)) #define IGETBITS(n) ((~((ulg)decoder->bit_buf)) & MASK_BITS(n)) #define DUMPBITS(n) {decoder->bit_buf>>=(n);decoder->bit_len-=(n);} /*ARGSUSED*/ static long default_read_func(char *buf, long size, void *v) { return (long)fread(buf, 1, size, stdin); } ExplodeHandler open_explode_handler( long (* read_func)(char *buf, long size, void *user_val), int method, long compsize, long origsize, void *user_val) { ExplodeHandler decoder; decoder = (ExplodeHandler)malloc(sizeof(struct _ExplodeHandler)); if(decoder == NULL) return NULL; memset(decoder, 0, sizeof(struct _ExplodeHandler)); decoder->user_val = user_val; if(read_func == NULL) decoder->read_func = default_read_func; else decoder->read_func = read_func; decoder->insize = 0; decoder->method = method; decoder->bit_buf = 0; decoder->bit_len = 0; decoder->u = 1; decoder->n = 0; decoder->d = 0; decoder->w = 0; decoder->s = origsize; decoder->csize = compsize; decoder->eof = 0; decoder->initflag = 0; init_mblock(&decoder->pool); /* Tune base table sizes. Note: I thought that to truly optimize speed, I would have to select different bl, bd, and bb values for different compressed file sizes. I was suprised to find out the the values of 7, 7, and 9 worked best over a very wide range of sizes, except that bd = 8 worked marginally better for large compressed sizes. */ decoder->bl = 7; #if 0 decoder->bd = (G.csize + G.incnt) > 200000L ? 8 : 7; #else decoder->bd = (compsize > 200000L ? 8 : 7); #endif return decoder; } static int explode_start(ExplodeHandler decoder) { int method; method = decoder->method; /* With literal tree--minimum match length is 3 */ if(method == EXPLODE_LIT8 || method == EXPLODE_LIT4) { decoder->bb = 9; /* base table size for literals */ if(get_tree(decoder, decoder->l, 256) != 0) return 1; if(huft_build(decoder->l, 256, 256, NULL, NULL, &decoder->tb, &decoder->bb, &decoder->pool) != 0) return 1; if(get_tree(decoder, decoder->l, 64) != 0) return 1; if(huft_build(decoder->l, 64, 0, cplen3, extra, &decoder->tl, &decoder->bl, &decoder->pool) != 0) return 1; if(get_tree(decoder, decoder->l, 64) != 0) return 1; if(method == EXPLODE_LIT8) { if(huft_build(decoder->l, 64, 0, cpdist8, extra, &decoder->td, &decoder->bd, &decoder->pool) != 0) return 1; } else { if(huft_build(decoder->l, 64, 0, cpdist4, extra, &decoder->td, &decoder->bd, &decoder->pool) != 0) return 1; } } else /* EXPLODE_NOLIT8 or EXPLODE_NOLIT4 */ { if(get_tree(decoder, decoder->l, 64) != 0) return 1; if(huft_build(decoder->l, 64, 0, cplen2, extra, &decoder->tl, &decoder->bl, &decoder->pool) != 0) return 1; if(get_tree(decoder, decoder->l, 64) != 0) return 1; if(method == EXPLODE_NOLIT8) { if(huft_build(decoder->l, 64, 0, cpdist8, extra, &decoder->td, &decoder->bd, &decoder->pool) != 0) return 1; } else { if(huft_build(decoder->l, 64, 0, cpdist4, extra, &decoder->td, &decoder->bd, &decoder->pool) != 0) return 1; } } return 0; } void close_explode_handler(ExplodeHandler decoder) { free(decoder); } static int get_tree( ExplodeHandler decoder, unsigned *l, /* bit lengths */ unsigned n) /* number expected */ /* Get the bit lengths for a code representation from the compressed stream. If get_tree() returns 4, then there is an error in the data. Otherwise zero is returned. */ { unsigned i; /* bytes remaining in list */ unsigned k; /* lengths entered */ unsigned j; /* number of codes */ unsigned b; /* bit length for those codes */ /* get bit lengths */ i = NEXTBYTE + 1; /* length/count pairs to read */ k = 0; /* next code */ do { b = ((j = NEXTBYTE) & 0xf) + 1; /* bits in code (1..16) */ j = ((j & 0xf0) >> 4) + 1; /* codes with those bits (1..16) */ if (k + j > n) return 4; /* don't overflow l[] */ do { l[k++] = b; } while (--j); } while (--i); return k != n ? 4 : 0; /* should have read n of them */ } static long explode_lit8(ExplodeHandler decoder, char *buff, long size) /* Decompress the imploded data using coded literals and an 8K sliding window. */ { long s; /* bytes to decompress */ register unsigned e; /* table entry flag/number of extra bits */ unsigned n, d; /* length and index for copy */ unsigned w; /* current window position */ struct huft *t; /* pointer to table entry */ unsigned u; /* true if unflushed */ long j; struct huft *tb, *tl, *td; /* literal, length, and distance tables */ int bb, bl, bd; /* number of bits decoded by those */ tb = decoder->tb; tl = decoder->tl; td = decoder->td; bb = decoder->bb; bl = decoder->bl; bd = decoder->bd; /* explode the coded data */ s = decoder->s; w = decoder->w; u = decoder->u; j = 0; while(s > 0) /* do until ucsize bytes uncompressed */ { NEEDBITS(1); if(decoder->bit_buf & 1) /* then literal--decode it */ { DUMPBITS(1); s--; NEEDBITS((unsigned)bb); /* get coded literal */ t = tb + IGETBITS(bb); e = t->e; while(e > 16) { if(e == 99) return -1; DUMPBITS(t->b); e -= 16; NEEDBITS(e); t = t->v.t + IGETBITS(e); e = t->e; } DUMPBITS(t->b); buff[j++] = decoder->slide[w++] = (uch)t->v.n; if(w == WSIZE) w = u = 0; if(j == size) { decoder->u = u; decoder->w = w; decoder->s = s; return size; } } else /* else distance/length */ { DUMPBITS(1); NEEDBITS(7); /* get distance low bits */ d = GETBITS(7); DUMPBITS(7); NEEDBITS((unsigned)bd); /* get coded distance high bits */ t = td + IGETBITS(bd); e = t->e; while(e > 16) { if(e == 99) return -1; DUMPBITS(t->b); e -= 16; NEEDBITS(e); t = t->v.t + IGETBITS(e); e = t->e; } DUMPBITS(t->b); d = w - d - t->v.n; /* construct offset */ NEEDBITS((unsigned)bl); /* get coded length */ t = tl + IGETBITS(bl); e = t->e; while(e > 16) { if(e == 99) return -1; DUMPBITS(t->b); e -= 16; NEEDBITS(e); t = t->v.t + IGETBITS(e); e = t->e; } DUMPBITS(t->b); n = t->v.n; if(e) /* get length extra bits */ { NEEDBITS(8); n += GETBITS(8); DUMPBITS(8); } /* do the copy */ s -= n; while(n > 0 && j < size) { n--; d &= WSIZE - 1; w &= WSIZE - 1; if(u && w <= d) { buff[j++] = 0; w++; d++; } else buff[j++] = decoder->slide[w++] = decoder->slide[d++]; if(w == WSIZE) w = u = 0; } if(j == size) { decoder->u = u; decoder->n = n; decoder->d = d; decoder->w = w; decoder->s = s; return size; } decoder->n = 0; } } decoder->n = 0; decoder->w = 0; decoder->eof = 1; return j; } static long explode_lit4(ExplodeHandler decoder, char *buff, long size) /* Decompress the imploded data using coded literals and a 4K sliding window. */ { long s; /* bytes to decompress */ register unsigned e; /* table entry flag/number of extra bits */ unsigned n, d; /* length and index for copy */ unsigned w; /* current window position */ struct huft *t; /* pointer to table entry */ unsigned u; /* true if unflushed */ long j; struct huft *tb, *tl, *td; /* literal, length, and distance tables */ int bb, bl, bd; /* number of bits decoded by those */ tb = decoder->tb; tl = decoder->tl; td = decoder->td; bb = decoder->bb; bl = decoder->bl; bd = decoder->bd; /* explode the coded data */ s = decoder->s; w = decoder->w; u = decoder->u; j = 0; while(s > 0) /* do until ucsize bytes uncompressed */ { NEEDBITS(1); if(decoder->bit_buf & 1) /* then literal--decode it */ { DUMPBITS(1); s--; NEEDBITS((unsigned)bb); /* get coded literal */ t = tb + IGETBITS(bb); e = t->e; while(e > 16) { if(e == 99) return -1; DUMPBITS(t->b); e -= 16; NEEDBITS(e); t = t->v.t + IGETBITS(e); } DUMPBITS(t->b); buff[j++] = decoder->slide[w++] = (uch)t->v.n; if(w == WSIZE) w = u = 0; if(j == size) { decoder->u = u; decoder->w = w; decoder->s = s; return size; } } else /* else distance/length */ { DUMPBITS(1); NEEDBITS(6); /* get distance low bits */ d = GETBITS(6); DUMPBITS(6); NEEDBITS((unsigned)bd); /* get coded distance high bits */ t = td + IGETBITS(bd); e = t->e; while(e > 16) { if(e == 99) return -1; DUMPBITS(t->b); e -= 16; NEEDBITS(e); t = t->v.t + IGETBITS(e); e = t->e; } DUMPBITS(t->b); d = w - d - t->v.n; /* construct offset */ NEEDBITS((unsigned)bl); /* get coded length */ t = tl + IGETBITS(bl); e = t->e; while(e > 16) { if(e == 99) return -1; DUMPBITS(t->b); e -= 16; NEEDBITS(e); t = t->v.t + IGETBITS(e); e = t->e; } DUMPBITS(t->b); n = t->v.n; if(e) /* get length extra bits */ { NEEDBITS(8); n += GETBITS(8); DUMPBITS(8); } /* do the copy */ s -= n; while(n > 0 && j < size) { n--; d &= WSIZE - 1; w &= WSIZE - 1; if(u && w <= d) { buff[j++] = 0; w++; d++; } else buff[j++] = decoder->slide[w++] = decoder->slide[d++]; if(w == WSIZE) w = u = 0; } if(j == size) { decoder->u = u; decoder->n = n; decoder->d = d; decoder->w = w; decoder->s = s; return size; } decoder->n = 0; } } decoder->n = 0; decoder->w = 0; decoder->eof = 1; return j; } static long explode_nolit8(ExplodeHandler decoder, char *buff, long size) /* Decompress the imploded data using uncoded literals and an 8K sliding window. */ { long s; /* bytes to decompress */ register unsigned e; /* table entry flag/number of extra bits */ unsigned n, d; /* length and index for copy */ unsigned w; /* current window position */ struct huft *t; /* pointer to table entry */ unsigned u; /* true if unflushed */ long j; struct huft *tl, *td; /* length and distance decoder tables */ int bl, bd; /* number of bits decoded by tl[] and td[] */ tl = decoder->tl; td = decoder->td; bl = decoder->bl; bd = decoder->bd; /* explode the coded data */ #if 0 b = k = w = 0; /* initialize bit buffer, window */ u = 1; /* buffer unflushed */ ml = mask_bits[bl]; /* precompute masks for speed */ md = mask_bits[bd]; s = G.ucsize; #endif s = decoder->s; w = decoder->w; u = decoder->u; j = 0; while(s > 0) /* do until ucsize bytes uncompressed */ { NEEDBITS(1); if(decoder->bit_buf & 1) /* then literal--get eight bits */ { DUMPBITS(1); s--; NEEDBITS(8); buff[j++] = decoder->slide[w++] = (uch)decoder->bit_buf;; DUMPBITS(8); if(w == WSIZE) w = u = 0; if(j == size) { decoder->u = u; decoder->w = w; decoder->s = s; return size; } } else /* else distance/length */ { DUMPBITS(1); NEEDBITS(7); /* get distance low bits */ d = GETBITS(7); DUMPBITS(7); NEEDBITS((unsigned)bd); /* get coded distance high bits */ t = td + IGETBITS(bd); e = t->e; while(e > 16) { if(e == 99) return -1; DUMPBITS(t->b); e -= 16; NEEDBITS(e); t = t->v.t + IGETBITS(e); e = t->e; } DUMPBITS(t->b); d = w - d - t->v.n; /* construct offset */ NEEDBITS((unsigned)bl); /* get coded length */ t = tl + IGETBITS(bl); e = t->e; while(e > 16) { if(e == 99) return -1; DUMPBITS(t->b); e -= 16; NEEDBITS(e); t = t->v.t + IGETBITS(e); e = t->e; } DUMPBITS(t->b); n = t->v.n; if(e) /* get length extra bits */ { NEEDBITS(8); n += GETBITS(8); DUMPBITS(8); } /* do the copy */ s -= n; while(n > 0 && j < size) { n--; d &= WSIZE - 1; w &= WSIZE - 1; if(u && w <= d) { buff[j++] = 0; w++; d++; } else buff[j++] = decoder->slide[w++] = decoder->slide[d++]; if(w == WSIZE) w = u = 0; } if(j == size) { decoder->u = u; decoder->n = n; decoder->d = d; decoder->w = w; decoder->s = s; return size; } decoder->n = 0; } } decoder->n = 0; decoder->w = 0; decoder->eof = 1; return j; } static long explode_nolit4(ExplodeHandler decoder, char *buff, long size) /* Decompress the imploded data using uncoded literals and a 4K sliding window. */ { long s; /* bytes to decompress */ register unsigned e; /* table entry flag/number of extra bits */ unsigned n, d; /* length and index for copy */ unsigned w; /* current window position */ struct huft *t; /* pointer to table entry */ unsigned u; /* true if unflushed */ long j; struct huft *tl, *td; /* length and distance decoder tables */ int bl, bd; /* number of bits decoded by tl[] and td[] */ tl = decoder->tl; td = decoder->td; bl = decoder->bl; bd = decoder->bd; /* explode the coded data */ #if 0 b = k = w = 0; /* initialize bit buffer, window */ u = 1; /* buffer unflushed */ ml = mask_bits[bl]; /* precompute masks for speed */ md = mask_bits[bd]; s = G.ucsize; #endif s = decoder->s; w = decoder->w; u = decoder->u; j = 0; while(s > 0) /* do until ucsize bytes uncompressed */ { NEEDBITS(1); if(decoder->bit_buf & 1) /* then literal--get eight bits */ { DUMPBITS(1); s--; NEEDBITS(8); buff[j++] = decoder->slide[w++] = (uch)decoder->bit_buf; DUMPBITS(8); if(w == WSIZE) w = u = 0; if(j == size) { decoder->u = u; decoder->w = w; decoder->s = s; return size; } } else /* else distance/length */ { DUMPBITS(1); NEEDBITS(6); /* get distance low bits */ #if 0 d = (unsigned)b & 0x3f; #else d = GETBITS(6); #endif DUMPBITS(6); NEEDBITS((unsigned)bd); /* get coded distance high bits */ t = td + IGETBITS(bd); e = t->e; while(e > 16) { if(e == 99) return -1; DUMPBITS(t->b); e -= 16; NEEDBITS(e); t = t->v.t + IGETBITS(e); e = t->e; } DUMPBITS(t->b); d = w - d - t->v.n; /* construct offset */ NEEDBITS((unsigned)bl); /* get coded length */ /*t =*/ t = tl + IGETBITS(bl); e = t->e; while(e > 16) { if(e == 99) return -1; DUMPBITS(t->b); e -= 16; NEEDBITS(e); t = t->v.t + IGETBITS(e); e = t->e; } DUMPBITS(t->b); n = t->v.n; if(e) /* get length extra bits */ { NEEDBITS(8); n += GETBITS(8); DUMPBITS(8); } /* do the copy */ s -= n; while(n > 0 && j < size) { n--; d &= WSIZE - 1; w &= WSIZE - 1; if(u && w <= d) { buff[j++] = 0; w++; d++; } else buff[j++] = decoder->slide[w++] = decoder->slide[d++]; if(w == WSIZE) w = u = 0; } if(j == size) { decoder->u = u; decoder->n = n; decoder->d = d; decoder->w = w; decoder->s = s; return size; } decoder->n = 0; } } decoder->n = 0; decoder->w = 0; decoder->eof = 1; return j; } long explode(ExplodeHandler decoder, char *buff, long size) /* Explode an imploded compressed stream. Based on the general purpose bit flag, decide on coded or uncoded literals, and an 8K or 4K sliding window. Construct the literal (if any), length, and distance codes and the tables needed to decode them (using huft_build() from inflate.c), and call the appropriate routine for the type of data in the remainder of the stream. The four routines are nearly identical, differing only in whether the literal is decoded or simply read in, and in how many bits are read in, uncoded, for the low distance bits. */ { long j, i; if(size <= 0) return size; if(!decoder->initflag) { decoder->initflag = 1; if(explode_start(decoder) != 0) return 0; } j = 0; while(j < size) { if(decoder->n > 0) /* do the copy */ { unsigned u, n, w, d; u = decoder->u; n = decoder->n; d = decoder->d; w = decoder->w; while(n > 0 && j < size) { n--; d &= WSIZE - 1; w &= WSIZE - 1; if(u && w <= d) { buff[j++] = 0; w++; d++; } else buff[j++] = decoder->slide[w++] = decoder->slide[d++]; if(w == WSIZE) w = u = 0; } decoder->u = u; decoder->n = n; decoder->d = d; decoder->w = w; if(j == size) return size; } /* decoder->n == 0 */ if(decoder->eof) return j; switch(decoder->method) { case EXPLODE_LIT8: i = explode_lit8(decoder, buff + j, size - j); break; case EXPLODE_LIT4: i = explode_lit4(decoder, buff + j, size - j); break; case EXPLODE_NOLIT8: i = explode_nolit8(decoder, buff + j, size - j); break; case EXPLODE_NOLIT4: i = explode_nolit4(decoder, buff + j, size - j); break; default: i = -1; break; } if(i == -1) return -1; j += i; } return j; } static int fill_inbuf(ExplodeHandler decoder) { int len; /* Read as much as possible */ decoder->insize = 0; errno = 0; do { len = decoder->read_func((char*)decoder->inbuf + decoder->insize, (long)(INBUFSIZ - decoder->insize), decoder->user_val); if(len == 0 || len == EOF) break; decoder->insize += len; } while(decoder->insize < INBUFSIZ); if(decoder->insize == 0) return EOF; decoder->inptr = 1; return decoder->inbuf[0]; } TiMidity++-2.13.2/libarc/explode.h0100644004711200001440000000264107421005037015743 0ustar tamukiusers/* TiMidity++ -- MIDI to WAVE converter and player Copyright (C) 1999-2002 Masanao Izumo Copyright (C) 1995 Tuukka Toivonen 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef ___EXPLODE_H_ #define ___EXPLODE_H_ typedef struct _ExplodeHandler *ExplodeHandler; enum explode_method_t { EXPLODE_LIT8, EXPLODE_LIT4, EXPLODE_NOLIT8, EXPLODE_NOLIT4 }; extern ExplodeHandler open_explode_handler( long (* read_func)(char *buf, long size, void *user_val), int method, long compsize, long origsize, void *user_val); extern long explode(ExplodeHandler decoder, char *decode_buff, long decode_buff_size); extern void close_explode_handler(ExplodeHandler decoder); #endif /* ___EXPLODE_H_ */ TiMidity++-2.13.2/libarc/inflate.c0100644004711200001440000007602207421005037015724 0ustar tamukiusers/* TiMidity++ -- MIDI to WAVE converter and player Copyright (C) 1999-2002 Masanao Izumo Copyright (C) 1995 Tuukka Toivonen 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ /* inflate.c -- Not copyrighted 1992 by Mark Adler version c10p1, 10 January 1993 */ /* You can do whatever you like with this source file, though I would prefer that if you modify it and redistribute it that you include comments to that effect with your name and the date. Thank you. [The history has been moved to the file ChangeLog.] */ /* Inflate deflated (PKZIP's method 8 compressed) data. The compression method searches for as much of the current string of bytes (up to a length of 258) in the previous 32K bytes. If it doesn't find any matches (of at least length 3), it codes the next byte. Otherwise, it codes the length of the matched string and its distance backwards from the current position. There is a single Huffman code that codes both single bytes (called "literals") and match lengths. A second Huffman code codes the distance information, which follows a length code. Each length or distance code actually represents a base value and a number of "extra" (sometimes zero) bits to get to add to the base value. At the end of each deflated block is a special end-of-block (EOB) literal/ length code. The decoding process is basically: get a literal/length code; if EOB then done; if a literal, emit the decoded byte; if a length then get the distance and emit the referred-to bytes from the sliding window of previously emitted data. There are (currently) three kinds of inflate blocks: stored, fixed, and dynamic. The compressor outputs a chunk of data at a time and decides which method to use on a chunk-by-chunk basis. A chunk might typically be 32K to 64K, uncompressed. If the chunk is uncompressible, then the "stored" method is used. In this case, the bytes are simply stored as is, eight bits per byte, with none of the above coding. The bytes are preceded by a count, since there is no longer an EOB code. If the data are compressible, then either the fixed or dynamic methods are used. In the dynamic method, the compressed data are preceded by an encoding of the literal/length and distance Huffman codes that are to be used to decode this block. The representation is itself Huffman coded, and so is preceded by a description of that code. These code descriptions take up a little space, and so for small blocks, there is a predefined set of codes, called the fixed codes. The fixed method is used if the block ends up smaller that way (usually for quite small chunks); otherwise the dynamic method is used. In the latter case, the codes are customized to the probabilities in the current block and so can code it much better than the pre-determined fixed codes can. The Huffman codes themselves are decoded using a multi-level table lookup, in order to maximize the speed of decoding plus the speed of building the decoding tables. See the comments below that precede the lbits and dbits tuning parameters. */ /* Notes beyond the 1.93a appnote.txt: 1. Distance pointers never point before the beginning of the output stream. 2. Distance pointers can point back across blocks, up to 32k away. 3. There is an implied maximum of 7 bits for the bit length table and 15 bits for the actual data. 4. If only one code exists, then it is encoded using one bit. (Zero would be more efficient, but perhaps a little confusing.) If two codes exist, they are coded using one bit each (0 and 1). 5. There is no way of sending zero distance codes--a dummy must be sent if there are none. (History: a pre 2.0 version of PKZIP would store blocks with no distance codes, but this was discovered to be too harsh a criterion.) Valid only for 1.93a. 2.04c does allow zero distance codes, which is sent as one code of zero bits in length. 6. There are up to 286 literal/length codes. Code 256 represents the end-of-block. Note however that the static length tree defines 288 codes just to fill out the Huffman codes. Codes 286 and 287 cannot be used though, since there is no length base or extra bits defined for them. Similarily, there are up to 30 distance codes. However, static trees define 32 codes (all 5 bits) to fill out the Huffman codes, but the last two had better not show up in the data. 7. Unzip can check dynamic Huffman blocks for complete code sets. The exception is that a single code would not be complete (see #4). 8. The five bits following the block type is really the number of literal codes sent minus 257. 9. Length codes 8,16,16 are interpreted as 13 length codes of 8 bits (1+6+6). Therefore, to output three times the length, you output three codes (1+1+1), whereas to output four times the same length, you only need two codes (1+3). Hmm. 10. In the tree reconstruction algorithm, Code = Code + Increment only if BitLength(i) is not zero. (Pretty obvious.) 11. Correction: 4 Bits: # of Bit Length codes - 4 (4 - 19) 12. Note: length code 284 can represent 227-258, but length code 285 really is 258. The last length deserves its own, short code since it gets used a lot in very redundant files. The length 258 is special since 258 - 3 (the min match length) is 255. 13. The literal/length and distance code bit lengths are read as a single stream of lengths. It is possible (and advantageous) for a repeat code (16, 17, or 18) to go across the boundary between the two sets of lengths. */ #include #include #ifndef NO_STRING_H #include #else #include #endif #include "timidity.h" #include "mblock.h" #include "zip.h" #define local static /* Save to local */ #define BITS_SAVE \ ulg bit_buf = decoder->bit_buf; \ ulg bit_len = decoder->bit_len; /* Restore to decoder */ #define BITS_RESTORE \ decoder->bit_buf = bit_buf; \ decoder->bit_len = bit_len; #define MASK_BITS(n) ((((ulg)1)<<(n))-1) #define GET_BYTE() (decoder->inptr < decoder->insize ? decoder->inbuf[decoder->inptr++] : fill_inbuf(decoder)) #define NEEDBITS(n) {while(bit_len<(n)){bit_buf|=((ulg)GET_BYTE())<>=(n);bit_len-=(n);} /* variables */ struct _InflateHandler { void *user_val; long (* read_func)(char *buf, long size, void *user_val); uch slide[2L * WSIZE]; uch inbuf[INBUFSIZ + INBUF_EXTRA]; unsigned wp; /* current position in slide */ unsigned insize; /* valid bytes in inbuf */ unsigned inptr; /* index of next byte to be processed in inbuf */ struct huft *fixed_tl; /* inflate static */ struct huft *fixed_td; /* inflate static */ int fixed_bl, fixed_bd; /* inflate static */ ulg bit_buf; /* bit buffer */ ulg bit_len; /* bits in bit buffer */ int method; int eof; unsigned copy_leng; unsigned copy_dist; struct huft *tl, *td; /* literal/length and distance decoder tables */ int bl, bd; /* number of bits decoded by tl[] and td[] */ MBlockList pool; /* memory buffer for tl, td */ }; /* Function prototypes */ local int fill_inbuf(InflateHandler); local int huft_free(struct huft *); local long inflate_codes(InflateHandler, char *, long); local long inflate_stored(InflateHandler, char *, long); local long inflate_fixed(InflateHandler, char *, long); local long inflate_dynamic(InflateHandler, char *, long); local void inflate_start(InflateHandler); /* The inflate algorithm uses a sliding 32K byte window on the uncompressed stream to find repeated byte strings. This is implemented here as a circular buffer. The index is updated simply by incrementing and then and'ing with 0x7fff (32K-1). */ /* It is left to other modules to supply the 32K area. It is assumed to be usable as if it were declared "uch slide[32768];" or as just "uch *slide;" and then malloc'ed in the latter case. The definition must be in unzip.h, included above. */ #define lbits 9 /* bits in base literal/length lookup table */ #define dbits 6 /* bits in base distance lookup table */ /* Tables for deflate from PKZIP's appnote.txt. */ local ush cplens[] = { /* Copy lengths for literal codes 257..285 */ 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0}; /* note: see note #13 above about the 258 in this list. */ local ush cplext[] = { /* Extra bits for literal codes 257..285 */ 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0, 99, 99}; /* 99==invalid */ local ush cpdist[] = { /* Copy offsets for distance codes 0..29 */ 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, 8193, 12289, 16385, 24577}; local ush cpdext[] = { /* Extra bits for distance codes */ 0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13}; /* Huffman code decoding is performed using a multi-level table lookup. The fastest way to decode is to simply build a lookup table whose size is determined by the longest code. However, the time it takes to build this table can also be a factor if the data being decoded are not very long. The most common codes are necessarily the shortest codes, so those codes dominate the decoding time, and hence the speed. The idea is you can have a shorter table that decodes the shorter, more probable codes, and then point to subsidiary tables for the longer codes. The time it costs to decode the longer codes is then traded against the time it takes to make longer tables. This results of this trade are in the variables lbits and dbits below. lbits is the number of bits the first level table for literal/ length codes can decode in one step, and dbits is the same thing for the distance codes. Subsequent tables are also less than or equal to those sizes. These values may be adjusted either when all of the codes are shorter than that, in which case the longest code length in bits is used, or when the shortest code is *longer* than the requested table size, in which case the length of the shortest code in bits is used. There are two different values for the two tables, since they code a different number of possibilities each. The literal/length table codes 286 possible values, or in a flat code, a little over eight bits. The distance table codes 30 possible values, or a little less than five bits, flat. The optimum values for speed end up being about one bit more than those, so lbits is 8+1 and dbits is 5+1. The optimum values may differ though from machine to machine, and possibly even between compilers. Your mileage may vary. */ /* If BMAX needs to be larger than 16, then h and x[] should be ulg. */ #define BMAX 16 /* maximum bit length of any code (16 for explode) */ #define N_MAX 288 /* maximum number of codes in any set */ int huft_build( unsigned *b, /* code lengths in bits (all assumed <= BMAX) */ unsigned n, /* number of codes (assumed <= N_MAX) */ unsigned s, /* number of simple-valued codes (0..s-1) */ ush *d, /* list of base values for non-simple codes */ ush *e, /* list of extra bits for non-simple codes */ struct huft **t, /* result: starting table */ int *m, /* maximum lookup bits, returns actual */ MBlockList *pool) /* memory pool */ /* Given a list of code lengths and a maximum table size, make a set of tables to decode that set of codes. Return zero on success, one if the given code set is incomplete (the tables are still built in this case), two if the input is invalid (all zero length codes or an oversubscribed set of lengths), and three if not enough memory. The code with value 256 is special, and the tables are constructed so that no bits beyond that code are fetched when that code is decoded. */ { unsigned a; /* counter for codes of length k */ unsigned c[BMAX+1]; /* bit length count table */ unsigned el; /* length of EOB code (value 256) */ unsigned f; /* i repeats in table every f entries */ int g; /* maximum code length */ int h; /* table level */ register unsigned i; /* counter, current code */ register unsigned j; /* counter */ register int k; /* number of bits in current code */ int lx[BMAX+1]; /* memory for l[-1..BMAX-1] */ int *l = lx+1; /* stack of bits per table */ register unsigned *p; /* pointer into c[], b[], or v[] */ register struct huft *q; /* points to current table */ struct huft r; /* table entry for structure assignment */ struct huft *u[BMAX]; /* table stack */ unsigned v[N_MAX]; /* values in order of bit length */ register int w; /* bits before this table == (l * h) */ unsigned x[BMAX+1]; /* bit offsets, then code stack */ unsigned *xp; /* pointer into x */ int y; /* number of dummy codes added */ unsigned z; /* number of entries in current table */ /* Generate counts for each bit length */ el = n > 256 ? b[256] : BMAX; /* set length of EOB code, if any */ memset(c, 0, sizeof(c)); p = b; i = n; do { Tracecv(*p, (stderr, (n-i >= ' ' && n-i <= '~' ? "%c %d\n" : "0x%x %d\n"), n-i, *p)); c[*p]++; /* assume all entries <= BMAX */ p++; /* Can't combine with above line (Solaris bug) */ } while(--i); if(c[0] == n) /* null input--all zero length codes */ { *t = (struct huft *)NULL; *m = 0; return 0; } /* Find minimum and maximum length, bound *m by those */ for(j = 1; j <= BMAX; j++) if(c[j]) break; k = j; /* minimum code length */ if((unsigned)*m < j) *m = j; for(i = BMAX; i; i--) if(c[i]) break; g = i; /* maximum code length */ if((unsigned)*m > i) *m = i; /* Adjust last length count to fill out codes, if needed */ for(y = 1 << j; j < i; j++, y <<= 1) if((y -= c[j]) < 0) return 2; /* bad input: more codes than bits */ if((y -= c[i]) < 0) return 2; c[i] += y; /* Generate starting offsets into the value table for each length */ x[1] = j = 0; p = c + 1; xp = x + 2; while(--i) /* note that i == g from above */ *xp++ = (j += *p++); /* Make a table of values in order of bit lengths */ memset(v, 0, sizeof(v)); p = b; i = 0; do { if((j = *p++) != 0) v[x[j]++] = i; } while(++i < n); n = x[g]; /* set n to length of v */ /* Generate the Huffman codes and for each, make the table entries */ x[0] = i = 0; /* first Huffman code is zero */ p = v; /* grab values in bit order */ h = -1; /* no tables yet--level -1 */ w = l[-1] = 0; /* no bits decoded yet */ u[0] = (struct huft *)NULL; /* just to keep compilers happy */ q = (struct huft *)NULL; /* ditto */ z = 0; /* ditto */ /* go through the bit lengths (k already is bits in shortest code) */ for(; k <= g; k++) { a = c[k]; while(a--) { /* here i is the Huffman code of length k bits for value *p */ /* make tables up to required level */ while(k > w + l[h]) { w += l[h++]; /* add bits already decoded */ /* compute minimum size table less than or equal to *m bits */ z = (z = g - w) > (unsigned)*m ? *m : z; /* upper limit */ if((f = 1 << (j = k - w)) > a + 1) /* try a k-w bit table */ { /* too few codes for k-w bit table */ f -= a + 1; /* deduct codes from patterns left */ xp = c + k; while(++j < z)/* try smaller tables up to z bits */ { if((f <<= 1) <= *++xp) break; /* enough codes to use up j bits */ f -= *xp; /* else deduct codes from patterns */ } } if((unsigned)w + j > el && (unsigned)w < el) j = el - w; /* make EOB code end at table */ z = 1 << j; /* table entries for j-bit table */ l[h] = j; /* set table size in stack */ /* allocate and link in new table */ if(pool == NULL) q = (struct huft *)malloc((z + 1)*sizeof(struct huft)); else q = (struct huft *) new_segment(pool, (z + 1)*sizeof(struct huft)); if(q == NULL) { if(h && pool == NULL) huft_free(u[0]); return 3; /* not enough memory */ } *t = q + 1; /* link to list for huft_free() */ *(t = &(q->v.t)) = (struct huft *)NULL; u[h] = ++q; /* table starts after link */ /* connect to last table, if there is one */ if(h) { x[h] = i; /* save pattern for backing up */ r.b = (uch)l[h-1]; /* bits to dump before this table */ r.e = (uch)(16 + j);/* bits in this table */ r.v.t = q; /* pointer to this table */ j = (i & ((1 << w) - 1)) >> (w - l[h-1]); u[h-1][j] = r; /* connect to last table */ } } /* set up table entry in r */ r.b = (uch)(k - w); if(p >= v + n) r.e = 99; /* out of values--invalid code */ else if(*p < s) { r.e = (uch)(*p < 256 ? 16 : 15); /* 256 is end-of-block code */ r.v.n = (ush)*p++; /* simple code is just the value */ } else { r.e = (uch)e[*p - s]; /* non-simple--look up in lists */ r.v.n = d[*p++ - s]; } /* fill code-like entries with r */ f = 1 << (k - w); for(j = i >> w; j < z; j += f) q[j] = r; /* backwards increment the k-bit code i */ for(j = 1 << (k - 1); i & j; j >>= 1) i ^= j; i ^= j; /* backup over finished tables */ while((i & ((1 << w) - 1)) != x[h]) w -= l[--h]; /* don't need to update q */ } } /* return actual size of base table */ *m = l[0]; /* Return true (1) if we were given an incomplete table */ return y != 0 && g != 1; } local int huft_free(struct huft *t) /* Free the malloc'ed tables built by huft_build(), which makes a linked list of the tables it made, with the links in a dummy first entry of each table. */ { register struct huft *p, *q; /* Go through linked list, freeing from the malloced (t[-1]) address. */ p = t; while(p != (struct huft *)NULL) { q = (--p)->v.t; free((char*)p); p = q; } return 0; } local long inflate_codes(InflateHandler decoder, char *buff, long size) /* inflate (decompress) the codes in a deflated (compressed) block. Return an error code or zero if it all goes ok. */ { register unsigned e;/* table entry flag/number of extra bits */ struct huft *t; /* pointer to table entry */ int n; struct huft *tl, *td;/* literal/length and distance decoder tables */ int bl, bd; /* number of bits decoded by tl[] and td[] */ unsigned l, w, d; uch *slide; BITS_SAVE; if(size == 0) return 0; slide = decoder->slide; tl = decoder->tl; td = decoder->td; bl = decoder->bl; bd = decoder->bd; #ifdef DEBUG if(decoder->copy_leng != 0) { fprintf(stderr, "What ? (decoder->copy_leng = %d)\n", decoder->copy_leng); abort(); } #endif /* DEBUG */ w = decoder->wp; /* inflate the coded data */ n = 0; for(;;) /* do until end of block */ { NEEDBITS((unsigned)bl); t = tl + GETBITS(bl); e = t->e; while(e > 16) { if(e == 99) return -1; DUMPBITS(t->b); e -= 16; NEEDBITS(e); t = t->v.t + GETBITS(e); e = t->e; } DUMPBITS(t->b); if(e == 16) /* then it's a literal */ { w &= WSIZE - 1; buff[n++] = slide[w++] = (uch)t->v.n; if(n == size) { decoder->wp = w; BITS_RESTORE; return size; } continue; } /* exit if end of block */ if(e == 15) break; /* it's an EOB or a length */ /* get length of block to copy */ NEEDBITS(e); l = t->v.n + GETBITS(e); DUMPBITS(e); /* decode distance of block to copy */ NEEDBITS((unsigned)bd); t = td + GETBITS(bd); e = t->e; while(e > 16) { if(e == 99) return -1; DUMPBITS(t->b); e -= 16; NEEDBITS(e); t = t->v.t + GETBITS(e); e = t->e; } DUMPBITS(t->b); NEEDBITS(e); d = w - t->v.n - GETBITS(e); DUMPBITS(e); /* do the copy */ while(l > 0 && n < size) { l--; d &= WSIZE - 1; w &= WSIZE - 1; buff[n++] = slide[w++] = slide[d++]; } if(n == size) { decoder->copy_leng = l; decoder->wp = w; decoder->copy_dist = d; BITS_RESTORE; return n; } } decoder->wp = w; decoder->method = -1; /* done */ BITS_RESTORE; return n; } local long inflate_stored(InflateHandler decoder, char *buff, long size) /* "decompress" an inflated type 0 (stored) block. */ { unsigned n, l, w; BITS_SAVE; /* go to byte boundary */ n = bit_len & 7; DUMPBITS(n); /* get the length and its complement */ NEEDBITS(16); n = GETBITS(16); DUMPBITS(16); NEEDBITS(16); if(n != (unsigned)((~bit_buf) & 0xffff)) { BITS_RESTORE; return -1; /* error in compressed data */ } DUMPBITS(16); /* read and output the compressed data */ decoder->copy_leng = n; n = 0; l = decoder->copy_leng; w = decoder->wp; while(l > 0 && n < size) { l--; w &= WSIZE - 1; NEEDBITS(8); buff[n++] = decoder->slide[w++] = (uch)GETBITS(8); DUMPBITS(8); } if(l == 0) decoder->method = -1; /* done */ decoder->copy_leng = l; decoder->wp = w; BITS_RESTORE; return (long)n; } local long inflate_fixed(InflateHandler decoder, char *buff, long size) /* decompress an inflated type 1 (fixed Huffman codes) block. We should either replace this with a custom decoder, or at least precompute the Huffman tables. */ { /* if first time, set up tables for fixed blocks */ if(decoder->fixed_tl == NULL) { int i; /* temporary variable */ unsigned l[288]; /* length list for huft_build */ /* literal table */ for(i = 0; i < 144; i++) l[i] = 8; for(; i < 256; i++) l[i] = 9; for(; i < 280; i++) l[i] = 7; for(; i < 288; i++) /* make a complete, but wrong code set */ l[i] = 8; decoder->fixed_bl = 7; if((i = huft_build(l, 288, 257, cplens, cplext, &decoder->fixed_tl, &decoder->fixed_bl, NULL)) != 0) { decoder->fixed_tl = NULL; return -1; } /* distance table */ for(i = 0; i < 30; i++) /* make an incomplete code set */ l[i] = 5; decoder->fixed_bd = 5; if((i = huft_build(l, 30, 0, cpdist, cpdext, &decoder->fixed_td, &decoder->fixed_bd, NULL)) > 1) { huft_free(decoder->fixed_tl); decoder->fixed_tl = NULL; return -1; } } decoder->tl = decoder->fixed_tl; decoder->td = decoder->fixed_td; decoder->bl = decoder->fixed_bl; decoder->bd = decoder->fixed_bd; return inflate_codes(decoder, buff, size); } local long inflate_dynamic(InflateHandler decoder, char *buff, long size) /* decompress an inflated type 2 (dynamic Huffman codes) block. */ { int i; /* temporary variables */ unsigned j; unsigned l; /* last length */ unsigned n; /* number of lengths to get */ struct huft *tl; /* literal/length code table */ struct huft *td; /* distance code table */ int bl; /* lookup bits for tl */ int bd; /* lookup bits for td */ unsigned nb; /* number of bit length codes */ unsigned nl; /* number of literal/length codes */ unsigned nd; /* number of distance codes */ #ifdef PKZIP_BUG_WORKAROUND unsigned ll[288+32];/* literal/length and distance code lengths */ #else unsigned ll[286+30];/* literal/length and distance code lengths */ #endif static unsigned border[] = { /* Order of the bit length code lengths */ 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15}; BITS_SAVE; reuse_mblock(&decoder->pool); /* read in table lengths */ NEEDBITS(5); nl = 257 + GETBITS(5); /* number of literal/length codes */ DUMPBITS(5); NEEDBITS(5); nd = 1 + GETBITS(5); /* number of distance codes */ DUMPBITS(5); NEEDBITS(4); nb = 4 + GETBITS(4); /* number of bit length codes */ DUMPBITS(4); #ifdef PKZIP_BUG_WORKAROUND if(nl > 288 || nd > 32) #else if(nl > 286 || nd > 30) #endif { BITS_RESTORE; return -1; /* bad lengths */ } /* read in bit-length-code lengths */ for(j = 0; j < nb; j++) { NEEDBITS(3); ll[border[j]] = GETBITS(3); DUMPBITS(3); } for(; j < 19; j++) ll[border[j]] = 0; /* build decoding table for trees--single level, 7 bit lookup */ bl = 7; if((i = huft_build(ll, 19, 19, NULL, NULL, &tl, &bl, &decoder->pool)) != 0) { reuse_mblock(&decoder->pool); BITS_RESTORE; return -1; /* incomplete code set */ } /* read in literal and distance code lengths */ n = nl + nd; i = l = 0; while((unsigned)i < n) { NEEDBITS((unsigned)bl); j = (td = tl + (GETBITS(bl)))->b; DUMPBITS(j); j = td->v.n; if(j < 16) /* length of code in bits (0..15) */ ll[i++] = l = j; /* save last length in l */ else if(j == 16) /* repeat last length 3 to 6 times */ { NEEDBITS(2); j = 3 + GETBITS(2); DUMPBITS(2); if((unsigned)i + j > n) { BITS_RESTORE; return -1; } while(j--) ll[i++] = l; } else if(j == 17) /* 3 to 10 zero length codes */ { NEEDBITS(3); j = 3 + GETBITS(3); DUMPBITS(3); if((unsigned)i + j > n) { BITS_RESTORE; return -1; } while(j--) ll[i++] = 0; l = 0; } else /* j == 18: 11 to 138 zero length codes */ { NEEDBITS(7); j = 11 + GETBITS(7); DUMPBITS(7); if((unsigned)i + j > n) { BITS_RESTORE; return -1; } while(j--) ll[i++] = 0; l = 0; } } BITS_RESTORE; /* free decoding table for trees */ reuse_mblock(&decoder->pool); /* build the decoding tables for literal/length and distance codes */ bl = lbits; i = huft_build(ll, nl, 257, cplens, cplext, &tl, &bl, &decoder->pool); if(bl == 0) /* no literals or lengths */ i = 1; if(i) { if(i == 1) fprintf(stderr, " incomplete literal tree\n"); reuse_mblock(&decoder->pool); return -1; /* incomplete code set */ } bd = dbits; i = huft_build(ll + nl, nd, 0, cpdist, cpdext, &td, &bd, &decoder->pool); if(bd == 0 && nl > 257) /* lengths but no distances */ { fprintf(stderr, " incomplete distance tree\n"); reuse_mblock(&decoder->pool); return -1; } if(i == 1) { #ifdef PKZIP_BUG_WORKAROUND i = 0; #else fprintf(stderr, " incomplete distance tree\n"); #endif } if(i) { reuse_mblock(&decoder->pool); return -1; } /* decompress until an end-of-block code */ decoder->tl = tl; decoder->td = td; decoder->bl = bl; decoder->bd = bd; i = inflate_codes(decoder, buff, size); if(i == -1) /* error */ { reuse_mblock(&decoder->pool); return -1; } /* free the decoding tables, return */ return i; } local void inflate_start(InflateHandler decoder) /* initialize window, bit buffer */ { decoder->wp = 0; decoder->bit_buf = 0; decoder->bit_len = 0; decoder->insize = decoder->inptr = 0; decoder->fixed_td = decoder->fixed_tl = NULL; decoder->method = -1; decoder->eof = 0; decoder->copy_leng = decoder->copy_dist = 0; decoder->tl = NULL; init_mblock(&decoder->pool); } /*ARGSUSED*/ static long default_read_func(char *buf, long size, void *v) { return (long)fread(buf, 1, size, stdin); } InflateHandler open_inflate_handler( long (* read_func)(char *buf, long size, void *user_val), void *user_val) { InflateHandler decoder; decoder = (InflateHandler) malloc(sizeof(struct _InflateHandler)); inflate_start(decoder); decoder->user_val = user_val; if(read_func == NULL) decoder->read_func = default_read_func; else decoder->read_func = read_func; return decoder; } void close_inflate_handler(InflateHandler decoder) { if(decoder->fixed_tl != NULL) { huft_free(decoder->fixed_td); huft_free(decoder->fixed_tl); decoder->fixed_td = decoder->fixed_tl = NULL; } reuse_mblock(&decoder->pool); free(decoder); } /* decompress an inflated entry */ long zip_inflate( InflateHandler decoder, char *buff, long size) { long n, i; n = 0; while(n < size) { if(decoder->eof && decoder->method == -1) return n; if(decoder->copy_leng > 0) { unsigned l, w, d; l = decoder->copy_leng; w = decoder->wp; if(decoder->method != STORED_BLOCK) { /* STATIC_TREES or DYN_TREES */ d = decoder->copy_dist; while(l > 0 && n < size) { l--; d &= WSIZE - 1; w &= WSIZE - 1; buff[n++] = decoder->slide[w++] = decoder->slide[d++]; } decoder->copy_dist = d; } else /* STATIC_TREES or DYN_TREES */ { BITS_SAVE; while(l > 0 && n < size) { l--; w &= WSIZE - 1; NEEDBITS(8); buff[n++] = decoder->slide[w++] = (uch)GETBITS(8); DUMPBITS(8); } BITS_RESTORE; if(l == 0) decoder->method = -1; /* done */ } decoder->copy_leng = l; decoder->wp = w; if(n == size) return n; } if(decoder->method == -1) { BITS_SAVE; if(decoder->eof) { BITS_RESTORE; break; } /* read in last block bit */ NEEDBITS(1); if(GETBITS(1)) decoder->eof = 1; DUMPBITS(1); /* read in block type */ NEEDBITS(2); decoder->method = (int)GETBITS(2); DUMPBITS(2); decoder->tl = NULL; decoder->copy_leng = 0; BITS_RESTORE; } switch(decoder->method) { case STORED_BLOCK: i = inflate_stored(decoder, buff + n, size - n); break; case STATIC_TREES: if(decoder->tl != NULL) i = inflate_codes(decoder, buff + n, size - n); else i = inflate_fixed(decoder, buff + n, size - n); break; case DYN_TREES: if(decoder->tl != NULL) i = inflate_codes(decoder, buff + n, size - n); else i = inflate_dynamic(decoder, buff + n, size - n); break; default: /* error */ i = -1; break; } if(i == -1) { if(decoder->eof) return 0; return -1; /* error */ } n += i; } return n; } /* =========================================================================== * Fill the input buffer. This is called only when the buffer is empty. */ local int fill_inbuf(InflateHandler decoder) { int len; /* Read as much as possible */ decoder->insize = 0; errno = 0; do { len = decoder->read_func((char*)decoder->inbuf + decoder->insize, (long)(INBUFSIZ - decoder->insize), decoder->user_val); if(len == 0 || len == EOF) break; decoder->insize += len; } while(decoder->insize < INBUFSIZ); if(decoder->insize == 0) return EOF; decoder->inptr = 1; return decoder->inbuf[0]; } TiMidity++-2.13.2/libarc/unlzh.c0100644004711200001440000006770707611477716015476 0ustar tamukiusers/* TiMidity++ -- MIDI to WAVE converter and player Copyright (C) 1999-2002 Masanao Izumo Copyright (C) 1995 Tuukka Toivonen 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ #include #include #ifndef NO_STRING_H #include #else #include #endif #include "timidity.h" #include "unlzh.h" #ifndef UCHAR_MAX #define UCHAR_MAX 255 /* max value for an unsigned char */ #endif #ifndef CHAR_BIT #define CHAR_BIT 8 #endif #define MAX_DICBIT 15 #define MAXMATCH 256 /* formerly F (not more than UCHAR_MAX + 1) */ #define THRESHOLD 3 /* choose optimal value */ #define NC (UCHAR_MAX + MAXMATCH + 2 - THRESHOLD) /* alphabet = {0, 1, 2, ..., NC - 1} */ #define CBIT 9 /* $\lfloor \log_2 NC \rfloor + 1$ */ #define USHRT_BIT 16 /* (CHAR_BIT * sizeof(ushort)) */ #define NP (MAX_DICBIT + 1) #define NT (USHRT_BIT + 3) #define PBIT 4 /* smallest integer such that (1 << PBIT) > NP */ #define TBIT 5 /* smallest integer such that (1 << TBIT) > NT */ #define NPT 0x80 #define N1 286 /* alphabet size */ #define N2 (2 * N1 - 1) /* # of nodes in Huffman tree */ #define EXTRABITS 8 /* >= log2(F-THRESHOLD+258-N1) */ #define BUFBITS 16 /* >= log2(MAXBUF) */ #define LENFIELD 4 /* bit size of length field for tree output */ #define SNP (8 * 1024 / 64) #define SNP2 (SNP * 2 - 1) #define N_CHAR (256 + 60 - THRESHOLD + 1) #define TREESIZE_C (N_CHAR * 2) #define TREESIZE_P (128 * 2) #define TREESIZE (TREESIZE_C + TREESIZE_P) #define ROOT_C 0 #define ROOT_P TREESIZE_C #define MAGIC0 18 #define MAGIC5 19 #define INBUFSIZ BUFSIZ struct _UNLZHHandler { void *user_val; long (* read_func)(char *buff, long buff_size, void *user_val); int method; unsigned char inbuf[INBUFSIZ]; int inbuf_size; int inbuf_cnt; int initflag; int cpylen; int cpypos; unsigned long origsize; unsigned long compsize; void (* decode_s)(UNLZHHandler decoder); unsigned short (* decode_c)(UNLZHHandler decoder); unsigned short (* decode_p)(UNLZHHandler decoder); int dicbit; unsigned short maxmatch; unsigned long count; unsigned short loc; unsigned char text[1L<inbuf_cnt < decoder->inbuf_size ? (int)decoder->inbuf[decoder->inbuf_cnt++] : fill_inbuf(decoder)) static struct { char *id; int dicbit; void (*decode_s)(UNLZHHandler decoder); unsigned short (*decode_c)(UNLZHHandler decoder); unsigned short (*decode_p)(UNLZHHandler decoder); } method_table[] = { /* No compression */ {"-lh0-", 0, decode_start_cpy, decode_c_cpy, decode_p_cpy}, /* 4k sliding dictionary(max 60 bytes) + dynamic Huffman + fixed encoding of position */ {"-lh1-", 12, decode_start_fix, decode_c_dyn, decode_p_st0}, /* 8k sliding dictionary(max 256 bytes) + dynamic Huffman */ {"-lh2-", 13, decode_start_dyn, decode_c_dyn, decode_p_dyn}, /* 8k sliding dictionary(max 256 bytes) + static Huffman */ {"-lh3-", 13, decode_start_st0, decode_c_st0, decode_p_st0}, /* 4k sliding dictionary(max 256 bytes) + static Huffman + improved encoding of position and trees */ {"-lh4-", 12, decode_start_st1, decode_c_st1, decode_p_st1}, /* 8k sliding dictionary(max 256 bytes) + static Huffman + improved encoding of position and trees */ {"-lh5-", 13, decode_start_st1, decode_c_st1, decode_p_st1}, /* 2k sliding dictionary(max 17 bytes) */ {"-lzs-", 11, decode_start_lzs, decode_c_lzs, decode_p_lzs}, /* No compression */ {"-lz5-", 12, decode_start_lz5, decode_c_lz5, decode_p_lz5}, /* 4k sliding dictionary(max 17 bytes) */ {"-lz4-", 0, decode_start_cpy, decode_c_cpy, decode_p_cpy}, /* Directory */ {"-lhd-", 0, NULL, NULL, NULL}, /* 32k sliding dictionary + static Huffman */ {"-lh6-", 15, decode_start_st1, decode_c_st1, decode_p_st1}, #if 0 /* not supported */ /* 64k sliding dictionary + static Huffman */ {"-lh7-", 16, decode_start_st1, decode_c_st1, decode_p_st1}, #endif {NULL, 0, NULL, NULL} }; char *lzh_methods[] = { "-lh0-", "-lh1-", "-lh2-", "-lh3-", "-lh4-", "-lh5-", "-lzs-", "-lz5-", "-lz4-", "-lhd-", "-lh6-", "-lh7-", NULL }; /*ARGSUSED*/ static long default_read_func(char *buf, long size, void *v) { return (long)fread(buf, 1, size, stdin); } UNLZHHandler open_unlzh_handler(long (* read_func)(char *, long, void *), const char *method, long compsize, long origsize, void *user_val) { UNLZHHandler decoder; int i; for(i = 0; method_table[i].id != NULL; i++) if(!strcmp(method_table[i].id, method)) break; if(method_table[i].id == NULL) return NULL; /* Invalid method */ if((decoder = (UNLZHHandler)malloc(sizeof(struct _UNLZHHandler))) == NULL) return NULL; memset(decoder, 0, sizeof(struct _UNLZHHandler)); if(strcmp(method, "-lhd-") == 0) origsize = 0; decoder->method = i; decoder->dicbit = method_table[i].dicbit; decoder->decode_s = method_table[i].decode_s; decoder->decode_c = method_table[i].decode_c; decoder->decode_p = method_table[i].decode_p; decoder->compsize = compsize; decoder->origsize = origsize; decoder->user_val = user_val; decoder->cpylen = 0; decoder->cpypos = 0; decoder->offset = (decoder->method == 6) ? 0x100 - 2 : 0x100 - 3; decoder->count = 0; decoder->loc = 0; decoder->initflag = 0; if(read_func == NULL) decoder->read_func = default_read_func; else decoder->read_func = read_func; return decoder; } void close_unlzh_handler(UNLZHHandler decoder) { free(decoder); } long unlzh(UNLZHHandler decoder, char *buff, long buff_size) { long n; unsigned short dicsiz1; int offset; int cpylen, cpypos, loc; unsigned char *text; unsigned long origsize; if((origsize = decoder->origsize) == 0 || buff_size <= 0) return 0; if(!decoder->initflag) { decoder->initflag = 1; decoder->decode_s(decoder); } dicsiz1 = (1 << decoder->dicbit) - 1; n = 0; text = decoder->text; if(decoder->cpylen > 0) { cpylen = decoder->cpylen; cpypos = decoder->cpypos; loc = decoder->loc; while(cpylen > 0 && n < buff_size) { buff[n++] = text[loc++] = text[cpypos++]; loc &= dicsiz1; cpypos &= dicsiz1; cpylen--; } decoder->cpylen = cpylen; decoder->cpypos = cpypos; decoder->loc = loc; } if(n == buff_size) return buff_size; offset = decoder->offset; while(decoder->count < origsize && n < buff_size) { int c; c = decoder->decode_c(decoder); if(c <= UCHAR_MAX) { buff[n++] = decoder->text[decoder->loc++] = c; decoder->loc &= dicsiz1; decoder->count++; } else { int i, j, k, m; j = c - offset; i = (decoder->loc - decoder->decode_p(decoder) - 1) & dicsiz1; decoder->count += j; loc = decoder->loc; m = buff_size - n; if(m > j) m = j; for(k = 0; k < m; k++) { buff[n++] = text[loc++] = text[i++]; loc &= dicsiz1; i &= dicsiz1; } decoder->loc = loc; if(k < j) { decoder->cpylen = j - k; decoder->cpypos = i; break; } } } return n; } static unsigned short decode_c_cpy(UNLZHHandler decoder) { int c; if((c = NEXTBYTE) == EOF) return 0; return (unsigned short)c; } /*ARGSUSED*/ static unsigned short decode_p_cpy(UNLZHHandler decoder) { return 0; } static void decode_start_cpy(UNLZHHandler decoder) { init_getbits(decoder); } static void read_pt_len(UNLZHHandler decoder, short k, short nbit, short i_special) { short i, c, n; n = getbits(decoder, nbit); if(n == 0) { c = getbits(decoder, nbit); for(i = 0; i < k; i++) decoder->pt_len[i] = 0; for(i = 0; i < 256; i++) decoder->pt_table[i] = c; } else { i = 0; while(i < n) { c = decoder->bitbuf >> (16 - 3); if (c == 7) { unsigned short mask = 1 << (16 - 4); while(mask & decoder->bitbuf) { mask >>= 1; c++; } } fillbuf(decoder, (c < 7) ? 3 : c - 3); decoder->pt_len[i++] = c; if(i == i_special) { c = getbits(decoder, 2); while(--c >= 0) decoder->pt_len[i++] = 0; } } while(i < k) decoder->pt_len[i++] = 0; make_table(decoder, k, decoder->pt_len, 8, decoder->pt_table); } } static void read_c_len(UNLZHHandler decoder) { short i, c, n; n = getbits(decoder, CBIT); if(n == 0) { c = getbits(decoder, CBIT); for(i = 0; i < NC; i++) decoder->c_len[i] = 0; for(i = 0; i < 4096; i++) decoder->c_table[i] = c; } else { i = 0; while(i < n) { c = decoder->pt_table[decoder->bitbuf >> (16 - 8)]; if(c >= NT) { unsigned short mask = 1 << (16 - 9); do { if(decoder->bitbuf & mask) c = decoder->right[c]; else c = decoder->left[c]; mask >>= 1; } while(c >= NT); } fillbuf(decoder, decoder->pt_len[c]); if(c <= 2) { if(c == 0) c = 1; else if(c == 1) c = getbits(decoder, 4) + 3; else c = getbits(decoder, CBIT) + 20; while(--c >= 0) decoder->c_len[i++] = 0; } else decoder->c_len[i++] = c - 2; } while(i < NC) decoder->c_len[i++] = 0; make_table(decoder, NC, decoder->c_len, 12, decoder->c_table); } } static unsigned short decode_c_st1(UNLZHHandler decoder) { unsigned short j, mask; if(decoder->blocksize == 0) { decoder->blocksize = getbits(decoder, 16); read_pt_len(decoder, NT, TBIT, 3); read_c_len(decoder); read_pt_len(decoder, decoder->snp, decoder->pbit, -1); } decoder->blocksize--; j = decoder->c_table[decoder->bitbuf >> 4]; if(j < NC) fillbuf(decoder, decoder->c_len[j]); else { fillbuf(decoder, 12); mask = 1 << (16 - 1); do { if(decoder->bitbuf & mask) j = decoder->right[j]; else j = decoder->left[j]; mask >>= 1; } while(j >= NC); fillbuf(decoder, decoder->c_len[j] - 12); } return j; } static unsigned short decode_p_st1(UNLZHHandler decoder) { unsigned short j, mask; unsigned int np = decoder->snp; j = decoder->pt_table[decoder->bitbuf >> (16 - 8)]; if(j < np) fillbuf(decoder, decoder->pt_len[j]); else { fillbuf(decoder, 8); mask = 1 << (16 - 1); do { if(decoder->bitbuf & mask) j = decoder->right[j]; else j = decoder->left[j]; mask >>= 1; } while(j >= np); fillbuf(decoder, decoder->pt_len[j] - 8); } if(j != 0) j = (1 << (j - 1)) + getbits(decoder, j - 1); return j; } static void decode_start_st1(UNLZHHandler decoder) { if(decoder->dicbit <= (MAX_DICBIT - 2)) { decoder->snp = 14; decoder->pbit = 4; } else { decoder->snp = 16; decoder->pbit = 5; } init_getbits(decoder); decoder->blocksize = 0; } static void start_c_dyn(UNLZHHandler decoder) { int i, j, f; decoder->n1 = (decoder->n_max >= 256 + decoder->maxmatch - THRESHOLD + 1) ? 512 : decoder->n_max - 1; for(i = 0; i < TREESIZE_C; i++) { decoder->stock[i] = i; decoder->block[i] = 0; } for(i = 0, j = decoder->n_max * 2 - 2; i < decoder->n_max; i++, j--) { decoder->freq[j] = 1; decoder->child[j] = ~i; decoder->node[i] = j; decoder->block[j] = 1; } decoder->avail = 2; decoder->edge[1] = decoder->n_max - 1; i = decoder->n_max * 2 - 2; while(j >= 0) { f = decoder->freq[j] = decoder->freq[i] + decoder->freq[i - 1]; decoder->child[j] = i; decoder->parent[i] = decoder->parent[i - 1] = j; if(f == decoder->freq[j + 1]) { decoder->edge[decoder->block[j] = decoder->block[j + 1]] = j; } else { decoder->edge[decoder->block[j] = decoder->stock[decoder->avail++]] = j; } i -= 2; j--; } } static void start_p_dyn(UNLZHHandler decoder) { decoder->freq[ROOT_P] = 1; decoder->child[ROOT_P] = ~(N_CHAR); decoder->node[N_CHAR] = ROOT_P; decoder->edge[decoder->block[ROOT_P] = decoder->stock[decoder->avail++]] = ROOT_P; decoder->most_p = ROOT_P; decoder->total_p = 0; decoder->nn = 1 << decoder->dicbit; decoder->nextcount = 64; } static void decode_start_dyn(UNLZHHandler decoder) { decoder->n_max = 286; decoder->maxmatch = MAXMATCH; init_getbits(decoder); start_c_dyn(decoder); start_p_dyn(decoder); } static void reconst(UNLZHHandler decoder, int start, int end) { int i, j, k, l, b; unsigned int f, g; b = 0; for(i = j = start; i < end; i++) { if((k = decoder->child[i]) < 0) { decoder->freq[j] = (decoder->freq[i] + 1) / 2; decoder->child[j] = k; j++; } if(decoder->edge[b = decoder->block[i]] == i) { decoder->stock[--decoder->avail] = b; } } j--; i = end - 1; l = end - 2; while(i >= start) { while (i >= l) { decoder->freq[i] = decoder->freq[j]; decoder->child[i] = decoder->child[j]; i--; j--; } f = decoder->freq[l] + decoder->freq[l + 1]; for(k = start; f < decoder->freq[k]; k++) ; while(j >= k) { decoder->freq[i] = decoder->freq[j]; decoder->child[i] = decoder->child[j]; i--; j--; } decoder->freq[i] = f; decoder->child[i] = l + 1; i--; l -= 2; } f = 0; for(i = start; i < end; i++) { if((j = decoder->child[i]) < 0) decoder->node[~j] = i; else decoder->parent[j] = decoder->parent[j - 1] = i; if((g = decoder->freq[i]) == f) { decoder->block[i] = b; } else { decoder->edge[b = decoder->block[i] = decoder->stock[decoder->avail++]] = i; f = g; } } } static int swap_inc(UNLZHHandler decoder, int p) { int b, q, r, s; b = decoder->block[p]; if((q = decoder->edge[b]) != p) { /* swap for leader */ r = decoder->child[p]; s = decoder->child[q]; decoder->child[p] = s; decoder->child[q] = r; if(r >= 0) decoder->parent[r] = decoder->parent[r - 1] = q; else decoder->node[~r] = q; if(s >= 0) decoder->parent[s] = decoder->parent[s - 1] = p; else decoder->node[~s] = p; p = q; goto Adjust; } else if(b == decoder->block[p + 1]) { Adjust: decoder->edge[b]++; if(++decoder->freq[p] == decoder->freq[p - 1]) { decoder->block[p] = decoder->block[p - 1]; } else { decoder->edge[decoder->block[p] = decoder->stock[decoder->avail++]] = p; /* create block */ } } else if (++decoder->freq[p] == decoder->freq[p - 1]) { decoder->stock[--decoder->avail] = b; /* delete block */ decoder->block[p] = decoder->block[p - 1]; } return decoder->parent[p]; } static void update_c(UNLZHHandler decoder, int p) { int q; if(decoder->freq[ROOT_C] == 0x8000) { reconst(decoder, 0, decoder->n_max * 2 - 1); } decoder->freq[ROOT_C]++; q = decoder->node[p]; do { q = swap_inc(decoder, q); } while(q != ROOT_C); } static void update_p(UNLZHHandler decoder, int p) { int q; if(decoder->total_p == 0x8000) { reconst(decoder, ROOT_P, decoder->most_p + 1); decoder->total_p = decoder->freq[ROOT_P]; decoder->freq[ROOT_P] = 0xffff; } q = decoder->node[p + N_CHAR]; while(q != ROOT_P) { q = swap_inc(decoder, q); } decoder->total_p++; } static void make_new_node(UNLZHHandler decoder, int p) { int q, r; r = decoder->most_p + 1; q = r + 1; decoder->node[~(decoder->child[r] = decoder->child[decoder->most_p])] = r; decoder->child[q] = ~(p + N_CHAR); decoder->child[decoder->most_p] = q; decoder->freq[r] = decoder->freq[decoder->most_p]; decoder->freq[q] = 0; decoder->block[r] = decoder->block[decoder->most_p]; if(decoder->most_p == ROOT_P) { decoder->freq[ROOT_P] = 0xffff; decoder->edge[decoder->block[ROOT_P]]++; } decoder->parent[r] = decoder->parent[q] = decoder->most_p; decoder->edge[decoder->block[q] = decoder->stock[decoder->avail++]] = decoder->node[p + N_CHAR] = decoder->most_p = q; update_p(decoder, p); } static unsigned short decode_c_dyn(UNLZHHandler decoder) { int c; short buf, cnt; c = decoder->child[ROOT_C]; buf = decoder->bitbuf; cnt = 0; do { c = decoder->child[c - (buf < 0)]; buf <<= 1; if(++cnt == 16) { fillbuf(decoder, 16); buf = decoder->bitbuf; cnt = 0; } }while (c > 0); fillbuf(decoder, cnt); c = ~c; update_c(decoder, c); if(c == decoder->n1) c += getbits(decoder, 8); return c; } static unsigned short decode_p_dyn(UNLZHHandler decoder) { int c; short buf, cnt; while(decoder->count > decoder->nextcount) { make_new_node(decoder, (int)(decoder->nextcount / 64)); if((decoder->nextcount += 64) >= decoder->nn) decoder->nextcount = 0xffffffff; } c = decoder->child[ROOT_P]; buf = decoder->bitbuf; cnt = 0; while(c > 0) { c = decoder->child[c - (buf < 0)]; buf <<= 1; if(++cnt == 16) { fillbuf(decoder, 16); buf = decoder->bitbuf; cnt = 0; } } fillbuf(decoder, cnt); c = (~c) - N_CHAR; update_p(decoder, c); return (c << 6) + getbits(decoder, 6); } static void decode_start_st0(UNLZHHandler decoder) { decoder->n_max = 286; decoder->maxmatch = MAXMATCH; init_getbits(decoder); decoder->snp = 1 << (MAX_DICBIT - 6); decoder->blocksize = 0; } static int fixed[2][16] = { {3, 0x01, 0x04, 0x0c, 0x18, 0x30, 0}, /* old compatible */ {2, 0x01, 0x01, 0x03, 0x06, 0x0D, 0x1F, 0x4E, 0} /* 8K buf */ }; static void ready_made(UNLZHHandler decoder, int method) { int i, j; unsigned int code, weight; int *tbl; tbl = fixed[method]; j = *tbl++; weight = 1 << (16 - j); code = 0; for(i = 0; i < decoder->snp; i++) { while(*tbl == i) { j++; tbl++; weight >>= 1; } decoder->pt_len[i] = j; code += weight; } } static void read_tree_c(UNLZHHandler decoder) /* read tree from file */ { int i, c; i = 0; while(i < N1) { if(getbits(decoder, 1)) decoder->c_len[i] = getbits(decoder, LENFIELD) + 1; else decoder->c_len[i] = 0; if(++i == 3 && decoder->c_len[0] == 1 && decoder->c_len[1] == 1 && decoder->c_len[2] == 1) { c = getbits(decoder, CBIT); for(i = 0; i < N1; i++) decoder->c_len[i] = 0; for(i = 0; i < 4096; i++) decoder->c_table[i] = c; return; } } make_table(decoder, N1, decoder->c_len, 12, decoder->c_table); } static void read_tree_p(UNLZHHandler decoder) /* read tree from file */ { int i, c; i = 0; while(i < SNP) { decoder->pt_len[i] = getbits(decoder, LENFIELD); if(++i == 3 && decoder->pt_len[0] == 1 && decoder->pt_len[1] == 1 && decoder->pt_len[2] == 1) { c = getbits(decoder, MAX_DICBIT - 6); for(i = 0; i < SNP; i++) decoder->c_len[i] = 0; for(i = 0; i < 256; i++) decoder->c_table[i] = c; return; } } } static void decode_start_fix(UNLZHHandler decoder) { decoder->n_max = 314; decoder->maxmatch = 60; init_getbits(decoder); decoder->snp = 1 << (12 - 6); start_c_dyn(decoder); ready_made(decoder, 0); make_table(decoder, decoder->snp, decoder->pt_len, 8, decoder->pt_table); } static unsigned short decode_c_st0(UNLZHHandler decoder) { int i, j; if(decoder->blocksize == 0) /* read block head */ { /* read block blocksize */ decoder->blocksize = getbits(decoder, BUFBITS); read_tree_c(decoder); if(getbits(decoder, 1)) { read_tree_p(decoder); } else { ready_made(decoder, 1); } make_table(decoder, SNP, decoder->pt_len, 8, decoder->pt_table); } decoder->blocksize--; j = decoder->c_table[decoder->bitbuf >> 4]; if(j < N1) fillbuf(decoder, decoder->c_len[j]); else { fillbuf(decoder, 12); i = decoder->bitbuf; do { if((short)i < 0) j = decoder->right[j]; else j = decoder->left [j]; i <<= 1; } while(j >= N1); fillbuf(decoder, decoder->c_len[j] - 12); } if(j == N1 - 1) j += getbits(decoder, EXTRABITS); return j; } static unsigned short decode_p_st0(UNLZHHandler decoder) { int i, j; j = decoder->pt_table[decoder->bitbuf >> 8]; if(j < decoder->snp) { fillbuf(decoder, decoder->pt_len[j]); } else { fillbuf(decoder, 8); i = decoder->bitbuf; do { if((short)i < 0) j = decoder->right[j]; else j = decoder->left[j]; i <<= 1; } while(j >= decoder->snp); fillbuf(decoder, decoder->pt_len[j] - 8); } return (j << 6) + getbits(decoder, 6); } static unsigned short decode_c_lzs(UNLZHHandler decoder) { if(getbits(decoder, 1)) return getbits(decoder, 8); decoder->matchpos = getbits(decoder, 11); return getbits(decoder, 4) + 0x100; } static unsigned short decode_p_lzs(UNLZHHandler decoder) { return (decoder->loc - decoder->matchpos - MAGIC0) & 0x7ff; } static void decode_start_lzs(UNLZHHandler decoder) { init_getbits(decoder); } static unsigned short decode_c_lz5(UNLZHHandler decoder) { int c; if(decoder->flagcnt == 0) { decoder->flagcnt = 8; decoder->flag = NEXTBYTE; } decoder->flagcnt--; c = NEXTBYTE; if((decoder->flag & 1) == 0) { decoder->matchpos = c; c = NEXTBYTE; decoder->matchpos += (c & 0xf0) << 4; c &= 0x0f; c += 0x100; } decoder->flag >>= 1; return c; } static unsigned short decode_p_lz5(UNLZHHandler decoder) { return (decoder->loc - decoder->matchpos - MAGIC5) & 0xfff; } static void decode_start_lz5(UNLZHHandler decoder) { int i; decoder->flagcnt = 0; for(i = 0; i < 256; i++) memset(&decoder->text[i * 13 + 18], i, 13); for(i = 0; i < 256; i++) decoder->text[256 * 13 + 18 + i] = i; for(i = 0; i < 256; i++) decoder->text[256 * 13 + 256 + 18 + i] = 255 - i; memset(&decoder->text[256 * 13 + 512 + 18], 0, 128); memset(&decoder->text[256 * 13 + 512 + 128 + 18], ' ', 128 - 18); } static int make_table(UNLZHHandler decoder, int nchar, unsigned char bitlen[], int tablebits, unsigned short table[]) { unsigned short cnttable[17]; /* count of bitlen */ unsigned short weight[17]; /* 0x10000ul >> bitlen */ unsigned short start[17]; /* first code of bitlen */ unsigned short total; unsigned int i; int j, k, l, m, n, available; unsigned short *p; available = nchar; /* initialize */ for(i = 1; i <= 16; i++) { cnttable[i] = 0; weight[i] = 1 << (16 - i); } /* cnttable */ for(i = 0; i < nchar; i++) cnttable[bitlen[i]]++; /* calculate first code */ total = 0; for(i = 1; i <= 16; i++) { start[i] = total; total += weight[i] * cnttable[i]; } if((total & 0xffff) != 0) { fprintf(stderr, "Decode: Bad table (5)\n"); /*exit(1);*/ /* for win32gui i/f 2002/8/17 */ return 1; } /* shift data for make table. */ m = 16 - tablebits; for(i = 1; i <= tablebits; i++) { start[i] >>= m; weight[i] >>= m; } /* initialize */ j = start[tablebits + 1] >> m; k = 1 << tablebits; if(j != 0) for(i = j; i < k; i++) table[i] = 0; /* create table and tree */ for(j = 0; j < nchar; j++) { k = bitlen[j]; if(k == 0) continue; l = start[k] + weight[k]; if(k <= tablebits) { /* code in table */ for(i = start[k]; i < l; i++) table[i] = j; } else { /* code not in table */ p = &table[(i = start[k]) >> m]; i <<= tablebits; n = k - tablebits; /* make tree (n length) */ while(--n >= 0) { if(*p == 0) { decoder->right[available] = decoder->left[available] = 0; *p = available++; } if(i & 0x8000) p = &decoder->right[*p]; else p = &decoder->left[*p]; i <<= 1; } *p = j; } start[k] = l; } return 0; } static int fill_inbuf(UNLZHHandler decoder) { long n, i; if(decoder->compsize == 0) return EOF; i = INBUFSIZ; if(i > decoder->compsize) i = (long)decoder->compsize; n = decoder->read_func((char *)decoder->inbuf, i, decoder->user_val); if(n <= 0) return EOF; decoder->inbuf_size = n; decoder->inbuf_cnt = 1; decoder->compsize -= n; return (int)decoder->inbuf[0]; } /* Shift bitbuf n bits left, read n bits */ static void fillbuf(UNLZHHandler decoder, unsigned char n) { unsigned char bitcount; unsigned short bitbuf; bitcount = decoder->bitcount; bitbuf = decoder->bitbuf; while(n > bitcount) { n -= bitcount; bitbuf = (bitbuf << bitcount) + (decoder->subbitbuf >> (CHAR_BIT - bitcount)); decoder->subbitbuf = (unsigned char)NEXTBYTE; bitcount = CHAR_BIT; } bitcount -= n; bitbuf = (bitbuf << n) + (decoder->subbitbuf >> (CHAR_BIT - n)); decoder->subbitbuf <<= n; decoder->bitcount = bitcount; decoder->bitbuf = bitbuf; } static unsigned short getbits(UNLZHHandler decoder, unsigned char n) { unsigned short x; x = decoder->bitbuf >> (2 * CHAR_BIT - n); fillbuf(decoder, n); return x; } static void init_getbits(UNLZHHandler decoder) { decoder->bitbuf = 0; decoder->subbitbuf = 0; decoder->bitcount = 0; decoder->inbuf_cnt = 0; decoder->inbuf_size = 0; fillbuf(decoder, 2 * CHAR_BIT); } TiMidity++-2.13.2/libarc/unlzh.h0100644004711200001440000000245607421005037015447 0ustar tamukiusers/* TiMidity++ -- MIDI to WAVE converter and player Copyright (C) 1999-2002 Masanao Izumo Copyright (C) 1995 Tuukka Toivonen 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef ___LZH_H_ #define ___LZH_H_ typedef struct _UNLZHHandler *UNLZHHandler; extern UNLZHHandler open_unlzh_handler(long (* read_func)(char*,long,void*), const char *method, long compsize, long origsize, void *user_val); extern long unlzh(UNLZHHandler decoder, char *buff, long buff_size); extern void close_unlzh_handler(UNLZHHandler decoder); extern char *lzh_methods[]; #endif /* ___LZH_H_ */ TiMidity++-2.13.2/libarc/url.c0100644004711200001440000002543407515567414015125 0ustar tamukiusers/* TiMidity++ -- MIDI to WAVE converter and player Copyright (C) 1999-2002 Masanao Izumo Copyright (C) 1995 Tuukka Toivonen 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ #include #include #include #ifndef NO_STRING_H #include #else #include #endif #include "timidity.h" #include "common.h" #include "url.h" /* #define DEBUG */ int url_errno; static struct URL_module *url_mod_list = NULL; char *user_mailaddr = NULL; char *url_user_agent = NULL; int url_newline_code = '\n'; char *url_lib_version = URL_LIB_VERSION; int uudecode_unquote_html = 0; void url_add_module(struct URL_module *m) { m->chain = url_mod_list; url_mod_list = m; } void url_add_modules(struct URL_module *m, ...) { va_list ap; struct URL_module *mod; if(m == NULL) return; url_add_module(m); va_start(ap, m); while((mod = va_arg(ap, struct URL_module *)) != NULL) url_add_module(mod); } static int url_init_nop(void) { /* Do nothing any more */ return 1; } int url_check_type(char *s) { struct URL_module *m; for(m = url_mod_list; m; m = m->chain) if(m->type != URL_none_t && m->name_check && m->name_check(s)) return m->type; return -1; } URL url_open(char *s) { struct URL_module *m; for(m = url_mod_list; m; m = m->chain) { #ifdef DEBUG printf("Check URL type=%d\n", m->type); #endif /* DEBUG */ if(m->type != URL_none_t && m->name_check && m->name_check(s)) { #ifdef DEBUG printf("open url (type=%d, name=%s)\n", m->type, s); #endif /* DEBUG */ if(m->url_init != url_init_nop) { if(m->url_init && m->url_init() < 0) return NULL; m->url_init = url_init_nop; } url_errno = URLERR_NONE; errno = 0; return m->url_open(s); } } url_errno = URLERR_NOURL; errno = ENOENT; return NULL; } long url_read(URL url, void *buff, long n) { if(n <= 0) return 0; url_errno = URLERR_NONE; errno = 0; if(url->nread >= url->readlimit) { url->eof = 1; return 0; } if(url->nread + n > url->readlimit) n = (long)(url->readlimit - url->nread); n = url->url_read(url, buff, n); if(n > 0) url->nread += n; return n; } long url_safe_read(URL url, void *buff, long n) { long i; if(n <= 0) return 0; do /* Ignore signal intruption */ { errno = 0; i = url_read(url, buff, n); } while(i == -1 && errno == EINTR); #if 0 /* Already done in url_read!! */ if(i > 0) url->nread += i; #endif return i; } long url_nread(URL url, void *buff, long n) { long insize = 0; char *s = (char *)buff; do { long i; i = url_safe_read(url, s + insize, n - insize); if(i <= 0) { if(insize == 0) return i; break; } insize += i; } while(insize < n); return insize; } char *url_gets(URL url, char *buff, int n) { if(url->nread >= url->readlimit) return NULL; if(url->url_gets == NULL) { int maxlen, i, c; int newline = url_newline_code; maxlen = n - 1; if(maxlen == 0) *buff = '\0'; if(maxlen <= 0) return buff; i = 0; do { if((c = url_getc(url)) == EOF) break; buff[i++] = c; } while(c != newline && i < maxlen); if(i == 0) return NULL; /* EOF */ buff[i] = '\0'; return buff; } url_errno = URLERR_NONE; errno = 0; if(url->nread + n > url->readlimit) n = (long)(url->readlimit - url->nread) + 1; buff = url->url_gets(url, buff, n); if(buff != NULL) url->nread += strlen(buff); return buff; } int url_readline(URL url, char *buff, int n) { int maxlen, i, c; maxlen = n - 1; if(maxlen == 0) *buff = '\0'; if(maxlen <= 0) return 0; do { i = 0; do { if((c = url_getc(url)) == EOF) break; buff[i++] = c; } while(c != '\r' && c != '\n' && i < maxlen); if(i == 0) return 0; /* EOF */ } while(i == 1 && (c == '\r' || c == '\n')); if(c == '\r' || c == '\n') i--; buff[i] = '\0'; return i; } int url_fgetc(URL url) { if(url->nread >= url->readlimit) return EOF; url->nread++; if(url->url_fgetc == NULL) { unsigned char c; if(url_read(url, &c, 1) <= 0) return EOF; return (int)c; } url_errno = URLERR_NONE; errno = 0; return url->url_fgetc(url); } long url_seek(URL url, long offset, int whence) { long pos, savelimit; if(url->url_seek == NULL) { if(whence == SEEK_CUR && offset >= 0) { pos = url_tell(url); if(offset == 0) return pos; savelimit = (long)url->readlimit; url->readlimit = URL_MAX_READLIMIT; url_skip(url, offset); url->readlimit = savelimit; url->nread = 0; return pos; } if(whence == SEEK_SET) { pos = url_tell(url); if(pos != -1 && pos <= offset) { if(pos == offset) return pos; savelimit = (long)url->readlimit; url->readlimit = URL_MAX_READLIMIT; url_skip(url, offset - pos); url->readlimit = savelimit; url->nread = 0; return pos; } } url_errno = errno = EPERM; return -1; } url_errno = URLERR_NONE; errno = 0; url->nread = 0; return url->url_seek(url, offset, whence); } long url_tell(URL url) { url_errno = URLERR_NONE; errno = 0; if(url->url_tell == NULL) return (long)url->nread; return url->url_tell(url); } void url_skip(URL url, long n) { char tmp[BUFSIZ]; if(url->url_seek != NULL) { long savenread; savenread = (long)url->nread; if(savenread >= url->readlimit) return; if(savenread + n > url->readlimit) n = (long)(url->readlimit - savenread); if(url->url_seek(url, n, SEEK_CUR) != -1) { url->nread = savenread + n; return; } url->nread = savenread; } while(n > 0) { long c; c = n; if(c > sizeof(tmp)) c = sizeof(tmp); c = url_read(url, tmp, c); if(c <= 0) break; n -= c; } } void url_rewind(URL url) { if(url->url_seek != NULL) url->url_seek(url, 0, SEEK_SET); url->nread = 0; } void url_set_readlimit(URL url, long readlimit) { if(readlimit < 0) url->readlimit = URL_MAX_READLIMIT; else url->readlimit = (unsigned long)readlimit; url->nread = 0; } URL alloc_url(int size) { URL url; #ifdef HAVE_SAFE_MALLOC url = (URL)safe_malloc(size); memset(url, 0, size); #else url = (URL)malloc(size); if(url != NULL) memset(url, 0, size); else url_errno = errno; #endif /* HAVE_SAFE_MALLOC */ url->nread = 0; url->readlimit = URL_MAX_READLIMIT; url->eof = 0; return url; } void url_close(URL url) { int save_errno = errno; if(url == NULL) { fprintf(stderr, "URL stream structure is NULL?\n"); #ifdef ABORT_AT_FATAL abort(); #endif /* ABORT_AT_FATAL */ } else if(url->url_close == NULL) { fprintf(stderr, "URL Error: Already URL is closed (type=%d)\n", url->type); #ifdef ABORT_AT_FATAL abort(); #endif /* ABORT_AT_FATAL */ } else { url->url_close(url); #if 0 url->url_close = NULL; #endif /* unix */ } errno = save_errno; } #if defined(TILD_SCHEME_ENABLE) #include char *url_expand_home_dir(char *fname) { static char path[BUFSIZ]; char *dir; int dirlen; if(fname[0] != '~') return fname; if(IS_PATH_SEP(fname[1])) /* ~/... */ { fname++; if((dir = getenv("HOME")) == NULL) if((dir = getenv("home")) == NULL) return fname; } else /* ~user/... */ { struct passwd *pw; int i; fname++; for(i = 0; i < sizeof(path) - 1 && fname[i] && !IS_PATH_SEP(fname[i]); i++) path[i] = fname[i]; path[i] = '\0'; if((pw = getpwnam(path)) == NULL) return fname - 1; fname += i; dir = pw->pw_dir; } dirlen = strlen(dir); strncpy(path, dir, sizeof(path) - 1); if(sizeof(path) > dirlen) strncat(path, fname, sizeof(path) - dirlen - 1); path[sizeof(path) - 1] = '\0'; return path; } char *url_unexpand_home_dir(char *fname) { static char path[BUFSIZ]; char *dir, *p; int dirlen; if(!IS_PATH_SEP(fname[0])) return fname; if((dir = getenv("HOME")) == NULL) if((dir = getenv("home")) == NULL) return fname; dirlen = strlen(dir); if(dirlen == 0 || dirlen >= sizeof(path) - 2) return fname; memcpy(path, dir, dirlen); if(!IS_PATH_SEP(path[dirlen - 1])) path[dirlen++] = PATH_SEP; #ifndef __W32__ if(strncmp(path, fname, dirlen) != 0) #else if(strncasecmp(path, fname, dirlen) != 0) #endif /* __W32__ */ return fname; path[0] = '~'; path[1] = '/'; p = fname + dirlen; if(strlen(p) >= sizeof(path) - 3) return fname; path[2] = '\0'; strcat(path, p); return path; } #else char *url_expand_home_dir(char *fname) { return fname; } char *url_unexpand_home_dir(char *fname) { return fname; } #endif static char *url_strerror_txt[] = { "", /* URLERR_NONE */ "Unknown URL", /* URLERR_NOURL */ "Operation not permitted", /* URLERR_OPERM */ "Can't open a URL", /* URLERR_CANTOPEN */ "Invalid URL form", /* URLERR_IURLF */ "URL too long", /* URLERR_URLTOOLONG */ "No mail address", /* URLERR_NOMAILADDR */ "" }; char *url_strerror(int no) { if(no <= URLERR_NONE) return strerror(no); if(no >= URLERR_MAXNO) return "Internal error"; return url_strerror_txt[no - URLERR_NONE]; } void *url_dump(URL url, long nbytes, long *read_size) { long allocated, offset, read_len; char *buff; if(read_size != NULL) *read_size = 0; if(nbytes == 0) return NULL; if(nbytes >= 0) { buff = (void *)safe_malloc(nbytes); if(nbytes == 0) return buff; read_len = url_nread(url, buff, nbytes); if(read_size != NULL) *read_size = read_len; if(read_len <= 0) { free(buff); return NULL; } return buff; } allocated = 1024; buff = (char *)safe_malloc(allocated); offset = 0; read_len = allocated; while((nbytes = url_read(url, buff + offset, read_len)) > 0) { offset += nbytes; read_len -= nbytes; if(offset == allocated) { read_len = allocated; allocated *= 2; buff = (char *)safe_realloc(buff, allocated); } } if(offset == 0) { free(buff); return NULL; } if(read_size != NULL) *read_size = offset; return buff; } TiMidity++-2.13.2/libarc/url.h0100644004711200001440000001622307421005037015106 0ustar tamukiusers/* TiMidity++ -- MIDI to WAVE converter and player Copyright (C) 1999-2002 Masanao Izumo Copyright (C) 1995 Tuukka Toivonen 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef ___URL_H_ #define ___URL_H_ /* This header file from liburl-1.8.3. * You can get full source from: * http://www.goice.co.jp/member/mo/release/index.html#liburl */ #define URL_LIB_VERSION "1.9.5" /* Define if you want to enable pipe command scheme ("command|") */ #define PIPE_SCHEME_ENABLE /* Define if you want to appended on a user's home directory if a filename * is beginning with '~' */ #if !defined(__MACOS__) && !defined(__W32__) #define TILD_SCHEME_ENABLE #endif /* Define if you want to use soft directory cache */ #ifndef URL_DIR_CACHE_DISABLE #define URL_DIR_CACHE_ENABLE #endif /* URL_DIR_CACHE_DISABLE */ /* Define if you want to use XOVER command in NNTP */ /* #define URL_NEWS_XOVER_SUPPORT "XOVER", "XOVERVIEW" */ /* M:Must, O:Optional defined */ typedef struct _URL { int type; /* M */ long (* url_read)(struct _URL *url, void *buff, long n); /* M */ char *(* url_gets)(struct _URL *url, char *buff, int n); /* O */ int (* url_fgetc)(struct _URL *url); /* O */ long (* url_seek)(struct _URL *url, long offset, int whence); /* O */ long (* url_tell)(struct _URL *url); /* O */ void (* url_close)(struct _URL *url); /* M */ unsigned long nread; /* Reset in url_seek, url_rewind, url_set_readlimit */ unsigned long readlimit; int eof; /* Used in url_nread and others */ } *URL; #define URLm(url, m) (((URL)url)->m) #define url_eof(url) URLm((url), eof) /* open URL stream */ extern URL url_open(char *url_string); /* close URL stream */ extern void url_close(URL url); /* read n bytes */ extern long url_read(URL url, void *buff, long n); extern long url_safe_read(URL url, void *buff, long n); extern long url_nread(URL url, void *buff, long n); /* read a line */ /* Like a fgets */ extern char *url_gets(URL url, char *buff, int n); /* Allow termination by CR or LF or both. Ignored empty lines. * CR or LF is truncated. * Success: length of the line. * EOF or Error: EOF */ extern int url_readline(URL url, char *buff, int n); /* read a byte */ extern int url_fgetc(URL url); #define url_getc(url) \ ((url)->nread >= (url)->readlimit ? ((url)->eof = 1, EOF) : \ (url)->url_fgetc != NULL ? ((url)->nread++, (url)->url_fgetc(url)) : \ url_fgetc(url)) /* seek position */ extern long url_seek(URL url, long offset, int whence); /* get the current position */ extern long url_tell(URL url); /* skip n bytes */ extern void url_skip(URL url, long n); /* seek to first position */ extern void url_rewind(URL url); /* dump */ void *url_dump(URL url, long nbytes, long *real_read); /* set read limit */ void url_set_readlimit(URL url, long readlimit); /* url_errno to error message */ extern char *url_strerror(int no); /* allocate URL structure */ extern URL alloc_url(int size); /* Check URL type. */ extern int url_check_type(char *url_string); /* replace `~' to user directory */ extern char *url_expand_home_dir(char *filename); extern char *url_unexpand_home_dir(char *filename); extern int url_errno; enum url_errtypes { URLERR_NONE = 10000, /* < 10000 represent system call's errno */ URLERR_NOURL, /* Unknown URL */ URLERR_OPERM, /* Operation not permitted */ URLERR_CANTOPEN, /* Can't open a URL */ URLERR_IURLF, /* Invalid URL form */ URLERR_URLTOOLONG, /* URL too long */ URLERR_NOMAILADDR, /* No mail address */ URLERR_MAXNO }; struct URL_module { /* url type */ int type; /* URL checker */ int (* name_check)(char *url_string); /* Once call just before url_open(). */ int (* url_init)(void); /* Open specified URL */ URL (* url_open)(char *url_string); /* chain next modules */ struct URL_module *chain; }; extern void url_add_module(struct URL_module *m); extern void url_add_modules(struct URL_module *m, ...); extern URL url_file_open(char *filename); extern URL url_dir_open(char *directory_name); extern URL url_http_open(char *url_string); extern URL url_ftp_open(char *url_string); extern URL url_newsgroup_open(char *url_string); extern URL url_news_open(char *url_string); extern URL url_pipe_open(char *command); /* No URL_module */ extern URL url_mem_open(char *memory, long memsiz, int autofree); extern URL url_inflate_open(URL instream, long compsize, int autoclose); extern URL url_buff_open(URL url, int autoclose); extern URL url_cache_open(URL url, int autoclose); extern void url_cache_detach(URL url); extern void url_cache_disable(URL url); extern URL url_uudecode_open(URL reader, int autoclose); extern URL url_b64decode_open(URL reader, int autoclose); extern URL url_hqxdecode_open(URL reader, int dataonly, int autoclose); extern URL url_qsdecode_open(URL reader, int autoclose); extern URL url_cgi_escape_open(URL reader, int autoclose); extern URL url_cgi_unescape_open(URL reader, int autoclose); extern char *url_dir_name(URL url); extern char *url_newsgroup_name(URL url); extern int url_news_connection_cache(int flag); extern char *url_lib_version; extern char *user_mailaddr; extern char *url_user_agent; extern char *url_http_proxy_host; extern unsigned short url_http_proxy_port; extern char *url_ftp_proxy_host; extern unsigned short url_ftp_proxy_port; extern int url_newline_code; extern int uudecode_unquote_html; enum url_types { URL_none_t, /* Undefined URL */ URL_file_t, /* File system */ URL_dir_t, /* Directory entry */ URL_http_t, /* HTTP */ URL_ftp_t, /* FTP */ URL_news_t, /* NetNews article */ URL_newsgroup_t, /* NetNews group */ URL_pipe_t, /* Pipe */ URL_mem_t, /* On memory */ URL_buff_t, /* Buffered stream */ URL_cache_t, /* Cached stream */ URL_uudecode_t, /* UU decoder */ URL_b64decode_t, /* Base64 decoder */ URL_qsdecode_t, /* Quoted-string decoder */ URL_hqxdecode_t, /* HQX decoder */ URL_cgi_escape_t, /* WWW CGI Escape */ URL_cgi_unescape_t, /* WWW CGI Unescape */ URL_arc_t, /* arc stream */ URL_inflate_t = 99, /* LZ77 decode stream */ URL_extension_t = 100 /* extentional stream >= 100 */ }; enum url_news_conn_type { URL_NEWS_CONN_NO_CACHE, URL_NEWS_CONN_CACHE, URL_NEWS_CLOSE_CACHE, URL_NEWS_GET_FLAG }; #define IS_URL_SEEK_SAFE(url) ((url)->url_seek != NULL && \ (url)->type != URL_buff_t) #define URL_MAX_READLIMIT ((~(unsigned long)0) >> 1) #endif /* ___URL_H_ */ TiMidity++-2.13.2/libarc/url_b64decode.c0100644004711200001440000001267407421005037016726 0ustar tamukiusers/* TiMidity++ -- MIDI to WAVE converter and player Copyright (C) 1999-2002 Masanao Izumo Copyright (C) 1995 Tuukka Toivonen 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ #include #include #ifndef NO_STRING_H #include #else #include #endif #include "timidity.h" #include "url.h" #define DECODEBUFSIZ 255 /* Must be power of 3 */ typedef struct _URL_b64decode { char common[sizeof(struct _URL)]; URL reader; long rpos; int beg, end, eof, eod; unsigned char decodebuf[DECODEBUFSIZ]; int autoclose; } URL_b64decode; static long url_b64decode_read(URL url, void *buff, long n); static int url_b64decode_fgetc(URL url); static long url_b64decode_tell(URL url); static void url_b64decode_close(URL url); URL url_b64decode_open(URL reader, int autoclose) { URL_b64decode *url; url = (URL_b64decode *)alloc_url(sizeof(URL_b64decode)); if(url == NULL) { if(autoclose) url_close(reader); url_errno = errno; return NULL; } /* common members */ URLm(url, type) = URL_b64decode_t; URLm(url, url_read) = url_b64decode_read; URLm(url, url_gets) = NULL; URLm(url, url_fgetc) = url_b64decode_fgetc; URLm(url, url_seek) = NULL; URLm(url, url_tell) = url_b64decode_tell; URLm(url, url_close) = url_b64decode_close; /* private members */ url->reader = reader; url->rpos = 0; url->beg = 0; url->end = 0; url->eof = url->eod = 0; memset(url->decodebuf, 0, sizeof(url->decodebuf)); url->autoclose = autoclose; return (URL)url; } static int b64getchar(URL reader) { int c; static int b64_decode_table[256] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 62, 0, 0, 0, 63, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 0, 0, 0, EOF, 0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 0, 0, 0, 0, 0, 0, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 0, 0, 0, 0, 0 }; do { if((c = url_getc(reader)) == EOF) return EOF; } while(c == '\r' || c == '\n'); return b64_decode_table[c]; } static int b64decode(URL_b64decode *urlp) { int c1, c2, c3, c4; int n; unsigned char *p; URL url; if(urlp->eod) { urlp->eof = 1; return 1; } p = urlp->decodebuf; url = urlp->reader; n = 0; while(n < DECODEBUFSIZ) { if((c1 = b64getchar(url)) == EOF) { urlp->eod = 1; break; } if((c2 = b64getchar(url)) == EOF) { urlp->eod = 1; break; } p[n++] = ((c1 << 2) | ((c2 & 0x30) >> 4)); if((c3 = b64getchar(url)) == EOF) { urlp->eod = 1; break; } p[n++] = (((c2 & 0xf) << 4) | ((c3 & 0x3c) >> 2)); if((c4 = b64getchar(url)) == EOF) { urlp->eod = 1; break; } p[n++] = (((c3 & 0x03) << 6) | c4); } urlp->rpos += urlp->beg; urlp->beg = 0; urlp->end = n; if(n == 0) { urlp->eof = 1; return 1; } return 0; } static long url_b64decode_read(URL url, void *buff, long size) { URL_b64decode *urlp = (URL_b64decode *)url; unsigned char *p = (unsigned char *)buff; long n; if(urlp->eof) return 0; n = 0; while(n < size) { int i; if(urlp->beg == urlp->end) if(b64decode(urlp)) break; i = urlp->end - urlp->beg; if(i > size - n) i = size - n; memcpy(p + n, urlp->decodebuf + urlp->beg, i); n += i; urlp->beg += i; } return n; } static int url_b64decode_fgetc(URL url) { URL_b64decode *urlp = (URL_b64decode *)url; if(urlp->eof) return EOF; if(urlp->beg == urlp->end) if(b64decode(urlp)) return EOF; return (int)urlp->decodebuf[urlp->beg++]; } static long url_b64decode_tell(URL url) { URL_b64decode *urlp = (URL_b64decode *)url; return urlp->rpos + urlp->beg; } static void url_b64decode_close(URL url) { URL_b64decode *urlp = (URL_b64decode *)url; if(urlp->autoclose) url_close(urlp->reader); free(url); } #ifdef B64DECODE_MAIN void main(int argc, char** argv) { URL b64decoder; char buff[256], *filename; int c; if(argc != 2) { fprintf(stderr, "Usage: %s b64-filename\n", argv[0]); exit(1); } filename = argv[1]; if((b64decoder = url_file_open(filename)) == NULL) { perror(argv[1]); url_close(b64decoder); exit(1); } b64decoder = url_b64decode_open(b64decoder, 1); #if B64DECODE_MAIN while((c = url_getc(b64decoder)) != EOF) putchar(c); #else while((c = url_read(b64decoder, buff, sizeof(buff))) > 0) write(1, buff, c); #endif url_close(b64decoder); exit(0); } #endif /* B64DECODE_MAIN */ TiMidity++-2.13.2/libarc/url_buff.c0100644004711200001440000001523007421005037016100 0ustar tamukiusers/* TiMidity++ -- MIDI to WAVE converter and player Copyright (C) 1999-2002 Masanao Izumo Copyright (C) 1995 Tuukka Toivonen 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ #include #include #ifndef NO_STRING_H #include #else #include #endif #include "timidity.h" #include "url.h" #define URL_BUFF_SIZE (8*1024) #define BASESIZE (URL_BUFF_SIZE * 2) #define BASEMASK (BASESIZE-1) typedef struct _URL_buff { char common[sizeof(struct _URL)]; URL reader; unsigned char buffer[BASESIZE + URL_BUFF_SIZE]; /* ring buffer */ int wp; /* write pointer to the buffer */ int rp; /* read pointer from the buffer */ long pos, posofs; /* position */ int weof; int eof; int autoclose; } URL_buff; static long url_buff_read(URL url, void *buff, long n); static char *url_buff_gets(URL url, char *buff, int n); static int url_buff_fgetc(URL url); static long url_buff_seek(URL url, long offset, int whence); static long url_buff_tell(URL url); static void url_buff_close(URL url); URL url_buff_open(URL url, int autoclose) { URL_buff *urlp; if((urlp = (URL_buff *)alloc_url(sizeof(URL_buff))) == NULL) { if(autoclose) url_close(url); return NULL; } /* common members */ URLm(urlp, type) = URL_buff_t; URLm(urlp, url_read) = url_buff_read; URLm(urlp, url_gets) = url_buff_gets; URLm(urlp, url_fgetc) = url_buff_fgetc; URLm(urlp, url_seek) = url_buff_seek; URLm(urlp, url_tell) = url_buff_tell; URLm(urlp, url_close) = url_buff_close; /* private members */ urlp->reader = url; memset(urlp->buffer, 0, sizeof(urlp->buffer)); urlp->wp = 0; urlp->rp = 0; if((urlp->posofs = url_tell(url)) == -1) urlp->posofs = 0; urlp->pos = 0; urlp->eof = 0; urlp->autoclose = autoclose; return (URL)urlp; } static void prefetch(URL_buff *urlp) { long i, n; n = url_safe_read(urlp->reader, urlp->buffer + urlp->wp, URL_BUFF_SIZE); if(n <= 0) return; urlp->wp += n; if(urlp->wp < BASESIZE) return; if(urlp->wp == BASESIZE) { urlp->wp = 0; return; } /* urlp->wp > BASESIZE */ i = urlp->wp - BASESIZE; memcpy(urlp->buffer, urlp->buffer + BASESIZE, i); urlp->wp = i; } static int url_buff_fgetc(URL url) { URL_buff *urlp = (URL_buff *)url; int c, r; if(urlp->eof) return EOF; r = urlp->rp; if(r == urlp->wp) { prefetch(urlp); if(r == urlp->wp) { urlp->eof = 1; return EOF; } } c = urlp->buffer[r]; urlp->rp = ((r + 1) & BASEMASK); urlp->pos++; return c; } static long url_buff_read(URL url, void *buff, long n) { URL_buff *urlp = (URL_buff *)url; char *s = (char *)buff; int r, i, j; if(urlp->eof) return 0; r = urlp->rp; if(r == urlp->wp) { prefetch(urlp); if(r == urlp->wp) { urlp->eof = 1; return EOF; } } /* first fragment */ i = urlp->wp - r; if(i < 0) i = BASESIZE - r; if(i > n) i = n; memcpy(s, urlp->buffer + r, i); r = ((r + i) & BASEMASK); if(i == n || r == urlp->wp || r != 0) { urlp->rp = r; urlp->pos += i; return i; } /* second fragment */ j = urlp->wp; n -= i; s += i; if(j > n) j = n; memcpy(s, urlp->buffer, j); urlp->rp = j; urlp->pos += i + j; return i + j; } static long url_buff_tell(URL url) { URL_buff *urlp = (URL_buff *)url; return urlp->pos + urlp->posofs; } static char *url_buff_gets(URL url, char *buff, int maxsiz) { URL_buff *urlp = (URL_buff *)url; int c, r, w; long len, maxlen; int newline = url_newline_code; unsigned char *bp; if(urlp->eof) return NULL; maxlen = maxsiz - 1; if(maxlen == 0) *buff = '\0'; if(maxlen <= 0) return buff; len = 0; r = urlp->rp; w = urlp->wp; bp = urlp->buffer; do { if(r == w) { urlp->wp = w; prefetch(urlp); w = urlp->wp; if(r == w) { urlp->eof = 1; if(len == 0) return NULL; buff[len] = '\0'; urlp->pos += len; urlp->rp = r; return buff; } } c = bp[r]; buff[len++] = c; r = ((r + 1) & BASEMASK); } while(c != newline && len < maxlen); buff[len] = '\0'; urlp->pos += len; urlp->rp = r; return buff; } static long url_buff_seek(URL url, long offset, int whence) { URL_buff *urlp = (URL_buff *)url; long ret, diff, n; int r, w, filled, i; ret = urlp->pos + urlp->posofs; switch(whence) { case SEEK_SET: diff = offset - ret; break; case SEEK_CUR: diff = offset; break; case SEEK_END: if(!urlp->eof) while(url_buff_fgetc(url) != EOF) ; diff = offset; break; default: url_errno = errno = EPERM; return -1; } if(diff == 0) { urlp->eof = 0; /* To be more read */ return ret; } n = 0; /* number of bytes to move */ r = urlp->rp; /* read pointer */ w = urlp->wp; /* write pointer */ if(diff > 0) { while(diff > 0) { if(r == w) { urlp->wp = w; prefetch(urlp); w = urlp->wp; if(r == w) { urlp->eof = 1; urlp->pos += n; urlp->rp = r; return ret; } } i = w - r; if(i < 0) i = BASESIZE - r; if(i > diff) i = diff; n += i; diff -= i; r = ((r + i) & BASEMASK); } urlp->pos += n; urlp->rp = r; urlp->eof = 0; /* To be more read */ return ret; } /* diff < 0 */ diff = -diff; filled = r - w; if(filled <= 0) filled = BASEMASK + filled; filled--; if(filled > urlp->pos) filled = urlp->pos; if(filled < diff) { url_errno = errno = EPERM; return -1; } /* back `rp' by `diff' */ r -= diff; if(r < 0) r += BASESIZE; urlp->rp = r; urlp->pos -= diff; urlp->eof = 0; /* To be more read */ return ret; } static void url_buff_close(URL url) { URL_buff *urlp = (URL_buff *)url; if(urlp->autoclose) url_close(urlp->reader); free(url); } TiMidity++-2.13.2/libarc/url_cache.c0100644004711200001440000001241707421005037016225 0ustar tamukiusers/* TiMidity++ -- MIDI to WAVE converter and player Copyright (C) 1999-2002 Masanao Izumo Copyright (C) 1995 Tuukka Toivonen 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ #include #include #include "timidity.h" #include "url.h" #include "memb.h" typedef struct _URL_cache { char common[sizeof(struct _URL)]; URL reader; int memb_ok; MemBuffer b; long pos; int autoclose; } URL_cache; static long url_cache_read(URL url, void *buff, long n); static int url_cache_fgetc(URL url); static long url_cache_seek(URL url, long offset, int whence); static long url_cache_tell(URL url); static void url_cache_close(URL url); URL url_cache_open(URL url, int autoclose) { URL_cache *urlp; if(url->type == URL_cache_t && autoclose) { if(((URL_cache *)url)->memb_ok) delete_memb(&((URL_cache *)url)->b); urlp = (URL_cache *)url; url = urlp->reader; } else { if((urlp = (URL_cache *)alloc_url(sizeof(URL_cache))) == NULL) { if(autoclose) url_close(url); return NULL; } } /* common members */ URLm(urlp, type) = URL_cache_t; URLm(urlp, url_read) = url_cache_read; URLm(urlp, url_gets) = NULL; URLm(urlp, url_fgetc) = url_cache_fgetc; URLm(urlp, url_seek) = url_cache_seek; URLm(urlp, url_tell) = url_cache_tell; URLm(urlp, url_close) = url_cache_close; /* private members */ urlp->reader = url; urlp->memb_ok = 1; init_memb(&urlp->b); urlp->pos = 0; urlp->autoclose = autoclose; return (URL)urlp; } void url_cache_disable(URL url) { if(url->type == URL_cache_t) url->url_seek = NULL; } void url_cache_detach(URL url) { if(url != NULL && url->type == URL_cache_t) { URL_cache *urlp = (URL_cache *)url; if(urlp->autoclose && urlp->reader != NULL) url_close(urlp->reader); urlp->reader = NULL; } } static long url_cache_read(URL url, void *buff, long n) { URL_cache *urlp = (URL_cache *)url; MemBuffer *b = &urlp->b; if(!urlp->memb_ok) { if(urlp->reader == NULL) return 0; n = url_read(urlp->reader, buff, n); if(n > 0) urlp->pos += n; return n; } if(urlp->pos < b->total_size) { if(n > b->total_size - urlp->pos) n = b->total_size - urlp->pos; urlp->pos += read_memb(b, buff, n); return n; } if(url->url_seek == NULL) { delete_memb(b); urlp->memb_ok = 0; if(urlp->reader == NULL) return 0; n = url_read(urlp->reader, buff, n); if(n > 0) urlp->pos += n; return n; } if(urlp->reader == NULL) return 0; n = url_read(urlp->reader, buff, n); if(n > 0) { push_memb(b, buff, n); b->cur = b->tail; b->cur->pos = b->cur->size; urlp->pos += n; } return n; } static int url_cache_fgetc(URL url) { URL_cache *urlp = (URL_cache *)url; MemBuffer *b = &urlp->b; char c; int i; if(!urlp->memb_ok) { if(urlp->reader == NULL) return EOF; if((i = url_getc(urlp->reader)) == EOF) return EOF; urlp->pos++; return i; } if(urlp->pos < b->total_size) { read_memb(b, &c, 1); urlp->pos++; return (int)(unsigned char)c; } if(url->url_seek == NULL) { delete_memb(b); urlp->memb_ok = 0; if(urlp->reader == NULL) return EOF; if((i = url_getc(urlp->reader)) == EOF) return EOF; urlp->pos++; return i; } if(urlp->reader == NULL) return EOF; if((i = url_getc(urlp->reader)) == EOF) return EOF; c = (char)i; push_memb(b, &c, 1); b->cur = b->tail; b->cur->pos = b->cur->size; urlp->pos++; return i; } static long url_cache_seek(URL url, long offset, int whence) { URL_cache *urlp = (URL_cache *)url; MemBuffer *b = &urlp->b; long ret, newpos, n, s; ret = urlp->pos; switch(whence) { case SEEK_SET: newpos = offset; break; case SEEK_CUR: newpos = ret + offset; break; case SEEK_END: while(url_cache_fgetc(url) != EOF) ; newpos = b->total_size + whence; break; default: url_errno = errno = EPERM; return -1; } if(newpos < 0) newpos = 0; n = newpos - ret; if(n < 0) { rewind_memb(b); n = newpos; urlp->pos = 0; } s = skip_read_memb(b, n); urlp->pos += s; while(s++ < n && url_cache_fgetc(url) != EOF) ; return ret; } static long url_cache_tell(URL url) { return ((URL_cache *)url)->pos; } static void url_cache_close(URL url) { URL_cache *urlp = (URL_cache *)url; if(urlp->autoclose && urlp->reader != NULL) url_close(urlp->reader); if(urlp->memb_ok) delete_memb(&urlp->b); free(urlp); } TiMidity++-2.13.2/libarc/url_dir.c0100644004711200001440000002352307541273632015753 0ustar tamukiusers/* TiMidity++ -- MIDI to WAVE converter and player Copyright (C) 1999-2002 Masanao Izumo Copyright (C) 1995 Tuukka Toivonen 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ #include #include #ifndef NO_STRING_H #include #else #include #endif #include "timidity.h" #include "common.h" #include "url.h" #ifdef __W32READDIR__ #include "readdir.h" # define NAMLEN(dirent) strlen((dirent)->d_name) #elif __MACOS__ # include "mac_readdir.h" # define NAMLEN(dirent) strlen((dirent)->d_name) #else #if HAVE_DIRENT_H # include # define NAMLEN(dirent) strlen((dirent)->d_name) #else # define dirent direct # define NAMLEN(dirent) (dirent)->d_namlen # if HAVE_SYS_NDIR_H # include # endif # if HAVE_SYS_DIR_H # include # endif # if HAVE_NDIR_H # include # endif #endif #endif #ifdef URL_DIR_CACHE_ENABLE #include #ifdef HAVE_FCNTL_H #include #endif /* HAVE_FCNTL_H */ #include "strtab.h" #ifndef S_ISDIR #define S_ISDIR(mode) (((mode)&0xF000) == 0x4000) #endif /* S_ISDIR */ #ifdef unix #define INODE_AVAILABLE #endif /* unix */ struct dir_cache_t { char **fnames; #ifdef INODE_AVAILABLE dev_t dev; ino_t ino; #else char *dirname; #endif time_t dir_mtime; struct dir_cache_t *next; }; static struct dir_cache_t *dir_cache = NULL; #ifdef INODE_AVAILABLE #define REMOVE_CACHE_ENT(p, isalloced) if(isalloced) free(p); else (p)->ino = 0 #else #define REMOVE_CACHE_ENT(p, isalloced) free((p)->dirname); if(isalloced) free(p); else p->dirname = NULL #endif /* INODE_AVAILABLE */ static struct dir_cache_t *scan_cached_files(struct dir_cache_t *p, struct stat *s, char *dirname) { StringTable stab; DIR *dirp; struct dirent *d; int allocated; if(p == NULL) { if((p = (struct dir_cache_t *)safe_malloc(sizeof(struct dir_cache_t))) == NULL) return NULL; allocated = 1; } else allocated = 0; /* save directory information */ #ifdef INODE_AVAILABLE p->ino = s->st_ino; p->dev = s->st_dev; #else p->dirname = safe_strdup(dirname); #endif /* INODE_AVAILABLE */ p->dir_mtime = s->st_mtime; if((dirp = opendir(dirname)) == NULL) { url_errno = errno; REMOVE_CACHE_ENT(p, allocated); errno = url_errno; return NULL; } init_string_table(&stab); while((d = readdir(dirp)) != NULL) { int dlen; #ifdef INODE_AVAILABLE if(d->d_ino == 0) continue; #endif if((dlen = NAMLEN(d)) == 0) continue; /* put into string table */ if(put_string_table(&stab, d->d_name, dlen) == NULL) { url_errno = errno; delete_string_table(&stab); REMOVE_CACHE_ENT(p, allocated); closedir(dirp); errno = url_errno; return NULL; } } closedir(dirp); /* make string array */ p->fnames = make_string_array(&stab); if(p->fnames == NULL) { url_errno = errno; delete_string_table(&stab); REMOVE_CACHE_ENT(p, allocated); errno = url_errno; return NULL; } return p; } static struct dir_cache_t *read_cached_files(char *dirname) { struct dir_cache_t *p, *q; struct stat s; if(stat(dirname, &s) < 0) return NULL; if(!S_ISDIR(s.st_mode)) { errno = url_errno = ENOTDIR; return NULL; } q = NULL; for(p = dir_cache; p; p = p->next) { #ifdef INODE_AVAILABLE if(p->ino == 0) #else if(p->dirname == NULL) #endif /* INODE_AVAILABLE */ { /* Entry is removed. * Save the entry to `q' which is reused for puting in new entry. */ if(q != NULL) q = p; continue; } #ifdef INODE_AVAILABLE if(s.st_dev == p->dev && s.st_ino == p->ino) #else if(strcmp(p->dirname, dirname) == 0) #endif /* INODE_AVAILABLE */ { /* found */ if(p->dir_mtime == s.st_mtime) return p; /* Directory entry is updated */ free(p->fnames[0]); free(p->fnames); #ifndef INODE_AVAILABLE free(p->dirname); #endif /* !INODE_AVAILABLE */ return scan_cached_files(p, &s, dirname); } } /* New directory */ if((p = scan_cached_files(q, &s, dirname)) == NULL) return NULL; p->next = dir_cache; dir_cache = p; return p; } #endif /* URL_DIR_CACHE_ENABLE */ typedef struct _URL_dir { char common[sizeof(struct _URL)]; #ifdef URL_DIR_CACHE_ENABLE char **fptr; #else DIR *dirp; struct dirent *d; #endif /* URL_DIR_CACHE_ENABLE */ char *ptr; int len; long total; char *dirname; int endp; } URL_dir; static int name_dir_check(char *url_string); static long url_dir_read(URL url, void *buff, long n); static char *url_dir_gets(URL url, char *buff, int n); static long url_dir_tell(URL url); static void url_dir_close(URL url); struct URL_module URL_module_dir = { URL_dir_t, /* type */ name_dir_check, /* URL checker */ NULL, /* initializer */ url_dir_open, /* open */ NULL /* must be NULL */ }; static int name_dir_check(char *url_string) { if(strncasecmp(url_string, "dir:", 4) == 0) return 1; url_string = pathsep_strrchr(url_string); return url_string != NULL && *(url_string + 1) == '\0'; } #ifdef URL_DIR_CACHE_ENABLE URL url_dir_open(char *dname) { struct dir_cache_t *d; URL_dir *url; int dlen; if(dname == NULL) dname = "."; else { if(strncasecmp(dname, "dir:", 4) == 0) dname += 4; if(*dname == '\0') dname = "."; else dname = url_expand_home_dir(dname); } dname = safe_strdup(dname); /* Remove tail of path sep. */ dlen = strlen(dname); while(dlen > 0 && IS_PATH_SEP(dname[dlen - 1])) dlen--; dname[dlen] = '\0'; if(dlen == 0) strcpy(dname, PATH_STRING); /* root */ d = read_cached_files(dname); if(d == NULL) { free(dname); return NULL; } url = (URL_dir *)alloc_url(sizeof(URL_dir)); if(url == NULL) { url_errno = errno; free(dname); errno = url_errno; /* restore errno */ return NULL; } /* common members */ URLm(url, type) = URL_dir_t; URLm(url, url_read) = url_dir_read; URLm(url, url_gets) = url_dir_gets; URLm(url, url_fgetc) = NULL; URLm(url, url_seek) = NULL; URLm(url, url_tell) = url_dir_tell; URLm(url, url_close) = url_dir_close; /* private members */ url->fptr = d->fnames; url->ptr = NULL; url->len = 0; url->total = 0; url->dirname = dname; url->endp = 0; return (URL)url; } #else URL url_dir_open(char *dname) { URL_dir *url; DIR *dirp; int dlen; if(dname == NULL) dname = "."; else { if(strncasecmp(dname, "dir:", 4) == 0) dname += 4; if(*dname == '\0') dname = "."; else dname = url_expand_home_dir(dname); } dname = safe_strdup(dname); /* Remove tail of path sep. */ dlen = strlen(dname); while(dlen > 0 && IS_PATH_SEP(dname[dlen - 1])) dlen--; dname[dlen] = '\0'; if(dlen == 0) strcpy(dname, PATH_STRING); /* root */ if((dirp = opendir(dname)) == NULL) { url_errno = errno; free(dname); errno = url_errno; return NULL; } url = (URL_dir *)alloc_url(sizeof(URL_dir)); if(url == NULL) { url_errno = errno; closedir(dirp); free(dname); errno = url_errno; return NULL; } /* common members */ URLm(url, type) = URL_dir_t; URLm(url, url_read) = url_dir_read; URLm(url, url_gets) = url_dir_gets; URLm(url, url_fgetc) = NULL; URLm(url, url_seek) = NULL; URLm(url, url_tell) = url_dir_tell; URLm(url, url_close) = url_dir_close; /* private members */ url->dirp = dirp; url->d = NULL; url->ptr = NULL; url->len = 0; url->total = 0; url->dirname = dname; url->endp = 0; return (URL)url; } #endif /* URL_DIR_CACHE_ENABLE */ static long url_dir_tell(URL url) { return ((URL_dir *)url)->total; } char *url_dir_name(URL url) { if(url->type != URL_dir_t) return NULL; return ((URL_dir *)url)->dirname; } static void url_dir_close(URL url) { URL_dir *urlp = (URL_dir *)url; #ifndef URL_DIR_CACHE_ENABLE closedir(urlp->dirp); #endif free(urlp->dirname); free(urlp); } static long url_dir_read(URL url, void *buff, long n) { char *p; p = url_dir_gets(url, (char *)buff, (int)n); if(p == NULL) return 0; return (long)strlen(p); } static char *url_dir_gets(URL url, char *buff, int n) { URL_dir *urlp = (URL_dir *)url; int i; if(urlp->endp) return NULL; if(n <= 0) return buff; if(n == 1) { *buff = '\0'; return buff; } n--; /* for '\0' */; for(;;) { if(urlp->len > 0) { i = urlp->len; if(i > n) i = n; memcpy(buff, urlp->ptr, i); buff[i] = '\0'; urlp->len -= i; urlp->ptr += i; urlp->total += i; return buff; } #ifdef URL_DIR_CACHE_ENABLE if(*urlp->fptr == NULL) { urlp->endp = 1; return NULL; } urlp->ptr = *urlp->fptr; urlp->fptr++; urlp->len = strlen(urlp->ptr); #else do if((urlp->d = readdir(urlp->dirp)) == NULL) { urlp->endp = 1; return NULL; } while ( #ifdef INODE_AVAILABLE urlp->d->d_ino == 0 || #endif /* INODE_AVAILABLE */ NAMLEN(urlp->d) == 0); urlp->ptr = urlp->d->d_name; urlp->len = NAMLEN(urlp->d); #endif } } TiMidity++-2.13.2/libarc/url_file.c0100644004711200001440000002174007422304760016106 0ustar tamukiusers/* TiMidity++ -- MIDI to WAVE converter and player Copyright (C) 1999-2002 Masanao Izumo Copyright (C) 1995 Tuukka Toivonen 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ #include #include #ifndef NO_STRING_H #include #else #include #endif #include #ifdef HAVE_UNISTD_H #include #endif /* HAVE_UNISTD_H */ #ifdef __W32__ #include #endif /* __W32__ */ #include "timidity.h" #ifdef HAVE_MMAP #include #include #include #ifndef MAP_FAILED #define MAP_FAILED ((caddr_t)-1) #endif /* MAP_FAILED */ #else /* mmap is not supported */ #ifdef __W32__ #define try_mmap(fname, size_ret) w32_mmap(fname, size_ret, &hFile, &hMap) #define munmap(addr, size) w32_munmap(addr, size, hFile, hMap) #else #define try_mmap(dmy1, dmy2) NULL #define munmap(addr, size) /* Do nothing */ #endif /* __W32__ */ #endif #include "url.h" #ifdef __MACOS__ #include "mblock.h" #endif #if !defined(__W32__) && !defined(O_BINARY) #define O_BINARY 0 #endif typedef struct _URL_file { char common[sizeof(struct _URL)]; char *mapptr; /* Non NULL if mmap is success */ long mapsize; long pos; #ifdef __W32__ HANDLE hFile, hMap; #endif /* __W32__ */ FILE *fp; /* Non NULL if mmap is failure */ } URL_file; static int name_file_check(char *url_string); static long url_file_read(URL url, void *buff, long n); static char *url_file_gets(URL url, char *buff, int n); static int url_file_fgetc(URL url); static long url_file_seek(URL url, long offset, int whence); static long url_file_tell(URL url); static void url_file_close(URL url); struct URL_module URL_module_file = { URL_file_t, /* type */ name_file_check, /* URL checker */ NULL, /* initializer */ url_file_open, /* open */ NULL /* must be NULL */ }; static int name_file_check(char *s) { int i; if(IS_PATH_SEP(s[0])) return 1; if(strncasecmp(s, "file:", 5) == 0) return 1; #ifdef __W32__ /* [A-Za-z]: (for Windows) */ if((('A' <= s[0] && s[0] <= 'Z') || ('a' <= s[0] && s[0] <= 'z')) && s[1] == ':') return 1; #endif /* __W32__ */ for(i = 0; s[i] && s[i] != ':' && s[i] != '/'; i++) ; if(s[i] == ':' && s[i + 1] == '/') return 0; return 1; } #ifdef HAVE_MMAP static char *try_mmap(char *path, long *size) { int fd; char *p; struct stat st; errno = 0; fd = open(path, O_RDONLY | O_BINARY); if(fd < 0) return NULL; if(fstat(fd, &st) < 0) { int save_errno = errno; close(fd); errno = save_errno; return NULL; } p = (char *)mmap(0, st.st_size, PROT_READ, MAP_PRIVATE, fd, 0); if(p == (char *)MAP_FAILED) { int save_errno = errno; close(fd); errno = save_errno; return NULL; } close(fd); *size = (long)st.st_size; return p; } #elif defined(__W32__) static void *w32_mmap(char *fname, long *size_ret, HANDLE *hFilePtr, HANDLE *hMapPtr) { void *map; *hFilePtr = CreateFile(fname, GENERIC_READ, FILE_SHARE_READ , NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); if(*hFilePtr == INVALID_HANDLE_VALUE) return NULL; *size_ret = GetFileSize(*hFilePtr, NULL); if(*size_ret == 0xffffffff) { CloseHandle(*hFilePtr); return NULL; } *hMapPtr = CreateFileMapping(*hFilePtr, NULL, PAGE_READONLY, 0, 0, NULL); if(*hMapPtr == NULL) { CloseHandle(*hFilePtr); return NULL; } map = MapViewOfFile(*hMapPtr, FILE_MAP_READ, 0, 0, 0); if(map == NULL) { CloseHandle(*hMapPtr); CloseHandle(*hFilePtr); return NULL; } return map; } static void w32_munmap(void *ptr, long size, HANDLE hFile, HANDLE hMap) { UnmapViewOfFile(ptr); CloseHandle(hMap); CloseHandle(hFile); } #endif /* HAVE_MMAP */ URL url_file_open(char *fname) { URL_file *url; char *mapptr; /* Non NULL if mmap is success */ long mapsize; FILE *fp; /* Non NULL if mmap is failure */ #ifdef __W32__ HANDLE hFile, hMap; #endif /* __W32__ */ #ifdef DEBUG printf("url_file_open(%s)\n", fname); #endif /* DEBUG */ if(!strcmp(fname, "-")) { mapptr = NULL; mapsize = 0; fp = stdin; goto done; } if(strncasecmp(fname, "file:", 5) == 0) fname += 5; if(*fname == '\0') { url_errno = errno = ENOENT; return NULL; } fname = url_expand_home_dir(fname); fp = NULL; mapsize = 0; errno = 0; mapptr = try_mmap(fname, &mapsize); if(errno == ENOENT || errno == EACCES) { url_errno = errno; return NULL; } #ifdef DEBUG if(mapptr != NULL) printf("mmap - success. size=%d\n", mapsize); #ifdef HAVE_MMAP else printf("mmap - failure.\n"); #endif #endif /* DEBUG */ if(mapptr == NULL) { #ifdef __MACOS__ char *cnvname; MBlockList pool; init_mblock(&pool); cnvname = (char *)strdup_mblock(&pool, fname); mac_TransPathSeparater(fname, cnvname); fp = fopen(cnvname, "rb"); reuse_mblock(&pool); if( fp==NULL ){ /*try original name*/ fp = fopen(fname, "rb"); } #else fp = fopen(fname, "rb"); #endif if(fp == NULL) { url_errno = errno; return NULL; } } done: url = (URL_file *)alloc_url(sizeof(URL_file)); if(url == NULL) { url_errno = errno; if(mapptr) munmap(mapptr, mapsize); if(fp && fp != stdin) fclose(fp); errno = url_errno; return NULL; } /* common members */ URLm(url, type) = URL_file_t; URLm(url, url_read) = url_file_read; URLm(url, url_gets) = url_file_gets; URLm(url, url_fgetc) = url_file_fgetc; URLm(url, url_close) = url_file_close; if(fp == stdin) { URLm(url, url_seek) = NULL; URLm(url, url_tell) = NULL; } else { URLm(url, url_seek) = url_file_seek; URLm(url, url_tell) = url_file_tell; } /* private members */ url->mapptr = mapptr; url->mapsize = mapsize; url->pos = 0; url->fp = fp; #ifdef __W32__ url->hFile = hFile; url->hMap = hMap; #endif /* __W32__ */ return (URL)url; } static long url_file_read(URL url, void *buff, long n) { URL_file *urlp = (URL_file *)url; if(urlp->mapptr != NULL) { if(urlp->pos + n > urlp->mapsize) n = urlp->mapsize - urlp->pos; memcpy(buff, urlp->mapptr + urlp->pos, n); urlp->pos += n; } else { if((n = (long)fread(buff, 1, n, urlp->fp)) == 0) { if(ferror(urlp->fp)) { url_errno = errno; return -1; } return 0; } } return n; } char *url_file_gets(URL url, char *buff, int n) { URL_file *urlp = (URL_file *)url; if(urlp->mapptr != NULL) { long s; char *nlp, *p; if(urlp->mapsize == urlp->pos) return NULL; if(n <= 0) return buff; if(n == 1) { *buff = '\0'; return buff; } n--; /* for '\0' */ s = urlp->mapsize - urlp->pos; if(s > n) s = n; p = urlp->mapptr + urlp->pos; nlp = (char *)memchr(p, url_newline_code, s); if(nlp != NULL) s = nlp - p + 1; memcpy(buff, p, s); buff[s] = '\0'; urlp->pos += s; return buff; } return fgets(buff, n, urlp->fp); } int url_file_fgetc(URL url) { URL_file *urlp = (URL_file *)url; if(urlp->mapptr != NULL) { if(urlp->mapsize == urlp->pos) return EOF; return urlp->mapptr[urlp->pos++] & 0xff; } #ifdef getc return getc(urlp->fp); #else return fgetc(urlp->fp); #endif /* getc */ } static void url_file_close(URL url) { URL_file *urlp = (URL_file *)url; if(urlp->mapptr != NULL) { #ifdef __W32__ HANDLE hFile = urlp->hFile; HANDLE hMap = urlp->hMap; #endif /* __W32__ */ munmap(urlp->mapptr, urlp->mapsize); } if(urlp->fp != NULL) { if(urlp->fp == stdin) rewind(stdin); else fclose(urlp->fp); } free(url); } static long url_file_seek(URL url, long offset, int whence) { URL_file *urlp = (URL_file *)url; long ret; if(urlp->mapptr == NULL) return fseek(urlp->fp, offset, whence); ret = urlp->pos; switch(whence) { case SEEK_SET: urlp->pos = offset; break; case SEEK_CUR: urlp->pos += offset; break; case SEEK_END: urlp->pos = urlp->mapsize + offset; break; } if(urlp->pos > urlp->mapsize) urlp->pos = urlp->mapsize; else if(urlp->pos < 0) urlp->pos = 0; return ret; } static long url_file_tell(URL url) { URL_file *urlp = (URL_file *)url; return urlp->mapptr ? urlp->pos : ftell(urlp->fp); } TiMidity++-2.13.2/libarc/url_hqxdecode.c0100644004711200001440000002224507421005037017126 0ustar tamukiusers/* TiMidity++ -- MIDI to WAVE converter and player Copyright (C) 1999-2002 Masanao Izumo Copyright (C) 1995 Tuukka Toivonen 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ #include #include #ifndef NO_STRING_H #include #else #include #endif #include "timidity.h" #include "url.h" #define DECODEBUFSIZ 255 /* Must be power of 3 */ #define INFOBYTES 128 typedef struct _URL_hqxdecode { char common[sizeof(struct _URL)]; URL reader; long rpos; int beg, end, eof, eod; unsigned char decodebuf[DECODEBUFSIZ]; long datalen, rsrclen, restlen; int dsoff, rsoff, zoff; int stage, dataonly, autoclose; } URL_hqxdecode; static long url_hqxdecode_read(URL url, void *buff, long n); static int url_hqxdecode_fgetc(URL url); static long url_hqxdecode_tell(URL url); static void url_hqxdecode_close(URL url); URL url_hqxdecode_open(URL reader, int dataonly, int autoclose) { URL_hqxdecode *url; url = (URL_hqxdecode *)alloc_url(sizeof(URL_hqxdecode)); if(url == NULL) { if(autoclose) url_close(reader); url_errno = errno; return NULL; } /* common members */ URLm(url, type) = URL_hqxdecode_t; URLm(url, url_read) = url_hqxdecode_read; URLm(url, url_gets) = NULL; URLm(url, url_fgetc) = url_hqxdecode_fgetc; URLm(url, url_seek) = NULL; URLm(url, url_tell) = url_hqxdecode_tell; URLm(url, url_close) = url_hqxdecode_close; /* private members */ url->reader = reader; url->rpos = 0; url->beg = 0; url->end = 0; url->eof = url->eod = 0; memset(url->decodebuf, 0, sizeof(url->decodebuf)); url->datalen = -1; url->rsrclen = -1; url->restlen = 0; url->stage = 0; url->dataonly = dataonly; url->autoclose = autoclose; return (URL)url; } static int hqxgetchar(URL reader) { int c; static int hqx_decode_table[256] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x00, 0x00, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x00, 0x14, 0x15, EOF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23, 0x24, 0x00, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x00, 0x2c, 0x2d, 0x2e, 0x2f, 0x00, 0x00, 0x00, 0x00, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x00, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x00, 0x00, 0x3d, 0x3e, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00 }; do { if((c = url_getc(reader)) == EOF) return EOF; } while(c == '\r' || c == '\n'); return hqx_decode_table[c]; } static int hqxdecode_chunk(URL url, unsigned char *p) { int c1, c2, c3, c4; int n; n = 0; if((c1 = hqxgetchar(url)) == EOF) return 0; if((c2 = hqxgetchar(url)) == EOF) return 0; p[n++] = ((c1 << 2) | ((c2 & 0x30) >> 4)); if((c3 = hqxgetchar(url)) == EOF) return n; p[n++] = (((c2 & 0xf) << 4) | ((c3 & 0x3c) >> 2)); if((c4 = hqxgetchar(url)) == EOF) return n; p[n++] = (((c3 & 0x03) << 6) | c4); return n; } static uint32 convert_int32(unsigned char *p) { return ((uint32)p[3]) | (((uint32)p[2]) << 8) | (((uint32)p[1]) << 16) | (((uint32)p[0]) << 24); } static int hqxdecode_header(URL_hqxdecode *urlp) { int i, n; unsigned char *p, *q; URL url; int hlen, nlen; n = 0; p = urlp->decodebuf; q = urlp->decodebuf + INFOBYTES; url = urlp->reader; while(n < DECODEBUFSIZ - INFOBYTES - 2) { i = hqxdecode_chunk(url, q + n); n += i; if(i != 3) { urlp->eod = 1; break; } } memset(p, 0, INFOBYTES); nlen = q[0]; hlen = nlen + 22; if(n < hlen) { urlp->eof = 1; return -1; /* Error */ } urlp->datalen = (long)convert_int32(q + hlen - 10); urlp->rsrclen = (long)convert_int32(q + hlen - 6); urlp->dsoff = (((urlp->datalen + 127) >> 7) << 7) - urlp->datalen; urlp->rsoff = (((urlp->rsrclen + 127) >> 7) << 7) - urlp->rsrclen; urlp->zoff = 0; p[1] = nlen; memcpy(p + 2, q + 1, nlen); memcpy(p + 65, q + hlen - 20, 4+4+2); /* type, author, flags */ memcpy(p + 83, q + hlen - 10, 4+4); /* datalen, rsrclen */ /* 91: create time (4) */ /* 95: modify time (4) */ q += hlen; n -= hlen; for(i = 0; i < n; i++) p[INFOBYTES + i] = q[i]; return INFOBYTES + n; } static int hqxdecode(URL_hqxdecode *urlp) { int i, n; unsigned char *p; URL url; if(urlp->eod) { urlp->eof = 1; return 1; } if(urlp->stage == 0) { n = hqxdecode_header(urlp); if(n == -1) return 1; urlp->end = n; if(urlp->dataonly) { urlp->beg = INFOBYTES; urlp->restlen = urlp->datalen; } else { urlp->beg = 0; urlp->restlen = urlp->datalen + INFOBYTES; } urlp->stage = 1; return 0; } p = urlp->decodebuf; url = urlp->reader; n = 0; if(urlp->restlen == 0) { if(urlp->dataonly) { urlp->eof = 1; return 1; } if(urlp->stage == 2) { urlp->zoff = urlp->rsoff; urlp->eof = 1; return 1; } urlp->zoff = urlp->dsoff; urlp->stage = 2; n = urlp->end - urlp->beg; if(n <= 2) { for(i = 0; i < n; i++) p[i] = p[i + urlp->beg]; n += hqxdecode_chunk(url, p + n); if(n <= 2) { urlp->eof = 1; return 1; } urlp->rpos += urlp->beg; urlp->beg = 0; urlp->end = n; } urlp->restlen = urlp->rsrclen; /* skip 2 byte (crc) */ urlp->beg += 2; urlp->rpos -= 2; n = urlp->beg; } while(n < DECODEBUFSIZ) { i = hqxdecode_chunk(url, p + n); n += i; if(i != 3) { urlp->eod = 1; break; } } urlp->rpos += urlp->beg; urlp->beg = 0; urlp->end = n; if(n == 0) { urlp->eof = 1; return 1; } return 0; } static long url_hqxdecode_read(URL url, void *buff, long size) { URL_hqxdecode *urlp = (URL_hqxdecode *)url; char *p = (char *)buff; long n; int i; n = 0; while(n < size) { if(urlp->zoff > 0) { i = urlp->zoff; if(i > size - n) i = size - n; memset(p + n, 0, i); urlp->zoff -= i; urlp->rpos += i; n += i; continue; } if(urlp->eof) break; if(urlp->restlen == 0 || urlp->beg == urlp->end) { hqxdecode(urlp); continue; } i = urlp->end - urlp->beg; if(i > urlp->restlen) i = urlp->restlen; if(i > size - n) i = size - n; memcpy(p + n, urlp->decodebuf + urlp->beg, i); urlp->beg += i; n += i; urlp->restlen -= i; } return n; } static int url_hqxdecode_fgetc(URL url) { URL_hqxdecode *urlp = (URL_hqxdecode *)url; int c; retry_read: if(urlp->zoff > 0) { urlp->zoff--; urlp->rpos++; return 0; } if(urlp->eof) return EOF; if(urlp->restlen == 0 || urlp->beg == urlp->end) { hqxdecode(urlp); goto retry_read; } c = (int)urlp->decodebuf[urlp->beg++]; urlp->restlen--; return c; } static long url_hqxdecode_tell(URL url) { URL_hqxdecode *urlp = (URL_hqxdecode *)url; if(urlp->dataonly) return urlp->rpos + urlp->beg - INFOBYTES; return urlp->rpos + urlp->beg; } static void url_hqxdecode_close(URL url) { URL_hqxdecode *urlp = (URL_hqxdecode *)url; if(urlp->autoclose) url_close(urlp->reader); free(url); } #ifdef HQXDECODE_MAIN void main(int argc, char** argv) { URL hqxdecoder; char buff[256], *filename; int c; if(argc != 2) { fprintf(stderr, "Usage: %s hqx-filename\n", argv[0]); exit(1); } filename = argv[1]; if((hqxdecoder = url_file_open(filename)) == NULL) { perror(argv[1]); exit(1); } for(;;) { if(url_readline(hqxdecoder, buff, sizeof(buff)) == NULL) { fprintf(stderr, "%s: Not a hqx-file\n", filename); url_close(hqxdecoder); exit(1); } if((strncmp(buff, "(This file", 10) == 0) || (strncmp(buff, "(Convert with", 13) == 0)) break; } while((c = url_getc(hqxdecoder)) != EOF) if(c == ':') break; if(c == EOF) { fprintf(stderr, "%s: Not a hqx-file\n", filename); url_close(hqxdecoder); exit(1); } hqxdecoder = url_hqxdecode_open(hqxdecoder, 0, 1); #if HQXDECODE_MAIN while((c = url_getc(hqxdecoder)) != EOF) putchar(c); #else while((c = url_read(hqxdecoder, buff, sizeof(buff))) > 0) write(1, buff, c); #endif url_close(hqxdecoder); exit(0); } #endif /* HQXDECODE_MAIN */ TiMidity++-2.13.2/libarc/url_inflate.c0100644004711200001440000000655507421005037016612 0ustar tamukiusers/* TiMidity++ -- MIDI to WAVE converter and player Copyright (C) 1999-2002 Masanao Izumo Copyright (C) 1995 Tuukka Toivonen 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ #include #include #include "timidity.h" #include "url.h" #include "mblock.h" #include "zip.h" typedef struct _URL_inflate { char common[sizeof(struct _URL)]; InflateHandler decoder; URL instream; long compsize; long pos; int autoclose; } URL_inflate; static long url_inflate_read_func(char *buf, long size, void *v); static long url_inflate_read(URL url, void *buff, long n); static long url_inflate_tell(URL url); static void url_inflate_close(URL url); URL url_inflate_open(URL instream, long compsize, int autoclose) { URL_inflate *url; url = (URL_inflate *)alloc_url(sizeof(URL_inflate)); if(url == NULL) { if(autoclose) url_close(instream); url_errno = errno; return NULL; } /* common members */ URLm(url, type) = URL_inflate_t; URLm(url, url_read) = url_inflate_read; URLm(url, url_gets) = NULL; URLm(url, url_fgetc) = NULL; URLm(url, url_seek) = NULL; URLm(url, url_tell) = url_inflate_tell; URLm(url, url_close) = url_inflate_close; /* private members */ url->decoder = NULL; url->instream = instream; url->pos = 0; url->compsize = compsize; url->autoclose = autoclose; errno = 0; url->decoder = open_inflate_handler(url_inflate_read_func, url); if(url->decoder == NULL) { if(autoclose) url_close(instream); url_inflate_close((URL)url); url_errno = errno; return NULL; } return (URL)url; } static long url_inflate_read_func(char *buf, long size, void *v) { URL_inflate *urlp = (URL_inflate *)v; long n; if(urlp->compsize == -1) /* size if unknown */ return url_read(urlp->instream, buf, size); if(urlp->compsize == 0) return 0; n = size; if(n > urlp->compsize) n = urlp->compsize; n = url_read(urlp->instream, buf, n); if(n == -1) return -1; urlp->compsize -= n; return n; } static long url_inflate_read(URL url, void *buff, long n) { URL_inflate *urlp = (URL_inflate *)url; n = zip_inflate(urlp->decoder, (char *)buff, n); if(n <= 0) return n; urlp->pos += n; return n; } static long url_inflate_tell(URL url) { return ((URL_inflate *)url)->pos; } static void url_inflate_close(URL url) { int save_errno = errno; URL_inflate *urlp = (URL_inflate *)url; if(urlp->decoder) close_inflate_handler(urlp->decoder); if(urlp->autoclose) url_close(urlp->instream); free(url); errno = save_errno; } TiMidity++-2.13.2/libarc/url_mem.c0100644004711200001440000001002407421005037015730 0ustar tamukiusers/* TiMidity++ -- MIDI to WAVE converter and player Copyright (C) 1999-2002 Masanao Izumo Copyright (C) 1995 Tuukka Toivonen 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ #include #include #ifndef NO_STRING_H #include #else #include #endif #ifdef HAVE_UNISTD_H #include #endif /* HAVE_UNISTD_H */ #include "timidity.h" #include "url.h" typedef struct _URL_mem { char common[sizeof(struct _URL)]; char *memory; long memsiz; long mempos; int autofree; } URL_mem; static long url_mem_read(URL url, void *buff, long n); static char *url_mem_gets(URL url, char *buff, int n); static int url_mem_fgetc(URL url); static long url_mem_seek(URL url, long offset, int whence); static long url_mem_tell(URL url); static void url_mem_close(URL url); URL url_mem_open(char *memory, long memsiz, int autofree) { URL_mem *url; url = (URL_mem *)alloc_url(sizeof(URL_mem)); if(url == NULL) { url_errno = errno; if(autofree) { free(memory); errno = url_errno; } return NULL; } /* common members */ URLm(url, type) = URL_mem_t; URLm(url, url_read) = url_mem_read; URLm(url, url_gets) = url_mem_gets; URLm(url, url_fgetc) = url_mem_fgetc; URLm(url, url_seek) = url_mem_seek; URLm(url, url_tell) = url_mem_tell; URLm(url, url_close) = url_mem_close; /* private members */ url->memory = memory; url->memsiz = memsiz; url->mempos = 0; url->autofree = autofree; return (URL)url; } static long url_mem_read(URL url, void *buff, long n) { URL_mem *urlp = (URL_mem *)url; long s; char *p = (char *)buff; s = urlp->memsiz - urlp->mempos; if(s > n) s = n; if(s <= 0) return 0; memcpy(p, urlp->memory + urlp->mempos, s); urlp->mempos += s; return s; } static char *url_mem_gets(URL url, char *buff, int n) { URL_mem *urlp = (URL_mem *)url; long s; char *nlp, *p; if(urlp->memsiz == urlp->mempos) return NULL; if(n <= 0) return buff; if(n == 1) { *buff = '\0'; return buff; } n--; /* for '\0' */ s = urlp->memsiz - urlp->mempos; if(s > n) s = n; p = urlp->memory + urlp->mempos; nlp = (char *)memchr(p, url_newline_code, s); if(nlp != NULL) s = nlp - p + 1; memcpy(buff, p, s); buff[s] = '\0'; urlp->mempos += s; return buff; } static int url_mem_fgetc(URL url) { URL_mem *urlp = (URL_mem *)url; if(urlp->memsiz == urlp->mempos) return EOF; return (int)(unsigned char)urlp->memory[urlp->mempos++]; } static long url_mem_seek(URL url, long offset, int whence) { URL_mem *urlp = (URL_mem *)url; long ret; ret = urlp->mempos; switch(whence) { case SEEK_SET: urlp->mempos = offset; break; case SEEK_CUR: urlp->mempos += offset; break; case SEEK_END: urlp->mempos = urlp->memsiz + offset; break; } if(urlp->mempos > urlp->memsiz) urlp->mempos = urlp->memsiz; else if(urlp->mempos < 0) urlp->mempos = 0; return ret; } static long url_mem_tell(URL url) { return ((URL_mem *)url)->mempos; } static void url_mem_close(URL url) { int save_errno = errno; URL_mem *urlp = (URL_mem *)url; if(urlp->autofree) free(urlp->memory); free(url); errno = save_errno; } TiMidity++-2.13.2/libarc/url_pipe.c0100644004711200001440000000743507421005037016123 0ustar tamukiusers/* TiMidity++ -- MIDI to WAVE converter and player Copyright (C) 1999-2002 Masanao Izumo Copyright (C) 1995 Tuukka Toivonen 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ #include #include #ifndef NO_STRING_H #include #else #include #endif #include "timidity.h" #include "url.h" #ifdef HAVE_POPEN /* It is not supported command PIPE at Windows */ typedef struct _URL_pipe { char common[sizeof(struct _URL)]; FILE *fp; } URL_pipe; #define PIPE_FP(url) (((URL_pipe *)(url))->fp) static int name_pipe_check(char *url_string); static long url_pipe_read(URL url, void *buff, long n); static char *url_pipe_gets(URL url, char *buff, int n); static int url_pipe_fgetc(URL url); static void url_pipe_close(URL url); struct URL_module URL_module_pipe = { URL_pipe_t, /* type */ name_pipe_check, /* URL checker */ NULL, /* initializer */ url_pipe_open, /* open */ NULL /* must be NULL */ }; /* url_string := "command|" */ static int name_pipe_check(char *url_string) { #ifdef PIPE_SCHEME_ENABLE char *p; p = strrchr(url_string, '|'); if(p == NULL) return 0; p++; while(*p == ' ') p++; return *p == '\0'; #else return 0; #endif } URL url_pipe_open(char *command) { URL_pipe *url; char buff[BUFSIZ], *p; strncpy(buff, command, sizeof(buff)); buff[sizeof(buff) - 1] = '\0'; p = strrchr(buff, '|'); if(p != NULL) { char *q; q = p + 1; while(*q == ' ') q++; if(*q == '\0') { p--; while(buff < p && *p == ' ') p--; if(buff == p) { errno = ENOENT; url_errno = URLERR_IURLF; return NULL; } p[1] = '\0'; } } url = (URL_pipe *)alloc_url(sizeof(URL_pipe)); if(url == NULL) { url_errno = errno; return NULL; } /* common members */ URLm(url, type) = URL_pipe_t; URLm(url, url_read) = url_pipe_read; URLm(url, url_gets) = url_pipe_gets; URLm(url, url_fgetc) = url_pipe_fgetc; URLm(url, url_seek) = NULL; URLm(url, url_tell) = NULL; URLm(url, url_close) = url_pipe_close; /* private members */ url->fp = NULL; if((url->fp = popen(buff, "r")) == NULL) { url_pipe_close((URL)url); url_errno = errno; return NULL; } return (URL)url; } static long url_pipe_read(URL url, void *buff, long n) { return (long)fread(buff, 1, n, PIPE_FP(url)); } static char *url_pipe_gets(URL url, char *buff, int n) { return fgets(buff, n, PIPE_FP(url)); } static int url_pipe_fgetc(URL url) { #ifdef getc return getc(PIPE_FP(url)); #else return fgetc(PIPE_FP(url)); #endif /* getc */ } static void url_pipe_close(URL url) { int save_errno = errno; if(PIPE_FP(url) != NULL) pclose(PIPE_FP(url)); free(url); errno = save_errno; } #else /* HAVE_POPEN */ struct URL_module URL_module_pipe = { URL_none_t, /* type */ NULL, /* URL checker */ NULL, /* initializer */ NULL, /* open */ NULL /* must be NULL */ }; URL url_pipe_open(char *command) { return NULL; } /* dmy */ #endif TiMidity++-2.13.2/libarc/url_qsdecode.c0100644004711200001440000001176407421005037016755 0ustar tamukiusers/* TiMidity++ -- MIDI to WAVE converter and player Copyright (C) 1999-2002 Masanao Izumo Copyright (C) 1995 Tuukka Toivonen 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ #include #include #ifndef NO_STRING_H #include #else #include #endif #include "timidity.h" #include "url.h" #define DECODEBUFSIZ BUFSIZ typedef struct _URL_qsdecode { char common[sizeof(struct _URL)]; URL reader; long rpos; int beg, end, eof, eod; unsigned char decodebuf[DECODEBUFSIZ]; int autoclose; } URL_qsdecode; static long url_qsdecode_read(URL url, void *buff, long n); static int url_qsdecode_fgetc(URL url); static long url_qsdecode_tell(URL url); static void url_qsdecode_close(URL url); URL url_qsdecode_open(URL reader, int autoclose) { URL_qsdecode *url; url = (URL_qsdecode *)alloc_url(sizeof(URL_qsdecode)); if(url == NULL) { if(autoclose) url_close(reader); url_errno = errno; return NULL; } /* common members */ URLm(url, type) = URL_qsdecode_t; URLm(url, url_read) = url_qsdecode_read; URLm(url, url_gets) = NULL; URLm(url, url_fgetc) = url_qsdecode_fgetc; URLm(url, url_seek) = NULL; URLm(url, url_tell) = url_qsdecode_tell; URLm(url, url_close) = url_qsdecode_close; /* private members */ url->reader = reader; url->rpos = 0; url->beg = 0; url->end = 0; url->eof = url->eod = 0; memset(url->decodebuf, 0, sizeof(url->decodebuf)); url->autoclose = autoclose; return (URL)url; } static int qsdecode(URL_qsdecode *urlp) { int n; unsigned char *p; URL url; if(urlp->eod) { urlp->eof = 1; return 1; } p = urlp->decodebuf; url = urlp->reader; n = 0; while(n < DECODEBUFSIZ) { int c1, c2; if((c1 = url_getc(url)) == EOF) break; if(c1 != '=') { p[n++] = c1; continue; } /* quoted character */ next_quote: if((c1 = url_getc(url)) == EOF) break; if(c1 == '\n') continue; if(c1 == '\r') { if((c1 = url_getc(url)) == EOF) break; if(c1 == '\n') continue; if(c1 == '=') goto next_quote; p[n++] = c1; continue; } if((c2 = url_getc(url)) == EOF) break; if('0' <= c1 && c1 <= '9') c1 -= '0'; else if('A' <= c1 && c1 <= 'F') c1 -= 'A' - 10; else c1 = 0; if('0' <= c2 && c2 <= '9') c2 -= '0'; else if('A' <= c2 && c2 <= 'F') c2 -= 'A' - 10; else c2 = 0; p[n++] = (c1 << 4 | c2); } urlp->rpos += urlp->beg; urlp->beg = 0; urlp->end = n; if(n < DECODEBUFSIZ) urlp->eod = 1; if(n == 0) { urlp->eof = 1; return 1; } return 0; } static long url_qsdecode_read(URL url, void *buff, long size) { URL_qsdecode *urlp = (URL_qsdecode *)url; unsigned char *p = (unsigned char *)buff; long n; if(urlp->eof) return 0; n = 0; while(n < size) { int i; if(urlp->beg == urlp->end) if(qsdecode(urlp)) break; i = urlp->end - urlp->beg; if(i > size - n) i = size - n; memcpy(p + n, urlp->decodebuf + urlp->beg, i); n += i; urlp->beg += i; } return n; } static int url_qsdecode_fgetc(URL url) { URL_qsdecode *urlp = (URL_qsdecode *)url; if(urlp->eof) return EOF; if(urlp->beg == urlp->end) if(qsdecode(urlp)) return EOF; return (int)urlp->decodebuf[urlp->beg++]; } static long url_qsdecode_tell(URL url) { URL_qsdecode *urlp = (URL_qsdecode *)url; return urlp->rpos + urlp->beg; } static void url_qsdecode_close(URL url) { URL_qsdecode *urlp = (URL_qsdecode *)url; if(urlp->autoclose) url_close(urlp->reader); free(url); } #ifdef QSDECODE_MAIN void main(int argc, char** argv) { URL qsdecoder; char buff[256], *filename; int c; if(argc != 2) { fprintf(stderr, "Usage: %s qs-filename\n", argv[0]); exit(1); } filename = argv[1]; if((qsdecoder = url_file_open(filename)) == NULL) { perror(argv[1]); url_close(qsdecoder); exit(1); } qsdecoder = url_qsdecode_open(qsdecoder, 1); #if QSDECODE_MAIN while((c = url_getc(qsdecoder)) != EOF) putchar(c); #else while((c = url_read(qsdecoder, buff, sizeof(buff))) > 0) write(1, buff, c); #endif url_close(qsdecoder); exit(0); } #endif /* QSDECODE_MAIN */ TiMidity++-2.13.2/libarc/url_uudecode.c0100644004711200001440000001351507421005037016757 0ustar tamukiusers/* TiMidity++ -- MIDI to WAVE converter and player Copyright (C) 1999-2002 Masanao Izumo Copyright (C) 1995 Tuukka Toivonen 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ #include #include #ifndef NO_STRING_H #include #else #include #endif #include "timidity.h" #include "url.h" typedef struct _URL_uudecode { char common[sizeof(struct _URL)]; URL reader; long rpos; int beg, end, eof; unsigned char decodebuf[128]; int autoclose; } URL_uudecode; static long url_uudecode_read(URL url, void *buff, long n); static int url_uudecode_fgetc(URL url); static long url_uudecode_tell(URL url); static void url_uudecode_close(URL url); URL url_uudecode_open(URL reader, int autoclose) { URL_uudecode *url; url = (URL_uudecode *)alloc_url(sizeof(URL_uudecode)); if(url == NULL) { if(autoclose) url_close(reader); url_errno = errno; return NULL; } /* common members */ URLm(url, type) = URL_uudecode_t; URLm(url, url_read) = url_uudecode_read; URLm(url, url_gets) = NULL; URLm(url, url_fgetc) = url_uudecode_fgetc; URLm(url, url_seek) = NULL; URLm(url, url_tell) = url_uudecode_tell; URLm(url, url_close) = url_uudecode_close; /* private members */ url->reader = reader; url->rpos = 0; url->beg = 0; url->end = 0; url->eof = 0; memset(url->decodebuf, 0, sizeof(url->decodebuf)); url->autoclose = autoclose; return (URL)url; } #define DEC(c) (((c) - ' ') & 077) /* single character decode */ static int uudecodeline(URL_uudecode *urlp) { unsigned char inbuf[BUFSIZ], *p, *q, ch; int n; if(url_gets(urlp->reader, (char *)inbuf, sizeof(inbuf)) == NULL) { urlp->eof = 1; return 1; } if((n = DEC(*inbuf)) <= 0) { urlp->eof = 1; return 1; } if(uudecode_unquote_html) { int i, j, len; len = strlen((char *)inbuf); while(len > 0 && (inbuf[len - 1] == '\r' || inbuf[len - 1] == '\n' || inbuf[len - 1] == '\t' || inbuf[len - 1] == ' ')) inbuf[--len] = '\0'; if(n * 4 != (len - 1) * 3) { /* </>/& */ i = j = 0; while(i < len - 3) if(inbuf[i] != '&') inbuf[j++] = inbuf[i++]; else { i++; if(strncmp((char *)inbuf + i, "lt;", 3) == 0) { inbuf[j++] = '<'; i += 3; } else if(strncmp((char *)inbuf + i, "gt;", 3) == 0) { inbuf[j++] = '>'; i += 3; } else if(strncmp((char *)inbuf + i, "amp;", 4) == 0) { inbuf[j++] = '&'; i += 4; } else inbuf[j++] = '&'; } while(i < len) inbuf[j++] = inbuf[i++]; inbuf[j++] = '\0'; } } p = inbuf + 1; q = urlp->decodebuf; for(; n > 0; p += 4, n -= 3) { if(n >= 3) { ch = DEC(p[0]) << 2 | DEC(p[1]) >> 4; *q++ = ch; ch = DEC(p[1]) << 4 | DEC(p[2]) >> 2; *q++ = ch; ch = DEC(p[2]) << 6 | DEC(p[3]); *q++ = ch; } else { if(n >= 1) { ch = DEC(p[0]) << 2 | DEC(p[1]) >> 4; *q++ = ch; } if(n >= 2) { ch = DEC(p[1]) << 4 | DEC(p[2]) >> 2; *q++ = ch; } if(n >= 3) { ch = DEC(p[2]) << 6 | DEC(p[3]); *q++ = ch; } } } urlp->rpos += urlp->beg; urlp->beg = 0; urlp->end = q - urlp->decodebuf; return 0; } static long url_uudecode_read(URL url, void *buff, long size) { URL_uudecode *urlp = (URL_uudecode *)url; unsigned char *p = (unsigned char *)buff; long n; if(urlp->eof) return 0; n = 0; while(n < size) { int i; if(urlp->beg == urlp->end) if(uudecodeline(urlp)) break; i = urlp->end - urlp->beg; if(i > size - n) i = size - n; memcpy(p + n, urlp->decodebuf + urlp->beg, i); n += i; urlp->beg += i; } return n; } static int url_uudecode_fgetc(URL url) { URL_uudecode *urlp = (URL_uudecode *)url; if(urlp->eof) return EOF; if(urlp->beg == urlp->end) if(uudecodeline(urlp)) return EOF; return (int)urlp->decodebuf[urlp->beg++]; } static long url_uudecode_tell(URL url) { URL_uudecode *urlp = (URL_uudecode *)url; return urlp->rpos + urlp->beg; } static void url_uudecode_close(URL url) { URL_uudecode *urlp = (URL_uudecode *)url; if(urlp->autoclose) url_close(urlp->reader); free(url); } #ifdef UUDECODE_MAIN void main(int argc, char** argv) { URL uudecoder; char buff[256], *filename; int c; if(argc != 2) { fprintf(stderr, "Usage: %s uu-filename\n", argv[0]); exit(1); } filename = argv[1]; if((uudecoder = url_file_open(filename)) == NULL) { perror(argv[1]); exit(1); } for(;;) { if(url_readline(uudecoder, buff, sizeof(buff)) == EOF) { fprintf(stderr, "%s: Not a hqx-file\n", filename); url_close(uudecoder); exit(1); } if(strncmp(buff, "begin ", 6) == 0) break; } uudecoder = url_uudecode_open(uudecoder, 1); #if UUDECODE_MAIN while((c = url_getc(uudecoder)) != EOF) putchar(c); #else while((c = url_read(uudecoder, buff, sizeof(buff))) > 0) write(1, buff, c); #endif url_close(uudecoder); exit(0); } #endif /* UUDECODE_MAIN */ TiMidity++-2.13.2/libarc/zip.h0100644004711200001440000000717507421005037015114 0ustar tamukiusers/* TiMidity++ -- MIDI to WAVE converter and player Copyright (C) 1999-2002 Masanao Izumo Copyright (C) 1995 Tuukka Toivonen 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef ___ZIP_H_ #define ___ZIP_H_ /* zip.h -- common declarations for deflate/inflate routine */ #define INBUF_EXTRA 64 #define OUTBUF_EXTRA 2048 #ifdef SMALL_MEM # define INBUFSIZ 8192 /* input buffer size */ # define OUTBUFSIZ 8192 /* output buffer size */ #else # define INBUFSIZ 32768 /* input buffer size */ # define OUTBUFSIZ 16384 /* output buffer size */ #endif typedef unsigned char uch; typedef unsigned short ush; typedef unsigned long ulg; /* Huffman code lookup table entry--this entry is four bytes for machines that have 16-bit pointers (e.g. PC's in the small or medium model). Valid extra bits are 0..13. e == 15 is EOB (end of block), e == 16 means that v is a literal, 16 < e < 32 means that v is a pointer to the next table, which codes e - 16 bits, and lastly e == 99 indicates an unused code. If a code with e == 99 is looked up, this implies an error in the data. */ struct huft { uch e; /* number of extra bits or operation */ uch b; /* number of bits in this code or subcode */ union { ush n; /* literal, length base, or distance base */ struct huft *t; /* pointer to next level of table */ } v; }; int huft_build(unsigned *, unsigned, unsigned, ush *, ush *, struct huft **, int *, MBlockList *pool); #define STORED_BLOCK 0 #define STATIC_TREES 1 #define DYN_TREES 2 /* The three kinds of block type */ #define WSIZE 32768 /* window size--must be a power of two, and */ /* at least 32K for zip's deflate method */ /* Diagnostic functions */ #ifdef DEBUG # define Trace(x) fprintf x # define Tracev(x) {fprintf x ;} # define Tracevv(x) {fprintf x ;} # define Tracec(c,x) {fprintf x ;} # define Tracecv(c,x) {fprintf x ;} #else # define Trace(x) # define Tracev(x) # define Tracevv(x) # define Tracec(c,x) # define Tracecv(c,x) #endif #define near typedef struct _InflateHandler *InflateHandler; typedef struct _DeflateHandler *DeflateHandler; /*****************************************************************/ /* INTERFACE FUNCTIONS */ /*****************************************************************/ /* in deflate.c */ extern DeflateHandler open_deflate_handler( long (* read_func)(char *buf, long size, void *user_val), void *user_val, int compression_level); extern long zip_deflate(DeflateHandler encoder, char *decode_buff, long decode_buff_size); extern void close_deflate_handler(DeflateHandler encoder); /* in inflate.c */ extern InflateHandler open_inflate_handler( long (* read_func)(char *buf, long size, void *user_val), void *user_val); extern long zip_inflate(InflateHandler decoder, char *decode_buff, long decode_buff_size); extern void close_inflate_handler(InflateHandler decoder); #endif /* ___ZIP_H_ */ TiMidity++-2.13.2/libarc/url_http.c0100644004711200001440000001566707421005037016153 0ustar tamukiusers/* TiMidity++ -- MIDI to WAVE converter and player Copyright (C) 1999-2002 Masanao Izumo Copyright (C) 1995 Tuukka Toivonen 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ #include #include #ifdef HAVE_UNISTD_H #include #endif /* HAVE_UNISTD_H */ #ifndef NO_STRING_H #include #else #include #endif #include /* for SIGALRM */ #include "timidity.h" #include "url.h" #include "net.h" /* #define DEBUG */ #ifdef HTTP_PROXY_HOST char *url_http_proxy_host = HTTP_PROXY_HOST; unsigned short url_http_proxy_port = HTTP_PROXY_PORT; #else char *url_http_proxy_host = NULL; unsigned short url_http_proxy_port; #endif /* HTTP_PROXY_HOST */ #define REQUEST_OFFSET 16 #define ALARM_TIMEOUT 10 static VOLATILE int timeout_flag = 1; typedef struct _URL_http { char common[sizeof(struct _URL)]; FILE *fp; } URL_http; static int name_http_check(char *url_string); static long url_http_read(URL url, void *buff, long n); static char *url_http_gets(URL url, char *buff, int n); static int url_http_fgetc(URL url); static void url_http_close(URL url); struct URL_module URL_module_http = { URL_http_t, name_http_check, NULL, url_http_open, NULL }; static int name_http_check(char *s) { if(strncmp(s, "http://", 7) == 0) return 1; return 0; } /*ARGSUSED*/ static void timeout(int sig) { timeout_flag = 1; } URL url_http_open(char *name) { URL_http *url; SOCKET fd; char *host, *path = NULL, *p; unsigned short port; char buff[BUFSIZ]; char wwwserver[256]; int n; #ifdef DEBUG printf("url_http_open(%s)\n", name); #endif /* DEBUG */ url = (URL_http *)alloc_url(sizeof(URL_http)); if(url == NULL) { url_errno = errno; return NULL; } /* common members */ URLm(url, type) = URL_http_t; URLm(url, url_read) = url_http_read; URLm(url, url_gets) = url_http_gets; URLm(url, url_fgetc) = url_http_fgetc; URLm(url, url_seek) = NULL; URLm(url, url_tell) = NULL; URLm(url, url_close) = url_http_close; /* private members */ url->fp = NULL; if(url_http_proxy_host) { char *q; int len; host = url_http_proxy_host; port = url_http_proxy_port; p = name; if(strncmp(p, "http://", 7) == 0) p += 7; for(q = p; *q && *q != ':' && *q != '/'; q++) ; len = q - p; if(len >= sizeof(wwwserver) - 1) { /* What?? */ strcpy(wwwserver, "localhost"); } else { strncpy(wwwserver, p, len); } } else { if(strncmp(name, "http://", 7) == 0) name += 7; n = strlen(name); if(n + REQUEST_OFFSET >= BUFSIZ) { url_http_close((URL)url); url_errno = URLERR_URLTOOLONG; errno = ENOENT; return NULL; } memcpy(buff, name, n + 1); host = buff; for(p = host; *p && *p != ':' && *p != '/'; p++) ; if(*p == ':') { char *pp; *p++ = '\0'; /* terminate `host' string */ port = atoi(p); pp = strchr(p, '/'); if(pp == NULL) p[0] = '\0'; else p = pp; } else port = 80; path = p; if(*path == '\0') *(path + 1) = '\0'; *path = '\0'; /* terminate `host' string */ strncpy(wwwserver, host, sizeof(wwwserver)); } #ifdef DEBUG printf("open(host=`%s', port=`%d')\n", host, port); #endif /* DEBUG */ #ifdef __W32__ timeout_flag = 0; fd = open_socket(host, port); #else timeout_flag = 0; signal(SIGALRM, timeout); alarm(ALARM_TIMEOUT); fd = open_socket(host, port); alarm(0); signal(SIGALRM, SIG_DFL); #endif /* __W32__ */ if(fd == (SOCKET)-1) { VOLATILE_TOUCH(timeout_flag); #ifdef ETIMEDOUT if(timeout_flag) errno = ETIMEDOUT; #endif /* ETIMEDOUT */ if(errno) url_errno = errno; else { url_errno = URLERR_CANTOPEN; errno = ENOENT; } url_http_close((URL)url); return NULL; } if((url->fp = socket_fdopen(fd, "rb")) == NULL) { url_errno = errno; closesocket(fd); url_http_close((URL)url); errno = url_errno; return NULL; } if(url_http_proxy_host) sprintf(buff, "GET %s HTTP/1.0\r\n", name); else { *path = '/'; sprintf(buff, "GET %s HTTP/1.0\r\n", path); } socket_write(fd, buff, (long)strlen(buff)); #ifdef DEBUG printf("HTTP<%s", buff); #endif /* DEBUG */ if(url_user_agent) { sprintf(buff, "User-Agent: %s\r\n", url_user_agent); socket_write(fd, buff, (long)strlen(buff)); #ifdef DEBUG printf("HTTP<%s", buff); #endif /* DEBUG */ } /* Host field */ sprintf(buff, "Host: %s\r\n", wwwserver); socket_write(fd, buff, (long)strlen(buff)); #ifdef DEBUG printf("HTTP<%s", buff); #endif /* DEBUG */ /* End of header */ socket_write(fd, "\r\n", 2); socket_shutdown(fd, 1); if(socket_fgets(buff, BUFSIZ, url->fp) == NULL) { if(errno) url_errno = errno; else { url_errno = URLERR_CANTOPEN; errno = ENOENT; } url_http_close((URL)url); return NULL; } #ifdef DEBUG printf("HTTP>%s", buff); #endif /* DEBUG */ p = buff; if(strncmp(p, "HTTP/1.0 ", 9) == 0 || strncmp(p, "HTTP/1.1 ", 9) == 0) p += 9; if(strncmp(p, "200", 3) != 0) /* Not success */ { url_http_close((URL)url); url_errno = errno = ENOENT; return NULL; } /* Skip mime header */ while(socket_fgets(buff, BUFSIZ, url->fp) != NULL) { if(buff[0] == '\n' || (buff[0] == '\r' && buff[1] == '\n')) break; /* end of heaer */ #ifdef DEBUG printf("HTTP>%s", buff); #endif /* DEBUG */ } #ifdef __W32__ return url_buff_open((URL)url, 1); #else return (URL)url; #endif /* __W32__ */ } static void url_http_close(URL url) { URL_http *urlp = (URL_http *)url; int save_errno = errno; if(urlp->fp != NULL) socket_fclose(urlp->fp); free(url); errno = save_errno; } static long url_http_read(URL url, void *buff, long n) { URL_http *urlp = (URL_http *)url; return socket_fread(buff, n, urlp->fp); } static char *url_http_gets(URL url, char *buff, int n) { URL_http *urlp = (URL_http *)url; return socket_fgets(buff, n, urlp->fp); } static int url_http_fgetc(URL url) { URL_http *urlp = (URL_http *)url; int n; unsigned char c; n = socket_fread(&c, 1, urlp->fp); if(n <= 0) { if(errno) url_errno = errno; return EOF; } return (int)c; } TiMidity++-2.13.2/libarc/url_ftp.c0100644004711200001440000002632307421005037015754 0ustar tamukiusers/* TiMidity++ -- MIDI to WAVE converter and player Copyright (C) 1999-2002 Masanao Izumo Copyright (C) 1995 Tuukka Toivonen 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ #include #include #ifndef NO_STRING_H #include #else #include #endif #ifdef HAVE_UNISTD_H #include #endif /* HAVE_UNISTD_H */ #include /* for SIGALRM */ #include "timidity.h" #include "url.h" #include "net.h" /* supported PASV mode only */ #define ALARM_TIMEOUT 10 static VOLATILE int timeout_flag = 0; #ifdef FTP_PROXY_HOST char *url_ftp_proxy_host = FTP_PROXY_HOST unsigned short url_ftp_proxy_port = FTP_PROXY_PORT #else char *url_ftp_proxy_host = NULL; unsigned short url_ftp_proxy_port; #endif /* FTP_PROXY_HOST */ typedef struct _URL_ftp { char common[sizeof(struct _URL)]; FILE *datafp; FILE *ctlifp; FILE *ctlofp; int abor; } URL_ftp; static int name_ftp_check(char *url_string); static long url_ftp_read(URL url, void *buff, long size); static char *url_ftp_gets(URL url, char *buff, int n); static int url_ftp_fgetc(URL url); static void url_ftp_close(URL url); static int guess_errno(char *msg); struct URL_module URL_module_ftp = { URL_ftp_t, name_ftp_check, NULL, url_ftp_open, NULL }; static int name_ftp_check(char *s) { if(strncmp(s, "ftp://", 6) == 0) return 1; return 0; } static int ftp_cmd(URL_ftp *url, char *buff, char *rspns) { #ifdef DEBUG printf("FTP<%s", buff); #endif errno = 0; if(socket_fwrite(buff, (long)strlen(buff), url->ctlofp) <= 0) { url_ftp_close((URL)url); if(errno) url_errno = errno; else url_errno = errno = ENOENT; return -1; } socket_fflush(url->ctlofp); do { errno = 0; if(socket_fgets(buff, BUFSIZ, url->ctlifp) == NULL) { url_ftp_close((URL)url); if(errno) url_errno = errno; else url_errno = errno = ENOENT; return -1; } #ifdef DEBUG printf("FTP>%s", buff); #endif if(strncmp(buff, rspns, 3) != 0) { url_ftp_close((URL)url); url_errno = errno = guess_errno(buff); return -1; } } while(buff[3] == '-'); return 0; } /*ARGSUSED*/ static void timeout(int sig) { timeout_flag = 1; } static int guess_errno(char *msg) { if(strncmp(msg, "550", 3) != 0) return ENOENT; if((msg = strchr(msg, ':')) == NULL) return ENOENT; msg++; if(*msg == ' ') msg++; if(strncmp(msg, "No such file or directory", 25) == 0) return ENOENT; if(strncmp(msg, "Permission denied", 17) == 0) return EACCES; if(strncmp(msg, "HTTP/1.0 500", 12) == 0) /* Proxy Error */ return ENOENT; return ENOENT; } URL url_ftp_open(char *name) { URL_ftp *url; SOCKET fd; char *p, *host, *path; unsigned short port; char buff[BUFSIZ]; char path_buff[1024], host_buff[1024]; int n; char *passwd; char *user; #ifdef DEBUG printf("url_ftp_open(%s)\n", name); #endif /* DEBUG */ passwd = user_mailaddr; user = "anonymous"; url = (URL_ftp *)alloc_url(sizeof(URL_ftp)); if(url == NULL) { url_errno = errno; return NULL; } /* common members */ URLm(url, type) = URL_ftp_t; URLm(url, url_read) = url_ftp_read; URLm(url, url_gets) = url_ftp_gets; URLm(url, url_fgetc) = url_ftp_fgetc; URLm(url, url_seek) = NULL; URLm(url, url_tell) = NULL; URLm(url, url_close) = url_ftp_close; /* private members */ url->datafp = NULL; url->ctlifp = NULL; url->ctlofp = NULL; url->abor = 0; if(url_ftp_proxy_host != NULL) { /* proxy */ host = url_ftp_proxy_host; port = url_ftp_proxy_port; } else { /* not proxy */ if(strncmp(name, "ftp://", 6) == 0) name += 6; strncpy(buff, name, sizeof(buff)); buff[sizeof(buff) - 1] = '\0'; strncpy(host_buff, buff, sizeof(host_buff)); host_buff[sizeof(host_buff) - 1] = '\0'; host = host_buff; if((p = strchr(host, '/')) == NULL) { url_ftp_close((URL)url); url_errno = URLERR_IURLF; errno = ENOENT; return NULL; } port = 21; *p = '\0'; strncpy(path_buff, name + strlen(host), sizeof(path_buff)); path_buff[sizeof(path_buff) - 1] = '\0'; path = path_buff; /* check user:password@host */ p = strchr(host, '@'); if(p != NULL) { user = host; host = p; *host++ = '\0'; if((passwd = strchr(user, ':')) == NULL) passwd = user_mailaddr; else *passwd++ = '\0'; } #ifdef DEBUG printf("open(host=`%s', port=`%d')\n", host, port); #endif /* DEBUG */ #ifdef __W32__ timeout_flag = 0; fd = open_socket(host, port); #else timeout_flag = 0; signal(SIGALRM, timeout); alarm(ALARM_TIMEOUT); fd = open_socket(host, port); alarm(0); signal(SIGALRM, SIG_DFL); #endif /* __W32__ */ if(fd < 0) { VOLATILE_TOUCH(timeout_flag); #ifdef ETIMEDOUT if(timeout_flag) errno = ETIMEDOUT; #endif /* ETIMEDOUT */ if(errno) url_errno = errno; else { url_errno = URLERR_CANTOPEN; errno = ENOENT; } url_ftp_close((URL)url); return NULL; } if((url->ctlifp = socket_fdopen(fd, "rb")) == NULL) { url_ftp_close((URL)url); url_errno = errno; return NULL; } if((url->ctlofp = socket_fdopen(fd, "wb")) == NULL) { url_ftp_close((URL)url); url_errno = errno; return NULL; } if(socket_fgets(buff, BUFSIZ, url->ctlifp) == NULL) { url_ftp_close((URL)url); url_errno = URLERR_CANTOPEN; errno = ENOENT; return NULL; } if(strncmp(buff, "220 ", 4) != 0) { url_ftp_close((URL)url); url_errno = URLERR_CANTOPEN; errno = ENOENT; return NULL; } /* login */ sprintf(buff, "USER %s\r\n", user); if(ftp_cmd(url, buff, "331") < 0) return NULL; /* password */ if(passwd == NULL) sprintf(buff, "PASS Unknown@liburl.a\r\n"); else sprintf(buff, "PASS %s\r\n", passwd); if(ftp_cmd(url, buff, "230") < 0) return NULL; /* CWD */ if(path[1] == '0') /* Here is root */; else { path++; /* skip '/' */ while((p = strchr(path, '/')) != NULL) { *p = '\0'; sprintf(buff, "CWD %s\r\n", path); if(ftp_cmd(url, buff, "250") < 0) return NULL; path = p + 1; } if(!*path) { url_ftp_close((URL)url); url_errno = URLERR_IURLF; errno = ENOENT; return NULL; } } /* TYPE I */ strcpy(buff, "TYPE I\r\n"); if(ftp_cmd(url, buff, "200") < 0) return NULL; /* PASV */ strcpy(buff, "PASV\r\n"); if(ftp_cmd(url, buff, "227") < 0) return NULL; /* Parse PASV * 227 Entering Passive Mode (h1,h2,h3,h4,p1,p2) */ p = buff + 4; while(*p && (*p < '0' || *p > '9')) p++; if(*p == '\0') { url_ftp_close((URL)url); url_errno = URLERR_CANTOPEN; errno = ENOENT; return NULL; } host = p; n = 0; /* number of commas */ while(n < 4) { if((p = strchr(p, ',')) == NULL) { url_ftp_close((URL)url); url_errno = URLERR_CANTOPEN; errno = ENOENT; return NULL; } *p = '.'; n++; } *p++ = '\0'; port = atoi(p) * 256; if((p = strchr(p, ',')) == NULL) { url_ftp_close((URL)url); url_errno = URLERR_CANTOPEN; errno = ENOENT; return NULL; } port += atoi(p + 1); /* RETR */ socket_fwrite("RETR ", 5, url->ctlofp); socket_fwrite(path, (long)strlen(path), url->ctlofp); socket_fwrite("\r\n", 2, url->ctlofp); socket_fflush(url->ctlofp); #ifdef DEBUG printf("FTP>RETR %s\r\n", path); #endif /* DEBUG */ } /* Open data connection. */ #ifdef DEBUG printf("open(host=`%s', port=`%d')\n", host, port); #endif /* DEBUG */ if((fd = open_socket(host, port)) < 0) { url_ftp_close((URL)url); if(errno) url_errno = errno; else url_errno = errno = ENOENT; return NULL; } if((url->datafp = socket_fdopen(fd, "rb")) == NULL) { url_errno = errno; closesocket(fd); url_ftp_close((URL)url); errno = url_errno; return NULL; } if(url_ftp_proxy_host != NULL) { /* proxy */ sprintf(buff, "GET %s HTTP/1.0\r\n", name); socket_write(fd, buff, (long)strlen(buff)); #ifdef DEBUG printf("FTP<%s", buff); #endif /* DEBUG */ if(url_user_agent) { sprintf(buff, "User-Agent: %s\r\n", url_user_agent); socket_write(fd, buff, (long)strlen(buff)); #ifdef DEBUG printf("FTP<%s", buff); #endif /* DEBUG */ } socket_write(fd, "\r\n", 2); errno = 0; if(socket_fgets(buff, BUFSIZ, url->datafp) == NULL) { if(errno == 0) errno = ENOENT; url_errno = errno; url_ftp_close((URL)url); return NULL; } #ifdef DEBUG printf("FTP>%s", buff); #endif /* DEBUG */ p = buff; if(strncmp(p, "HTTP/1.0 ", 9) == 0 || strncmp(p, "HTTP/1.1 ", 9) == 0) p += 9; if(strncmp(p, "200", 3) != 0) /* Not success */ { url_ftp_close((URL)url); url_errno = errno = guess_errno(buff); return NULL; } /* Skip mime header */ while(socket_fgets(buff, BUFSIZ, url->datafp) != NULL) { if(buff[0] == '\n' || (buff[0] == '\r' && buff[1] == '\n')) break; /* end of heaer */ #ifdef DEBUG printf("FTP>%s", buff); #endif /* DEBUG */ } } else { /* not proxy */ if(socket_fgets(buff, BUFSIZ, url->ctlifp) == NULL) { url_ftp_close((URL)url); url_errno = errno; return NULL; } #ifdef DEBUG printf("FTP<%s", buff); #endif /* DEBUG */ if(strncmp(buff, "150", 3) != 0) { url_ftp_close((URL)url); url_errno = errno = guess_errno(buff); return NULL; } url->abor = 1; } #ifdef __W32__ return url_buff_open((URL)url, 1); #else return (URL)url; #endif /* __W32__ */ } static long url_ftp_read(URL url, void *buff, long n) { URL_ftp *urlp = (URL_ftp *)url; n = socket_fread(buff, n, urlp->datafp); if(n <= 0) urlp->abor = 0; return n; } static char *url_ftp_gets(URL url, char *buff, int n) { URL_ftp *urlp = (URL_ftp *)url; buff = socket_fgets(buff, n, urlp->datafp); if(buff == NULL) urlp->abor = 0; return buff; } static int url_ftp_fgetc(URL url) { URL_ftp *urlp = (URL_ftp *)url; int n; unsigned char c; n = socket_fread(&c, 1, urlp->datafp); if(n <= 0) { urlp->abor = 0; if(errno) url_errno = errno; return EOF; } return (int)c; } static void url_ftp_close(URL url) { URL_ftp *urlp = (URL_ftp *)url; int save_errno = errno; if(urlp->datafp != NULL) socket_fclose(urlp->datafp); else urlp->abor = 0; if(urlp->ctlofp != NULL) { if(urlp->abor) socket_fwrite("ABOR\r\n", 6, urlp->ctlofp); socket_fwrite("QUIT\r\n", 6, urlp->ctlofp); socket_fflush(urlp->ctlofp); socket_fclose(urlp->ctlofp); } if(urlp->ctlifp != NULL) socket_fclose(urlp->ctlifp); free(url); errno = save_errno; } TiMidity++-2.13.2/libarc/url_news.c0100644004711200001440000002326007515654262016152 0ustar tamukiusers/* TiMidity++ -- MIDI to WAVE converter and player Copyright (C) 1999-2002 Masanao Izumo Copyright (C) 1995 Tuukka Toivonen 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ #include #include #ifdef HAVE_UNISTD_H #include #endif /* HAVE_UNISTD_H */ #ifndef NO_STRING_H #include #else #include #endif #include /* for SIGALRM */ #include "timidity.h" #include "common.h" #include "url.h" #include "net.h" typedef struct _NewsConnection { char *host; unsigned short port; FILE *fp; SOCKET fd; struct _NewsConnection *next; int status; /* -1, 0, 1 */ } NewsConnection; #define NNTP_OK_ID '2' #define ALARM_TIMEOUT 10 /* #define DEBUG */ static VOLATILE int timeout_flag = 1; static NewsConnection *connection_cache; static int connection_cache_flag = URL_NEWS_CONN_NO_CACHE; typedef struct _URL_news { char common[sizeof(struct _URL)]; NewsConnection *news; int status; /* for detection '\r?\n.\r?\n' * 1 2 34 5 */ int eof; } URL_news; enum { ARTICLE_STATUS_0, ARTICLE_STATUS_1, ARTICLE_STATUS_2, ARTICLE_STATUS_3, ARTICLE_STATUS_4 }; static int name_news_check(char *url_string); static long url_news_read(URL url, void *buff, long n); static int url_news_fgetc(URL url); static void url_news_close(URL url); struct URL_module URL_module_news = { URL_news_t, name_news_check, NULL, url_news_open, NULL }; static int name_news_check(char *s) { if(strncmp(s, "news://", 7) == 0 && strchr(s, '@') != NULL) return 1; return 0; } /*ARGSUSED*/ static void timeout(int sig) { timeout_flag = 1; } static void close_news_server(NewsConnection *news) { if(news->fd != (SOCKET)-1) { socket_write(news->fd, "QUIT\r\n", 6); closesocket(news->fd); } if(news->fp != NULL) socket_fclose(news->fp); free(news->host); news->status = -1; } static NewsConnection *open_news_server(char *host, unsigned short port) { NewsConnection *p; char buff[512]; for(p = connection_cache; p != NULL; p = p->next) { if(p->status == 0 && strcmp(p->host, host) == 0 && p->port == port) { p->status = 1; return p; } } for(p = connection_cache; p != NULL; p = p->next) if(p->status == -1) break; if(p == NULL) { if((p = (NewsConnection *)safe_malloc(sizeof(NewsConnection))) == NULL) return NULL; p->next = connection_cache; connection_cache = p; p->status = -1; } if((p->host = safe_strdup(host)) == NULL) return NULL; p->port = port; #ifdef __W32__ timeout_flag = 0; p->fd = open_socket(host, port); #else timeout_flag = 0; signal(SIGALRM, timeout); alarm(ALARM_TIMEOUT); p->fd = open_socket(host, port); alarm(0); signal(SIGALRM, SIG_DFL); #endif /* __W32__ */ if(p->fd == (SOCKET)-1) { int save_errno; VOLATILE_TOUCH(timeout_flag); #ifdef ETIMEDOUT if(timeout_flag) errno = ETIMEDOUT; #endif /* ETIMEDOUT */ if(errno) url_errno = errno; else { url_errno = URLERR_CANTOPEN; errno = ENOENT; } #ifdef DEBUG perror(host); #endif /* DEBUG */ save_errno = errno; free(p->host); errno = save_errno; return NULL; } if((p->fp = socket_fdopen(p->fd, "rb")) == NULL) { url_errno = errno; closesocket(p->fd); free(p->host); errno = url_errno; return NULL; } buff[0] = '\0'; if(socket_fgets(buff, sizeof(buff), p->fp) == NULL) { url_errno = errno; closesocket(p->fd); socket_fclose(p->fp); free(p->host); errno = url_errno; return NULL; } #ifdef DEBUG printf("Connect status: %s", buff); #endif /* DEBUG */ if(buff[0] != NNTP_OK_ID) { closesocket(p->fd); socket_fclose(p->fp); free(p->host); url_errno = URLERR_CANTOPEN; errno = ENOENT; return NULL; } p->status = 1; return p; } int url_news_connection_cache(int flag) { NewsConnection *p; int oldflag; oldflag = connection_cache_flag; switch(flag) { case URL_NEWS_CONN_NO_CACHE: case URL_NEWS_CONN_CACHE: connection_cache_flag = flag; break; case URL_NEWS_CLOSE_CACHE: for(p = connection_cache; p != NULL; p = p->next) if(p->status == 0) close_news_server(p); break; case URL_NEWS_GET_FLAG: break; } return oldflag; } URL url_news_open(char *name) { URL_news *url; char *host, *p; unsigned short port; char buff[BUFSIZ], messageID[256]; int check_timeout; int i; #ifdef DEBUG printf("url_news_open(%s)\n", name); #endif /* DEBUG */ url = (URL_news *)alloc_url(sizeof(URL_news)); if(url == NULL) { url_errno = errno; return NULL; } /* common members */ URLm(url, type) = URL_news_t; URLm(url, url_read) = url_news_read; URLm(url, url_gets) = NULL; URLm(url, url_fgetc) = url_news_fgetc; URLm(url, url_seek) = NULL; URLm(url, url_tell) = NULL; URLm(url, url_close) = url_news_close; /* private members */ url->news = NULL; url->status = ARTICLE_STATUS_2; url->eof = 0; if(strncmp(name, "news://", 7) == 0) name += 7; strncpy(buff, name, sizeof(buff) - 1); buff[sizeof(buff) - 1] = '\0'; host = buff; for(p = host; *p && *p != ':' && *p != '/'; p++) ; if(*p == ':') { *p++ = '\0'; /* terminate `host' string */ port = atoi(p); p = strchr(p, '/'); if(p == NULL) { url_errno = URLERR_CANTOPEN; errno = ENOENT; url_news_close((URL)url); return NULL; } } else port = 119; *p++ = '\0'; /* terminate `host' string */ if(*p == '<') p++; strncpy(messageID, p, sizeof(messageID) - 1); messageID[sizeof(messageID) - 1] = '\0'; i = strlen(messageID); if(i > 0 && messageID[i - 1] == '>') messageID[i - 1] = '\0'; #ifdef DEBUG printf("messageID: <%s>\n", messageID); #endif /* DEBUG */ #ifdef DEBUG printf("open(host=`%s', port=`%d')\n", host, port); #endif /* DEBUG */ if((url->news = open_news_server(host, port)) == NULL) { url_news_close((URL)url); return NULL; } check_timeout = 1; retry_article: sprintf(buff, "ARTICLE <%s>\r\n", messageID); #ifdef DEBUG printf("CMD> %s", buff); #endif /* DEBUG */ socket_write(url->news->fd, buff, (long)strlen(buff)); buff[0] = '\0'; if(socket_fgets(buff, sizeof(buff), url->news->fp) == NULL) { if(check_timeout) { check_timeout = 0; close_news_server(url->news); if((url->news = open_news_server(host, port)) != NULL) goto retry_article; } url_news_close((URL)url); url_errno = URLERR_CANTOPEN; errno = ENOENT; return NULL; } #ifdef DEBUG printf("CMD< %s", buff); #endif /* DEBUG */ if(buff[0] != NNTP_OK_ID) { if(check_timeout && strncmp(buff, "503", 3) == 0) { check_timeout = 0; close_news_server(url->news); if((url->news = open_news_server(host, port)) != NULL) goto retry_article; } url_news_close((URL)url); url_errno = errno = ENOENT; return NULL; } return (URL)url; } static void url_news_close(URL url) { URL_news *urlp = (URL_news *)url; NewsConnection *news = urlp->news; int save_errno = errno; if(news != NULL) { if(connection_cache_flag == URL_NEWS_CONN_CACHE) news->status = 0; else close_news_server(news); } free(url); errno = save_errno; } static long url_news_read(URL url, void *buff, long size) { char *p = (char *)buff; long n; int c; n = 0; while(n < size) { if((c = url_news_fgetc(url)) == EOF) break; p[n++] = c; } return n; } static int url_news_fgetc(URL url) { URL_news *urlp = (URL_news *)url; NewsConnection *news = urlp->news; int c; if(urlp->eof) return EOF; if((c = socket_fgetc(news->fp)) == EOF) { urlp->eof = 1; return EOF; } switch(urlp->status) { case ARTICLE_STATUS_0: if(c == '\r') urlp->status = ARTICLE_STATUS_1; else if(c == '\n') urlp->status = ARTICLE_STATUS_2; break; case ARTICLE_STATUS_1: if(c == '\n') urlp->status = ARTICLE_STATUS_2; else urlp->status = ARTICLE_STATUS_0; break; case ARTICLE_STATUS_2: if(c == '.') urlp->status = ARTICLE_STATUS_3; else urlp->status = ARTICLE_STATUS_0; break; case ARTICLE_STATUS_3: if(c == '\r') urlp->status = ARTICLE_STATUS_4; else if(c == '\n') urlp->eof = 1; else urlp->status = ARTICLE_STATUS_0; break; case ARTICLE_STATUS_4: if(c == '\n') urlp->eof = 1; break; } return c; } #ifdef NEWS_MAIN void main(int argc, char **argv) { URL url; char buff[BUFSIZ]; int c; if(argc != 2) { fprintf(stderr, "Usage: %s news-URL\n", argv[0]); exit(1); } if((url = url_news_open(argv[1])) == NULL) { fprintf(stderr, "Can't open news group: %s\n", argv[1]); exit(1); } #if NEWS_MAIN while((c = url_getc(url)) != EOF) putchar(c); #else while((c = url_read(url, buff, sizeof(buff))) > 0) write(1, buff, c); #endif url_close(url); exit(0); } #endif /* NEWS_MAIN */ TiMidity++-2.13.2/libarc/url_newsgroup.c0100644004711200001440000002537507515607224017234 0ustar tamukiusers/* TiMidity++ -- MIDI to WAVE converter and player Copyright (C) 1999-2002 Masanao Izumo Copyright (C) 1995 Tuukka Toivonen 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ #include #include #ifdef HAVE_UNISTD_H #include #endif /* HAVE_UNISTD_H */ #ifndef NO_STRING_H #include #else #include #endif #include /* for SIGALRM */ #include "timidity.h" #include "common.h" #include "url.h" #include "net.h" #define NNTP_OK_ID '2' #define MAX_LINE_BUFF 1024 #define ALARM_TIMEOUT 10 /* #define DEBUG */ #ifdef URL_NEWS_XOVER_SUPPORT static char *xover_commands[] = {URL_NEWS_XOVER_SUPPORT, NULL}; #else static char *xover_commands[] = {NULL}; #endif /* URL_NEWS_XOVER_SUPPORT */ static VOLATILE int timeout_flag = 1; typedef struct _URL_newsgroup { char common[sizeof(struct _URL)]; FILE *fp; SOCKET fd; int first, last; int minID, maxID; int xover; int eof; char *name; } URL_newsgroup; static int name_newsgroup_check(char *url_string); static long url_newsgroup_read(URL url, void *buff, long n); static char *url_newsgroup_gets(URL url, char *buff, int n); static void url_newsgroup_close(URL url); struct URL_module URL_module_newsgroup = { URL_newsgroup_t, name_newsgroup_check, NULL, url_newsgroup_open, NULL }; static int name_newsgroup_check(char *s) { if(strncmp(s, "news://", 7) == 0 && strchr(s, '@') == NULL) return 1; return 0; } /*ARGSUSED*/ static void timeout(int sig) { timeout_flag = 1; } URL url_newsgroup_open(char *name) { URL_newsgroup *url; SOCKET fd; char *host, *p, *urlname; unsigned short port; char buff[BUFSIZ], group[256], *range; int n; #ifdef DEBUG printf("url_newsgroup_open(%s)\n", name); #endif /* DEBUG */ if((urlname = safe_strdup(name)) == NULL) return NULL; n = strlen(urlname); while(n > 0 && urlname[n - 1] == '/') urlname[--n] = '\0'; url = (URL_newsgroup *)alloc_url(sizeof(URL_newsgroup)); if(url == NULL) { url_errno = errno; free(urlname); errno = url_errno; return NULL; } /* common members */ URLm(url, type) = URL_newsgroup_t; URLm(url, url_read) = url_newsgroup_read; URLm(url, url_gets) = url_newsgroup_gets; URLm(url, url_fgetc) = NULL; URLm(url, url_seek) = NULL; URLm(url, url_tell) = NULL; URLm(url, url_close) = url_newsgroup_close; /* private members */ url->fd = (SOCKET)-1; url->fp = NULL; url->xover = -1; url->eof = 0; url->first = url->last = 0; url->minID = url->maxID = 0; url->name = urlname; if(strncmp(name, "news://", 7) == 0) name += 7; strncpy(buff, name, sizeof(buff) - 1); buff[sizeof(buff) - 1] = '\0'; host = buff; for(p = host; *p && *p != ':' && *p != '/'; p++) ; if(*p == ':') { *p++ = '\0'; /* terminate `host' string */ port = atoi(p); p = strchr(p, '/'); if(p == NULL) { url_errno = URLERR_CANTOPEN; errno = ENOENT; url_newsgroup_close((URL)url); return NULL; } } else port = 119; *p++ = '\0'; /* terminate `host' string */ strncpy(group, p, sizeof(group) - 1); group[sizeof(group) - 1] = '\0'; if((range = strchr(group, '/')) != NULL) *range++ = '\0'; #ifdef DEBUG printf("group: %s\n", group); #endif /* DEBUG */ #ifdef DEBUG printf("open(host=`%s', port=`%d')\n", host, port); #endif /* DEBUG */ #ifdef __W32__ timeout_flag = 0; fd = open_socket(host, port); #else timeout_flag = 0; signal(SIGALRM, timeout); alarm(ALARM_TIMEOUT); url->fd = fd = open_socket(host, port); alarm(0); signal(SIGALRM, SIG_DFL); #endif /* __W32__ */ if(fd == (SOCKET)-1) { VOLATILE_TOUCH(timeout_flag); #ifdef ETIMEDOUT if(timeout_flag) errno = ETIMEDOUT; #endif /* ETIMEDOUT */ if(errno) url_errno = errno; else { url_errno = URLERR_CANTOPEN; errno = ENOENT; } url_newsgroup_close((URL)url); return NULL; } if((url->fp = socket_fdopen(fd, "rb")) == NULL) { url_errno = errno; closesocket(fd); url_newsgroup_close((URL)url); errno = url_errno; return NULL; } if(socket_fgets(buff, sizeof(buff), url->fp) == NULL) { url_newsgroup_close((URL)url); return NULL; } #ifdef DEBUG printf("Connect status: %s", buff); #endif /* DEBUG */ if(buff[0] != NNTP_OK_ID) { url_newsgroup_close((URL)url); url_errno = URLERR_CANTOPEN; errno = ENOENT; return NULL; } sprintf(buff, "GROUP %s\r\n", group); #ifdef DEBUG printf("CMD> %s", buff); #endif /* DEBUG */ socket_write(fd, buff, (long)strlen(buff)); if(socket_fgets(buff, sizeof(buff), url->fp) == NULL) { url_newsgroup_close((URL)url); url_errno = URLERR_CANTOPEN; errno = ENOENT; return NULL; } #ifdef DEBUG printf("CMD< %s", buff); #endif /* DEBUG */ if(buff[0] != NNTP_OK_ID) { url_newsgroup_close((URL)url); url_errno = URLERR_CANTOPEN; errno = ENOENT; return NULL; } p = buff + 4; if(*p == '0') /* No article */ url->eof = 1; p++; while('0' <= *p && *p <= '9') p++; while(*p == ' ') p++; url->first = url->minID = atoi(p); while('0' <= *p && *p <= '9') p++; while(*p == ' ') p++; url->last = url->maxID = atoi(p); if(range != NULL) { if('0' <= *range && *range <= '9') { url->first = atoi(range); if(url->first < url->minID) url->first = url->minID; } if((range = strchr(range, '-')) != NULL) { range++; if('0' <= *range && *range <= '9') { url->last = atoi(range); if(url->last > url->maxID) url->last = url->maxID; } } } return (URL)url; } char *url_newsgroup_name(URL url) { if(url->type != URL_newsgroup_t) return NULL; return ((URL_newsgroup *)url)->name; } static void url_newsgroup_close(URL url) { URL_newsgroup *urlp = (URL_newsgroup *)url; int save_errno = errno; if(urlp->fd != (SOCKET)-1) { socket_write(urlp->fd, "QUIT\r\n", 6); closesocket(urlp->fd); } if(urlp->fp != NULL) socket_fclose(urlp->fp); if(urlp->name != NULL) free(urlp->name); free(url); errno = save_errno; } static long url_newsgroup_read(URL url, void *buff, long n) { char *p; p = url_newsgroup_gets(url, (char *)buff, n); if(p == NULL) return 0; return (long)strlen(p); } static char *url_newsgroup_gets(URL url, char *buff, int n) { URL_newsgroup *urlp = (URL_newsgroup *)url; char linebuff[MAX_LINE_BUFF], *p, numbuf[32]; int i, j, nump; int find_first; if(urlp->eof || n <= 0) return NULL; if(n == 1) { buff[0] = '\0'; return buff; } find_first = 0; if(urlp->xover == -1) { urlp->xover = 0; for(i = 0; xover_commands[i] != NULL; i++) { sprintf(linebuff, "%s %d-%d\r\n", xover_commands[i], urlp->first, urlp->last); #ifdef DEBUG printf("CMD> %s", linebuff); #endif /* DEBUG */ socket_write(urlp->fd, linebuff, (long)strlen(linebuff)); if(socket_fgets(linebuff, sizeof(linebuff), urlp->fp) == NULL) { urlp->eof = 1; return NULL; } #ifdef DEBUG printf("CMD< %s", linebuff); #endif /* DEBUG */ if(linebuff[0] == NNTP_OK_ID) { urlp->xover = 1; break; } } if(!urlp->xover) find_first = 1; } else if(!urlp->xover) socket_write(urlp->fd, "NEXT\r\n", 6); next_read: if(find_first) { for(i = urlp->first; i <= urlp->last; i++) { sprintf(linebuff, "STAT %d\r\n", i); #ifdef DEBUG printf("CMD> %s", linebuff); #endif /* DEBUG */ socket_write(urlp->fd, linebuff, (long)strlen(linebuff)); if(socket_fgets(linebuff, sizeof(linebuff), urlp->fp) == NULL) { urlp->eof = 1; return NULL; } #ifdef DEBUG printf("CMD< %s", linebuff); #endif /* DEBUG */ if(atoi(linebuff) != 423) break; } if(i > urlp->last) { urlp->eof = 1; return NULL; } find_first = 0; } else { if(socket_fgets(linebuff, sizeof(linebuff), urlp->fp) == NULL) { urlp->eof = 1; return NULL; } i = strlen(linebuff); if(i > 0 && linebuff[i - 1] != '\n') { int c; do { c = socket_fgetc(urlp->fp); } while(c != '\n' && c != EOF); } } p = linebuff; #ifdef DEBUG printf("line: %s", linebuff); #endif /* DEBUG */ if(urlp->xover == 0) { if(p[0] != '2') { if(strncmp(p, "421", 3) == 0) { urlp->eof = 1; return NULL; } socket_write(urlp->fd, "NEXT\r\n", 6); goto next_read; } p += 3; while(*p == ' ' || *p == '\t') p++; nump = 0; i = atoi(p); if(i > urlp->last) { urlp->eof = 1; return NULL; } if(i == urlp->last) urlp->eof = 1; while('0' <= *p && *p <= '9' && nump < sizeof(numbuf)) numbuf[nump++] = *p++; if(nump == 0) { socket_write(urlp->fd, "NEXT\r\n", 6); goto next_read; } if((p = strchr(linebuff, '<')) == NULL) { socket_write(urlp->fd, "NEXT\r\n", 6); goto next_read; } } else { int i; if(linebuff[0] == '.') { urlp->eof = 1; return NULL; } nump = 0; while('0' <= linebuff[nump] && linebuff[nump] <= '9' && nump < sizeof(numbuf)) { numbuf[nump] = linebuff[nump]; nump++; } for(i = 0; i < 4; i++) { p = strchr(p, '\t'); if(p == NULL) goto next_read; p++; } } if(*p == '<') p++; i = j = 0; while(j < n - 2 && j < nump) { buff[j] = numbuf[j]; j++; } buff[j++] = ' '; while(j < n - 1 && p[i] && p[i] != '>' && p[i] != ' ' && p[i] != '\t') { buff[j] = p[i]; i++; j++; } buff[j] = '\0'; return buff; } #ifdef NEWSGROUP_MAIN void *safe_malloc(int n) { return malloc(n); } void *safe_realloc(void *p, int n) { return realloc(p, n); } void main(int argc, char **argv) { URL url; char buff[BUFSIZ]; if(argc != 2) { fprintf(stderr, "Usage: %s news-URL\n", argv[0]); exit(1); } if((url = url_newsgroup_open(argv[1])) == NULL) { fprintf(stderr, "Can't open news group: %s\n", argv[1]); exit(1); } while(url_gets(url, buff, sizeof(buff)) != NULL) puts(buff); url_close(url); exit(0); } #endif /* NEWSGROUP_MAIN */ TiMidity++-2.13.2/libunimod/0040755004711200001440000000000010031564160014656 5ustar tamukiusersTiMidity++-2.13.2/libunimod/AUTHORS0100644004711200001440000001050707421005041015723 0ustar tamukiusersCode in this directory was modified by Paolo Bonzini starting from libmikmod 3.1.8 libmikmod was cleaned up, removing code that was needed by libmikmod's portability (MD_) layer and data that were needed by the player. The player itself now forms the core of TiMidity++'s mod.c file but is detached from libunimod which is nothing more a generic module->UNI converter. In addition, libmikmod's own portable file I/O routines were changed to rely on libarc's URL objects. The code should be compatible enough that new libmikmod loaders should be plugged in without even touching the code (only mloader.c's final part). Some might require changing MREADER * to URL (e.g. amf, it). libmikmod main authors ---------------------- * Jean-Paul Mikkers (MikMak) wrote MikMod and maintained it until version 3. * Jake Stine (Air Richter) [email doesn't work anymore...] made decisive contributions to the code (esp. IT support) and maintained MikMod version 3 until it was discontinued. He still works on the WinAmp module plugin, roughly based on MikMod. * Miodrag Vallat current libmikmod maintainer (since version 3.0.4), made an audit of the code resulting in many bugs fixed. Previous Unix maintainers ------------------------- * Steve McIntyre maintained MikMod'Unix version 2. * Peter Amstutz maintained MikMod'Unix version 3.0. Contributors on the Unix side ----------------------------- * Arne de Bruijn wrote the compressed IT sample support. * Douglas Carmichael made MikMod work under FreeBSD. * Chris Conn wrote the OSS driver. * Roine Gustaffson wrote the Digital AudioFile driver. * Stephan Kanthak wrote the SGI driver. * Lutz Vieweg wrote the AIX and HP-UX drivers. * Valtteri Vuorikoski wrote the Sun driver. * Andy Lo A Foe wrote the Ultra driver (for the Gravis Ultrasound sound card). * C Ray C updated the Ultra driver to work with libmikmod 3. * ``MenTaLguY'' autoconfized the Unix libmikmod distribution. * Claudio Matsuoka wrote the STX loader and submitted bug fixes. * Tobias Gloth created the new I/O interface, made the code MT-safe and submitted bug fixes. * Kev Vance wrote the GDM loader. * Simon Hosie wrote the piped output driver, and submitted speed optimizations and bugfixes for the software mixer. Contributors on the Windows side -------------------------------- * Brian McKinney created the DirectSound driver. * Bjornar Henden created the Multimedia API windows driver. Contributors on the Dos side ---------------------------- Their code isn't there anymore, but they contributed to the success of libmikmod... * Jean-Philippe Ajirent wrote the EMS memory routines. * Peter Breitling ported MikMod to DJGPP. * Arnout Cosman wrote the PAS driver. * Mario Koeppen wrote the WSS driver. * Mike Leibow wrote the GUS driver. * Jeremy McDonald wrote a fast assembly-language mixer. * Steffen Rusitschka and Vince Vu wrote the AWE driver. Contributors on the Macintosh side ---------------------------------- * Anders Bjoerklund ported libmikmod to the Macintosh. Contributors on the OS/2 side ----------------------------- * Stefan Tibus ported libmikmod to OS/2. * Andrew Zabolotny improved the existing OS/2 drivers. Contributors on the BeOS side ----------------------------- * Thomas Neumann integrated libmikmod into his BeOS APlayer, and contributed many bug fixes. Other contributors ------------------ * Sebastiaan A. Megens fixed various bugs (memory leaks, endianness issues, etc). * Paul Fisher made decisive contributions and improvements. * Alexander Kerkhove fixed an ULT panning effect bug. * ``Kodiak'' helped on the interfaces of libmikmod. * Sylvain Marchand make MikMod more portable and GCC compilable. -- If your name is missing, don't hesitate to remind me at TiMidity++-2.13.2/libunimod/Makefile.am0100644004711200001440000000417510056744111016721 0ustar tamukiusers# TiMidity++ -- MIDI to WAVE converter and player # Copyright (C) 1999-2002 Masanao Izumo # Copyright (C) 1995 Tuukka Toivonen # # 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA include $(top_srcdir)/common.makefile.in INCLUDES = \ -I$(top_srcdir) \ -I$(top_srcdir)/timidity \ -I$(top_srcdir)/utils \ -I$(top_srcdir)/libarc \ $(EXTRAINCS) noinst_LIBRARIES = libunimod.a libunimod_a_SOURCES = \ load_669.c \ load_amf.c \ load_dsm.c \ load_far.c \ load_gdm.c \ load_imf.c \ load_it.c \ load_m15.c \ load_med.c \ load_mod.c \ load_mtm.c \ load_okt.c \ load_s3m.c \ load_stm.c \ load_stx.c \ load_ult.c \ load_uni.c \ load_xm.c \ mloader.c \ mlutil.c \ mmsup.c \ munitrk.c \ unimod.h \ unimod_priv.h libunimod.a: $(libunimod_a_OBJECTS) $(libunimod_a_DEPENDENCIES) if VCPP rm -f libunimod.a rm -f unimod.lib link -lib $(libunimod_a_OBJECTS) -out:unimod.lib if test -f unimod.lib ; then touch $@ ; fi else if BORLANDC rm -f libunimod.a rm -f unimod.lib for foo in $(libunimod_a_OBJECTS);do \ tlib unimod.lib +$$foo; \ done if test -f unimod.lib ; then touch $@ ; fi else if WATCOM_C rm -f libunimod.a rm -f unimod.lib for foo in $(libunimod_a_OBJECTS);do \ wlib -q unimod.lib +$$foo; \ done if test -f unimod.lib ; then touch $@ ; fi else -rm -f libunimod.a $(libunimod_a_AR) libunimod.a $(libunimod_a_OBJECTS) $(libunimod_a_LIBADD) $(RANLIB) libunimod.a endif endif endif clean: rm -f *.$(OBJEXT) rm -f *.$(so) rm -f *.a rm -f *.lib TiMidity++-2.13.2/libunimod/Makefile.in0100644004711200001440000005217710124332437016737 0ustar tamukiusers# Makefile.in generated by automake 1.7.6 from Makefile.am. # @configure_input@ # Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 # 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@ # TiMidity++ -- MIDI to WAVE converter and player # Copyright (C) 1999-2002 Masanao Izumo # Copyright (C) 1995 Tuukka Toivonen # # 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # Define follows if you want to change. # Note that the definition of beginning with just one `#' implies # default value from configure. srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = .. am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ 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 = : host_triplet = @host@ pkgdatadir = @pkgdatadir@ #CC= @CC@ #CFLAGS = @CFLAGS@ # For pentium gcc # For PGCC #CPPFLAGS = @CPPFLAGS@ #DEFS = @DEFS@ #LDFLAGS = @LDFLAGS@ #LIBS = @LIBS@ #SHLD = @SHLD@ #SHCFLAGS = @SHCFLAGS@ #@SET_MAKE@ #prefix = @prefix@ #exec_prefix = @exec_prefix@ #bindir = @bindir@ #libdir = @libdir@ #datadir = @datadir@ #mandir = @mandir@ pkglibdir = @pkglibdir@ ACLOCAL = @ACLOCAL@ ALSA_CFLAGS = @ALSA_CFLAGS@ ALSA_LIBS = @ALSA_LIBS@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AO_CFLAGS = @AO_CFLAGS@ AO_LIBS = @AO_LIBS@ ARTS_CFLAGS = @ARTS_CFLAGS@ ARTS_CONFIG = @ARTS_CONFIG@ ARTS_LIBS = @ARTS_LIBS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ A_so_libs = @A_so_libs@ BORLANDC_FALSE = @BORLANDC_FALSE@ BORLANDC_LDFLAGS = @BORLANDC_LDFLAGS@ BORLANDC_START = @BORLANDC_START@ BORLANDC_TRUE = @BORLANDC_TRUE@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGNUS_FALSE = @CYGNUS_FALSE@ CYGNUS_TRUE = @CYGNUS_TRUE@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ELFILES = @ELFILES@ EMACS = @EMACS@ ENABLE_ALSASEQ_FALSE = @ENABLE_ALSASEQ_FALSE@ ENABLE_ALSASEQ_TRUE = @ENABLE_ALSASEQ_TRUE@ ENABLE_DYNAMIC_TCLTK_FALSE = @ENABLE_DYNAMIC_TCLTK_FALSE@ ENABLE_DYNAMIC_TCLTK_TRUE = @ENABLE_DYNAMIC_TCLTK_TRUE@ ENABLE_DYNAMIC_XAW_FALSE = @ENABLE_DYNAMIC_XAW_FALSE@ ENABLE_DYNAMIC_XAW_TRUE = @ENABLE_DYNAMIC_XAW_TRUE@ ENABLE_EMACS_FALSE = @ENABLE_EMACS_FALSE@ ENABLE_EMACS_TRUE = @ENABLE_EMACS_TRUE@ ENABLE_GTK_FALSE = @ENABLE_GTK_FALSE@ ENABLE_GTK_TRUE = @ENABLE_GTK_TRUE@ ENABLE_MOTIF_FALSE = @ENABLE_MOTIF_FALSE@ ENABLE_MOTIF_TRUE = @ENABLE_MOTIF_TRUE@ ENABLE_NCURSES_FALSE = @ENABLE_NCURSES_FALSE@ ENABLE_NCURSES_TRUE = @ENABLE_NCURSES_TRUE@ ENABLE_NETWORK_FALSE = @ENABLE_NETWORK_FALSE@ ENABLE_NETWORK_TRUE = @ENABLE_NETWORK_TRUE@ ENABLE_PLUGIN_FALSE = @ENABLE_PLUGIN_FALSE@ ENABLE_PLUGIN_TRUE = @ENABLE_PLUGIN_TRUE@ ENABLE_PORTMIDISYN_FALSE = @ENABLE_PORTMIDISYN_FALSE@ ENABLE_PORTMIDISYN_TRUE = @ENABLE_PORTMIDISYN_TRUE@ ENABLE_SERVER_FALSE = @ENABLE_SERVER_FALSE@ ENABLE_SERVER_TRUE = @ENABLE_SERVER_TRUE@ ENABLE_SLANG_FALSE = @ENABLE_SLANG_FALSE@ ENABLE_SLANG_TRUE = @ENABLE_SLANG_TRUE@ ENABLE_SOUND_SPEC_FALSE = @ENABLE_SOUND_SPEC_FALSE@ ENABLE_SOUND_SPEC_TRUE = @ENABLE_SOUND_SPEC_TRUE@ ENABLE_TCLTK_FALSE = @ENABLE_TCLTK_FALSE@ ENABLE_TCLTK_TRUE = @ENABLE_TCLTK_TRUE@ ENABLE_VT100_FALSE = @ENABLE_VT100_FALSE@ ENABLE_VT100_TRUE = @ENABLE_VT100_TRUE@ ENABLE_W32GUI_FALSE = @ENABLE_W32GUI_FALSE@ ENABLE_W32GUI_TRUE = @ENABLE_W32GUI_TRUE@ ENABLE_W32G_SYN_FALSE = @ENABLE_W32G_SYN_FALSE@ ENABLE_W32G_SYN_TRUE = @ENABLE_W32G_SYN_TRUE@ ENABLE_WINSYN_FALSE = @ENABLE_WINSYN_FALSE@ ENABLE_WINSYN_TRUE = @ENABLE_WINSYN_TRUE@ ENABLE_WRD_FALSE = @ENABLE_WRD_FALSE@ ENABLE_WRD_TRUE = @ENABLE_WRD_TRUE@ ENABLE_XAW_FALSE = @ENABLE_XAW_FALSE@ ENABLE_XAW_TRUE = @ENABLE_XAW_TRUE@ ENABLE_XSKIN_FALSE = @ENABLE_XSKIN_FALSE@ ENABLE_XSKIN_TRUE = @ENABLE_XSKIN_TRUE@ ESD_CFLAGS = @ESD_CFLAGS@ ESD_CONFIG = @ESD_CONFIG@ ESD_LIBS = @ESD_LIBS@ EXEEXT = @EXEEXT@ EXTRALIBS = @EXTRALIBS@ GTK_CFLAGS = @GTK_CFLAGS@ GTK_CONFIG = @GTK_CONFIG@ GTK_LIBS = @GTK_LIBS@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INTERFACE_SRCS = @INTERFACE_SRCS@ LDFLAGS = @LDFLAGS@ LIBFLAC_CFLAGS = @LIBFLAC_CFLAGS@ LIBFLAC_LIBS = @LIBFLAC_LIBS@ LIBOBJS = @LIBOBJS@ LIBOGGFLAC_CFLAGS = @LIBOGGFLAC_CFLAGS@ LIBOGGFLAC_LIBS = @LIBOGGFLAC_LIBS@ LIBS = @LIBS@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ MAKEINFO = @MAKEINFO@ MSYS_FALSE = @MSYS_FALSE@ MSYS_TRUE = @MSYS_TRUE@ NEEDDLOPEN_FALSE = @NEEDDLOPEN_FALSE@ NEEDDLOPEN_TRUE = @NEEDDLOPEN_TRUE@ NEEDGETOPT_FALSE = @NEEDGETOPT_FALSE@ NEEDGETOPT_TRUE = @NEEDGETOPT_TRUE@ NETSRCS = @NETSRCS@ OBJEXT = @OBJEXT@ OGG_CFLAGS = @OGG_CFLAGS@ OGG_LIBS = @OGG_LIBS@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PKG_CONFIG = @PKG_CONFIG@ P_so_libs = @P_so_libs@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ SHCFLAGS = @SHCFLAGS@ SHELL = @SHELL@ SHLD = @SHLD@ STRIP = @STRIP@ SYSEXTRAS = @SYSEXTRAS@ T_so_libs = @T_so_libs@ VCPP_FALSE = @VCPP_FALSE@ VCPP_LDFLAGS = @VCPP_LDFLAGS@ VCPP_TRUE = @VCPP_TRUE@ VERSION = @VERSION@ VORBISENC_LIBS = @VORBISENC_LIBS@ VORBISFILE_LIBS = @VORBISFILE_LIBS@ VORBIS_CFLAGS = @VORBIS_CFLAGS@ VORBIS_LIBS = @VORBIS_LIBS@ W32READDIR_FALSE = @W32READDIR_FALSE@ W32READDIR_TRUE = @W32READDIR_TRUE@ WATCOM_C_FALSE = @WATCOM_C_FALSE@ WATCOM_C_TRUE = @WATCOM_C_TRUE@ WATCOM_LDFLAGS = @WATCOM_LDFLAGS@ WISH = @WISH@ W_so_libs = @W_so_libs@ X_CFLAGS = @X_CFLAGS@ X_EXTRA_LIBS = @X_EXTRA_LIBS@ X_LIBS = @X_LIBS@ X_PRE_LIBS = @X_PRE_LIBS@ a_so_libs = @a_so_libs@ ac_ct_CC = @ac_ct_CC@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ datadir = @datadir@ dynamic_targets = @dynamic_targets@ e_so_libs = @e_so_libs@ exec_prefix = @exec_prefix@ g_so_libs = @g_so_libs@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ i_so_libs = @i_so_libs@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ k_so_libs = @k_so_libs@ libdir = @libdir@ libexecdir = @libexecdir@ lispdir = @lispdir@ localstatedir = @localstatedir@ m_so_libs = @m_so_libs@ mandir = @mandir@ n_so_libs = @n_so_libs@ oldincludedir = @oldincludedir@ p_so_libs = @p_so_libs@ prefix = @prefix@ program_transform_name = @program_transform_name@ r_so_libs = @r_so_libs@ s_so_libs = @s_so_libs@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ so = @so@ sysconfdir = @sysconfdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ tcltk_dep = @tcltk_dep@ timidity_LDFLAGS = @timidity_LDFLAGS@ w_so_libs = @w_so_libs@ #INSTALL = @INSTALL@ # Where to install the patches, config files. PKGDATADIR = $(pkgdatadir) # Where to install the Tcl code and the bitmaps. # It also contains bitmaps which are shared with XAW interface. PKGLIBDIR = $(pkglibdir) # Where to install the dynamic link interface. SHLIB_DIR = $(pkglibdir) # Where to install timidity.el ELISP_DIR = $(lispdir) # If you want to change TCL_DIR, please do follows. # * Add -DTKPROGPATH=\"$(TCL_DIR)/tkmidity.tcl\" to CPPFLAGS. # * Make a symbolic link $(PKGLIBDIR)/bitmaps to $(TCL_DIR)/bitmaps TCL_DIR = $(PKGLIBDIR) # Define the timidity default file search path. DEF_DEFAULT_PATH = -DDEFAULT_PATH=\"$(PKGDATADIR)\" # You sould not change follows definitions. DEF_PKGDATADIR = -DPKGDATADIR=\"$(PKGDATADIR)\" DEF_PKGLIBDIR = -DPKGLIBDIR=\"$(PKGLIBDIR)\" DEF_SHLIB_DIR = -DSHLIB_DIR=\"$(SHLIB_DIR)\" BITMAP_DIR = $(TCL_DIR)/bitmaps INCLUDES = \ -I$(top_srcdir) \ -I$(top_srcdir)/timidity \ -I$(top_srcdir)/utils \ -I$(top_srcdir)/libarc \ $(EXTRAINCS) noinst_LIBRARIES = libunimod.a libunimod_a_SOURCES = \ load_669.c \ load_amf.c \ load_dsm.c \ load_far.c \ load_gdm.c \ load_imf.c \ load_it.c \ load_m15.c \ load_med.c \ load_mod.c \ load_mtm.c \ load_okt.c \ load_s3m.c \ load_stm.c \ load_stx.c \ load_ult.c \ load_uni.c \ load_xm.c \ mloader.c \ mlutil.c \ mmsup.c \ munitrk.c \ unimod.h \ unimod_priv.h subdir = libunimod ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 mkinstalldirs = $(SHELL) $(top_srcdir)/autoconf/mkinstalldirs CONFIG_HEADER = $(top_builddir)/config.h $(top_builddir)/interface.h CONFIG_CLEAN_FILES = LIBRARIES = $(noinst_LIBRARIES) libunimod_a_AR = $(AR) cru libunimod_a_LIBADD = am_libunimod_a_OBJECTS = load_669.$(OBJEXT) load_amf.$(OBJEXT) \ load_dsm.$(OBJEXT) load_far.$(OBJEXT) load_gdm.$(OBJEXT) \ load_imf.$(OBJEXT) load_it.$(OBJEXT) load_m15.$(OBJEXT) \ load_med.$(OBJEXT) load_mod.$(OBJEXT) load_mtm.$(OBJEXT) \ load_okt.$(OBJEXT) load_s3m.$(OBJEXT) load_stm.$(OBJEXT) \ load_stx.$(OBJEXT) load_ult.$(OBJEXT) load_uni.$(OBJEXT) \ load_xm.$(OBJEXT) mloader.$(OBJEXT) mlutil.$(OBJEXT) \ mmsup.$(OBJEXT) munitrk.$(OBJEXT) libunimod_a_OBJECTS = $(am_libunimod_a_OBJECTS) DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/autoconf/depcomp am__depfiles_maybe = depfiles @AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/load_669.Po ./$(DEPDIR)/load_amf.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/load_dsm.Po ./$(DEPDIR)/load_far.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/load_gdm.Po ./$(DEPDIR)/load_imf.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/load_it.Po ./$(DEPDIR)/load_m15.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/load_med.Po ./$(DEPDIR)/load_mod.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/load_mtm.Po ./$(DEPDIR)/load_okt.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/load_s3m.Po ./$(DEPDIR)/load_stm.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/load_stx.Po ./$(DEPDIR)/load_ult.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/load_uni.Po ./$(DEPDIR)/load_xm.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/mloader.Po ./$(DEPDIR)/mlutil.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/mmsup.Po ./$(DEPDIR)/munitrk.Po COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ DIST_SOURCES = $(libunimod_a_SOURCES) DIST_COMMON = $(top_srcdir)/common.makefile.in AUTHORS Makefile.am \ Makefile.in SOURCES = $(libunimod_a_SOURCES) all: all-am .SUFFIXES: .SUFFIXES: .c .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/common.makefile.in $(top_srcdir)/configure.in $(ACLOCAL_M4) cd $(top_srcdir) && \ $(AUTOMAKE) --gnu libunimod/Makefile Makefile: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.in $(top_builddir)/config.status cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) AR = ar clean-noinstLIBRARIES: -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) mostlyclean-compile: -rm -f *.$(OBJEXT) core *.core distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/load_669.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/load_amf.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/load_dsm.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/load_far.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/load_gdm.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/load_imf.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/load_it.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/load_m15.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/load_med.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/load_mod.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/load_mtm.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/load_okt.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/load_s3m.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/load_stm.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/load_stx.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/load_ult.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/load_uni.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/load_xm.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mloader.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mlutil.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mmsup.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/munitrk.Po@am__quote@ distclean-depend: -rm -rf ./$(DEPDIR) .c.o: @am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ @am__fastdepCC_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ @am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ @am__fastdepCC_TRUE@ fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `test -f '$<' || echo '$(srcdir)/'`$< .c.obj: @am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ @am__fastdepCC_TRUE@ -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ @am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ @am__fastdepCC_TRUE@ fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi` uninstall-info-am: ETAGS = etags ETAGSFLAGS = CTAGS = ctags CTAGSFLAGS = tags: TAGS ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ mkid -fID $$unique TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ test -z "$(ETAGS_ARGS)$$tags$$unique" \ || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$tags $$unique ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ test -z "$(CTAGS_ARGS)$$tags$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$tags $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && cd $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) $$here distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) top_distdir = .. distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) distdir: $(DISTFILES) $(mkinstalldirs) $(distdir)/.. @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ list='$(DISTFILES)'; for file in $$list; do \ case $$file in \ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ esac; \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ $(mkinstalldirs) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ if test -d $$d/$$file; then \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ cp -pR $$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 $(LIBRARIES) 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: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -rm -f Makefile $(CONFIG_CLEAN_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 clean-noinstLIBRARIES mostlyclean-am distclean: distclean-am distclean-am: clean-am distclean-compile distclean-depend \ distclean-generic distclean-tags dvi: dvi-am dvi-am: info: info-am info-am: install-data-am: install-exec-am: install-info: install-info-am install-man: installcheck-am: maintainer-clean: maintainer-clean-am 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-info-am .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-noinstLIBRARIES ctags distclean distclean-compile \ distclean-depend distclean-generic distclean-tags distdir dvi \ dvi-am info info-am install install-am install-data \ install-data-am install-exec install-exec-am install-info \ install-info-am install-man install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \ uninstall-am uninstall-info-am libunimod.a: $(libunimod_a_OBJECTS) $(libunimod_a_DEPENDENCIES) @VCPP_TRUE@ rm -f libunimod.a @VCPP_TRUE@ rm -f unimod.lib @VCPP_TRUE@ link -lib $(libunimod_a_OBJECTS) -out:unimod.lib @VCPP_TRUE@ if test -f unimod.lib ; then touch $@ ; fi @BORLANDC_TRUE@@VCPP_FALSE@ rm -f libunimod.a @BORLANDC_TRUE@@VCPP_FALSE@ rm -f unimod.lib @BORLANDC_TRUE@@VCPP_FALSE@ for foo in $(libunimod_a_OBJECTS);do \ @BORLANDC_TRUE@@VCPP_FALSE@ tlib unimod.lib +$$foo; \ @BORLANDC_TRUE@@VCPP_FALSE@ done @BORLANDC_TRUE@@VCPP_FALSE@ if test -f unimod.lib ; then touch $@ ; fi @BORLANDC_FALSE@@VCPP_FALSE@@WATCOM_C_TRUE@ rm -f libunimod.a @BORLANDC_FALSE@@VCPP_FALSE@@WATCOM_C_TRUE@ rm -f unimod.lib @BORLANDC_FALSE@@VCPP_FALSE@@WATCOM_C_TRUE@ for foo in $(libunimod_a_OBJECTS);do \ @BORLANDC_FALSE@@VCPP_FALSE@@WATCOM_C_TRUE@ wlib -q unimod.lib +$$foo; \ @BORLANDC_FALSE@@VCPP_FALSE@@WATCOM_C_TRUE@ done @BORLANDC_FALSE@@VCPP_FALSE@@WATCOM_C_TRUE@ if test -f unimod.lib ; then touch $@ ; fi @BORLANDC_FALSE@@VCPP_FALSE@@WATCOM_C_FALSE@ -rm -f libunimod.a @BORLANDC_FALSE@@VCPP_FALSE@@WATCOM_C_FALSE@ $(libunimod_a_AR) libunimod.a $(libunimod_a_OBJECTS) $(libunimod_a_LIBADD) @BORLANDC_FALSE@@VCPP_FALSE@@WATCOM_C_FALSE@ $(RANLIB) libunimod.a clean: rm -f *.$(OBJEXT) rm -f *.$(so) rm -f *.a rm -f *.lib # 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: TiMidity++-2.13.2/libunimod/load_669.c0100644004711200001440000002260307421005041016342 0ustar tamukiusers/* MikMod sound library (c) 1998, 1999 Miodrag Vallat and others - see file AUTHORS for complete list. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /*============================================================================== $Id: load_669.c,v 1.30 1999/10/25 16:31:41 miod Exp $ Composer 669 module loader ==============================================================================*/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include "unimod_priv.h" /*========== Module structure */ /* header */ typedef struct S69HEADER { UBYTE marker[2]; CHAR message[108]; UBYTE nos; UBYTE nop; UBYTE looporder; UBYTE orders[0x80]; UBYTE tempos[0x80]; UBYTE breaks[0x80]; } S69HEADER; /* sample information */ typedef struct S69SAMPLE { CHAR filename[13]; SLONG length; SLONG loopbeg; SLONG loopend; } S69SAMPLE; /* encoded note */ typedef struct S69NOTE { UBYTE a, b, c; } S69NOTE; /*========== Loader variables */ /* current pattern */ static S69NOTE *s69pat = NULL; /* Module header */ static S69HEADER *mh = NULL; /* file type identification */ static CHAR *S69_Version[] = { "Composer 669", "Extended 669" }; /*========== Loader code */ BOOL S69_Test (void) { UBYTE buf[0x80]; if (!_mm_read_UBYTES (buf, 2, modreader)) return 0; /* look for id */ if (!memcmp (buf, "if", 2) || !memcmp (buf, "JN", 2)) { int i; /* skip song message */ _mm_fseek (modreader, 108, SEEK_CUR); /* sanity checks */ if (_mm_read_UBYTE (modreader) > 64) return 0; if (_mm_read_UBYTE (modreader) > 128) return 0; if (_mm_read_UBYTE (modreader) > 127) return 0; /* check order table */ if (!_mm_read_UBYTES (buf, 0x80, modreader)) return 0; for (i = 0; i < 0x80; i++) if ((buf[i] >= 0x80) && (buf[i] != 0xff)) return 0; /* check tempos table */ if (!_mm_read_UBYTES (buf, 0x80, modreader)) return 0; for (i = 0; i < 0x80; i++) if ((!buf[i]) || (buf[i] > 32)) return 0; /* check pattern length table */ if (!_mm_read_UBYTES (buf, 0x80, modreader)) return 0; for (i = 0; i < 0x80; i++) if (buf[i] > 0x3f) return 0; } else return 0; return 1; } BOOL S69_Init (void) { if (!(s69pat = (S69NOTE *) _mm_malloc (64 * 8 * sizeof (S69NOTE)))) return 0; if (!(mh = (S69HEADER *) _mm_malloc (sizeof (S69HEADER)))) return 0; return 1; } void S69_Cleanup (void) { _mm_free (s69pat); _mm_free (mh); } static BOOL S69_LoadPatterns (void) { int track, row, channel; UBYTE note, inst, vol, effect, lastfx, lastval; S69NOTE *cur; int tracks = 0; if (!AllocPatterns ()) return 0; if (!AllocTracks ()) return 0; for (track = 0; track < of.numpat; track++) { /* set pattern break locations */ of.pattrows[track] = mh->breaks[track] + 1; /* load the 669 pattern */ cur = s69pat; for (row = 0; row < 64; row++) { for (channel = 0; channel < 8; channel++, cur++) { cur->a = _mm_read_UBYTE (modreader); cur->b = _mm_read_UBYTE (modreader); cur->c = _mm_read_UBYTE (modreader); } } if (_mm_eof (modreader)) { _mm_errno = MMERR_LOADING_PATTERN; return 0; } /* translate the pattern */ for (channel = 0; channel < 8; channel++) { UniReset (); /* set pattern tempo */ UniPTEffect (0xf, 78); UniPTEffect (0xf, mh->tempos[track]); lastfx = 0xff, lastval = 0; for (row = 0; row <= mh->breaks[track]; row++) { int a, b, c; /* fetch the encoded note */ a = s69pat[(row * 8) + channel].a; b = s69pat[(row * 8) + channel].b; c = s69pat[(row * 8) + channel].c; /* decode it */ note = a >> 2; inst = ((a & 0x3) << 4) | ((b & 0xf0) >> 4); vol = b & 0xf; if (a < 0xff) { if (a < 0xfe) { UniInstrument (inst); UniNote (note + 2 * OCTAVE); lastfx = 0xff; /* reset background effect memory */ } UniPTEffect (0xc, vol << 2); } if ((c != 0xff) || (lastfx != 0xff)) { if (c == 0xff) c = lastfx, effect = lastval; else effect = c & 0xf; switch (c >> 4) { case 0: /* porta up */ UniPTEffect (0x1, effect); lastfx = c, lastval = effect; break; case 1: /* porta down */ UniPTEffect (0x2, effect); lastfx = c, lastval = effect; break; case 2: /* porta to note */ UniPTEffect (0x3, effect); lastfx = c, lastval = effect; break; case 3: /* frequency adjust */ /* DMP converts this effect to S3M FF1. Why not ? */ UniEffect (UNI_S3MEFFECTF, 0xf0 | effect); break; case 4: /* vibrato */ UniPTEffect (0x4, effect); lastfx = c, lastval = effect; break; case 5: /* set speed */ if (effect) UniPTEffect (0xf, effect); else if (mh->marker[0] != 0x69) { #ifdef MIKMOD_DEBUG fprintf (stderr, "\r669: unsupported super fast tempo at pat=%d row=%d chan=%d\n", track, row, channel); #endif } break; } } UniNewline (); } if (!(of.tracks[tracks++] = UniDup ())) return 0; } } return 1; } BOOL S69_Load (BOOL curious) { int i; SAMPLE *current; S69SAMPLE sample; /* module header */ _mm_read_UBYTES (mh->marker, 2, modreader); _mm_read_UBYTES (mh->message, 108, modreader); mh->nos = _mm_read_UBYTE (modreader); mh->nop = _mm_read_UBYTE (modreader); mh->looporder = _mm_read_UBYTE (modreader); _mm_read_UBYTES (mh->orders, 0x80, modreader); for (i = 0; i < 0x80; i++) if ((mh->orders[i] >= 0x80) && (mh->orders[i] != 0xff)) { _mm_errno = MMERR_NOT_A_MODULE; return 1; } _mm_read_UBYTES (mh->tempos, 0x80, modreader); for (i = 0; i < 0x80; i++) if ((!mh->tempos[i]) || (mh->tempos[i] > 32)) { _mm_errno = MMERR_NOT_A_MODULE; return 1; } _mm_read_UBYTES (mh->breaks, 0x80, modreader); for (i = 0; i < 0x80; i++) if (mh->breaks[i] > 0x3f) { _mm_errno = MMERR_NOT_A_MODULE; return 1; } /* set module variables */ of.initspeed = 4; of.inittempo = 78; of.songname = DupStr (mh->message, 36, 1); of.modtype = strdup (S69_Version[memcmp (mh->marker, "JN", 2) == 0]); of.numchn = 8; of.numpat = mh->nop; of.numins = of.numsmp = mh->nos; of.numtrk = of.numchn * of.numpat; of.flags = UF_XMPERIODS | UF_LINEAR; for (i = 35; (i >= 0) && (mh->message[i] == ' '); i--) mh->message[i] = 0; for (i = 36 + 35; (i >= 36 + 0) && (mh->message[i] == ' '); i--) mh->message[i] = 0; for (i = 72 + 35; (i >= 72 + 0) && (mh->message[i] == ' '); i--) mh->message[i] = 0; if ((mh->message[0]) || (mh->message[36]) || (mh->message[72])) if ((of.comment = (CHAR *) _mm_malloc (3 * (36 + 1) + 1))) { strncpy (of.comment, mh->message, 36); strcat (of.comment, "\r"); if (mh->message[36]) strncat (of.comment, mh->message + 36, 36); strcat (of.comment, "\r"); if (mh->message[72]) strncat (of.comment, mh->message + 72, 36); strcat (of.comment, "\r"); of.comment[3 * (36 + 1)] = 0; } if (!AllocPositions (0x80)) return 0; for (i = 0; i < 0x80; i++) { if (mh->orders[i] >= mh->nop) break; of.positions[i] = mh->orders[i]; } of.numpos = i; of.reppos = mh->looporder < of.numpos ? mh->looporder : 0; if (!AllocSamples ()) return 0; current = of.samples; for (i = 0; i < of.numins; i++) { /* sample information */ _mm_read_UBYTES ((UBYTE *) sample.filename, 13, modreader); sample.length = _mm_read_I_SLONG (modreader); sample.loopbeg = _mm_read_I_SLONG (modreader); sample.loopend = _mm_read_I_SLONG (modreader); if (sample.loopend == 0xfffff) sample.loopend = 0; if ((sample.length < 0) || (sample.loopbeg < -1) || (sample.loopend < -1)) { _mm_errno = MMERR_LOADING_HEADER; return 0; } current->samplename = DupStr (sample.filename, 13, 1); current->seekpos = 0; current->speed = 0; current->length = sample.length; current->loopstart = sample.loopbeg; current->loopend = (sample.loopend < sample.length) ? sample.loopend : sample.length; current->flags = (sample.loopbeg < sample.loopend) ? SF_LOOP : 0; current->volume = 64; current++; } if (!S69_LoadPatterns ()) return 0; return 1; } CHAR * S69_LoadTitle (void) { CHAR s[36]; _mm_fseek (modreader, 2, SEEK_SET); if (!_mm_read_UBYTES (s, 36, modreader)) return NULL; return (DupStr (s, 36, 1)); } /*========== Loader information */ MLOADER load_669 = { NULL, "669", "669 (Composer 669, Unis 669)", S69_Init, S69_Test, S69_Load, S69_Cleanup, S69_LoadTitle }; /* ex:set ts=4: */ TiMidity++-2.13.2/libunimod/load_amf.c0100644004711200001440000003371307421005041016565 0ustar tamukiusers/* MikMod sound library (c) 1998, 1999 Miodrag Vallat and others - see file AUTHORS for complete list. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /*============================================================================== $Id: load_amf.c,v 1.28 1999/10/25 16:31:41 miod Exp $ DMP Advanced Module Format loader ==============================================================================*/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include "unimod_priv.h" /*========== Module structure */ typedef struct AMFHEADER { UBYTE id[3]; /* AMF file marker */ UBYTE version; /* upper major, lower nibble minor version number */ CHAR songname[32]; /* ASCIIZ songname */ UBYTE numsamples; /* number of samples saved */ UBYTE numorders; UWORD numtracks; /* number of tracks saved */ UBYTE numchannels; /* number of channels used */ SBYTE panpos[32]; /* voice pan positions */ UBYTE songbpm; UBYTE songspd; } AMFHEADER; typedef struct AMFSAMPLE { UBYTE type; CHAR samplename[32]; CHAR filename[13]; ULONG offset; ULONG length; UWORD c2spd; UBYTE volume; ULONG reppos; ULONG repend; } AMFSAMPLE; typedef struct AMFNOTE { UBYTE note, instr, volume, fxcnt; UBYTE effect[3]; SBYTE parameter[3]; } AMFNOTE; /*========== Loader variables */ static AMFHEADER *mh = NULL; #define AMFTEXTLEN 22 static CHAR AMF_Version[AMFTEXTLEN + 1] = "DSMI Module Format 0.0"; static AMFNOTE *track = NULL; /*========== Loader code */ BOOL AMF_Test (void) { UBYTE id[3], ver; if (!_mm_read_UBYTES (id, 3, modreader)) return 0; if (memcmp (id, "AMF", 3)) return 0; ver = _mm_read_UBYTE (modreader); if ((ver >= 10) && (ver <= 14)) return 1; return 0; } BOOL AMF_Init (void) { if (!(mh = (AMFHEADER *) _mm_malloc (sizeof (AMFHEADER)))) return 0; if (!(track = (AMFNOTE *) _mm_calloc (64, sizeof (AMFNOTE)))) return 0; return 1; } void AMF_Cleanup (void) { _mm_free (mh); _mm_free (track); } static BOOL AMF_UnpackTrack (URL modreader) { ULONG tracksize; UBYTE row, cmd; SBYTE arg; /* empty track */ memset (track, 0, 64 * sizeof (AMFNOTE)); /* read packed track */ if (modreader) { tracksize = _mm_read_I_UWORD (modreader); tracksize += ((ULONG) _mm_read_UBYTE (modreader)) << 16; if (tracksize) while (tracksize--) { row = _mm_read_UBYTE (modreader); cmd = _mm_read_UBYTE (modreader); arg = _mm_read_SBYTE (modreader); /* unexpected end of track */ if (!tracksize) { if ((row == 0xff) && (cmd == 0xff) && (arg == -1)) break; /* the last triplet should be FF FF FF, but this is not always the case... maybe a bug in m2amf ? else return 0; */ } /* invalid row (probably unexpected end of row) */ if (row >= 64) return 0; if (cmd < 0x7f) { /* note, vol */ track[row].note = cmd; track[row].volume = (UBYTE) arg + 1; } else if (cmd == 0x7f) { /* duplicate row */ if ((arg < 0) && (row + arg >= 0)) { memcpy (track + row, track + (row + arg), sizeof (AMFNOTE)); } } else if (cmd == 0x80) { /* instr */ track[row].instr = arg + 1; } else if (cmd == 0x83) { /* volume without note */ track[row].volume = (UBYTE) arg + 1; } else if (track[row].fxcnt < 3) { /* effect, param */ if (cmd > 0x97) return 0; track[row].effect[track[row].fxcnt] = cmd & 0x7f; track[row].parameter[track[row].fxcnt] = arg; track[row].fxcnt++; } else return 0; } } return 1; } static UBYTE * AMF_ConvertTrack (void) { int row, fx4memory = 0; /* convert track */ UniReset (); for (row = 0; row < 64; row++) { if (track[row].instr) UniInstrument (track[row].instr - 1); if (track[row].note > OCTAVE) UniNote (track[row].note - OCTAVE); /* AMF effects */ while (track[row].fxcnt--) { SBYTE inf = track[row].parameter[track[row].fxcnt]; switch (track[row].effect[track[row].fxcnt]) { case 1: /* Set speed */ UniEffect (UNI_S3MEFFECTA, inf); break; case 2: /* Volume slide */ if (inf) { UniWriteByte (UNI_S3MEFFECTD); if (inf >= 0) UniWriteByte ((inf & 0xf) << 4); else UniWriteByte ((-inf) & 0xf); } break; /* effect 3, set channel volume, done in UnpackTrack */ case 4: /* Porta up/down */ if (inf) { if (inf > 0) { UniEffect (UNI_S3MEFFECTE, inf); fx4memory = UNI_S3MEFFECTE; } else { UniEffect (UNI_S3MEFFECTF, -inf); fx4memory = UNI_S3MEFFECTF; } } else if (fx4memory) UniEffect (fx4memory, 0); break; /* effect 5, "Porta abs", not supported */ case 6: /* Porta to note */ UniEffect (UNI_ITEFFECTG, inf); break; case 7: /* Tremor */ UniEffect (UNI_S3MEFFECTI, inf); break; case 8: /* Arpeggio */ UniPTEffect (0x0, inf); break; case 9: /* Vibrato */ UniPTEffect (0x4, inf); break; case 0xa: /* Porta + Volume slide */ UniPTEffect (0x3, 0); if (inf) { UniWriteByte (UNI_S3MEFFECTD); if (inf >= 0) UniWriteByte ((inf & 0xf) << 4); else UniWriteByte ((-inf) & 0xf); } break; case 0xb: /* Vibrato + Volume slide */ UniPTEffect (0x4, 0); if (inf) { UniWriteByte (UNI_S3MEFFECTD); if (inf >= 0) UniWriteByte ((inf & 0xf) << 4); else UniWriteByte ((-inf) & 0xf); } break; case 0xc: /* Pattern break (in hex) */ UniPTEffect (0xd, inf); break; case 0xd: /* Pattern jump */ UniPTEffect (0xb, inf); break; /* effect 0xe, "Sync", not supported */ case 0xf: /* Retrig */ UniEffect (UNI_S3MEFFECTQ, inf & 0xf); break; case 0x10: /* Sample offset */ UniPTEffect (0x9, inf); break; case 0x11: /* Fine volume slide */ if (inf) { UniWriteByte (UNI_S3MEFFECTD); if (inf >= 0) UniWriteByte ((inf & 0xf) << 4 | 0xf); else UniWriteByte (0xf0 | ((-inf) & 0xf)); } break; case 0x12: /* Fine portamento */ if (inf) { if (inf > 0) { UniEffect (UNI_S3MEFFECTE, 0xf0 | (inf & 0xf)); fx4memory = UNI_S3MEFFECTE; } else { UniEffect (UNI_S3MEFFECTF, 0xf0 | ((-inf) & 0xf)); fx4memory = UNI_S3MEFFECTF; } } else if (fx4memory) UniEffect (fx4memory, 0); break; case 0x13: /* Delay note */ UniPTEffect (0xe, 0xd0 | (inf & 0xf)); break; case 0x14: /* Note cut */ UniPTEffect (0xc, 0); track[row].volume = 0; break; case 0x15: /* Set tempo */ UniEffect (UNI_S3MEFFECTT, inf); break; case 0x16: /* Extra fine portamento */ if (inf) { if (inf > 0) { UniEffect (UNI_S3MEFFECTE, 0xe0 | ((inf >> 2) & 0xf)); fx4memory = UNI_S3MEFFECTE; } else { UniEffect (UNI_S3MEFFECTF, 0xe0 | (((-inf) >> 2) & 0xf)); fx4memory = UNI_S3MEFFECTF; } } else if (fx4memory) UniEffect (fx4memory, 0); break; case 0x17: /* Panning */ if (inf > 64) UniEffect (UNI_ITEFFECTS0, 0x91); /* surround */ else UniPTEffect (0x8, (inf == 64) ? 255 : (inf + 64) << 1); break; } } if (track[row].volume) UniVolEffect (VOL_VOLUME, track[row].volume - 1); UniNewline (); } return UniDup (); } BOOL AMF_Load (BOOL curious) { int t, u, realtrackcnt, realsmpcnt; AMFSAMPLE s; SAMPLE *q; UWORD *track_remap; ULONG samplepos; int channel_remap[16]; /* try to read module header */ _mm_read_UBYTES (mh->id, 3, modreader); mh->version = _mm_read_UBYTE (modreader); _mm_read_string (mh->songname, 32, modreader); mh->numsamples = _mm_read_UBYTE (modreader); mh->numorders = _mm_read_UBYTE (modreader); mh->numtracks = _mm_read_I_UWORD (modreader); mh->numchannels = _mm_read_UBYTE (modreader); if ((!mh->numchannels) || (mh->numchannels > (mh->version >= 12 ? 32 : 16))) { _mm_errno = MMERR_NOT_A_MODULE; return 0; } if (mh->version >= 11) { memset (mh->panpos, 0, 32); _mm_read_SBYTES (mh->panpos, (mh->version >= 13) ? 32 : 16, modreader); } else _mm_read_UBYTES (channel_remap, 16, modreader); if (mh->version >= 13) { mh->songbpm = _mm_read_UBYTE (modreader); if (mh->songbpm < 32) { _mm_errno = MMERR_NOT_A_MODULE; return 0; } mh->songspd = _mm_read_UBYTE (modreader); if (mh->songspd > 32) { _mm_errno = MMERR_NOT_A_MODULE; return 0; } } else { mh->songbpm = 125; mh->songspd = 6; } if (_mm_eof (modreader)) { _mm_errno = MMERR_LOADING_HEADER; return 0; } /* set module variables */ of.initspeed = mh->songspd; of.inittempo = mh->songbpm; AMF_Version[AMFTEXTLEN - 3] = '0' + (mh->version / 10); AMF_Version[AMFTEXTLEN - 1] = '0' + (mh->version % 10); of.modtype = strdup (AMF_Version); of.numchn = mh->numchannels; of.numtrk = mh->numorders * mh->numchannels; if (mh->numtracks > of.numtrk) of.numtrk = mh->numtracks; of.songname = DupStr (mh->songname, 32, 1); of.numpos = mh->numorders; of.numpat = mh->numorders; of.reppos = 0; of.flags |= UF_S3MSLIDES; for (t = 0; t < 32; t++) { if (mh->panpos[t] > 64) of.panning[t] = PAN_SURROUND; else if (mh->panpos[t] == 64) of.panning[t] = 255; else of.panning[t] = (mh->panpos[t] + 64) << 1; } of.numins = of.numsmp = mh->numsamples; if (!AllocPositions (of.numpos)) return 0; for (t = 0; t < of.numpos; t++) of.positions[t] = t; if (!AllocTracks ()) return 0; if (!AllocPatterns ()) return 0; /* read AMF order table */ for (t = 0; t < of.numpat; t++) { if (mh->version >= 14) /* track size */ of.pattrows[t] = _mm_read_I_UWORD (modreader); if (mh->version >= 10) _mm_read_I_UWORDS (of.patterns + (t * of.numchn), of.numchn, modreader); else for (u = 0; u < of.numchn; u++) of.patterns[t * of.numchn + channel_remap[u]] = _mm_read_I_UWORD (modreader); } if (_mm_eof (modreader)) { _mm_errno = MMERR_LOADING_HEADER; return 0; } /* read sample information */ if (!AllocSamples ()) return 0; q = of.samples; for (t = 0; t < of.numins; t++) { /* try to read sample info */ s.type = _mm_read_UBYTE (modreader); _mm_read_string (s.samplename, 32, modreader); _mm_read_string (s.filename, 13, modreader); s.offset = _mm_read_I_ULONG (modreader); s.length = _mm_read_I_ULONG (modreader); s.c2spd = _mm_read_I_UWORD (modreader); if (s.c2spd == 8368) s.c2spd = 8363; s.volume = _mm_read_UBYTE (modreader); if (mh->version >= 11) { s.reppos = _mm_read_I_ULONG (modreader); s.repend = _mm_read_I_ULONG (modreader); } else { s.reppos = _mm_read_I_UWORD (modreader); s.repend = s.length; } if (_mm_eof (modreader)) { _mm_errno = MMERR_LOADING_SAMPLEINFO; return 0; } q->samplename = DupStr (s.samplename, 32, 1); q->speed = s.c2spd; q->volume = s.volume; if (s.type) { q->seekpos = s.offset; q->length = s.length; q->loopstart = s.reppos; q->loopend = s.repend; if ((s.repend - s.reppos) > 2) q->flags |= SF_LOOP; } q++; } /* read track table */ if (!(track_remap = _mm_calloc (mh->numtracks + 1, sizeof (UWORD)))) return 0; _mm_read_I_UWORDS (track_remap + 1, mh->numtracks, modreader); if (_mm_eof (modreader)) { free (track_remap); _mm_errno = MMERR_LOADING_TRACK; return 0; } for (realtrackcnt = t = 0; t <= mh->numtracks; t++) if (realtrackcnt < track_remap[t]) realtrackcnt = track_remap[t]; for (t = 0; t < of.numpat * of.numchn; t++) of.patterns[t] = (of.patterns[t] <= mh->numtracks) ? track_remap[of.patterns[t]] - 1 : realtrackcnt; free (track_remap); /* unpack tracks */ for (t = 0; t < realtrackcnt; t++) { if (_mm_eof (modreader)) { _mm_errno = MMERR_LOADING_TRACK; return 0; } if (!AMF_UnpackTrack (modreader)) { _mm_errno = MMERR_LOADING_TRACK; return 0; } if (!(of.tracks[t] = AMF_ConvertTrack ())) return 0; } /* add en extra void track */ UniReset (); for (t = 0; t < 64; t++) UniNewline (); of.tracks[realtrackcnt++] = UniDup (); for (t = realtrackcnt; t < of.numtrk; t++) of.tracks[t] = NULL; /* compute sample offsets */ samplepos = _mm_ftell (modreader); for (realsmpcnt = t = 0; t < of.numsmp; t++) if (realsmpcnt < of.samples[t].seekpos) realsmpcnt = of.samples[t].seekpos; for (t = 1; t <= realsmpcnt; t++) { q = of.samples; while (q->seekpos != t) q++; q->seekpos = samplepos; samplepos += q->length; } return 1; } CHAR * AMF_LoadTitle (void) { CHAR s[32]; _mm_fseek (modreader, 4, SEEK_SET); if (!_mm_read_UBYTES (s, 32, modreader)) return NULL; return (DupStr (s, 32, 1)); } /*========== Loader information */ MLOADER load_amf = { NULL, "AMF", "AMF (DSMI Advanced Module Format)", AMF_Init, AMF_Test, AMF_Load, AMF_Cleanup, AMF_LoadTitle }; /* ex:set ts=4: */ TiMidity++-2.13.2/libunimod/load_dsm.c0100644004711200001440000002125007421005041016576 0ustar tamukiusers/* MikMod sound library (c) 1998, 1999 Miodrag Vallat and others - see file AUTHORS for complete list. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /*============================================================================== $Id: load_dsm.c,v 1.28 1999/10/25 16:31:41 miod Exp $ DSIK internal format (DSM) module loader ==============================================================================*/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include "unimod_priv.h" /*========== Module structure */ #define DSM_MAXCHAN (16) #define DSM_MAXORDERS (128) typedef struct DSMSONG { CHAR songname[28]; UWORD version; UWORD flags; ULONG reserved2; UWORD numord; UWORD numsmp; UWORD numpat; UWORD numtrk; UBYTE globalvol; UBYTE mastervol; UBYTE speed; UBYTE bpm; UBYTE panpos[DSM_MAXCHAN]; UBYTE orders[DSM_MAXORDERS]; } DSMSONG; typedef struct DSMINST { CHAR filename[13]; UWORD flags; UBYTE volume; ULONG length; ULONG loopstart; ULONG loopend; ULONG reserved1; UWORD c2spd; UWORD period; CHAR samplename[28]; } DSMINST; typedef struct DSMNOTE { UBYTE note, ins, vol, cmd, inf; } DSMNOTE; #define DSM_SURROUND (0xa4) /*========== Loader variables */ static CHAR *SONGID = "SONG"; static CHAR *INSTID = "INST"; static CHAR *PATTID = "PATT"; static UBYTE blockid[4]; static ULONG blockln; static ULONG blocklp; static DSMSONG *mh = NULL; static DSMNOTE *dsmbuf = NULL; static CHAR DSM_Version[] = "DSIK DSM-format"; static unsigned char DSMSIG[4 + 4] = {'R', 'I', 'F', 'F', 'D', 'S', 'M', 'F'}; /*========== Loader code */ BOOL DSM_Test (void) { UBYTE id[12]; if (!_mm_read_UBYTES (id, 12, modreader)) return 0; if (!memcmp (id, DSMSIG, 4) && !memcmp (id + 8, DSMSIG + 4, 4)) return 1; return 0; } BOOL DSM_Init (void) { if (!(dsmbuf = (DSMNOTE *) _mm_malloc (DSM_MAXCHAN * 64 * sizeof (DSMNOTE)))) return 0; if (!(mh = (DSMSONG *) _mm_calloc (1, sizeof (DSMSONG)))) return 0; return 1; } void DSM_Cleanup (void) { _mm_free (dsmbuf); _mm_free (mh); } static BOOL GetBlockHeader (void) { /* make sure we're at the right position for reading the next riff block, no matter how many bytes read */ _mm_fseek (modreader, blocklp + blockln, SEEK_SET); while (1) { _mm_read_UBYTES (blockid, 4, modreader); blockln = _mm_read_I_ULONG (modreader); if (_mm_eof (modreader)) { _mm_errno = MMERR_LOADING_HEADER; return 0; } if (memcmp (blockid, SONGID, 4) && memcmp (blockid, INSTID, 4) && memcmp (blockid, PATTID, 4)) { #ifdef MIKMOD_DEBUG fprintf (stderr, "\rDSM: Skipping unknown block type %4.4s\n", blockid); #endif _mm_fseek (modreader, blockln, SEEK_CUR); } else break; } blocklp = _mm_ftell (modreader); return 1; } static BOOL DSM_ReadPattern (void) { int flag, row = 0; SWORD length; DSMNOTE *n; /* clear pattern data */ memset (dsmbuf, 255, DSM_MAXCHAN * 64 * sizeof (DSMNOTE)); length = _mm_read_I_SWORD (modreader); while (row < 64) { flag = _mm_read_UBYTE (modreader); if ((_mm_eof (modreader)) || (--length < 0)) { _mm_errno = MMERR_LOADING_PATTERN; return 0; } if (flag) { n = &dsmbuf[((flag & 0xf) * 64) + row]; if (flag & 0x80) n->note = _mm_read_UBYTE (modreader); if (flag & 0x40) n->ins = _mm_read_UBYTE (modreader); if (flag & 0x20) n->vol = _mm_read_UBYTE (modreader); if (flag & 0x10) { n->cmd = _mm_read_UBYTE (modreader); n->inf = _mm_read_UBYTE (modreader); } } else row++; } return 1; } static UBYTE * DSM_ConvertTrack (DSMNOTE * tr) { int t; UBYTE note, ins, vol, cmd, inf; UniReset (); for (t = 0; t < 64; t++) { note = tr[t].note; ins = tr[t].ins; vol = tr[t].vol; cmd = tr[t].cmd; inf = tr[t].inf; if (ins != 0 && ins != 255) UniInstrument (ins - 1); if (note != 255) UniNote (note - 1); /* normal note */ if (vol < 65) UniPTEffect (0xc, vol); if (cmd != 255) { if (cmd == 0x8) { if (inf == DSM_SURROUND) UniEffect (UNI_ITEFFECTS0, 0x91); else if (inf <= 0x80) { inf = (inf < 0x80) ? inf << 1 : 255; UniPTEffect (cmd, inf); } } else if (cmd == 0xb) { if (inf <= 0x7f) UniPTEffect (cmd, inf); } else { /* Convert pattern jump from Dec to Hex */ if (cmd == 0xd) inf = (((inf & 0xf0) >> 4) * 10) + (inf & 0xf); UniPTEffect (cmd, inf); } } UniNewline (); } return UniDup (); } BOOL DSM_Load (BOOL curious) { int t; DSMINST s; SAMPLE *q; int cursmp = 0, curpat = 0, track = 0; blocklp = 0; blockln = 12; if (!GetBlockHeader ()) return 0; if (memcmp (blockid, SONGID, 4)) { _mm_errno = MMERR_LOADING_HEADER; return 0; } _mm_read_UBYTES (mh->songname, 28, modreader); mh->version = _mm_read_I_UWORD (modreader); mh->flags = _mm_read_I_UWORD (modreader); mh->reserved2 = _mm_read_I_ULONG (modreader); mh->numord = _mm_read_I_UWORD (modreader); mh->numsmp = _mm_read_I_UWORD (modreader); mh->numpat = _mm_read_I_UWORD (modreader); mh->numtrk = _mm_read_I_UWORD (modreader); mh->globalvol = _mm_read_UBYTE (modreader); mh->mastervol = _mm_read_UBYTE (modreader); mh->speed = _mm_read_UBYTE (modreader); mh->bpm = _mm_read_UBYTE (modreader); _mm_read_UBYTES (mh->panpos, DSM_MAXCHAN, modreader); _mm_read_UBYTES (mh->orders, DSM_MAXORDERS, modreader); /* set module variables */ of.initspeed = mh->speed; of.inittempo = mh->bpm; of.modtype = strdup (DSM_Version); of.numchn = mh->numtrk; of.numpat = mh->numpat; of.numtrk = of.numchn * of.numpat; of.songname = DupStr (mh->songname, 28, 1); /* make a cstr of songname */ of.reppos = 0; for (t = 0; t < DSM_MAXCHAN; t++) of.panning[t] = mh->panpos[t] == DSM_SURROUND ? PAN_SURROUND : mh->panpos[t] < 0x80 ? (mh->panpos[t] << 1) : 255; if (!AllocPositions (mh->numord)) return 0; of.numpos = 0; for (t = 0; t < mh->numord; t++) { of.positions[of.numpos] = mh->orders[t]; if (mh->orders[t] < 254) of.numpos++; } of.numins = of.numsmp = mh->numsmp; if (!AllocSamples ()) return 0; if (!AllocTracks ()) return 0; if (!AllocPatterns ()) return 0; while (cursmp < of.numins || curpat < of.numpat) { if (!GetBlockHeader ()) return 0; if (!memcmp (blockid, INSTID, 4) && cursmp < of.numins) { q = &of.samples[cursmp]; /* try to read sample info */ _mm_read_UBYTES (s.filename, 13, modreader); s.flags = _mm_read_I_UWORD (modreader); s.volume = _mm_read_UBYTE (modreader); s.length = _mm_read_I_ULONG (modreader); s.loopstart = _mm_read_I_ULONG (modreader); s.loopend = _mm_read_I_ULONG (modreader); s.reserved1 = _mm_read_I_ULONG (modreader); s.c2spd = _mm_read_I_UWORD (modreader); s.period = _mm_read_I_UWORD (modreader); _mm_read_UBYTES (s.samplename, 28, modreader); q->samplename = DupStr (s.samplename, 28, 1); q->seekpos = _mm_ftell (modreader); q->speed = s.c2spd; q->length = s.length; q->loopstart = s.loopstart; q->loopend = s.loopend; q->volume = s.volume; if (s.flags & 1) q->flags |= SF_LOOP; if (s.flags & 2) q->flags |= SF_SIGNED; /* (s.flags&4) means packed sample, but did they really exist in dsm ? */ cursmp++; } else if (!memcmp (blockid, PATTID, 4) && curpat < of.numpat) { DSM_ReadPattern (); for (t = 0; t < of.numchn; t++) if (!(of.tracks[track++] = DSM_ConvertTrack (&dsmbuf[t * 64]))) return 0; curpat++; } } return 1; } CHAR * DSM_LoadTitle (void) { CHAR s[28]; _mm_fseek (modreader, 12, SEEK_SET); if (!_mm_read_UBYTES (s, 28, modreader)) return NULL; return (DupStr (s, 28, 1)); } /*========== Loader information */ MLOADER load_dsm = { NULL, "DSM", "DSM (DSIK internal format)", DSM_Init, DSM_Test, DSM_Load, DSM_Cleanup, DSM_LoadTitle }; /* ex:set ts=4: */ TiMidity++-2.13.2/libunimod/load_far.c0100644004711200001440000002065207421005041016570 0ustar tamukiusers/* MikMod sound library (c) 1998, 1999 Miodrag Vallat and others - see file AUTHORS for complete list. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /*============================================================================== $Id: load_far.c,v 1.29 1999/10/25 16:31:41 miod Exp $ Farandole (FAR) module loader ==============================================================================*/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include "unimod_priv.h" /*========== Module structure */ typedef struct FARHEADER1 { UBYTE id[4]; /* file magic */ CHAR songname[40]; /* songname */ CHAR blah[3]; /* 13,10,26 */ UWORD headerlen; /* remaining length of header in bytes */ UBYTE version; UBYTE onoff[16]; UBYTE edit1[9]; UBYTE speed; UBYTE panning[16]; UBYTE edit2[4]; UWORD stlen; } FARHEADER1; typedef struct FARHEADER2 { UBYTE orders[256]; UBYTE numpat; UBYTE snglen; UBYTE loopto; UWORD patsiz[256]; } FARHEADER2; typedef struct FARSAMPLE { CHAR samplename[32]; ULONG length; UBYTE finetune; UBYTE volume; ULONG reppos; ULONG repend; UBYTE type; UBYTE loop; } FARSAMPLE; typedef struct FARNOTE { UBYTE note, ins, vol, eff; } FARNOTE; /*========== Loader variables */ static CHAR FAR_Version[] = "Farandole"; static FARHEADER1 *mh1 = NULL; static FARHEADER2 *mh2 = NULL; static FARNOTE *pat = NULL; static unsigned char FARSIG[4 + 3] = {'F', 'A', 'R', 0xfe, 13, 10, 26}; /*========== Loader code */ BOOL FAR_Test (void) { UBYTE id[47]; if (!_mm_read_UBYTES (id, 47, modreader)) return 0; if ((memcmp (id, FARSIG, 4)) || (memcmp (id + 44, FARSIG + 4, 3))) return 0; return 1; } BOOL FAR_Init (void) { if (!(mh1 = (FARHEADER1 *) _mm_malloc (sizeof (FARHEADER1)))) return 0; if (!(mh2 = (FARHEADER2 *) _mm_malloc (sizeof (FARHEADER2)))) return 0; if (!(pat = (FARNOTE *) _mm_malloc (256 * 16 * 4 * sizeof (FARNOTE)))) return 0; return 1; } void FAR_Cleanup (void) { _mm_free (mh1); _mm_free (mh2); _mm_free (pat); } static UBYTE * FAR_ConvertTrack (FARNOTE * n, int rows) { int t, vibdepth = 1; UniReset (); for (t = 0; t < rows; t++) { if (n->note) { UniInstrument (n->ins); UniNote (n->note + 3 * OCTAVE - 1); } if (n->vol & 0xf) UniPTEffect (0xc, (n->vol & 0xf) << 2); if (n->eff) switch (n->eff >> 4) { case 0x3: /* porta to note */ UniPTEffect (0x3, (n->eff & 0xf) << 4); break; case 0x5: /* set vibrato depth */ vibdepth = n->eff & 0xf; break; case 0x6: /* vibrato */ UniPTEffect (0x4, ((n->eff & 0xf) << 4) | vibdepth); break; case 0x7: /* volume slide up */ UniPTEffect (0xa, (n->eff & 0xf) << 4); break; case 0x8: /* volume slide down */ UniPTEffect (0xa, n->eff & 0xf); break; case 0xf: /* set speed */ UniPTEffect (0xf, n->eff & 0xf); break; /* others not yet implemented */ default: #ifdef MIKMOD_DEBUG fprintf (stderr, "\rFAR: unsupported effect %02X\n", n->eff); #endif break; } UniNewline (); n += 16; } return UniDup (); } BOOL FAR_Load (BOOL curious) { int t, u, tracks = 0; SAMPLE *q; FARSAMPLE s; FARNOTE *crow; UBYTE smap[8]; /* try to read module header (first part) */ _mm_read_UBYTES (mh1->id, 4, modreader); _mm_read_SBYTES (mh1->songname, 40, modreader); _mm_read_SBYTES (mh1->blah, 3, modreader); mh1->headerlen = _mm_read_I_UWORD (modreader); mh1->version = _mm_read_UBYTE (modreader); _mm_read_UBYTES (mh1->onoff, 16, modreader); _mm_read_UBYTES (mh1->edit1, 9, modreader); mh1->speed = _mm_read_UBYTE (modreader); _mm_read_UBYTES (mh1->panning, 16, modreader); _mm_read_UBYTES (mh1->edit2, 4, modreader); mh1->stlen = _mm_read_I_UWORD (modreader); /* init modfile data */ of.modtype = strdup (FAR_Version); of.songname = DupStr (mh1->songname, 40, 1); of.numchn = 16; of.initspeed = mh1->speed; of.inittempo = 80; of.reppos = 0; for (t = 0; t < 16; t++) of.panning[t] = mh1->panning[t] << 4; /* read songtext into comment field */ if (mh1->stlen) if (!ReadComment (mh1->stlen)) return 0; /* try to read module header (second part) */ _mm_read_UBYTES (mh2->orders, 256, modreader); mh2->numpat = _mm_read_UBYTE (modreader); mh2->snglen = _mm_read_UBYTE (modreader); mh2->loopto = _mm_read_UBYTE (modreader); _mm_read_I_UWORDS (mh2->patsiz, 256, modreader); of.numpos = mh2->snglen; if (!AllocPositions (of.numpos)) return 0; for (t = 0; t < of.numpos; t++) { if (mh2->orders[t] == 0xff) break; of.positions[t] = mh2->orders[t]; } /* count number of patterns stored in file */ of.numpat = 0; for (t = 0; t < 256; t++) if (mh2->patsiz[t]) if ((t + 1) > of.numpat) of.numpat = t + 1; of.numtrk = of.numpat * of.numchn; /* seek across eventual new data */ _mm_fseek (modreader, mh1->headerlen - (869 + mh1->stlen), SEEK_CUR); /* alloc track and pattern structures */ if (!AllocTracks ()) return 0; if (!AllocPatterns ()) return 0; for (t = 0; t < of.numpat; t++) { UBYTE rows = 0, tempo; memset (pat, 0, 256 * 16 * 4 * sizeof (FARNOTE)); if (mh2->patsiz[t]) { rows = _mm_read_UBYTE (modreader); tempo = _mm_read_UBYTE (modreader); crow = pat; /* file often allocates 64 rows even if there are less in pattern */ if (mh2->patsiz[t] < 2 + (rows * 16 * 4)) { _mm_errno = MMERR_LOADING_PATTERN; return 0; } for (u = (mh2->patsiz[t] - 2) / 4; u; u--, crow++) { crow->note = _mm_read_UBYTE (modreader); crow->ins = _mm_read_UBYTE (modreader); crow->vol = _mm_read_UBYTE (modreader); crow->eff = _mm_read_UBYTE (modreader); } if (_mm_eof (modreader)) { _mm_errno = MMERR_LOADING_PATTERN; return 0; } crow = pat; of.pattrows[t] = rows; for (u = 16; u; u--, crow++) if (!(of.tracks[tracks++] = FAR_ConvertTrack (crow, rows))) { _mm_errno = MMERR_LOADING_PATTERN; return 0; } } else tracks += 16; } /* read sample map */ if (!_mm_read_UBYTES (smap, 8, modreader)) { _mm_errno = MMERR_LOADING_HEADER; return 0; } /* count number of samples used */ of.numins = 0; for (t = 0; t < 64; t++) if (smap[t >> 3] & (1 << (t & 7))) of.numins = t + 1; of.numsmp = of.numins; /* alloc sample structs */ if (!AllocSamples ()) return 0; q = of.samples; for (t = 0; t < of.numsmp; t++) { q->speed = 8363; q->flags = SF_SIGNED; if (smap[t >> 3] & (1 << (t & 7))) { _mm_read_SBYTES (s.samplename, 32, modreader); s.length = _mm_read_I_ULONG (modreader); s.finetune = _mm_read_UBYTE (modreader); s.volume = _mm_read_UBYTE (modreader); s.reppos = _mm_read_I_ULONG (modreader); s.repend = _mm_read_I_ULONG (modreader); s.type = _mm_read_UBYTE (modreader); s.loop = _mm_read_UBYTE (modreader); q->samplename = DupStr (s.samplename, 32, 1); q->length = s.length; q->loopstart = s.reppos; q->loopend = s.repend; q->volume = s.volume << 2; if (s.type & 1) q->flags |= SF_16BITS; if (s.loop & 8) q->flags |= SF_LOOP; q->seekpos = _mm_ftell (modreader); _mm_fseek (modreader, q->length, SEEK_CUR); } else q->samplename = DupStr (NULL, 0, 0); q++; } return 1; } CHAR * FAR_LoadTitle (void) { CHAR s[40]; _mm_fseek (modreader, 4, SEEK_SET); if (!_mm_read_UBYTES (s, 40, modreader)) return NULL; return (DupStr (s, 40, 1)); } /*========== Loader information */ MLOADER load_far = { NULL, "FAR", "FAR (Farandole Composer)", FAR_Init, FAR_Test, FAR_Load, FAR_Cleanup, FAR_LoadTitle }; /* ex:set ts=4: */ TiMidity++-2.13.2/libunimod/load_gdm.c0100644004711200001440000003407107421005041016567 0ustar tamukiusers/* MikMod sound library (c) 1998,1999 Miodrag Vallat and others - see file AUTHORS for complete list. This library is free software;you can redistribute it and/or modify it under the terms of the GNU Library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library;if not,write to the Free Software Foundation,Inc.,59 Temple Place - Suite 330,Boston,MA 02111-1307,USA. */ /*============================================================================== $Id: load_gdm.c,v 1.5 1999/10/25 16:31:41 miod Exp $ General DigiMusic (GDM) module loader ==============================================================================*/ /* Written by Kev Vance based on the file format description written by 'MenTaLguY' */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include "unimod_priv.h" typedef struct GDMNOTE { UBYTE note; UBYTE samp; struct { UBYTE effect; UBYTE param; } effect[4]; } GDMNOTE; typedef GDMNOTE GDMTRACK[64]; typedef struct GDMHEADER { CHAR id1[4]; CHAR songname[32]; CHAR author[32]; CHAR eofmarker[3]; CHAR id2[4]; UBYTE majorver; UBYTE minorver; UWORD trackerid; UBYTE t_majorver; UBYTE t_minorver; UBYTE pantable[32]; UBYTE mastervol; UBYTE mastertempo; UBYTE masterbpm; UWORD flags; ULONG orderloc; UBYTE ordernum; ULONG patternloc; UBYTE patternnum; ULONG samhead; ULONG samdata; UBYTE samnum; ULONG messageloc; ULONG messagelen; ULONG scrollyloc; UWORD scrollylen; ULONG graphicloc; UWORD graphiclen; } GDMHEADER; typedef struct GDMSAMPLE { CHAR sampname[32]; CHAR filename[13]; UBYTE ems; ULONG length; ULONG loopbeg; ULONG loopend; UBYTE flags; UWORD c4spd; UBYTE vol; UBYTE pan; } GDMSAMPLE; static GDMHEADER *mh = NULL; /* pointer to GDM header */ static GDMNOTE *gdmbuf = NULL; /* pointer to a complete GDM pattern */ CHAR GDM_Version[] = "General DigiMusic 1.xx"; BOOL GDM_Test (void) { /* test for gdm magic numbers */ UBYTE id[4]; _mm_fseek (modreader, 0x00, SEEK_SET); if (!_mm_read_UBYTES (id, 4, modreader)) return 0; if (!memcmp (id, "GDM\xfe", 4)) { _mm_fseek (modreader, 71, SEEK_SET); if (!_mm_read_UBYTES (id, 4, modreader)) return 0; if (!memcmp (id, "GMFS", 4)) return 1; } return 0; } BOOL GDM_Init (void) { if (!(gdmbuf = (GDMNOTE *) _mm_malloc (32 * 64 * sizeof (GDMNOTE)))) return 0; if (!(mh = (GDMHEADER *) _mm_malloc (sizeof (GDMHEADER)))) return 0; return 1; } void GDM_Cleanup (void) { _mm_free (mh); _mm_free (gdmbuf); } BOOL GDM_ReadPattern (void) { int pos, flag, ch, i, maxch; GDMNOTE n; UWORD length, x = 0; /* get pattern length */ length = _mm_read_I_UWORD (modreader) - 2; /* clear pattern data */ memset (gdmbuf, 255, 32 * 64 * sizeof (GDMNOTE)); pos = 0; maxch = 0; while (x < length) { memset (&n, 255, sizeof (GDMNOTE)); flag = _mm_read_UBYTE (modreader); x++; if (_mm_eof (modreader)) { _mm_errno = MMERR_LOADING_PATTERN; return 0; } ch = flag & 31; if (ch > maxch) maxch = ch; if (!flag) { pos++; continue; } if (flag & 0x60) { if (flag & 0x20) { /* new note */ n.note = _mm_read_UBYTE (modreader) & 127; n.samp = _mm_read_UBYTE (modreader); x += 2; } if (flag & 0x40) { do { /* effect channel set */ i = _mm_read_UBYTE (modreader); n.effect[i >> 6].effect = i & 31; n.effect[i >> 6].param = _mm_read_UBYTE (modreader); x += 2; } while (i & 32); } memcpy (gdmbuf + (64U * ch) + pos, &n, sizeof (n)); } } return 1; } UBYTE * GDM_ConvertTrack (GDMNOTE * tr) { int t, i = 0; UBYTE note, ins; UniReset (); for (t = 0; t < 64; t++) { note = tr[t].note; ins = tr[t].samp; if ((ins) && (ins != 255)) UniInstrument (ins - 1); if (note != 255) { UniNote (((note >> 4) * OCTAVE) + (note & 0xf) - 1); } for (i = 0; i < 4; i++) { switch (tr[t].effect[i].effect) { case 1: /* toneslide up */ UniEffect (UNI_S3MEFFECTF, tr[t].effect[i].param); break; case 2: /* toneslide down */ UniEffect (UNI_S3MEFFECTE, tr[t].effect[i].param); break; case 3: /* glissando to note */ UniEffect (UNI_ITEFFECTG, tr[t].effect[i].param); break; case 4: /* vibrato */ UniEffect (UNI_ITEFFECTH, tr[t].effect[i].param); break; case 5: /* portamento+volslide */ UniEffect (UNI_ITEFFECTG, 0); UniEffect (UNI_S3MEFFECTD, tr[t].effect[i].param); break; case 6: /* vibrato+volslide */ UniEffect (UNI_ITEFFECTH, 0); UniEffect (UNI_S3MEFFECTD, tr[t].effect[i].param); break; case 7: /* tremolo */ UniEffect (UNI_S3MEFFECTR, tr[t].effect[i].param); break; case 8: /* tremor */ UniEffect (UNI_S3MEFFECTI, tr[t].effect[i].param); break; case 9: /* offset */ UniPTEffect (0x09, tr[t].effect[i].param); break; case 0x0a: /* volslide */ UniEffect (UNI_S3MEFFECTD, tr[t].effect[i].param); break; case 0x0b: /* jump to order */ UniPTEffect (0x0b, tr[t].effect[i].param); break; case 0x0c: /* volume set */ UniPTEffect (0x0c, tr[t].effect[i].param); break; case 0x0d: /* pattern break */ UniPTEffect (0x0d, tr[t].effect[i].param); break; case 0x0e: /* extended */ switch (tr[t].effect[i].param & 0xf0) { case 0x10: /* fine portamento up */ UniEffect (UNI_S3MEFFECTF, 0x0f | ((tr[t].effect[i].param << 4) & 0x0f)); break; case 0x20: /* fine portamento down */ UniEffect (UNI_S3MEFFECTE, 0xf0 | (tr[t].effect[i].param & 0x0f)); break; case 0x30: /* glissando control */ UniEffect (SS_GLISSANDO, tr[t].effect[i].param & 0x0f); break; case 0x40: /* vibrato waveform */ UniEffect (SS_VIBWAVE, tr[t].effect[i].param & 0x0f); break; case 0x50: /* set c4spd */ UniEffect (SS_FINETUNE, tr[t].effect[i].param & 0x0f); break; case 0x60: /* loop fun */ UniEffect (UNI_ITEFFECTS0, (tr[t].effect[i].param & 0x0f) | 0xb0); break; case 0x70: /* tremolo waveform */ UniEffect (SS_TREMWAVE, tr[t].effect[i].param & 0x0f); break; case 0x80: /* extra fine porta up */ UniEffect (UNI_S3MEFFECTF, 0x0e | ((tr[t].effect[i].param << 4) & 0x0f)); break; case 0x90: /* extra fine porta down */ UniEffect (UNI_S3MEFFECTE, 0xe0 | (tr[t].effect[i].param & 0x0f)); break; case 0xa0: /* fine volslide up */ UniEffect (UNI_S3MEFFECTD, 0x0f | ((tr[t].effect[i].param << 4) & 0x0f)); break; case 0xb0: /* fine volslide down */ UniEffect (UNI_S3MEFFECTE, 0xf0 | (tr[t].effect[i].param & 0x0f)); break; case 0xc0: /* note cut */ case 0xd0: /* note delay */ case 0xe0: /* extend row */ UniPTEffect (0xe, tr[t].effect[i].param); break; } break; case 0x0f: /* set tempo */ UniEffect (UNI_S3MEFFECTA, tr[t].effect[i].param); break; case 0x10: /* arpeggio */ UniPTEffect (0x0, tr[t].effect[i].param); break; case 0x12: /* retrigger */ UniEffect (UNI_S3MEFFECTQ, tr[t].effect[i].param); break; case 0x13: /* set global volume */ UniEffect (UNI_XMEFFECTG, tr[t].effect[i].param); break; case 0x14: /* fine vibrato */ UniEffect (UNI_ITEFFECTU, tr[t].effect[i].param); break; case 0x1e: /* special */ switch (tr[t].effect[i].param & 0xf0) { case 8: /* set pan position */ if (tr[t].effect[i].param >= 128) UniPTEffect (0x08, 255); else UniPTEffect (0x08, tr[t].effect[i].param << 1); break; } break; case 0x1f: /* set bpm */ if (tr[t].effect[i].param >= 0x20) UniEffect (UNI_S3MEFFECTT, tr[t].effect[i].param); break; } } UniNewline (); } return UniDup (); } BOOL GDM_Load (BOOL curious) { int i, x, u, track; SAMPLE *q; GDMSAMPLE s; ULONG position; /* read header */ _mm_read_string (mh->id1, 4, modreader); _mm_read_string (mh->songname, 32, modreader); _mm_read_string (mh->author, 32, modreader); _mm_read_string (mh->eofmarker, 3, modreader); _mm_read_string (mh->id2, 4, modreader); mh->majorver = _mm_read_UBYTE (modreader); mh->minorver = _mm_read_UBYTE (modreader); mh->trackerid = _mm_read_I_UWORD (modreader); mh->t_majorver = _mm_read_UBYTE (modreader); mh->t_minorver = _mm_read_UBYTE (modreader); _mm_read_UBYTES (mh->pantable, 32, modreader); mh->mastervol = _mm_read_UBYTE (modreader); mh->mastertempo = _mm_read_UBYTE (modreader); mh->masterbpm = _mm_read_UBYTE (modreader); mh->flags = _mm_read_I_UWORD (modreader); mh->orderloc = _mm_read_I_ULONG (modreader); mh->ordernum = _mm_read_UBYTE (modreader); mh->patternloc = _mm_read_I_ULONG (modreader); mh->patternnum = _mm_read_UBYTE (modreader); mh->samhead = _mm_read_I_ULONG (modreader); mh->samdata = _mm_read_I_ULONG (modreader); mh->samnum = _mm_read_UBYTE (modreader); mh->messageloc = _mm_read_I_ULONG (modreader); mh->messagelen = _mm_read_I_ULONG (modreader); mh->scrollyloc = _mm_read_I_ULONG (modreader); mh->scrollylen = _mm_read_I_UWORD (modreader); mh->graphicloc = _mm_read_I_ULONG (modreader); mh->graphiclen = _mm_read_I_UWORD (modreader); /* have we ended abruptly? */ if (_mm_eof (modreader)) { _mm_errno = MMERR_LOADING_HEADER; return 0; } /* any orders? */ if (mh->ordernum == 255) { _mm_errno = MMERR_LOADING_PATTERN; return 0; } /* now we fill */ of.modtype = strdup (GDM_Version); of.modtype[18] = mh->majorver + '0'; of.modtype[20] = mh->minorver / 10 + '0'; of.modtype[21] = mh->minorver % 10 + '0'; of.songname = DupStr (mh->songname, 32, 0); of.numpat = mh->patternnum + 1; of.reppos = 0; of.numins = of.numsmp = mh->samnum + 1; of.initspeed = mh->mastertempo; of.inittempo = mh->masterbpm; of.initvolume = mh->mastervol << 1; of.flags |= UF_S3MSLIDES; /* read the order data */ if (!AllocPositions (mh->ordernum + 1)) { _mm_errno = MMERR_OUT_OF_MEMORY; return 0; } _mm_fseek (modreader, mh->orderloc, SEEK_SET); for (i = 0; i < mh->ordernum + 1; i++) of.positions[i] = _mm_read_UBYTE (modreader); of.numpos = 0; for (i = 0; i < mh->ordernum + 1; i++) { of.positions[of.numpos] = of.positions[i]; if (of.positions[i] < 254) of.numpos++; } /* have we ended abruptly yet? */ if (_mm_eof (modreader)) { _mm_errno = MMERR_LOADING_HEADER; return 0; } /* time to load the samples */ if (!AllocSamples ()) { _mm_errno = MMERR_OUT_OF_MEMORY; return 0; } q = of.samples; position = mh->samdata; /* seek to instrument position */ _mm_fseek (modreader, mh->samhead, SEEK_SET); for (i = 0; i < of.numins; i++) { /* load sample info */ _mm_read_UBYTES (s.sampname, 32, modreader); _mm_read_UBYTES (s.filename, 12, modreader); s.ems = _mm_read_UBYTE (modreader); s.length = _mm_read_I_ULONG (modreader); s.loopbeg = _mm_read_I_ULONG (modreader); s.loopend = _mm_read_I_ULONG (modreader); s.flags = _mm_read_UBYTE (modreader); s.c4spd = _mm_read_I_UWORD (modreader); s.vol = _mm_read_UBYTE (modreader); s.pan = _mm_read_UBYTE (modreader); if (_mm_eof (modreader)) { _mm_errno = MMERR_LOADING_SAMPLEINFO; return 0; } q->samplename = DupStr (s.sampname, 32, 0); q->speed = s.c4spd; q->length = s.length; q->loopstart = s.loopbeg; q->loopend = s.loopend; q->volume = s.vol; q->panning = s.pan; q->seekpos = position; position += s.length; if (s.flags & 1) q->flags |= SF_LOOP; if (s.flags & 2) q->flags |= SF_16BITS; if (s.flags & 16) q->flags |= SF_STEREO; q++; } /* set the panning */ for (i = x = 0; i < 32; i++) { of.panning[i] = mh->pantable[i]; if (!of.panning[i]) of.panning[i] = PAN_LEFT; else if (of.panning[i] == 8) of.panning[i] = PAN_CENTER; else if (of.panning[i] == 15) of.panning[i] = PAN_RIGHT; else if (of.panning[i] == 16) of.panning[i] = PAN_SURROUND; else if (of.panning[i] == 255) of.panning[i] = 128; else of.panning[i] <<= 3; of.panning[i] = PAN_CENTER; if (mh->pantable[i] != 255) x = i; } of.numchn = x + 1; if (of.numchn < 1) of.numchn = 1; /* for broken counts */ /* load the pattern info */ of.numtrk = of.numpat * of.numchn; /* jump to patterns */ _mm_fseek (modreader, mh->patternloc, SEEK_SET); if (!AllocTracks ()) { _mm_errno = MMERR_OUT_OF_MEMORY; return 0; } if (!AllocPatterns ()) { _mm_errno = MMERR_OUT_OF_MEMORY; return 0; } for (i = track = 0; i < of.numpat; i++) { if (!GDM_ReadPattern ()) { _mm_errno = MMERR_LOADING_PATTERN; return 0; } for (u = 0; u < of.numchn; u++, track++) { of.tracks[track] = GDM_ConvertTrack (&gdmbuf[u << 6]); if (!of.tracks[track]) { _mm_errno = MMERR_LOADING_TRACK; return 0; } } } return 1; } CHAR * GDM_LoadTitle (void) { CHAR s[32]; _mm_fseek (modreader, 4, SEEK_SET); if (!_mm_read_UBYTES (s, 32, modreader)) return NULL; return DupStr (s, 28, 0); } MLOADER load_gdm = { NULL, "GDM", "GDM (General DigiMusic)", GDM_Init, GDM_Test, GDM_Load, GDM_Cleanup, GDM_LoadTitle }; /* ex:set ts=4: */ TiMidity++-2.13.2/libunimod/load_imf.c0100644004711200001440000004440207421005041016572 0ustar tamukiusers/* MikMod sound library (c) 1998, 1999 Miodrag Vallat and others - see file AUTHORS for complete list. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /*============================================================================== $Id: load_imf.c,v 1.12 1999/10/25 16:31:41 miod Exp $ Imago Orpheus (IMF) module loader ==============================================================================*/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include "unimod_priv.h" /*========== Module structure */ /* module header */ typedef struct IMFHEADER { CHAR songname[32]; UWORD ordnum; UWORD patnum; UWORD insnum; UWORD flags; UBYTE initspeed; UBYTE inittempo; UBYTE mastervol; UBYTE mastermult; UBYTE orders[256]; } IMFHEADER; /* channel settings */ typedef struct IMFCHANNEL { CHAR name[12]; UBYTE chorus; UBYTE reverb; UBYTE pan; UBYTE status; } IMFCHANNEL; /* instrument header */ #define IMFNOTECNT (10*OCTAVE) #define IMFENVCNT (16*2) typedef struct IMFINSTHEADER { CHAR name[32]; UBYTE what[IMFNOTECNT]; UWORD volenv[IMFENVCNT]; UWORD panenv[IMFENVCNT]; UWORD pitenv[IMFENVCNT]; UBYTE volpts; UBYTE volsus; UBYTE volbeg; UBYTE volend; UBYTE volflg; UBYTE panpts; UBYTE pansus; UBYTE panbeg; UBYTE panend; UBYTE panflg; UBYTE pitpts; UBYTE pitsus; UBYTE pitbeg; UBYTE pitend; UBYTE pitflg; UWORD volfade; UWORD numsmp; ULONG signature; } IMFINSTHEADER; /* sample header */ typedef struct IMFWAVHEADER { CHAR samplename[13]; ULONG length; ULONG loopstart; ULONG loopend; ULONG samplerate; UBYTE volume; UBYTE pan; UBYTE flags; } IMFWAVHEADER; typedef struct IMFNOTE { UBYTE note, ins, eff1, dat1, eff2, dat2; } IMFNOTE; /*========== Loader variables */ static CHAR IMF_Version[] = "Imago Orpheus"; static IMFNOTE *imfpat = NULL; static IMFHEADER *mh = NULL; /*========== Loader code */ BOOL IMF_Test (void) { UBYTE id[4]; _mm_fseek (modreader, 0x3c, SEEK_SET); if (!_mm_read_UBYTES (id, 4, modreader)) return 0; if (!memcmp (id, "IM10", 4)) return 1; return 0; } BOOL IMF_Init (void) { if (!(imfpat = (IMFNOTE *) _mm_malloc (32 * 256 * sizeof (IMFNOTE)))) return 0; if (!(mh = (IMFHEADER *) _mm_malloc (sizeof (IMFHEADER)))) return 0; return 1; } void IMF_Cleanup (void) { FreeLinear (); _mm_free (imfpat); _mm_free (mh); } static BOOL IMF_ReadPattern (SLONG size, UWORD rows) { int row = 0, flag, ch; IMFNOTE *n, dummy; /* clear pattern data */ memset (imfpat, 255, 32 * 256 * sizeof (IMFNOTE)); while ((size > 0) && (row < rows)) { flag = _mm_read_UBYTE (modreader); size--; if (_mm_eof (modreader)) { _mm_errno = MMERR_LOADING_PATTERN; return 0; } if (flag) { ch = remap[flag & 31]; if (ch != -1) n = &imfpat[256 * ch + row]; else n = &dummy; if (flag & 32) { n->note = _mm_read_UBYTE (modreader); if (n->note >= 0xa0) n->note = 0xa0; /* note off */ n->ins = _mm_read_UBYTE (modreader); size -= 2; } if (flag & 64) { size -= 2; n->eff2 = _mm_read_UBYTE (modreader); n->dat2 = _mm_read_UBYTE (modreader); } if (flag & 128) { n->eff1 = _mm_read_UBYTE (modreader); n->dat1 = _mm_read_UBYTE (modreader); size -= 2; } } else row++; } if ((size) || (row != rows)) { _mm_errno = MMERR_LOADING_PATTERN; return 0; } return 1; } static void IMF_ProcessCmd (UBYTE eff, UBYTE inf) { if ((eff) && (eff != 255)) switch (eff) { case 0x01: /* set tempo */ UniEffect (UNI_S3MEFFECTA, inf); break; case 0x02: /* set BPM */ if (inf >= 0x20) UniEffect (UNI_S3MEFFECTT, inf); break; case 0x03: /* tone portamento */ UniEffect (UNI_ITEFFECTG, inf); break; case 0x04: /* porta + volslide */ UniEffect (UNI_ITEFFECTG, inf); UniEffect (UNI_S3MEFFECTD, 0); break; case 0x05: /* vibrato */ UniPTEffect (0x4, inf); break; case 0x06: /* vibrato + volslide */ UniPTEffect (0x4, inf); UniEffect (UNI_S3MEFFECTD, 0); break; case 0x07: /* fine vibrato */ UniEffect (UNI_ITEFFECTU, inf); break; case 0x08: /* tremolo */ UniEffect (UNI_S3MEFFECTR, inf); break; case 0x09: /* arpeggio */ UniPTEffect (0x0, inf); break; case 0x0a: /* panning */ UniPTEffect (0x8, (inf >= 128) ? 255 : (inf << 1)); break; case 0x0b: /* pan slide */ UniEffect (UNI_XMEFFECTP, inf); break; case 0x0c: /* set channel volume */ if (inf <= 64) UniPTEffect (0xc, inf); break; case 0x0d: /* volume slide */ UniEffect (UNI_S3MEFFECTD, inf); break; case 0x0e: /* fine volume slide */ if (inf) { if (inf >> 4) UniEffect (UNI_S3MEFFECTD, 0x0f | inf); else UniEffect (UNI_S3MEFFECTD, 0xf0 | inf); } else UniEffect (UNI_S3MEFFECTD, 0); break; case 0x0f: /* set finetune */ UniPTEffect (0xe, 0x50 | (inf >> 4)); break; #ifdef MIKMOD_DEBUG case 0x10: /* note slide up */ case 0x11: /* not slide down */ fprintf (stderr, "\rIMF effect 0x10/0x11 (note slide)" " not implemented (eff=%2X inf=%2X)\n", eff, inf); break; #endif case 0x12: /* slide up */ UniEffect (UNI_S3MEFFECTF, inf); break; case 0x13: /* slide down */ UniEffect (UNI_S3MEFFECTE, inf); break; case 0x14: /* fine slide up */ if (inf) { if (inf < 0x40) UniEffect (UNI_S3MEFFECTF, 0xe0 | (inf / 4)); else UniEffect (UNI_S3MEFFECTF, 0xf0 | (inf >> 4)); } else UniEffect (UNI_S3MEFFECTF, 0); break; case 0x15: /* fine slide down */ if (inf) { if (inf < 0x40) UniEffect (UNI_S3MEFFECTE, 0xe0 | (inf / 4)); else UniEffect (UNI_S3MEFFECTE, 0xf0 | (inf >> 4)); } else UniEffect (UNI_S3MEFFECTE, 0); break; /* 0x16 set filter cutoff (awe32) */ /* 0x17 filter side + resonance (awe32) */ case 0x18: /* sample offset */ UniPTEffect (0x9, inf); break; #ifdef MIKMOD_DEBUG case 0x19: /* set fine sample offset */ fprintf (stderr, "\rIMF effect 0x19 (fine sample offset)" " not implemented (inf=%2X)\n", inf); break; #endif case 0x1a: /* keyoff */ UniWriteByte (UNI_KEYOFF); break; case 0x1b: /* retrig */ UniEffect (UNI_S3MEFFECTQ, inf); break; case 0x1c: /* tremor */ UniEffect (UNI_S3MEFFECTI, inf); break; case 0x1d: /* position jump */ UniPTEffect (0xb, inf); break; case 0x1e: /* pattern break */ UniPTEffect (0xd, (inf >> 4) * 10 + (inf & 0xf)); break; case 0x1f: /* set master volume */ if (inf <= 64) UniEffect (UNI_XMEFFECTG, inf); break; case 0x20: /* master volume slide */ UniEffect (UNI_XMEFFECTH, inf); break; case 0x21: /* extended effects */ switch (inf >> 4) { case 0x1: /* set filter */ case 0x5: /* vibrato waveform */ case 0x8: /* tremolo waveform */ UniPTEffect (0xe, inf - 0x10); break; case 0xa: /* pattern loop */ UniPTEffect (0xe, 0x60 | (inf & 0xf)); break; case 0xb: /* pattern delay */ UniPTEffect (0xe, 0xe0 | (inf & 0xf)); break; case 0x3: /* glissando */ case 0xc: /* note cut */ case 0xd: /* note delay */ case 0xf: /* invert loop */ UniPTEffect (0xe, inf); break; case 0xe: /* ignore envelope */ UniEffect (UNI_ITEFFECTS0, 0x77); /* vol */ UniEffect (UNI_ITEFFECTS0, 0x79); /* pan */ UniEffect (UNI_ITEFFECTS0, 0x7b); /* pit */ break; } break; /* 0x22 chorus (awe32) */ /* 0x23 reverb (awe32) */ } } static UBYTE * IMF_ConvertTrack (IMFNOTE * tr, UWORD rows) { int t; UBYTE note, ins; UniReset (); for (t = 0; t < rows; t++) { note = tr[t].note; ins = tr[t].ins; if ((ins) && (ins != 255)) UniInstrument (ins - 1); if (note != 255) { if (note == 0xa0) { UniPTEffect (0xc, 0); /* Note cut */ if (tr[t].eff1 == 0x0c) tr[t].eff1 = 0; if (tr[t].eff2 == 0x0c) tr[t].eff2 = 0; } else UniNote (((note >> 4) * OCTAVE) + (note & 0xf)); } IMF_ProcessCmd (tr[t].eff1, tr[t].dat1); IMF_ProcessCmd (tr[t].eff2, tr[t].dat2); UniNewline (); } return UniDup (); } BOOL IMF_Load (BOOL curious) { #define IMF_SMPINCR 64 int t, u, track = 0; IMFCHANNEL channels[32]; INSTRUMENT *d; SAMPLE *q; IMFWAVHEADER *wh = NULL, *s = NULL; ULONG *nextwav = NULL; UWORD wavcnt = 0; UBYTE id[4]; /* try to read the module header */ _mm_read_string (mh->songname, 32, modreader); mh->ordnum = _mm_read_I_UWORD (modreader); mh->patnum = _mm_read_I_UWORD (modreader); mh->insnum = _mm_read_I_UWORD (modreader); mh->flags = _mm_read_I_UWORD (modreader); _mm_fseek (modreader, 8, SEEK_CUR); mh->initspeed = _mm_read_UBYTE (modreader); mh->inittempo = _mm_read_UBYTE (modreader); mh->mastervol = _mm_read_UBYTE (modreader); mh->mastermult = _mm_read_UBYTE (modreader); _mm_fseek (modreader, 64, SEEK_SET); if (_mm_eof (modreader)) { _mm_errno = MMERR_LOADING_HEADER; return 0; } /* set module variables */ of.songname = DupStr (mh->songname, 31, 1); of.modtype = strdup (IMF_Version); of.numpat = mh->patnum; of.numins = mh->insnum; of.reppos = 0; of.initspeed = mh->initspeed; of.inittempo = mh->inittempo; of.initvolume = mh->mastervol << 1; of.flags |= UF_INST; if (mh->flags & 1) of.flags |= UF_LINEAR; /* read channel information */ of.numchn = 0; memset (remap, -1, 32 * sizeof (UBYTE)); for (t = 0; t < 32; t++) { _mm_read_string (channels[t].name, 12, modreader); channels[t].chorus = _mm_read_UBYTE (modreader); channels[t].reverb = _mm_read_UBYTE (modreader); channels[t].pan = _mm_read_UBYTE (modreader); channels[t].status = _mm_read_UBYTE (modreader); } /* bug in Imago Orpheus ? If only channel 1 is enabled, in fact we have to enable 16 channels */ if (!channels[0].status) { for (t = 1; t < 16; t++) if (channels[t].status != 1) break; if (t == 16) for (t = 1; t < 16; t++) channels[t].status = 0; } for (t = 0; t < 32; t++) { if (channels[t].status != 2) remap[t] = of.numchn++; else remap[t] = -1; } for (t = 0; t < 32; t++) if (remap[t] != -1) { of.panning[remap[t]] = channels[t].pan; of.chanvol[remap[t]] = channels[t].status ? 0 : 64; } if (_mm_eof (modreader)) { _mm_errno = MMERR_LOADING_HEADER; return 0; } /* read order list */ _mm_read_UBYTES (mh->orders, 256, modreader); if (_mm_eof (modreader)) { _mm_errno = MMERR_LOADING_HEADER; return 0; } of.numpos = 0; for (t = 0; t < mh->ordnum; t++) if (mh->orders[t] != 0xff) of.numpos++; if (!AllocPositions (of.numpos)) return 0; for (t = u = 0; t < mh->ordnum; t++) if (mh->orders[t] != 0xff) of.positions[u++] = mh->orders[t]; /* load pattern info */ of.numtrk = of.numpat * of.numchn; if (!AllocTracks ()) return 0; if (!AllocPatterns ()) return 0; for (t = 0; t < of.numpat; t++) { SLONG size; UWORD rows; size = (SLONG) _mm_read_I_UWORD (modreader); rows = _mm_read_I_UWORD (modreader); if ((rows > 256) || (size < 4)) { _mm_errno = MMERR_LOADING_PATTERN; return 0; } of.pattrows[t] = rows; if (!IMF_ReadPattern (size - 4, rows)) return 0; for (u = 0; u < of.numchn; u++) if (!(of.tracks[track++] = IMF_ConvertTrack (&imfpat[u * 256], rows))) return 0; } /* load instruments */ if (!AllocInstruments ()) return 0; d = of.instruments; for (t = 0; t < of.numins; t++) { IMFINSTHEADER ih; memset (d->samplenumber, 0xff, INSTNOTES * sizeof (UWORD)); /* read instrument header */ _mm_read_string (ih.name, 32, modreader); d->insname = DupStr (ih.name, 31, 1); _mm_read_UBYTES (ih.what, IMFNOTECNT, modreader); _mm_fseek (modreader, 8, SEEK_CUR); _mm_read_I_UWORDS (ih.volenv, IMFENVCNT, modreader); _mm_read_I_UWORDS (ih.panenv, IMFENVCNT, modreader); _mm_read_I_UWORDS (ih.pitenv, IMFENVCNT, modreader); #define IMF_FinishLoadingEnvelope(name) \ ih.name##pts=_mm_read_UBYTE(modreader); \ ih.name##sus=_mm_read_UBYTE(modreader); \ ih.name##beg=_mm_read_UBYTE(modreader); \ ih.name##end=_mm_read_UBYTE(modreader); \ ih.name##flg=_mm_read_UBYTE(modreader); \ _mm_read_UBYTE(modreader); \ _mm_read_UBYTE(modreader); \ _mm_read_UBYTE(modreader); IMF_FinishLoadingEnvelope (vol); IMF_FinishLoadingEnvelope (pan); IMF_FinishLoadingEnvelope (pit); ih.volfade = _mm_read_I_UWORD (modreader); ih.numsmp = _mm_read_I_UWORD (modreader); _mm_read_UBYTES (id, 4, modreader); if (memcmp (id, "II10", 4)) { if (nextwav) free (nextwav); if (wh) free (wh); _mm_errno = MMERR_LOADING_SAMPLEINFO; return 0; } if ((ih.numsmp > 16) || (ih.volpts > IMFENVCNT / 2) || (ih.panpts > IMFENVCNT / 2) || (ih.pitpts > IMFENVCNT / 2) || (_mm_eof (modreader))) { if (nextwav) free (nextwav); if (wh) free (wh); _mm_errno = MMERR_LOADING_SAMPLEINFO; return 0; } for (u = 0; u < IMFNOTECNT; u++) d->samplenumber[u] = ih.what[u] > ih.numsmp ? 0xffff : ih.what[u] + of.numsmp; d->volfade = ih.volfade; #define IMF_ProcessEnvelope(name) \ for (u = 0; u < (IMFENVCNT >> 1); u++) { \ d->name##env[u].pos = ih.name##env[u << 1]; \ d->name##env[u].val = ih.name##env[(u << 1)+ 1]; \ } \ if (ih.name##flg&1) d->name##flg|=EF_ON; \ if (ih.name##flg&2) d->name##flg|=EF_SUSTAIN; \ if (ih.name##flg&4) d->name##flg|=EF_LOOP; \ d->name##susbeg=d->name##susend=ih.name##sus; \ d->name##beg=ih.name##beg; \ d->name##end=ih.name##end; \ d->name##pts=ih.name##pts; \ \ if ((d->name##flg&EF_ON)&&(d->name##pts<2)) \ d->name##flg&=~EF_ON; IMF_ProcessEnvelope (vol); IMF_ProcessEnvelope (pan); IMF_ProcessEnvelope (pit); #undef IMF_ProcessEnvelope if (ih.pitflg & 1) { d->pitflg &= ~EF_ON; #ifdef MIKMOD_DEBUG fputs ("\rFilter envelopes not supported yet\n", stderr); #endif } /* gather sample information */ for (u = 0; u < ih.numsmp; u++, s++) { /* allocate more room for sample information if necessary */ if (of.numsmp + u == wavcnt) { wavcnt += IMF_SMPINCR; if (!(nextwav = realloc (nextwav, wavcnt * sizeof (ULONG)))) { if (wh) free (wh); _mm_errno = MMERR_OUT_OF_MEMORY; return 0; } if (!(wh = realloc (wh, wavcnt * sizeof (IMFWAVHEADER)))) { free (nextwav); _mm_errno = MMERR_OUT_OF_MEMORY; return 0; } s = wh + (wavcnt - IMF_SMPINCR); } _mm_read_string (s->samplename, 13, modreader); _mm_read_UBYTE (modreader); _mm_read_UBYTE (modreader); _mm_read_UBYTE (modreader); s->length = _mm_read_I_ULONG (modreader); s->loopstart = _mm_read_I_ULONG (modreader); s->loopend = _mm_read_I_ULONG (modreader); s->samplerate = _mm_read_I_ULONG (modreader); s->volume = _mm_read_UBYTE (modreader) & 0x7f; s->pan = _mm_read_UBYTE (modreader); _mm_fseek (modreader, 14, SEEK_CUR); s->flags = _mm_read_UBYTE (modreader); _mm_fseek (modreader, 11, SEEK_CUR); _mm_read_UBYTES (id, 4, modreader); if (((memcmp (id, "IS10", 4)) && (memcmp (id, "IW10", 4))) || (_mm_eof (modreader))) { free (nextwav); free (wh); _mm_errno = MMERR_LOADING_SAMPLEINFO; return 0; } nextwav[of.numsmp + u] = _mm_ftell (modreader); _mm_fseek (modreader, s->length, SEEK_CUR); } of.numsmp += ih.numsmp; d++; } /* sanity check */ if (!of.numsmp) { if (nextwav) free (nextwav); if (wh) free (wh); _mm_errno = MMERR_LOADING_SAMPLEINFO; return 0; } /* load samples */ if (!AllocSamples ()) { free (nextwav); free (wh); return 0; } if (!AllocLinear ()) { free (nextwav); free (wh); return 0; } q = of.samples; s = wh; for (u = 0; u < of.numsmp; u++, s++, q++) { q->samplename = DupStr (s->samplename, 12, 1); q->length = s->length; q->loopstart = s->loopstart; q->loopend = s->loopend; q->volume = s->volume; q->speed = s->samplerate; if (of.flags & UF_LINEAR) q->speed = speed_to_finetune (s->samplerate << 1, u); q->panning = s->pan; q->seekpos = nextwav[u]; q->flags |= SF_SIGNED; if (s->flags & 0x1) q->flags |= SF_LOOP; if (s->flags & 0x2) q->flags |= SF_BIDI; if (s->flags & 0x8) q->flags |= SF_OWNPAN; if (s->flags & 0x4) { q->flags |= SF_16BITS; q->length >>= 1; q->loopstart >>= 1; q->loopend >>= 1; } } d = of.instruments; s = wh; for (u = 0; u < of.numins; u++, d++) { for (t = 0; t < IMFNOTECNT; t++) { if (d->samplenumber[t] >= of.numsmp) d->samplenote[t] = 255; else if (of.flags & UF_LINEAR) { int note = (int) d->samplenote[u] + noteindex[d->samplenumber[u]]; d->samplenote[u] = (note < 0) ? 0 : (note > 255 ? 255 : note); } else d->samplenote[t] = t; } } free (wh); free (nextwav); return 1; } CHAR * IMF_LoadTitle (void) { CHAR s[31]; _mm_fseek (modreader, 0, SEEK_SET); if (!_mm_read_UBYTES (s, 31, modreader)) return NULL; return (DupStr (s, 31, 1)); } /*========== Loader information */ MLOADER load_imf = { NULL, "IMF", "IMF (Imago Orpheus)", IMF_Init, IMF_Test, IMF_Load, IMF_Cleanup, IMF_LoadTitle }; /* ex:set ts=4: */ TiMidity++-2.13.2/libunimod/load_it.c0100644004711200001440000007277207421005041016446 0ustar tamukiusers/* MikMod sound library (c) 1998, 1999 Miodrag Vallat and others - see file AUTHORS for complete list. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /*============================================================================== $Id: load_it.c,v 1.39 1999/10/25 16:31:41 miod Exp $ Impulse tracker (IT) module loader ==============================================================================*/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include "unimod_priv.h" /*========== Module structure */ /* header */ typedef struct ITHEADER { CHAR songname[26]; UBYTE blank01[2]; UWORD ordnum; UWORD insnum; UWORD smpnum; UWORD patnum; UWORD cwt; /* Created with tracker (y.xx = 0x0yxx) */ UWORD cmwt; /* Compatible with tracker ver > than val. */ UWORD flags; UWORD special; /* bit 0 set = song message attached */ UBYTE globvol; UBYTE mixvol; /* mixing volume [ignored] */ UBYTE initspeed; UBYTE inittempo; UBYTE pansep; /* panning separation between channels */ UBYTE zerobyte; UWORD msglength; ULONG msgoffset; UBYTE blank02[4]; UBYTE pantable[64]; UBYTE voltable[64]; } ITHEADER; /* sample information */ typedef struct ITSAMPLE { CHAR filename[12]; UBYTE zerobyte; UBYTE globvol; UBYTE flag; UBYTE volume; UBYTE panning; CHAR sampname[28]; UWORD convert; /* sample conversion flag */ ULONG length; ULONG loopbeg; ULONG loopend; ULONG c5spd; ULONG susbegin; ULONG susend; ULONG sampoffset; UBYTE vibspeed; UBYTE vibdepth; UBYTE vibrate; UBYTE vibwave; /* 0=sine, 1=rampdown, 2=square, 3=random (speed ignored) */ } ITSAMPLE; /* instrument information */ #define ITENVCNT 25 #define ITNOTECNT 120 typedef struct ITINSTHEADER { ULONG size; /* (dword) Instrument size */ CHAR filename[12]; /* (char) Instrument filename */ UBYTE zerobyte; /* (byte) Instrument type (always 0) */ UBYTE volflg; UBYTE volpts; UBYTE volbeg; /* (byte) Volume loop start (node) */ UBYTE volend; /* (byte) Volume loop end (node) */ UBYTE volsusbeg; /* (byte) Volume sustain begin (node) */ UBYTE volsusend; /* (byte) Volume Sustain end (node) */ UBYTE panflg; UBYTE panpts; UBYTE panbeg; /* (byte) channel loop start (node) */ UBYTE panend; /* (byte) channel loop end (node) */ UBYTE pansusbeg; /* (byte) channel sustain begin (node) */ UBYTE pansusend; /* (byte) channel Sustain end (node) */ UBYTE pitflg; UBYTE pitpts; UBYTE pitbeg; /* (byte) pitch loop start (node) */ UBYTE pitend; /* (byte) pitch loop end (node) */ UBYTE pitsusbeg; /* (byte) pitch sustain begin (node) */ UBYTE pitsusend; /* (byte) pitch Sustain end (node) */ UWORD blank; UBYTE globvol; UBYTE chanpan; UWORD fadeout; /* Envelope end / NNA volume fadeout */ UBYTE dnc; /* Duplicate note check */ UBYTE dca; /* Duplicate check action */ UBYTE dct; /* Duplicate check type */ UBYTE nna; /* New Note Action [0,1,2,3] */ UWORD trkvers; /* tracker version used to save [files only] */ UBYTE ppsep; /* Pitch-pan Separation */ UBYTE ppcenter; /* Pitch-pan Center */ UBYTE rvolvar; /* random volume varations */ UBYTE rpanvar; /* random panning varations */ UWORD numsmp; /* Number of samples in instrument [files only] */ CHAR name[26]; /* Instrument name */ UBYTE blank01[6]; UWORD samptable[ITNOTECNT]; /* sample for each note [note / samp pairs] */ UBYTE volenv[200]; /* volume envelope (IT 1.x stuff) */ UBYTE oldvoltick[ITENVCNT]; /* volume tick position (IT 1.x stuff) */ UBYTE volnode[ITENVCNT]; /* amplitude of volume nodes */ UWORD voltick[ITENVCNT]; /* tick value of volume nodes */ SBYTE pannode[ITENVCNT]; /* panenv - node points */ UWORD pantick[ITENVCNT]; /* tick value of panning nodes */ SBYTE pitnode[ITENVCNT]; /* pitchenv - node points */ UWORD pittick[ITENVCNT]; /* tick value of pitch nodes */ } ITINSTHEADER; /* unpacked note */ typedef struct ITNOTE { UBYTE note, ins, volpan, cmd, inf; } ITNOTE; /*========== Loader data */ static ULONG *paraptr = NULL; /* parapointer array (see IT docs) */ static ITHEADER *mh = NULL; static ITNOTE *itpat = NULL; /* allocate to space for one full pattern */ static UBYTE *mask = NULL; /* arrays allocated to 64 elements and used for */ static ITNOTE *last = NULL; /* uncompressing IT's pattern information */ static int numtrk = 0; static int old_effect; /* if set, use S3M old-effects stuffs */ static CHAR *IT_Version[] = { "ImpulseTracker . ", "Compressed ImpulseTracker . ", "ImpulseTracker 2.14p3", "Compressed ImpulseTracker 2.14p3", "ImpulseTracker 2.14p4", "Compressed ImpulseTracker 2.14p4", }; /* table for porta-to-note command within volume/panning column */ static UBYTE portatable[10] = {0, 1, 4, 8, 16, 32, 64, 96, 128, 255}; /*========== Loader code */ BOOL IT_Test (void) { UBYTE id[4]; if (!_mm_read_UBYTES (id, 4, modreader)) return 0; if (!memcmp (id, "IMPM", 4)) return 1; return 0; } BOOL IT_Init (void) { if (!(mh = (ITHEADER *) _mm_malloc (sizeof (ITHEADER)))) return 0; if (!(poslookup = (UBYTE *) _mm_malloc (256 * sizeof (UBYTE)))) return 0; if (!(itpat = (ITNOTE *) _mm_malloc (200 * 64 * sizeof (ITNOTE)))) return 0; if (!(mask = (UBYTE *) _mm_malloc (64 * sizeof (UBYTE)))) return 0; if (!(last = (ITNOTE *) _mm_malloc (64 * sizeof (ITNOTE)))) return 0; return 1; } void IT_Cleanup (void) { FreeLinear (); _mm_free (mh); _mm_free (poslookup); _mm_free (itpat); _mm_free (mask); _mm_free (last); _mm_free (paraptr); _mm_free (origpositions); } /* Because so many IT files have 64 channels as the set number used, but really only use far less (usually from 8 to 24 still), I had to make this function, which determines the number of channels that are actually USED by a pattern. NOTE: You must first seek to the file location of the pattern before calling this procedure. Returns 1 on error */ static BOOL IT_GetNumChannels (UWORD patrows) { int row = 0, flag, ch; do { if ((flag = _mm_read_UBYTE (modreader)) == EOF) { _mm_errno = MMERR_LOADING_PATTERN; return 1; } if (!flag) row++; else { ch = (flag - 1) & 63; remap[ch] = 0; if (flag & 128) mask[ch] = _mm_read_UBYTE (modreader); if (mask[ch] & 1) _mm_read_UBYTE (modreader); if (mask[ch] & 2) _mm_read_UBYTE (modreader); if (mask[ch] & 4) _mm_read_UBYTE (modreader); if (mask[ch] & 8) { _mm_read_UBYTE (modreader); _mm_read_UBYTE (modreader); } } } while (row < patrows); return 0; } static UBYTE * IT_ConvertTrack (ITNOTE * tr, UWORD numrows) { int t; UBYTE note, ins, volpan; UniReset (); for (t = 0; t < numrows; t++) { note = tr[t * of.numchn].note; ins = tr[t * of.numchn].ins; volpan = tr[t * of.numchn].volpan; if (note != 255) { if (note == 253) UniWriteByte (UNI_KEYOFF); else if (note == 254) { UniPTEffect (0xc, -1); /* note cut command */ volpan = 255; } else UniNote (note); } if ((ins) && (ins < 100)) UniInstrument (ins - 1); else if (ins == 253) UniWriteByte (UNI_KEYOFF); else if (ins != 255) { /* crap */ _mm_errno = MMERR_LOADING_PATTERN; return NULL; } /* process volume / panning column volume / panning effects do NOT all share the same memory address yet. */ if (volpan <= 64) UniVolEffect (VOL_VOLUME, volpan); else if (volpan <= 74) /* fine volume slide up (65-74) */ UniVolEffect (VOL_VOLSLIDE, 0x0f + ((volpan - 65) << 4)); else if (volpan <= 84) /* fine volume slide down (75-84) */ UniVolEffect (VOL_VOLSLIDE, 0xf0 + (volpan - 75)); else if (volpan <= 94) /* volume slide up (85-94) */ UniVolEffect (VOL_VOLSLIDE, ((volpan - 85) << 4)); else if (volpan <= 104) /* volume slide down (95-104) */ UniVolEffect (VOL_VOLSLIDE, (volpan - 95)); else if (volpan <= 114) /* pitch slide down (105-114) */ UniVolEffect (VOL_PITCHSLIDEDN, (volpan - 105)); else if (volpan <= 124) /* pitch slide up (115-124) */ UniVolEffect (VOL_PITCHSLIDEUP, (volpan - 115)); else if (volpan <= 127) { /* crap */ _mm_errno = MMERR_LOADING_PATTERN; return NULL; } else if (volpan <= 192) UniVolEffect (VOL_PANNING, ((volpan - 128) == 64) ? 255 : ((volpan - 128) << 2)); else if (volpan <= 202) /* portamento to note */ UniVolEffect (VOL_PORTAMENTO, portatable[volpan - 193]); else if (volpan <= 212) /* vibrato */ UniVolEffect (VOL_VIBRATO, (volpan - 203)); else if ((volpan != 239) && (volpan != 255)) { /* crap */ _mm_errno = MMERR_LOADING_PATTERN; return NULL; } S3MIT_ProcessCmd (tr[t * of.numchn].cmd, tr[t * of.numchn].inf, old_effect | 2); UniNewline (); } return UniDup (); } static BOOL IT_ReadPattern (UWORD patrows) { int row = 0, flag, ch, blah; ITNOTE *itt = itpat, dummy, *n, *l; memset (itt, 255, 200 * 64 * sizeof (ITNOTE)); do { if ((flag = _mm_read_UBYTE (modreader)) == EOF) { _mm_errno = MMERR_LOADING_PATTERN; return 0; } if (!flag) { itt = &itt[of.numchn]; row++; } else { ch = remap[(flag - 1) & 63]; if (ch != -1) { n = &itt[ch]; l = &last[ch]; } else n = l = &dummy; if (flag & 128) mask[ch] = _mm_read_UBYTE (modreader); if (mask[ch] & 1) /* convert IT note off to internal note off */ if ((l->note = n->note = _mm_read_UBYTE (modreader)) == 255) l->note = n->note = 253; if (mask[ch] & 2) l->ins = n->ins = _mm_read_UBYTE (modreader); if (mask[ch] & 4) l->volpan = n->volpan = _mm_read_UBYTE (modreader); if (mask[ch] & 8) { l->cmd = n->cmd = _mm_read_UBYTE (modreader); l->inf = n->inf = _mm_read_UBYTE (modreader); } if (mask[ch] & 16) n->note = l->note; if (mask[ch] & 32) n->ins = l->ins; if (mask[ch] & 64) n->volpan = l->volpan; if (mask[ch] & 128) { n->cmd = l->cmd; n->inf = l->inf; } } } while (row < patrows); for (blah = 0; blah < of.numchn; blah++) { if (!(of.tracks[numtrk++] = IT_ConvertTrack (&itpat[blah], patrows))) return 0; } return 1; } static void LoadMidiString (URL modreader, CHAR * dest) { CHAR *cur, *last; _mm_read_UBYTES (dest, 32, modreader); cur = last = dest; /* remove blanks and uppercase all */ while (*last) { if (isalnum ((int) *last)) *(cur++) = toupper ((int) *last); last++; } *cur = 0; } /* Load embedded midi information for resonant filters */ static void IT_LoadMidiConfiguration (URL modreader) { int i; memset (filtermacros, 0, sizeof (filtermacros)); memset (filtersettings, 0, sizeof (filtersettings)); if (modreader) { /* information is embedded in file */ UWORD dat; CHAR midiline[33]; dat = _mm_read_I_UWORD (modreader); _mm_fseek (modreader, 8 * dat + 0x120, SEEK_CUR); /* read midi macros */ for (i = 0; i < 16; i++) { LoadMidiString (modreader, midiline); if ((!strncmp (midiline, "F0F00", 5)) && ((midiline[5] == '0') || (midiline[5] == '1'))) filtermacros[i] = (midiline[5] - '0') | 0x80; } /* read standalone filters */ for (i = 0x80; i < 0x100; i++) { LoadMidiString (modreader, midiline); if ((!strncmp (midiline, "F0F00", 5)) && ((midiline[5] == '0') || (midiline[5] == '1'))) { filtersettings[i].filter = (midiline[5] - '0') | 0x80; dat = (midiline[6]) ? (midiline[6] - '0') : 0; if (midiline[7]) dat = (dat << 4) | (midiline[7] - '0'); filtersettings[i].inf = dat; } } } else { /* use default information */ filtermacros[0] = FILT_CUT; for (i = 0x80; i < 0x90; i++) { filtersettings[i].filter = FILT_RESONANT; filtersettings[i].inf = (i & 0x7f) << 3; } } activemacro = 0; for (i = 0; i < 0x80; i++) { filtersettings[i].filter = filtermacros[0]; filtersettings[i].inf = i; } } BOOL IT_Load (BOOL curious) { int t, u, lp; INSTRUMENT *d; SAMPLE *q; BOOL compressed = 0; numtrk = 0; filters = 0; /* try to read module header */ _mm_read_I_ULONG (modreader); /* kill the 4 byte header */ _mm_read_string (mh->songname, 26, modreader); _mm_read_UBYTES (mh->blank01, 2, modreader); mh->ordnum = _mm_read_I_UWORD (modreader); mh->insnum = _mm_read_I_UWORD (modreader); mh->smpnum = _mm_read_I_UWORD (modreader); mh->patnum = _mm_read_I_UWORD (modreader); mh->cwt = _mm_read_I_UWORD (modreader); mh->cmwt = _mm_read_I_UWORD (modreader); mh->flags = _mm_read_I_UWORD (modreader); mh->special = _mm_read_I_UWORD (modreader); mh->globvol = _mm_read_UBYTE (modreader); mh->mixvol = _mm_read_UBYTE (modreader); mh->initspeed = _mm_read_UBYTE (modreader); mh->inittempo = _mm_read_UBYTE (modreader); mh->pansep = _mm_read_UBYTE (modreader); mh->zerobyte = _mm_read_UBYTE (modreader); mh->msglength = _mm_read_I_UWORD (modreader); mh->msgoffset = _mm_read_I_ULONG (modreader); _mm_read_UBYTES (mh->blank02, 4, modreader); _mm_read_UBYTES (mh->pantable, 64, modreader); _mm_read_UBYTES (mh->voltable, 64, modreader); if (_mm_eof (modreader)) { _mm_errno = MMERR_LOADING_HEADER; return 0; } /* set module variables */ of.songname = DupStr (mh->songname, 26, 0); /* make a cstr of songname */ of.reppos = 0; of.numpat = mh->patnum; of.numins = mh->insnum; of.numsmp = mh->smpnum; of.initspeed = mh->initspeed; of.inittempo = mh->inittempo; of.initvolume = mh->globvol; of.flags |= UF_BGSLIDES | UF_ARPMEM; if (mh->songname[25]) { of.numvoices = 1 + mh->songname[25]; #ifdef MIKMOD_DEBUG fprintf (stderr, "Embedded IT limitation to %d voices\n", of.numvoices); #endif } /* set the module type */ /* 2.17 : IT 2.14p4 */ /* 2.16 : IT 2.14p3 with resonant filters */ /* 2.15 : IT 2.14p3 (improved compression) */ if ((mh->cwt <= 0x219) && (mh->cwt >= 0x217)) of.modtype = strdup (IT_Version[mh->cmwt < 0x214 ? 4 : 5]); else if (mh->cwt >= 0x215) of.modtype = strdup (IT_Version[mh->cmwt < 0x214 ? 2 : 3]); else { of.modtype = strdup (IT_Version[mh->cmwt < 0x214 ? 0 : 1]); of.modtype[mh->cmwt < 0x214 ? 15 : 26] = (mh->cwt >> 8) + '0'; of.modtype[mh->cmwt < 0x214 ? 17 : 28] = ((mh->cwt >> 4) & 0xf) + '0'; of.modtype[mh->cmwt < 0x214 ? 18 : 29] = ((mh->cwt) & 0xf) + '0'; } if (mh->flags & 8) of.flags |= (UF_XMPERIODS | UF_LINEAR); if ((mh->cwt >= 0x106) && (mh->flags & 16)) old_effect = 1; else old_effect = 0; /* set panning positions */ for (t = 0; t < 64; t++) { mh->pantable[t] &= 0x7f; if (mh->pantable[t] < 64) of.panning[t] = mh->pantable[t] << 2; else if (mh->pantable[t] == 64) of.panning[t] = 255; else if (mh->pantable[t] == 100) of.panning[t] = PAN_SURROUND; else if (mh->pantable[t] == 127) of.panning[t] = PAN_CENTER; else { _mm_errno = MMERR_LOADING_HEADER; return 0; } } /* set channel volumes */ memcpy (of.chanvol, mh->voltable, 64); /* read the order data */ if (!AllocPositions (mh->ordnum)) return 0; if (!(origpositions = _mm_calloc (mh->ordnum, sizeof (UWORD)))) return 0; for (t = 0; t < mh->ordnum; t++) { origpositions[t] = _mm_read_UBYTE (modreader); if ((origpositions[t] > mh->patnum) && (origpositions[t] < 254)) origpositions[t] = 255; } if (_mm_eof (modreader)) { _mm_errno = MMERR_LOADING_HEADER; return 0; } poslookupcnt = mh->ordnum; S3MIT_CreateOrders (curious); if (!(paraptr = (ULONG *) _mm_malloc ((mh->insnum + mh->smpnum + of.numpat) * sizeof (ULONG)))) return 0; /* read the instrument, sample, and pattern parapointers */ _mm_read_I_ULONGS (paraptr, mh->insnum + mh->smpnum + of.numpat, modreader); if (_mm_eof (modreader)) { _mm_errno = MMERR_LOADING_HEADER; return 0; } /* Check for and load midi information for resonant filters */ if (mh->cmwt >= 0x216) { if (mh->special & 8) { IT_LoadMidiConfiguration (modreader); if (_mm_eof (modreader)) { _mm_errno = MMERR_LOADING_HEADER; return 0; } } else IT_LoadMidiConfiguration (NULL); filters = 1; } /* Check for and load song comment */ if ((mh->special & 1) && (mh->cwt >= 0x104) && (mh->msglength)) { _mm_fseek (modreader, (long) (mh->msgoffset), SEEK_SET); if (!ReadComment (mh->msglength)) return 0; } if (!(mh->flags & 4)) of.numins = of.numsmp; if (!AllocSamples ()) return 0; if (!AllocLinear ()) return 0; /* Load all samples */ q = of.samples; for (t = 0; t < mh->smpnum; t++) { ITSAMPLE s; /* seek to sample position */ _mm_fseek (modreader, (long) (paraptr[mh->insnum + t] + 4), SEEK_SET); /* load sample info */ _mm_read_string (s.filename, 12, modreader); s.zerobyte = _mm_read_UBYTE (modreader); s.globvol = _mm_read_UBYTE (modreader); s.flag = _mm_read_UBYTE (modreader); s.volume = _mm_read_UBYTE (modreader); _mm_read_string (s.sampname, 26, modreader); s.convert = _mm_read_UBYTE (modreader); s.panning = _mm_read_UBYTE (modreader); s.length = _mm_read_I_ULONG (modreader); s.loopbeg = _mm_read_I_ULONG (modreader); s.loopend = _mm_read_I_ULONG (modreader); s.c5spd = _mm_read_I_ULONG (modreader); s.susbegin = _mm_read_I_ULONG (modreader); s.susend = _mm_read_I_ULONG (modreader); s.sampoffset = _mm_read_I_ULONG (modreader); s.vibspeed = _mm_read_UBYTE (modreader); s.vibdepth = _mm_read_UBYTE (modreader); s.vibrate = _mm_read_UBYTE (modreader); s.vibwave = _mm_read_UBYTE (modreader); /* Some IT files have bogues loopbeg/loopend if looping is not used by * a sample. */ if (!(s.flag & 80)) s.loopbeg = s.loopend = 0; /* Generate an error if c5spd is > 512k, or samplelength > 256 megs (nothing would EVER be that high) */ if (_mm_eof (modreader) || (s.c5spd > 0x7ffffL) || (s.length > 0xfffffffUL) || (s.loopbeg > 0xfffffffUL) || (s.loopend > 0xfffffffUL)) { _mm_errno = MMERR_LOADING_SAMPLEINFO; return 0; } q->samplename = DupStr (s.sampname, 26, 0); q->speed = s.c5spd / 2; q->panning = ((s.panning & 127) == 64) ? 255 : (s.panning & 127) << 2; q->length = s.length; q->loopstart = s.loopbeg; q->loopend = s.loopend; q->volume = s.volume; q->globvol = s.globvol; q->seekpos = s.sampoffset; /* Convert speed to XM linear finetune */ if (of.flags & UF_LINEAR) q->speed = speed_to_finetune (s.c5spd, t); if (s.panning & 128) q->flags |= SF_OWNPAN; if (s.vibrate) { q->vibflags |= AV_IT; q->vibtype = s.vibwave; q->vibsweep = s.vibrate * 2; q->vibdepth = s.vibdepth; q->vibrate = s.vibspeed; } if (s.flag & 2) q->flags |= SF_16BITS; if ((s.flag & 8) && (mh->cwt >= 0x214)) { q->flags |= SF_ITPACKED; compressed = 1; } if (s.flag & 16) q->flags |= SF_LOOP; if (s.flag & 64) q->flags |= SF_BIDI; if (mh->cwt >= 0x200) { if (s.convert & 1) q->flags |= SF_SIGNED; if (s.convert & 4) q->flags |= SF_DELTA; } q++; } /* Load instruments if instrument mode flag enabled */ if (mh->flags & 4) { if (!AllocInstruments ()) return 0; d = of.instruments; of.flags |= UF_NNA | UF_INST; for (t = 0; t < mh->insnum; t++) { ITINSTHEADER ih; /* seek to instrument position */ _mm_fseek (modreader, paraptr[t] + 4, SEEK_SET); /* load instrument info */ _mm_read_string (ih.filename, 12, modreader); ih.zerobyte = _mm_read_UBYTE (modreader); if (mh->cwt < 0x200) { /* load IT 1.xx inst header */ ih.volflg = _mm_read_UBYTE (modreader); ih.volbeg = _mm_read_UBYTE (modreader); ih.volend = _mm_read_UBYTE (modreader); ih.volsusbeg = _mm_read_UBYTE (modreader); ih.volsusend = _mm_read_UBYTE (modreader); _mm_read_I_UWORD (modreader); ih.fadeout = _mm_read_I_UWORD (modreader); ih.nna = _mm_read_UBYTE (modreader); ih.dnc = _mm_read_UBYTE (modreader); } else { /* Read IT200+ header */ ih.nna = _mm_read_UBYTE (modreader); ih.dct = _mm_read_UBYTE (modreader); ih.dca = _mm_read_UBYTE (modreader); ih.fadeout = _mm_read_I_UWORD (modreader); ih.ppsep = _mm_read_UBYTE (modreader); ih.ppcenter = _mm_read_UBYTE (modreader); ih.globvol = _mm_read_UBYTE (modreader); ih.chanpan = _mm_read_UBYTE (modreader); ih.rvolvar = _mm_read_UBYTE (modreader); ih.rpanvar = _mm_read_UBYTE (modreader); } ih.trkvers = _mm_read_I_UWORD (modreader); ih.numsmp = _mm_read_UBYTE (modreader); _mm_read_UBYTE (modreader); _mm_read_string (ih.name, 26, modreader); _mm_read_UBYTES (ih.blank01, 6, modreader); _mm_read_I_UWORDS (ih.samptable, ITNOTECNT, modreader); if (mh->cwt < 0x200) { /* load IT 1xx volume envelope */ _mm_read_UBYTES (ih.volenv, 200, modreader); for (lp = 0; lp < ITENVCNT; lp++) { ih.oldvoltick[lp] = _mm_read_UBYTE (modreader); ih.volnode[lp] = _mm_read_UBYTE (modreader); } } else { /* load IT 2xx volume, pan and pitch envelopes */ #define IT_LoadEnvelope(name,type) \ ih.name##flg =_mm_read_UBYTE(modreader); \ ih.name##pts =_mm_read_UBYTE(modreader); \ ih.name##beg =_mm_read_UBYTE(modreader); \ ih.name##end =_mm_read_UBYTE(modreader); \ ih.name##susbeg=_mm_read_UBYTE(modreader); \ ih.name##susend=_mm_read_UBYTE(modreader); \ for(lp=0;lpvolflg |= EF_VOLENV; d->insname = DupStr (ih.name, 26, 0); d->nnatype = ih.nna; if (mh->cwt < 0x200) { d->volfade = ih.fadeout << 6; if (ih.dnc) { d->dct = DCT_NOTE; d->dca = DCA_CUT; } if (ih.volflg & 1) d->volflg |= EF_ON; if (ih.volflg & 2) d->volflg |= EF_LOOP; if (ih.volflg & 4) d->volflg |= EF_SUSTAIN; /* XM conversion of IT envelope Array */ d->volbeg = ih.volbeg; d->volend = ih.volend; d->volsusbeg = ih.volsusbeg; d->volsusend = ih.volsusend; if (ih.volflg & 1) { for (u = 0; u < ITENVCNT; u++) if (ih.oldvoltick[d->volpts] != 0xff) { d->volenv[d->volpts].val = (ih.volnode[d->volpts] << 2); d->volenv[d->volpts].pos = ih.oldvoltick[d->volpts]; d->volpts++; } else break; } } else { d->panning = ((ih.chanpan & 127) == 64) ? 255 : (ih.chanpan & 127) << 2; if (!(ih.chanpan & 128)) d->flags |= IF_OWNPAN; if (!(ih.ppsep & 128)) { d->pitpansep = ih.ppsep << 2; d->pitpancenter = ih.ppcenter; d->flags |= IF_PITCHPAN; } d->globvol = ih.globvol >> 1; d->volfade = ih.fadeout << 5; d->dct = ih.dct; d->dca = ih.dca; if (mh->cwt >= 0x204) { d->rvolvar = ih.rvolvar; d->rpanvar = ih.rpanvar; } #define IT_ProcessEnvelope(name) \ if(ih.name##flg&1) d->name##flg|=EF_ON; \ if(ih.name##flg&2) d->name##flg|=EF_LOOP; \ if(ih.name##flg&4) d->name##flg|=EF_SUSTAIN; \ d->name##pts=ih.name##pts; \ d->name##beg=ih.name##beg; \ d->name##end=ih.name##end; \ d->name##susbeg=ih.name##susbeg; \ d->name##susend=ih.name##susend; \ \ for(u=0;uname##env[u].pos=ih.name##tick[u]; \ \ if((d->name##flg&EF_ON)&&(d->name##pts<2)) \ d->name##flg&=~EF_ON; IT_ProcessEnvelope (vol); for (u = 0; u < ih.volpts; u++) d->volenv[u].val = (ih.volnode[u] << 2); IT_ProcessEnvelope (pan); for (u = 0; u < ih.panpts; u++) d->panenv[u].val = ih.pannode[u] == 32 ? 255 : (ih.pannode[u] + 32) << 2; IT_ProcessEnvelope (pit); for (u = 0; u < ih.pitpts; u++) d->pitenv[u].val = ih.pitnode[u] + 32; #undef IT_ProcessEnvelope if (ih.pitflg & 0x80) { /* filter envelopes not supported yet */ d->pitflg &= ~EF_ON; ih.pitpts = ih.pitbeg = ih.pitend = 0; #ifdef MIKMOD_DEBUG { static int warn = 0; if (!warn) fputs ("\rFilter envelopes not supported yet\n", stderr); warn = 1; } #endif } d->volpts = ih.volpts; d->volbeg = ih.volbeg; d->volend = ih.volend; d->volsusbeg = ih.volsusbeg; d->volsusend = ih.volsusend; for (u = 0; u < ih.volpts; u++) { d->volenv[u].val = (ih.volnode[u] << 2); d->volenv[u].pos = ih.voltick[u]; } d->panpts = ih.panpts; d->panbeg = ih.panbeg; d->panend = ih.panend; d->pansusbeg = ih.pansusbeg; d->pansusend = ih.pansusend; for (u = 0; u < ih.panpts; u++) { d->panenv[u].val = ih.pannode[u] == 32 ? 255 : (ih.pannode[u] + 32) << 2; d->panenv[u].pos = ih.pantick[u]; } d->pitpts = ih.pitpts; d->pitbeg = ih.pitbeg; d->pitend = ih.pitend; d->pitsusbeg = ih.pitsusbeg; d->pitsusend = ih.pitsusend; for (u = 0; u < ih.pitpts; u++) { d->pitenv[u].val = ih.pitnode[u] + 32; d->pitenv[u].pos = ih.pittick[u]; } } for (u = 0; u < ITNOTECNT; u++) { d->samplenote[u] = (ih.samptable[u] & 255); d->samplenumber[u] = (ih.samptable[u] >> 8) ? ((ih.samptable[u] >> 8) - 1) : 0xffff; if (d->samplenumber[u] >= of.numsmp) d->samplenote[u] = 255; else if (of.flags & UF_LINEAR) { int note = (int) d->samplenote[u] + noteindex[d->samplenumber[u]]; d->samplenote[u] = (note < 0) ? 0 : (note > 255 ? 255 : note); } } d++; } } else if (of.flags & UF_LINEAR) { if (!AllocInstruments ()) return 0; d = of.instruments; of.flags |= UF_INST; for (t = 0; t < mh->smpnum; t++, d++) for (u = 0; u < ITNOTECNT; u++) { if (d->samplenumber[u] >= of.numsmp) d->samplenote[u] = 255; else { int note = (int) d->samplenote[u] + noteindex[d->samplenumber[u]]; d->samplenote[u] = (note < 0) ? 0 : (note > 255 ? 255 : note); } } } /* Figure out how many channels this song actually uses */ of.numchn = 0; memset (remap, -1, 64 * sizeof (UBYTE)); for (t = 0; t < of.numpat; t++) { UWORD packlen; /* seek to pattern position */ if (paraptr[mh->insnum + mh->smpnum + t]) { /* 0 -> empty 64 row pattern */ _mm_fseek (modreader, ((long) paraptr[mh->insnum + mh->smpnum + t]), SEEK_SET); _mm_read_I_UWORD (modreader); /* read pattern length (# of rows) Impulse Tracker never creates patterns with less than 32 rows, but some other trackers do, so we only check for more than 256 rows */ packlen = _mm_read_I_UWORD (modreader); if (packlen > 256) { _mm_errno = MMERR_LOADING_PATTERN; return 0; } _mm_read_I_ULONG (modreader); if (IT_GetNumChannels (packlen)) return 0; } } /* give each of them a different number */ for (t = 0; t < 64; t++) if (!remap[t]) remap[t] = of.numchn++; of.numtrk = of.numpat * of.numchn; if (of.numvoices) if (of.numvoices < of.numchn) of.numvoices = of.numchn; if (!AllocPatterns ()) return 0; if (!AllocTracks ()) return 0; for (t = 0; t < of.numpat; t++) { UWORD packlen; /* seek to pattern position */ if (!paraptr[mh->insnum + mh->smpnum + t]) { /* 0 -> empty 64 row pattern */ of.pattrows[t] = 64; for (u = 0; u < of.numchn; u++) { int k; UniReset (); for (k = 0; k < 64; k++) UniNewline (); of.tracks[numtrk++] = UniDup (); } } else { _mm_fseek (modreader, ((long) paraptr[mh->insnum + mh->smpnum + t]), SEEK_SET); packlen = _mm_read_I_UWORD (modreader); of.pattrows[t] = _mm_read_I_UWORD (modreader); _mm_read_I_ULONG (modreader); if (!IT_ReadPattern (of.pattrows[t])) return 0; } } return 1; } CHAR * IT_LoadTitle (void) { CHAR s[26]; _mm_fseek (modreader, 4, SEEK_SET); if (!_mm_read_UBYTES (s, 26, modreader)) return NULL; return (DupStr (s, 26, 0)); } /*========== Loader information */ MLOADER load_it = { NULL, "IT", "IT (Impulse Tracker)", IT_Init, IT_Test, IT_Load, IT_Cleanup, IT_LoadTitle }; /* ex:set ts=4: */ TiMidity++-2.13.2/libunimod/load_m15.c0100644004711200001440000003314007421005041016416 0ustar tamukiusers/* MikMod sound library (c) 1998, 1999 Miodrag Vallat and others - see file AUTHORS for complete list. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /*============================================================================== $Id: load_m15.c,v 1.29 1999/10/25 16:31:41 miod Exp $ 15 instrument MOD loader Also supports Ultimate Sound Tracker (old M15 format) ==============================================================================*/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include "unimod_priv.h" /*========== Module Structure */ typedef struct MSAMPINFO { CHAR samplename[23]; /* 22 in module, 23 in memory */ UWORD length; UBYTE finetune; UBYTE volume; UWORD reppos; UWORD replen; } MSAMPINFO; typedef struct MODULEHEADER { CHAR songname[21]; /* the songname.., 20 in module, 21 in memory */ MSAMPINFO samples[15]; /* all sampleinfo */ UBYTE songlength; /* number of patterns used */ UBYTE magic1; /* should be 127 */ UBYTE positions[128]; /* which pattern to play at pos */ } MODULEHEADER; typedef struct MODNOTE { UBYTE a, b, c, d; } MODNOTE; /*========== Loader variables */ static MODULEHEADER *mh = NULL; static MODNOTE *patbuf = NULL; static BOOL ust_loader = 0; /* if TRUE, load as an ust module. */ /* known file formats which can confuse the loader */ #define REJECT 2 static char *signatures[REJECT] = { "CAKEWALK", /* cakewalk midi files */ "SZDD" /* Microsoft compressed files */ }; static int siglen[REJECT] = {8, 4}; /*========== Loader code */ static BOOL LoadModuleHeader (MODULEHEADER * mh) { int t, u; _mm_read_string (mh->songname, 20, modreader); mh->songname[20] = 0; /* just in case */ /* sanity check : title should contain printable characters and a bunch of null chars */ for (t = 0; t < 20; t++) if ((mh->songname[t]) && (mh->songname[t] < 32)) return 0; for (t = 0; (mh->songname[t]) && (t < 20); t++); if (t < 20) for (; t < 20; t++) if (mh->songname[t]) return 0; for (t = 0; t < 15; t++) { MSAMPINFO *s = &mh->samples[t]; _mm_read_string (s->samplename, 22, modreader); s->samplename[22] = 0; /* just in case */ s->length = _mm_read_M_UWORD (modreader); s->finetune = _mm_read_UBYTE (modreader); s->volume = _mm_read_UBYTE (modreader); s->reppos = _mm_read_M_UWORD (modreader); s->replen = _mm_read_M_UWORD (modreader); /* sanity check : sample title should contain printable characters and a bunch of null chars */ for (u = 0; u < 20; u++) if ((s->samplename[u]) && (s->samplename[u] < /*32 */ 14)) return 0; for (u = 0; (s->samplename[u]) && (u < 20); u++); if (u < 20) for (; u < 20; u++) if (s->samplename[u]) return 0; /* sanity check : finetune values */ if (s->finetune >> 4) return 0; } mh->songlength = _mm_read_UBYTE (modreader); mh->magic1 = _mm_read_UBYTE (modreader); /* should be 127 */ /* sanity check : no more than 128 positions, restart position in range */ if ((!mh->songlength) || (mh->songlength > 128)) return 0; /* values encountered so far are 0x6a and 0x78 */ if (((mh->magic1 & 0xf8) != 0x78) && (mh->magic1 != 0x6a) && (mh->magic1 > mh->songlength)) return 0; _mm_read_UBYTES (mh->positions, 128, modreader); /* sanity check : pattern range is 0..63 */ for (t = 0; t < 128; t++) if (mh->positions[t] > 63) return 0; return (!_mm_eof (modreader)); } /* Checks the patterns in the modfile for UST / 15-inst indications. For example, if an effect 3xx is found, it is assumed that the song is 15-inst. If a 1xx effect has dat greater than 0x20, it is UST. Returns: 0 indecisive; 1 = UST; 2 = 15-inst */ static int CheckPatternType (int numpat) { int t; UBYTE eff, dat; for (t = 0; t < numpat * (64U * 4); t++) { /* Load the pattern into the temp buffer and scan it */ _mm_read_UBYTE (modreader); _mm_read_UBYTE (modreader); eff = _mm_read_UBYTE (modreader); dat = _mm_read_UBYTE (modreader); switch (eff) { case 1: if (dat > 0x1f) return 1; if (dat < 0x3) return 2; break; case 2: if (dat > 0x1f) return 1; return 2; case 3: if (dat) return 2; break; default: return 2; } } return 0; } static BOOL M15_Test (void) { int t, numpat; MODULEHEADER mh; ust_loader = 0; if (!LoadModuleHeader (&mh)) return 0; /* reject other file types */ for (t = 0; t < REJECT; t++) if (!memcmp (mh.songname, signatures[t], siglen[t])) return 0; if (mh.magic1 > 127) return 0; if ((!mh.songlength) || (mh.songlength > mh.magic1)) return 0; for (t = 0; t < 15; t++) { /* all finetunes should be zero */ if (mh.samples[t].finetune) return 0; /* all volumes should be <= 64 */ if (mh.samples[t].volume > 64) return 0; /* all instrument names should begin with s, st-, or a number */ if (mh.samples[t].samplename[0] == 's') { if ((memcmp (mh.samples[t].samplename, "st-", 3)) && (memcmp (mh.samples[t].samplename, "ST-", 3)) && (*mh.samples[t].samplename)) ust_loader = 1; } else if ((mh.samples[t].samplename[0] < '0') || (mh.samples[t].samplename[0] > '9')) ust_loader = 1; if (mh.samples[t].length > 4999 || mh.samples[t].reppos > 9999) { ust_loader = 0; if (mh.samples[t].length > 32768) return 0; } /* if loop information is incorrect as words, but correct as bytes, this is likely to be an ust-style module */ if((mh.samples[t].reppos + mh.samples[t].replen > mh.samples[t].length) && (mh.samples[t].reppos + mh.samples[t].replen < (mh.samples[t].length << 1))) { ust_loader = 1; return 1; } } for (numpat = 0, t = 0; t < mh.songlength; t++) if (mh.positions[t] > numpat) numpat = mh.positions[t]; numpat++; switch (CheckPatternType (numpat)) { case 0: /* indecisive, so check more clues... */ break; case 1: ust_loader = 1; break; case 2: ust_loader = 0; break; } return 1; } static BOOL M15_Init (void) { if (!(mh = (MODULEHEADER *) _mm_malloc (sizeof (MODULEHEADER)))) return 0; return 1; } static void M15_Cleanup (void) { _mm_free (mh); _mm_free (patbuf); } /* Old (amiga) noteinfo: _____byte 1_____ byte2_ _____byte 3_____ byte4_ / \ / \ / \ / \ 0000 0000-00000000 0000 0000-00000000 Upper four 12 bits for Lower four Effect command. bits of sam- note period. bits of sam- ple number. ple number. */ static UWORD npertab[7 * OCTAVE] = { /* -> Tuning 0 */ 1712, 1616, 1524, 1440, 1356, 1280, 1208, 1140, 1076, 1016, 960, 906, 856, 808, 762, 720, 678, 640, 604, 570, 538, 508, 480, 453, 428, 404, 381, 360, 339, 320, 302, 285, 269, 254, 240, 226, 214, 202, 190, 180, 170, 160, 151, 143, 135, 127, 120, 113, 107, 101, 95, 90, 85, 80, 75, 71, 67, 63, 60, 56, 53, 50, 47, 45, 42, 40, 37, 35, 33, 31, 30, 28, 27, 25, 24, 22, 21, 20, 19, 18, 17, 16, 15, 14 }; static void M15_ConvertNote (MODNOTE * n) { UBYTE instrument, effect, effdat, note; UWORD period; UBYTE lastnote = 0; /* decode the 4 bytes that make up a single note */ instrument = n->c >> 4; period = (((UWORD) n->a & 0xf) << 8) + n->b; effect = n->c & 0xf; effdat = n->d; /* Convert the period to a note number */ note = 0; if (period) { for (note = 0; note < 7 * OCTAVE; note++) if (period >= npertab[note]) break; if (note == 7 * OCTAVE) note = 0; else note++; } if (instrument) { /* if instrument does not exist, note cut */ if ((instrument > 15) || (!mh->samples[instrument - 1].length)) { UniPTEffect (0xc, 0); if (effect == 0xc) effect = effdat = 0; } else { /* if we had a note, then change instrument... */ if (note) UniInstrument (instrument - 1); /* ...otherwise, only adjust volume... */ else { /* ...unless an effect was specified, which forces a new note to be played */ if (effect || effdat) { UniInstrument (instrument - 1); note = lastnote; } else UniPTEffect (0xc, mh->samples[instrument - 1].volume & 0x7f); } } } if (note) { UniNote (note + 2 * OCTAVE - 1); lastnote = note; } /* Handle ``heavy'' volumes correctly */ if ((effect == 0xc) && (effdat > 0x40)) effdat = 0x40; /* Convert pattern jump from Dec to Hex */ if (effect == 0xd) effdat = (((effdat & 0xf0) >> 4) * 10) + (effdat & 0xf); /* Volume slide, up has priority */ if ((effect == 0xa) && (effdat & 0xf) && (effdat & 0xf0)) effdat &= 0xf0; if (ust_loader) { switch (effect) { case 0: case 3: break; case 1: UniPTEffect (0, effdat); break; case 2: if (effdat & 0xf) UniPTEffect (1, effdat & 0xf); if (effdat >> 2) UniPTEffect (2, effdat >> 2); break; default: UniPTEffect (effect, effdat); break; } } else { /* Ignore 100, 200 and 300 (there is no porta memory in mod files) */ if ((!effdat) && ((effect == 1)||(effect == 2)||(effect == 3))) effect = 0; UniPTEffect (effect, effdat); } } static UBYTE * M15_ConvertTrack (MODNOTE * n) { int t; UniReset (); for (t = 0; t < 64; t++) { M15_ConvertNote (n); UniNewline (); n += 4; } return UniDup (); } /* Loads all patterns of a modfile and converts them into the 3 byte format. */ static BOOL M15_LoadPatterns (void) { int t, s, tracks = 0; if (!AllocPatterns ()) return 0; if (!AllocTracks ()) return 0; /* Allocate temporary buffer for loading and converting the patterns */ if (!(patbuf = (MODNOTE *) _mm_calloc (64U * 4, sizeof (MODNOTE)))) return 0; for (t = 0; t < of.numpat; t++) { /* Load the pattern into the temp buffer and convert it */ for (s = 0; s < (64U * 4); s++) { patbuf[s].a = _mm_read_UBYTE (modreader); patbuf[s].b = _mm_read_UBYTE (modreader); patbuf[s].c = _mm_read_UBYTE (modreader); patbuf[s].d = _mm_read_UBYTE (modreader); } for (s = 0; s < 4; s++) if (!(of.tracks[tracks++] = M15_ConvertTrack (patbuf + s))) return 0; } return 1; } static BOOL M15_Load (BOOL curious) { int t, scan; SAMPLE *q; MSAMPINFO *s; /* try to read module header */ if (!LoadModuleHeader (mh)) { _mm_errno = MMERR_LOADING_HEADER; return 0; } if (ust_loader) of.modtype = strdup ("Ultimate Soundtracker"); else of.modtype = strdup ("Soundtracker"); /* set module variables */ of.initspeed = 6; of.inittempo = 125; of.numchn = 4; of.songname = DupStr (mh->songname, 21, 1); of.numpos = mh->songlength; of.reppos = 0; /* Count the number of patterns */ of.numpat = 0; for (t = 0; t < of.numpos; t++) if (mh->positions[t] > of.numpat) of.numpat = mh->positions[t]; /* since some old modules embed extra patterns, we have to check the whole list to get the samples' file offsets right - however we can find garbage here, so check carefully */ scan = 1; for (t = of.numpos; t < 128; t++) if (mh->positions[t] >= 0x80) scan = 0; if (scan) for (t = of.numpos; t < 128; t++) { if (mh->positions[t] > of.numpat) of.numpat = mh->positions[t]; if ((curious) && (mh->positions[t])) of.numpos = t + 1; } of.numpat++; of.numtrk = of.numpat * of.numchn; if (!AllocPositions (of.numpos)) return 0; for (t = 0; t < of.numpos; t++) of.positions[t] = mh->positions[t]; /* Finally, init the sampleinfo structures */ of.numins = of.numsmp = 15; if (!AllocSamples ()) return 0; s = mh->samples; q = of.samples; for (t = 0; t < of.numins; t++) { /* convert the samplename */ q->samplename = DupStr (s->samplename, 23, 1); /* init the sampleinfo variables and convert the size pointers */ q->speed = finetune[s->finetune & 0xf]; q->volume = s->volume; if (ust_loader) q->loopstart = s->reppos; else q->loopstart = s->reppos << 1; q->loopend = q->loopstart + (s->replen << 1); q->length = s->length << 1; q->flags = SF_SIGNED; if(ust_loader) q->flags |= SF_UST_LOOP; if(s->replen > 2) q->flags |= SF_LOOP; /* fix replen if repend>length */ if (q->loopend > q->length) q->loopend = q->length; s++; q++; } if (!M15_LoadPatterns ()) return 0; ust_loader = 0; return 1; } static CHAR * M15_LoadTitle (void) { CHAR s[21]; _mm_fseek (modreader, 0, SEEK_SET); if (!_mm_read_UBYTES (s, 20, modreader)) return NULL; s[20] = 0; /* just in case */ return (DupStr (s, 21, 1)); } /*========== Loader information */ MLOADER load_m15 = { NULL, "15-instrument module", "MOD (15 instruments)", M15_Init, M15_Test, M15_Load, M15_Cleanup, M15_LoadTitle }; /* ex:set ts=4: */ TiMidity++-2.13.2/libunimod/load_med.c0100644004711200001440000004363407421005041016572 0ustar tamukiusers/* MikMod sound library (c) 1998, 1999 Miodrag Vallat and others - see file AUTHORS for complete list. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /*============================================================================== $Id: load_med.c,v 1.27 1999/10/25 16:31:41 miod Exp $ Amiga MED module loader ==============================================================================*/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include "unimod_priv.h" /*========== Module information */ typedef struct MEDHEADER { ULONG id; ULONG modlen; ULONG pMEDSONG; /* struct MEDSONG *song; */ UWORD psecnum; /* for the player routine, MMD2 only */ UWORD pseq; /* " " " " */ ULONG pMEDBLOCKP; /* struct MMD0Block **blockarr; */ ULONG reserved1; ULONG ppMedInstrHdr; /* struct InstrHdr **smplarr; */ ULONG reserved2; ULONG pMEDEXP; /* struct MEDEXP *expdata; */ ULONG reserved3; UWORD pstate; /* some data for the player routine */ UWORD pblock; UWORD pline; UWORD pseqnum; SWORD actplayline; UBYTE counter; UBYTE extra_songs; /* number of songs - 1 */ } MEDHEADER; typedef struct MEDSAMPLE { UWORD rep, replen; /* offs: 0(s), 2(s) */ UBYTE midich; /* offs: 4(s) */ UBYTE midipreset; /* offs: 5(s) */ UBYTE svol; /* offs: 6(s) */ SBYTE strans; /* offs: 7(s) */ } MEDSAMPLE; typedef struct MEDSONG { MEDSAMPLE sample[63]; /* 63 * 8 bytes = 504 bytes */ UWORD numblocks; /* offs: 504 */ UWORD songlen; /* offs: 506 */ UBYTE playseq[256]; /* offs: 508 */ UWORD deftempo; /* offs: 764 */ SBYTE playtransp; /* offs: 766 */ UBYTE flags; /* offs: 767 */ UBYTE flags2; /* offs: 768 */ UBYTE tempo2; /* offs: 769 */ UBYTE trkvol[16]; /* offs: 770 */ UBYTE mastervol; /* offs: 786 */ UBYTE numsamples; /* offs: 787 */ } MEDSONG; typedef struct MEDEXP { ULONG nextmod; /* pointer to next module */ ULONG exp_smp; /* pointer to InstrExt array */ UWORD s_ext_entries; UWORD s_ext_entrsz; ULONG annotxt; /* pointer to annotation text */ ULONG annolen; ULONG iinfo; /* pointer to InstrInfo array */ UWORD i_ext_entries; UWORD i_ext_entrsz; ULONG jumpmask; ULONG rgbtable; ULONG channelsplit; ULONG n_info; ULONG songname; /* pointer to songname */ ULONG songnamelen; ULONG dumps; ULONG reserved2[7]; } MEDEXP; typedef struct MMD0NOTE { UBYTE a, b, c; } MMD0NOTE; typedef struct MMD1NOTE { UBYTE a, b, c, d; } MMD1NOTE; typedef struct MEDINSTHEADER { ULONG length; SWORD type; /* Followed by actual data */ } MEDINSTHEADER; typedef struct MEDINSTEXT { UBYTE hold; UBYTE decay; UBYTE suppress_midi_off; SBYTE finetune; } MEDINSTEXT; typedef struct MEDINSTINFO { UBYTE name[40]; } MEDINSTINFO; /*========== Loader variables */ #define MMD0_string 0x4D4D4430 #define MMD1_string 0x4D4D4431 static MEDHEADER *mh = NULL; static MEDSONG *ms = NULL; static MEDEXP *me = NULL; static ULONG *ba = NULL; static MMD0NOTE *mmd0pat = NULL; static MMD1NOTE *mmd1pat = NULL; static BOOL decimalvolumes; static BOOL bpmtempos; #define d0note(row,col) mmd0pat[((row)*(UWORD)of.numchn)+(col)] #define d1note(row,col) mmd1pat[((row)*(UWORD)of.numchn)+(col)] static CHAR MED_Version[] = "OctaMED (MMDx)"; /*========== Loader code */ BOOL MED_Test (void) { UBYTE id[4]; if (!_mm_read_UBYTES (id, 4, modreader)) return 0; if ((!memcmp (id, "MMD0", 4)) || (!memcmp (id, "MMD1", 4))) return 1; return 0; } BOOL MED_Init (void) { if (!(me = (MEDEXP *) _mm_malloc (sizeof (MEDEXP)))) return 0; if (!(mh = (MEDHEADER *) _mm_malloc (sizeof (MEDHEADER)))) return 0; if (!(ms = (MEDSONG *) _mm_malloc (sizeof (MEDSONG)))) return 0; return 1; } void MED_Cleanup (void) { _mm_free (me); _mm_free (mh); _mm_free (ms); _mm_free (ba); _mm_free (mmd0pat); _mm_free (mmd1pat); } static void EffectCvt (UBYTE eff, UBYTE dat) { switch (eff) { /* 0x0 0x1 0x2 0x3 0x4 PT effects */ case 0x5: /* PT vibrato with speed/depth nibbles swapped */ UniPTEffect (0x4, (dat >> 4) | ((dat & 0xf) << 4)); break; /* 0x6 0x7 not used */ case 0x6: case 0x7: break; case 0x8: /* midi hold/decay */ break; case 0x9: if (bpmtempos) { if (!dat) dat = of.initspeed; UniEffect (UNI_S3MEFFECTA, dat); } else { if (dat <= 0x20) { if (!dat) dat = of.initspeed; else dat /= 4; UniPTEffect (0xf, dat); } else UniEffect (UNI_MEDSPEED, ((UWORD) dat * 125) / (33 * 4)); } break; /* 0xa 0xb PT effects */ case 0xc: if (decimalvolumes) dat = (dat >> 4) * 10 + (dat & 0xf); UniPTEffect (0xc, dat); break; case 0xd: /* same as PT volslide */ UniPTEffect (0xa, dat); break; case 0xe: /* synth jmp - midi */ break; case 0xf: switch (dat) { case 0: /* patternbreak */ UniPTEffect (0xd, 0); break; case 0xf1: /* play note twice */ UniWriteByte (UNI_MEDEFFECTF1); break; case 0xf2: /* delay note */ UniWriteByte (UNI_MEDEFFECTF2); break; case 0xf3: /* play note three times */ UniWriteByte (UNI_MEDEFFECTF3); break; case 0xfe: /* stop playing */ UniPTEffect (0xb, of.numpat); break; case 0xff: /* note cut */ UniPTEffect (0xc, 0); break; default: if (dat <= 10) UniPTEffect (0xf, dat); else if (dat <= 240) { if (bpmtempos) UniPTEffect (0xf, (dat < 32) ? 32 : dat); else UniEffect (UNI_MEDSPEED, ((UWORD) dat * 125) / 33); } } break; default: /* all normal PT effects are handled here */ UniPTEffect (eff, dat); break; } } static UBYTE * MED_Convert1 (int count, int col) { int t; UBYTE inst, note, eff, dat; MMD1NOTE *n; UniReset (); for (t = 0; t < count; t++) { n = &d1note (t, col); note = n->a & 0x7f; inst = n->b & 0x3f; eff = n->c & 0xf; dat = n->d; if (inst) UniInstrument (inst - 1); if (note) UniNote (note + 3 * OCTAVE - 1); EffectCvt (eff, dat); UniNewline (); } return UniDup (); } static UBYTE * MED_Convert0 (int count, int col) { int t; UBYTE a, b, inst, note, eff, dat; MMD0NOTE *n; UniReset (); for (t = 0; t < count; t++) { n = &d0note (t, col); a = n->a; b = n->b; note = a & 0x3f; a >>= 6; a = ((a & 1) << 1) | (a >> 1); inst = (b >> 4) | (a << 4); eff = b & 0xf; dat = n->c; if (inst) UniInstrument (inst - 1); if (note) UniNote (note + 3 * OCTAVE - 1); EffectCvt (eff, dat); UniNewline (); } return UniDup (); } static BOOL LoadMMD0Patterns (void) { int t, row, col; UWORD numtracks, numlines, maxlines = 0, track = 0; MMD0NOTE *mmdp; /* first, scan patterns to see how many channels are used */ for (t = 0; t < of.numpat; t++) { _mm_fseek (modreader, ba[t], SEEK_SET); numtracks = _mm_read_UBYTE (modreader); numlines = _mm_read_UBYTE (modreader); if (numtracks > of.numchn) of.numchn = numtracks; if (numlines > maxlines) maxlines = numlines; } of.numtrk = of.numpat * of.numchn; if (!AllocTracks ()) return 0; if (!AllocPatterns ()) return 0; if (!(mmd0pat = (MMD0NOTE *) _mm_calloc (of.numchn * (maxlines + 1), sizeof (MMD0NOTE)))) return 0; /* second read: read and convert patterns */ for (t = 0; t < of.numpat; t++) { _mm_fseek (modreader, ba[t], SEEK_SET); numtracks = _mm_read_UBYTE (modreader); numlines = _mm_read_UBYTE (modreader); of.pattrows[t] = ++numlines; memset (mmdp = mmd0pat, 0, of.numchn * maxlines * sizeof (MMD0NOTE)); for (row = numlines; row; row--) { for (col = numtracks; col; col--, mmdp++) { mmdp->a = _mm_read_UBYTE (modreader); mmdp->b = _mm_read_UBYTE (modreader); mmdp->c = _mm_read_UBYTE (modreader); } } for (col = 0; col < of.numchn; col++) of.tracks[track++] = MED_Convert0 (numlines, col); } return 1; } static BOOL LoadMMD1Patterns (void) { int t, row, col; UWORD numtracks, numlines, maxlines = 0, track = 0; MMD1NOTE *mmdp; /* first, scan patterns to see how many channels are used */ for (t = 0; t < of.numpat; t++) { _mm_fseek (modreader, ba[t], SEEK_SET); numtracks = _mm_read_M_UWORD (modreader); numlines = _mm_read_M_UWORD (modreader); if (numtracks > of.numchn) of.numchn = numtracks; if (numlines > maxlines) maxlines = numlines; } of.numtrk = of.numpat * of.numchn; if (!AllocTracks ()) return 0; if (!AllocPatterns ()) return 0; if (!(mmd1pat = (MMD1NOTE *) _mm_calloc (of.numchn * (maxlines + 1), sizeof (MMD1NOTE)))) return 0; /* second read: really read and convert patterns */ for (t = 0; t < of.numpat; t++) { _mm_fseek (modreader, ba[t], SEEK_SET); numtracks = _mm_read_M_UWORD (modreader); numlines = _mm_read_M_UWORD (modreader); _mm_fseek (modreader, sizeof (ULONG), SEEK_CUR); of.pattrows[t] = ++numlines; memset (mmdp = mmd1pat, 0, of.numchn * maxlines * sizeof (MMD1NOTE)); for (row = numlines; row; row--) { for (col = numtracks; col; col--, mmdp++) { mmdp->a = _mm_read_UBYTE (modreader); mmdp->b = _mm_read_UBYTE (modreader); mmdp->c = _mm_read_UBYTE (modreader); mmdp->d = _mm_read_UBYTE (modreader); } } for (col = 0; col < of.numchn; col++) of.tracks[track++] = MED_Convert1 (numlines, col); } return 1; } BOOL MED_Load (BOOL curious) { int t; ULONG sa[64]; MEDINSTHEADER s; SAMPLE *q; MEDSAMPLE *mss; /* try to read module header */ mh->id = _mm_read_M_ULONG (modreader); mh->modlen = _mm_read_M_ULONG (modreader); mh->pMEDSONG = _mm_read_M_ULONG (modreader); mh->psecnum = _mm_read_M_UWORD (modreader); mh->pseq = _mm_read_M_UWORD (modreader); mh->pMEDBLOCKP = _mm_read_M_ULONG (modreader); mh->reserved1 = _mm_read_M_ULONG (modreader); mh->ppMedInstrHdr = _mm_read_M_ULONG (modreader); mh->reserved2 = _mm_read_M_ULONG (modreader); mh->pMEDEXP = _mm_read_M_ULONG (modreader); mh->reserved3 = _mm_read_M_ULONG (modreader); mh->pstate = _mm_read_M_UWORD (modreader); mh->pblock = _mm_read_M_UWORD (modreader); mh->pline = _mm_read_M_UWORD (modreader); mh->pseqnum = _mm_read_M_UWORD (modreader); mh->actplayline = _mm_read_M_SWORD (modreader); mh->counter = _mm_read_UBYTE (modreader); mh->extra_songs = _mm_read_UBYTE (modreader); /* Seek to MEDSONG struct */ _mm_fseek (modreader, mh->pMEDSONG, SEEK_SET); /* Load the MMD0 Song Header */ mss = ms->sample; /* load the sample data first */ for (t = 63; t; t--, mss++) { mss->rep = _mm_read_M_UWORD (modreader); mss->replen = _mm_read_M_UWORD (modreader); mss->midich = _mm_read_UBYTE (modreader); mss->midipreset = _mm_read_UBYTE (modreader); mss->svol = _mm_read_UBYTE (modreader); mss->strans = _mm_read_SBYTE (modreader); } ms->numblocks = _mm_read_M_UWORD (modreader); ms->songlen = _mm_read_M_UWORD (modreader); _mm_read_UBYTES (ms->playseq, 256, modreader); ms->deftempo = _mm_read_M_UWORD (modreader); ms->playtransp = _mm_read_SBYTE (modreader); ms->flags = _mm_read_UBYTE (modreader); ms->flags2 = _mm_read_UBYTE (modreader); ms->tempo2 = _mm_read_UBYTE (modreader); _mm_read_UBYTES (ms->trkvol, 16, modreader); ms->mastervol = _mm_read_UBYTE (modreader); ms->numsamples = _mm_read_UBYTE (modreader); /* check for a bad header */ if (_mm_eof (modreader)) { _mm_errno = MMERR_LOADING_HEADER; return 0; } /* load extension structure */ if (mh->pMEDEXP) { _mm_fseek (modreader, mh->pMEDEXP, SEEK_SET); me->nextmod = _mm_read_M_ULONG (modreader); me->exp_smp = _mm_read_M_ULONG (modreader); me->s_ext_entries = _mm_read_M_UWORD (modreader); me->s_ext_entrsz = _mm_read_M_UWORD (modreader); me->annotxt = _mm_read_M_ULONG (modreader); me->annolen = _mm_read_M_ULONG (modreader); me->iinfo = _mm_read_M_ULONG (modreader); me->i_ext_entries = _mm_read_M_UWORD (modreader); me->i_ext_entrsz = _mm_read_M_UWORD (modreader); me->jumpmask = _mm_read_M_ULONG (modreader); me->rgbtable = _mm_read_M_ULONG (modreader); me->channelsplit = _mm_read_M_ULONG (modreader); me->n_info = _mm_read_M_ULONG (modreader); me->songname = _mm_read_M_ULONG (modreader); me->songnamelen = _mm_read_M_ULONG (modreader); me->dumps = _mm_read_M_ULONG (modreader); } /* seek to and read the samplepointer array */ _mm_fseek (modreader, mh->ppMedInstrHdr, SEEK_SET); if (!_mm_read_M_ULONGS (sa, ms->numsamples, modreader)) { _mm_errno = MMERR_LOADING_HEADER; return 0; } /* alloc and read the blockpointer array */ if (!(ba = (ULONG *) _mm_calloc (ms->numblocks, sizeof (ULONG)))) return 0; _mm_fseek (modreader, mh->pMEDBLOCKP, SEEK_SET); if (!_mm_read_M_ULONGS (ba, ms->numblocks, modreader)) { _mm_errno = MMERR_LOADING_HEADER; return 0; } /* copy song positions */ if (!AllocPositions (ms->songlen)) return 0; for (t = 0; t < ms->songlen; t++) of.positions[t] = ms->playseq[t]; decimalvolumes = (ms->flags & 0x10) ? 0 : 1; bpmtempos = (ms->flags2 & 0x20) ? 1 : 0; if (bpmtempos) { int bpmlen = (ms->flags2 & 0x1f) + 1; of.initspeed = ms->tempo2; of.inittempo = ms->deftempo * bpmlen / 4; if (bpmlen != 4) { /* Let's do some math : compute GCD of BPM beat length and speed */ int a, b; a = bpmlen; b = ms->tempo2; if (a > b) { t = b; b = a; a = t; } while ((a != b) && (a)) { t = a; a = b - a; b = t; if (a > b) { t = b; b = a; a = t; } } of.initspeed /= b; of.inittempo = ms->deftempo * bpmlen / (4 * b); } } else { of.initspeed = ms->tempo2; of.inittempo = ms->deftempo ? ((UWORD) ms->deftempo * 125) / 33 : 128; if ((ms->deftempo <= 10) && (ms->deftempo)) of.inittempo = (of.inittempo * 33) / 6; of.flags |= UF_HIGHBPM; } MED_Version[12] = mh->id; of.modtype = strdup (MED_Version); of.numchn = 0; /* will be counted later */ of.numpat = ms->numblocks; of.numpos = ms->songlen; of.numins = ms->numsamples; of.numsmp = of.numins; of.reppos = 0; if ((mh->pMEDEXP) && (me->songname) && (me->songnamelen)) { char *name; _mm_fseek (modreader, me->songname, SEEK_SET); name = _mm_malloc (me->songnamelen); _mm_read_UBYTES (name, me->songnamelen, modreader); of.songname = DupStr (name, me->songnamelen, 1); free (name); } else of.songname = DupStr (NULL, 0, 0); if ((mh->pMEDEXP) && (me->annotxt) && (me->annolen)) { _mm_fseek (modreader, me->annotxt, SEEK_SET); ReadComment (me->annolen); } if (!AllocSamples ()) return 0; q = of.samples; for (t = 0; t < of.numins; t++) { q->flags = SF_SIGNED; q->volume = 64; if (sa[t]) { _mm_fseek (modreader, sa[t], SEEK_SET); s.length = _mm_read_M_ULONG (modreader); s.type = _mm_read_M_SWORD (modreader); if (s.type) { #ifdef MIKMOD_DEBUG fputs ("\rNon-sample instruments not supported in MED loader yet\n", stderr); #endif if (!curious) { _mm_errno = MMERR_MED_SYNTHSAMPLES; return 0; } s.length = 0; } if (_mm_eof (modreader)) { _mm_errno = MMERR_LOADING_SAMPLEINFO; return 0; } q->length = s.length; q->seekpos = _mm_ftell (modreader); q->loopstart = ms->sample[t].rep << 1; q->loopend = q->loopstart + (ms->sample[t].replen << 1); if (ms->sample[t].replen > 1) q->flags |= SF_LOOP; /* don't load sample if length>='MMD0'... such kluges make libmikmod's code unique !!! */ if (q->length >= MMD0_string) q->length = 0; } else q->length = 0; if ((mh->pMEDEXP) && (me->exp_smp) && (t < me->s_ext_entries) && (me->s_ext_entrsz >= 4)) { MEDINSTEXT ie; _mm_fseek (modreader, me->exp_smp + t * me->s_ext_entrsz, SEEK_SET); ie.hold = _mm_read_UBYTE (modreader); ie.decay = _mm_read_UBYTE (modreader); ie.suppress_midi_off = _mm_read_UBYTE (modreader); ie.finetune = _mm_read_SBYTE (modreader); q->speed = finetune[ie.finetune & 0xf]; } else q->speed = 8363; if ((mh->pMEDEXP) && (me->iinfo) && (t < me->i_ext_entries) && (me->i_ext_entrsz >= 40)) { MEDINSTINFO ii; _mm_fseek (modreader, me->iinfo + t * me->i_ext_entrsz, SEEK_SET); _mm_read_UBYTES (ii.name, 40, modreader); q->samplename = DupStr ((CHAR *) ii.name, 40, 1); } else q->samplename = NULL; q++; } if (mh->id == MMD0_string) { if (!LoadMMD0Patterns ()) { _mm_errno = MMERR_LOADING_PATTERN; return 0; } } else if (mh->id == MMD1_string) { if (!LoadMMD1Patterns ()) { _mm_errno = MMERR_LOADING_PATTERN; return 0; } } else { _mm_errno = MMERR_NOT_A_MODULE; return 0; } return 1; } /*========== Loader information */ MLOADER load_med = { NULL, "MED", "MED (OctaMED)", MED_Init, MED_Test, MED_Load, MED_Cleanup, NULL }; /* ex:set ts=4: */ TiMidity++-2.13.2/libunimod/load_mod.c0100644004711200001440000002751310054364356016617 0ustar tamukiusers/* MikMod sound library (c) 1998, 1999 Miodrag Vallat and others - see file AUTHORS for complete list. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /*============================================================================== $Id: load_mod.c,v 1.28 1999/10/25 16:31:41 miod Exp $ Generic MOD loader (Protracker, StarTracker, FastTracker, etc) ==============================================================================*/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include "unimod_priv.h" /*========== Module structure */ typedef struct MSAMPINFO { CHAR samplename[23]; /* 22 in module, 23 in memory */ UWORD length; UBYTE finetune; UBYTE volume; UWORD reppos; UWORD replen; } MSAMPINFO; typedef struct MODULEHEADER { CHAR songname[21]; /* the songname.. 20 in module, 21 in memory */ MSAMPINFO samples[31]; /* all sampleinfo */ UBYTE songlength; /* number of patterns used */ UBYTE magic1; /* should be 127 */ UBYTE positions[128]; /* which pattern to play at pos */ UBYTE magic2[4]; /* string "M.K." or "FLT4" or "FLT8" */ } MODULEHEADER; typedef struct MODTYPE { CHAR id[5]; UBYTE channels; CHAR *name; } MODTYPE; typedef struct MODNOTE { UBYTE a, b, c, d; } MODNOTE; /*========== Loader variables */ #define MODULEHEADERSIZE 1084 static CHAR protracker[] = "Protracker"; static CHAR startracker[] = "Startracker"; static CHAR fasttracker[] = "Fasttracker"; static CHAR ins15tracker[] = "15-instrument"; static CHAR oktalyzer[] = "Oktalyzer"; static CHAR taketracker[] = "TakeTracker"; static CHAR orpheus[] = "Imago Orpheus (MOD format)"; #define MODTYPE_COUNT 24 static MODTYPE modtypes[MODTYPE_COUNT + 1] = { {"M.K.", 4, protracker}, /* protracker 4 channel */ {"M!K!", 4, protracker}, /* protracker 4 channel */ {"FLT4", 4, startracker}, /* startracker 4 channel */ {"2CHN", 2, fasttracker}, /* fasttracker 2 channel */ {"4CHN", 4, fasttracker}, /* fasttracker 4 channel */ {"6CHN", 6, fasttracker}, /* fasttracker 6 channel */ {"8CHN", 8, fasttracker}, /* fasttracker 8 channel */ {"10CH", 10, fasttracker}, /* fasttracker 10 channel */ {"12CH", 12, fasttracker}, /* fasttracker 12 channel */ {"14CH", 14, fasttracker}, /* fasttracker 14 channel */ {"15CH", 15, fasttracker}, /* fasttracker 15 channel */ {"16CH", 16, fasttracker}, /* fasttracker 16 channel */ {"18CH", 18, fasttracker}, /* fasttracker 18 channel */ {"20CH", 20, fasttracker}, /* fasttracker 20 channel */ {"22CH", 22, fasttracker}, /* fasttracker 22 channel */ {"24CH", 24, fasttracker}, /* fasttracker 24 channel */ {"26CH", 26, fasttracker}, /* fasttracker 26 channel */ {"28CH", 28, fasttracker}, /* fasttracker 28 channel */ {"30CH", 30, fasttracker}, /* fasttracker 30 channel */ {"32CH", 32, fasttracker}, /* fasttracker 32 channel */ {"CD81", 8, oktalyzer}, /* atari oktalyzer 8 channel */ {"OKTA", 8, oktalyzer}, /* atari oktalyzer 8 channel */ {"16CN", 16, taketracker}, /* taketracker 16 channel */ {"32CN", 32, taketracker}, /* taketracker 32 channel */ {" ", 4, ins15tracker} /* 15-instrument 4 channel */ }; static MODULEHEADER *mh = NULL; static MODNOTE *patbuf = NULL; static int modtype = 0; /*========== Loader code */ static BOOL MOD_Test (void) { UBYTE id[4]; _mm_fseek (modreader, MODULEHEADERSIZE - 4, SEEK_SET); if (!_mm_read_UBYTES (id, 4, modreader)) return 0; /* find out which ID string */ for (modtype = 0; modtype < MODTYPE_COUNT; modtype++) if (!memcmp (id, modtypes[modtype].id, 4)) return 1; return 0; } static BOOL MOD_Init (void) { if (!(mh = (MODULEHEADER *) _mm_malloc (sizeof (MODULEHEADER)))) return 0; return 1; } static void MOD_Cleanup (void) { _mm_free (mh); _mm_free (patbuf); } /* Old (amiga) noteinfo: _____byte 1_____ byte2_ _____byte 3_____ byte4_ / \ / \ / \ / \ 0000 0000-00000000 0000 0000-00000000 Upper four 12 bits for Lower four Effect command. bits of sam- note period. bits of sam- ple number. ple number. */ static UWORD npertab[7 * OCTAVE] = { /* -> Tuning 0 */ 1712, 1616, 1524, 1440, 1356, 1280, 1208, 1140, 1076, 1016, 960, 906, 856, 808, 762, 720, 678, 640, 604, 570, 538, 508, 480, 453, 428, 404, 381, 360, 339, 320, 302, 285, 269, 254, 240, 226, 214, 202, 190, 180, 170, 160, 151, 143, 135, 127, 120, 113, 107, 101, 95, 90, 85, 80, 75, 71, 67, 63, 60, 56, 53, 50, 47, 45, 42, 40, 37, 35, 33, 31, 30, 28, 27, 25, 24, 22, 21, 20, 19, 18, 17, 16, 15, 14 }; static void ConvertNote (MODNOTE * n) { UBYTE instrument, effect, effdat, note; UWORD period; UBYTE lastnote = 0; /* extract the various information from the 4 bytes that make up a note */ instrument = (n->a & 0x10) | (n->c >> 4); period = (((UWORD) n->a & 0xf) << 8) + n->b; effect = n->c & 0xf; effdat = n->d; /* Convert the period to a note number */ note = 0; if (period) { for (note = 0; note < 7 * OCTAVE; note++) if (period >= npertab[note]) break; if (note == 7 * OCTAVE) note = 0; else note++; } if (instrument) { /* if instrument does not exist, note cut */ if ((instrument > 31) || (!mh->samples[instrument - 1].length)) { UniPTEffect (0xc, 0); if (effect == 0xc) effect = effdat = 0; } else { /* Protracker handling */ if (modtype <= 2) { /* if we had a note, then change instrument... */ if (note) UniInstrument (instrument - 1); /* ...otherwise, only adjust volume... */ else { /* ...unless an effect was specified, which forces a new note to be played */ if (effect || effdat) { UniInstrument (instrument - 1); note = lastnote; } else UniPTEffect (0xc, mh->samples[instrument - 1].volume & 0x7f); } } else { /* Fasttracker handling */ UniInstrument (instrument - 1); if (!note) note = lastnote; } } } if (note) { UniNote (note + 2 * OCTAVE - 1); lastnote = note; } /* Convert pattern jump from Dec to Hex */ if (effect == 0xd) effdat = (((effdat & 0xf0) >> 4) * 10) + (effdat & 0xf); /* Volume slide, up has priority */ if ((effect == 0xa) && (effdat & 0xf) && (effdat & 0xf0)) effdat &= 0xf0; /* Handle ``heavy'' volumes correctly */ if ((effect == 0xc) && (effdat > 0x40)) effdat = 0x40; /* Ignore 100, 200 and 300 (there is no porta memory in mod files) */ #if 0 /* space_debris.mod uses 300 and porta memory!! */ if ((!effdat) && ((effect == 1)||(effect == 2)||(effect ==3))) effect = 0; #endif UniPTEffect (effect, effdat); } static UBYTE * ConvertTrack (MODNOTE * n) { int t; UniReset (); for (t = 0; t < 64; t++) { ConvertNote (n); UniNewline (); n += of.numchn; } return UniDup (); } /* Loads all patterns of a modfile and converts them into the 3 byte format. */ static BOOL ML_LoadPatterns (void) { int t, s, tracks = 0; if (!AllocPatterns ()) return 0; if (!AllocTracks ()) return 0; /* Allocate temporary buffer for loading and converting the patterns */ if (!(patbuf = (MODNOTE *) _mm_calloc (64U * of.numchn, sizeof (MODNOTE)))) return 0; for (t = 0; t < of.numpat; t++) { /* Load the pattern into the temp buffer and convert it */ for (s = 0; s < (64U * of.numchn); s++) { patbuf[s].a = _mm_read_UBYTE (modreader); patbuf[s].b = _mm_read_UBYTE (modreader); patbuf[s].c = _mm_read_UBYTE (modreader); patbuf[s].d = _mm_read_UBYTE (modreader); } for (s = 0; s < of.numchn; s++) if (!(of.tracks[tracks++] = ConvertTrack (patbuf + s))) return 0; } return 1; } static BOOL MOD_Load (BOOL curious) { int t, scan; SAMPLE *q; MSAMPINFO *s; BOOL is_orpheus = 0; /* try to read module header */ _mm_read_string ((CHAR *) mh->songname, 20, modreader); mh->songname[20] = 0; /* just in case */ for (t = 0; t < 31; t++) { s = &mh->samples[t]; _mm_read_string (s->samplename, 22, modreader); s->samplename[22] = 0; /* just in case */ s->length = _mm_read_M_UWORD (modreader); s->finetune = _mm_read_UBYTE (modreader); s->volume = _mm_read_UBYTE (modreader); s->reppos = _mm_read_M_UWORD (modreader); s->replen = _mm_read_M_UWORD (modreader); } mh->songlength = _mm_read_UBYTE (modreader); mh->magic1 = _mm_read_UBYTE (modreader); _mm_read_UBYTES (mh->positions, 128, modreader); _mm_read_UBYTES (mh->magic2, 4, modreader); if (_mm_eof (modreader)) { _mm_errno = MMERR_LOADING_HEADER; return 0; } /* set module variables */ of.initspeed = 6; of.inittempo = 125; of.numchn = modtypes[modtype].channels; of.songname = DupStr (mh->songname, 21, 1); of.numpos = mh->songlength; of.reppos = 0; /* Count the number of patterns */ of.numpat = 0; for (t = 0; t < of.numpos; t++) if (mh->positions[t] > of.numpat) of.numpat = mh->positions[t]; /* since some old modules embed extra patterns, we have to check the whole list to get the samples' file offsets right - however we can find garbage here, so check carefully */ scan = 1; for (t = of.numpos; t < 128; t++) if (mh->positions[t] >= 0x80) scan = 0; if (scan) for (t = of.numpos; t < 128; t++) { if (mh->positions[t] > of.numpat) of.numpat = mh->positions[t]; if ((curious) && (mh->positions[t])) of.numpos = t + 1; } of.numpat++; of.numtrk = of.numpat * of.numchn; if (!AllocPositions (of.numpos)) return 0; for (t = 0; t < of.numpos; t++) of.positions[t] = mh->positions[t]; /* Finally, init the sampleinfo structures */ of.numins = of.numsmp = 31; if (!AllocSamples ()) return 0; s = mh->samples; q = of.samples; for (t = 0; t < of.numins; t++) { /* convert the samplename */ q->samplename = DupStr (s->samplename, 23, 1); /* init the sampleinfo variables and convert the size pointers */ q->speed = finetune[s->finetune & 0xf]; q->volume = s->volume & 0x7f; q->loopstart = (ULONG) s->reppos << 1; q->loopend = q->loopstart + ((ULONG) s->replen << 1); q->length = (ULONG) s->length << 1; q->flags = SF_SIGNED; /* Imago Orpheus creates MODs with 16 bit samples, check */ if ((modtypes[modtype].name == fasttracker) && (s->volume & 0x80)) { q->flags |= SF_16BITS; is_orpheus = 1; } if (s->replen > 1) q->flags |= SF_LOOP; /* fix replen if repend > length */ if (q->loopend > q->length) q->loopend = q->length; s++; q++; } if (is_orpheus) of.modtype = strdup (orpheus); else of.modtype = strdup (modtypes[modtype].name); if (!ML_LoadPatterns ()) return 0; return 1; } static CHAR * MOD_LoadTitle (void) { CHAR s[21]; _mm_fseek (modreader, 0, SEEK_SET); if (!_mm_read_UBYTES (s, 20, modreader)) return NULL; s[20] = 0; /* just in case */ return (DupStr (s, 21, 1)); } /*========== Loader information */ MLOADER load_mod = { NULL, "Standard module", "MOD (31 instruments)", MOD_Init, MOD_Test, MOD_Load, MOD_Cleanup, MOD_LoadTitle }; /* ex:set ts=4: */ TiMidity++-2.13.2/libunimod/load_mtm.c0100644004711200001440000001624307421005041016616 0ustar tamukiusers/* MikMod sound library (c) 1998, 1999 Miodrag Vallat and others - see file AUTHORS for complete list. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /*============================================================================== $Id: load_mtm.c,v 1.27 1999/10/25 16:31:41 miod Exp $ MTM module loader ==============================================================================*/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include "unimod_priv.h" /*========== Module structure */ typedef struct MTMHEADER { UBYTE id[3]; /* MTM file marker */ UBYTE version; /* upper major, lower nibble minor version number */ CHAR songname[20]; /* ASCIIZ songname */ UWORD numtracks; /* number of tracks saved */ UBYTE lastpattern; /* last pattern number saved */ UBYTE lastorder; /* last order number to play (songlength-1) */ UWORD commentsize; /* length of comment field */ UBYTE numsamples; /* number of samples saved */ UBYTE attribute; /* attribute byte (unused) */ UBYTE beatspertrack; UBYTE numchannels; /* number of channels used */ UBYTE panpos[32]; /* voice pan positions */ } MTMHEADER; typedef struct MTMSAMPLE { CHAR samplename[22]; ULONG length; ULONG reppos; ULONG repend; UBYTE finetune; UBYTE volume; UBYTE attribute; } MTMSAMPLE; typedef struct MTMNOTE { UBYTE a, b, c; } MTMNOTE; /*========== Loader variables */ static MTMHEADER *mh = NULL; static MTMNOTE *mtmtrk = NULL; static UWORD pat[32]; static CHAR MTM_Version[] = "MTM"; /*========== Loader code */ BOOL MTM_Test (void) { UBYTE id[3]; if (!_mm_read_UBYTES (id, 3, modreader)) return 0; if (!memcmp (id, "MTM", 3)) return 1; return 0; } BOOL MTM_Init (void) { if (!(mtmtrk = (MTMNOTE *) _mm_calloc (64, sizeof (MTMNOTE)))) return 0; if (!(mh = (MTMHEADER *) _mm_malloc (sizeof (MTMHEADER)))) return 0; return 1; } void MTM_Cleanup (void) { _mm_free (mtmtrk); _mm_free (mh); } static UBYTE * MTM_Convert (void) { int t; UBYTE a, b, inst, note, eff, dat; UniReset (); for (t = 0; t < 64; t++) { a = mtmtrk[t].a; b = mtmtrk[t].b; inst = ((a & 0x3) << 4) | (b >> 4); note = a >> 2; eff = b & 0xf; dat = mtmtrk[t].c; if (inst) UniInstrument (inst - 1); if (note) UniNote (note + 2 * OCTAVE); /* MTM bug workaround : when the effect is volslide, slide-up *always* overrides slide-down. */ if (eff == 0xa && (dat & 0xf0)) dat &= 0xf0; /* Convert pattern jump from Dec to Hex */ if (eff == 0xd) dat = (((dat & 0xf0) >> 4) * 10) + (dat & 0xf); UniPTEffect (eff, dat); UniNewline (); } return UniDup (); } BOOL MTM_Load (BOOL curious) { int t, u; MTMSAMPLE s; SAMPLE *q; /* try to read module header */ _mm_read_UBYTES (mh->id, 3, modreader); mh->version = _mm_read_UBYTE (modreader); _mm_read_string (mh->songname, 20, modreader); mh->numtracks = _mm_read_I_UWORD (modreader); mh->lastpattern = _mm_read_UBYTE (modreader); mh->lastorder = _mm_read_UBYTE (modreader); mh->commentsize = _mm_read_I_UWORD (modreader); mh->numsamples = _mm_read_UBYTE (modreader); mh->attribute = _mm_read_UBYTE (modreader); mh->beatspertrack = _mm_read_UBYTE (modreader); mh->numchannels = _mm_read_UBYTE (modreader); _mm_read_UBYTES (mh->panpos, 32, modreader); if (_mm_eof (modreader)) { _mm_errno = MMERR_LOADING_HEADER; return 0; } /* set module variables */ of.initspeed = 6; of.inittempo = 125; of.modtype = strdup (MTM_Version); of.numchn = mh->numchannels; of.numtrk = mh->numtracks + 1; /* get number of channels */ of.songname = DupStr (mh->songname, 20, 1); /* make a cstr of songname */ of.numpos = mh->lastorder + 1; /* copy the songlength */ of.numpat = mh->lastpattern + 1; of.reppos = 0; for (t = 0; t < 32; t++) of.panning[t] = mh->panpos[t] << 4; of.numins = of.numsmp = mh->numsamples; if (!AllocSamples ()) return 0; q = of.samples; for (t = 0; t < of.numins; t++) { /* try to read sample info */ _mm_read_string (s.samplename, 22, modreader); s.length = _mm_read_I_ULONG (modreader); s.reppos = _mm_read_I_ULONG (modreader); s.repend = _mm_read_I_ULONG (modreader); s.finetune = _mm_read_UBYTE (modreader); s.volume = _mm_read_UBYTE (modreader); s.attribute = _mm_read_UBYTE (modreader); if (_mm_eof (modreader)) { _mm_errno = MMERR_LOADING_SAMPLEINFO; return 0; } q->samplename = DupStr (s.samplename, 22, 1); q->seekpos = 0; q->speed = finetune[s.finetune]; q->length = s.length; q->loopstart = s.reppos; q->loopend = s.repend; q->volume = s.volume; if ((s.repend - s.reppos) > 2) q->flags |= SF_LOOP; if (s.attribute & 1) { /* If the sample is 16-bits, convert the length and replen byte-values into sample-values */ q->flags |= SF_16BITS; q->length >>= 1; q->loopstart >>= 1; q->loopend >>= 1; } q++; } if (!AllocPositions (of.numpos)) return 0; for (t = 0; t < of.numpos; t++) of.positions[t] = _mm_read_UBYTE (modreader); for (; t < 128; t++) _mm_read_UBYTE (modreader); if (_mm_eof (modreader)) { _mm_errno = MMERR_LOADING_HEADER; return 0; } if (!AllocTracks ()) return 0; if (!AllocPatterns ()) return 0; of.tracks[0] = MTM_Convert (); /* track 0 is empty */ for (t = 1; t < of.numtrk; t++) { int s; for (s = 0; s < 64; s++) { mtmtrk[s].a = _mm_read_UBYTE (modreader); mtmtrk[s].b = _mm_read_UBYTE (modreader); mtmtrk[s].c = _mm_read_UBYTE (modreader); } if (_mm_eof (modreader)) { _mm_errno = MMERR_LOADING_TRACK; return 0; } if (!(of.tracks[t] = MTM_Convert ())) return 0; } for (t = 0; t < of.numpat; t++) { _mm_read_I_UWORDS (pat, 32, modreader); for (u = 0; u < of.numchn; u++) of.patterns[((long) t * of.numchn) + u] = pat[u]; } /* read comment field */ if (mh->commentsize) if (!ReadLinedComment (mh->commentsize / 40, 40)) return 0; return 1; } CHAR * MTM_LoadTitle (void) { CHAR s[20]; _mm_fseek (modreader, 4, SEEK_SET); if (!_mm_read_UBYTES (s, 20, modreader)) return NULL; return (DupStr (s, 20, 1)); } /*========== Loader information */ MLOADER load_mtm = { NULL, "MTM", "MTM (MultiTracker Module editor)", MTM_Init, MTM_Test, MTM_Load, MTM_Cleanup, MTM_LoadTitle }; /* ex:set ts=4: */ TiMidity++-2.13.2/libunimod/load_okt.c0100644004711200001440000002375207421005041016621 0ustar tamukiusers/* MikMod sound library (c) 1999, 2000 Miodrag Vallat and others - see file AUTHORS for complete list. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /*============================================================================== $Id: load_okt.c,v 1.3 2000/02/14 22:10:22 miod Exp $ Oktalyzer (OKT) module loader ==============================================================================*/ /* Written by UFO based on the file description compiled by Harald Zappe */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #ifdef HAVE_UNISTD_H #include #endif #include #include #include "unimod_priv.h" /*========== Module blocks */ /* sample information */ typedef struct OKTSAMPLE { CHAR sampname[20]; ULONG len; UWORD loopbeg; UWORD looplen; UBYTE volume; } OKTSAMPLE; typedef struct OKTNOTE { UBYTE note, ins, eff, dat; } OKTNOTE; /*========== Loader variables */ static OKTNOTE *okttrk = NULL; /*========== Loader code */ BOOL OKT_Test(void) { CHAR id[8]; if (!_mm_read_UBYTES(id, 8, modreader)) return 0; if (!memcmp(id, "OKTASONG", 8)) return 1; return 0; } /* Pattern analysis routine. Effects not implemented (yet) : (in decimal) 11 Arpeggio 4: Change note every 50Hz tick between N,H,N,L 12 Arpeggio 5: Change note every 50Hz tick between H,H,N N = normal note being played in this channel (1-36) L = normal note number minus upper four bits of 'data'. H = normal note number plus lower four bits of 'data'. 13 Decrease note number by 'data' once per tick. 17 Increase note number by 'data' once per tick. 21 Decrease note number by 'data' once per line. 30 Increase note number by 'data' once per line. */ static UBYTE *OKT_ConvertTrack(UBYTE patrows) { int t; UBYTE ins, note, eff, dat; UniReset(); for (t = 0; t < patrows; t++) { note = okttrk[t].note; ins = okttrk[t].ins; eff = okttrk[t].eff; dat = okttrk[t].dat; if (note) { UniNote(note + 3*OCTAVE - 1); UniInstrument(ins); } if (eff) switch (eff) { case 1: /* Porta Up */ UniPTEffect(0x1, dat); break; case 2: /* Portamento Down */ UniPTEffect(0x2, dat); break; case 10: /* Arpeggio 3 supported */ UniPTEffect(0x0, dat); break; case 15: /* Amiga filter toggle, ignored */ break; case 25: /* Pattern Jump */ UniPTEffect(0xb, dat); break; case 27: /* Release - similar to Keyoff */ UniWriteByte(UNI_KEYOFF); break; case 28: /* Set Tempo */ UniPTEffect(0xf, dat); break; case 31: /* volume Control */ if (dat <= 0x40) UniPTEffect(0xc, dat); else if (dat <= 0x50) UniEffect(UNI_XMEFFECTA, (dat - 0x40)); /* fast fade out */ else if (dat <= 0x60) UniEffect(UNI_XMEFFECTA, (dat - 0x50) << 4); /* fast fade in */ else if (dat <= 0x70) UniEffect(UNI_XMEFFECTEB, (dat - 0x60)); /* slow fade out */ else if (dat <= 0x80) UniEffect(UNI_XMEFFECTEA, (dat - 0x70)); /* slow fade in */ break; #ifdef MIKMOD_DEBUG default: fprintf(stderr, "\rUnimplemented effect (%02d,%02x)\n", eff, dat); #endif } UniNewline(); } return UniDup(); } /* Read "channel modes" i.e. channel number and panning information */ static void OKT_doCMOD(void) { /* amiga channel panning table */ UBYTE amigapan[4] = { 0x00, 0xff, 0xff, 0x00 }; int t; of.numchn = 0; for (t = 0; t < 4; t++) if (_mm_read_M_UWORD(modreader)) { /* two channels tied to the same Amiga hardware voice */ of.panning[of.numchn++] = amigapan[t]; of.panning[of.numchn++] = amigapan[t]; } else /* one channel tied to the Amiga hardware voice */ of.panning[of.numchn++] = amigapan[t]; } /* Read sample information */ static BOOL OKT_doSAMP(int len) { int t; SAMPLE *q; OKTSAMPLE s; of.numins = of.numsmp = (len / 0x20); if (!AllocSamples()) return 0; for (t = 0, q = of.samples; t < of.numins; t++, q++) { _mm_read_UBYTES(s.sampname, 20, modreader); s.len = _mm_read_M_ULONG(modreader); s.loopbeg = _mm_read_M_UWORD(modreader); s.looplen = _mm_read_M_UWORD(modreader); _mm_read_UBYTE(modreader); s.volume = _mm_read_UBYTE(modreader); _mm_read_M_UWORD(modreader); if (_mm_eof(modreader)) { _mm_errno = MMERR_LOADING_SAMPLEINFO; return 0; } if (!s.len) q->seekpos = q->length = q->loopstart = q->loopend = q->flags = 0; else { s.len--; /* sanity checks */ if (s.loopbeg > s.len) s.loopbeg = s.len; if (s.loopbeg + s.looplen > s.len) s.looplen = s.len - s.loopbeg; if (s.looplen < 2) s.looplen = 0; q->length = s.len; q->loopstart = s.loopbeg; q->loopend = s.looplen + q->loopstart; q->volume = s.volume; q->flags = SF_SIGNED; if (s.looplen) q->flags |= SF_LOOP; } q->samplename = DupStr(s.sampname, 20, 1); q->speed = 8363; } return 1; } /* Read speed information */ static void OKT_doSPEE(void) { int tempo = _mm_read_M_UWORD(modreader); of.initspeed = tempo; } /* Read song length information */ static void OKT_doSLEN(void) { of.numpat = _mm_read_M_UWORD(modreader); } /* Read pattern length information */ static void OKT_doPLEN(void) { of.numpos = _mm_read_M_UWORD(modreader); } /* Read order table */ static BOOL OKT_doPATT(void) { int t; if (!of.numpos || !AllocPositions(of.numpos)) return 0; for (t = 0; t < 128; t++) if (t < of.numpos) of.positions[t] = (UWORD)_mm_read_UBYTE(modreader); else break; return 1; } static BOOL OKT_doPBOD(int patnum) { char *patbuf; int rows, i; int u; if (!patnum) { of.numtrk = of.numpat * of.numchn; if (!AllocTracks() || !AllocPatterns()) return 0; } /* Read pattern */ of.pattrows[patnum] = rows = _mm_read_M_UWORD(modreader); if (!(okttrk = (OKTNOTE *) _mm_calloc(rows, sizeof(OKTNOTE))) || !(patbuf = (char *)_mm_calloc(rows * of.numchn, sizeof(OKTNOTE)))) return 0; _mm_read_UBYTES(patbuf, rows * of.numchn * sizeof(OKTNOTE), modreader); if (_mm_eof(modreader)) { _mm_errno = MMERR_LOADING_PATTERN; return 0; } for (i = 0; i < of.numchn; i++) { for (u = 0; u < rows; u++) { okttrk[u].note = patbuf[(u * of.numchn + i) * sizeof(OKTNOTE)]; okttrk[u].ins = patbuf[(u * of.numchn + i) * sizeof(OKTNOTE) + 1]; okttrk[u].eff = patbuf[(u * of.numchn + i) * sizeof(OKTNOTE) + 2]; okttrk[u].dat = patbuf[(u * of.numchn + i) * sizeof(OKTNOTE) + 3]; } if (!(of.tracks[patnum * of.numchn + i] = OKT_ConvertTrack(rows))) return 0; } _mm_free(patbuf); _mm_free(okttrk); return 1; } static void OKT_doSBOD(int insnum) { of.samples[insnum].seekpos = _mm_ftell(modreader); } BOOL OKT_Load(BOOL curious) { UBYTE id[4]; ULONG len; ULONG fp; BOOL seen_cmod = 0, seen_samp = 0, seen_slen = 0, seen_plen = 0, seen_patt = 0, seen_spee = 0; int patnum = 0, insnum = 0; /* skip OKTALYZER header */ _mm_fseek(modreader, 8, SEEK_SET); of.songname = strdup(""); of.modtype = strdup("Amiga Oktalyzer"); of.numpos = of.reppos = 0; /* default values */ of.initspeed = 6; of.inittempo = 125; while (1) { /* read block header */ _mm_read_UBYTES(id, 4, modreader); len = _mm_read_M_ULONG(modreader); if (_mm_eof(modreader)) break; fp = _mm_ftell(modreader); if (!memcmp(id, "CMOD", 4)) { if (!seen_cmod) { OKT_doCMOD(); seen_cmod = 1; } else { _mm_errno = MMERR_LOADING_HEADER; return 0; } } else if (!memcmp(id, "SAMP", 4)) { if (!seen_samp && OKT_doSAMP(len)) seen_samp = 1; else { _mm_errno = MMERR_LOADING_HEADER; return 0; } } else if (!memcmp(id, "SPEE", 4)) { if (!seen_spee) { OKT_doSPEE(); seen_spee = 1; } else { _mm_errno = MMERR_LOADING_HEADER; return 0; } } else if (!memcmp(id, "SLEN", 4)) { if (!seen_slen) { OKT_doSLEN(); seen_slen = 1; } else { _mm_errno = MMERR_LOADING_HEADER; return 0; } } else if (!memcmp(id, "PLEN", 4)) { if (!seen_plen) { OKT_doPLEN(); seen_plen = 1; } else { _mm_errno = MMERR_LOADING_HEADER; return 0; } } else if (!memcmp(id, "PATT", 4)) { if (!seen_plen) { _mm_errno = MMERR_LOADING_HEADER; return 0; } if (!seen_patt && OKT_doPATT()) seen_patt = 1; else { _mm_errno = MMERR_LOADING_HEADER; return 0; } } else if (!memcmp(id,"PBOD", 4)) { /* need to know numpat and numchn */ if (!seen_slen || !seen_cmod || (patnum >= of.numpat)) { _mm_errno = MMERR_LOADING_HEADER; return 0; } if (!OKT_doPBOD(patnum++)) { _mm_errno = MMERR_LOADING_PATTERN; return 0; } } else if (!memcmp(id,"SBOD",4)) { /* need to know numsmp */ if (!seen_samp) { _mm_errno = MMERR_LOADING_HEADER; return 0; } while ((insnum < of.numins) && !of.samples[insnum].length) insnum++; if (insnum >= of.numins) { _mm_errno = MMERR_LOADING_HEADER; return 0; } OKT_doSBOD(insnum++); } /* goto next block start position */ _mm_fseek(modreader, fp + len, SEEK_SET); } if (!seen_cmod || !seen_samp || !seen_patt || !seen_slen || !seen_plen || (patnum != of.numpat)) { _mm_errno = MMERR_LOADING_HEADER; return 0; } return 1; } CHAR *OKT_LoadTitle(void) { return strdup(""); } /*========== Loader information */ MLOADER load_okt = { NULL, "OKT", "OKT (Amiga Oktalyzer)", NULL, OKT_Test, OKT_Load, NULL, OKT_LoadTitle }; /* ex:set ts=4: */ TiMidity++-2.13.2/libunimod/load_s3m.c0100644004711200001440000003057107421005041016523 0ustar tamukiusers/* MikMod sound library (c) 1998, 1999 Miodrag Vallat and others - see file AUTHORS for complete list. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /*============================================================================== $Id: load_s3m.c,v 1.32 1999/10/25 16:31:41 miod Exp $ Screamtracker (S3M) module loader ==============================================================================*/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include "unimod_priv.h" /*========== Module structure */ /* header */ typedef struct S3MHEADER { CHAR songname[28]; UBYTE t1a; UBYTE type; UBYTE unused1[2]; UWORD ordnum; UWORD insnum; UWORD patnum; UWORD flags; UWORD tracker; UWORD fileformat; CHAR scrm[4]; UBYTE mastervol; UBYTE initspeed; UBYTE inittempo; UBYTE mastermult; UBYTE ultraclick; UBYTE pantable; UBYTE unused2[8]; UWORD special; UBYTE channels[32]; } S3MHEADER; /* sample information */ typedef struct S3MSAMPLE { UBYTE type; CHAR filename[12]; UBYTE memsegh; UWORD memsegl; ULONG length; ULONG loopbeg; ULONG loopend; UBYTE volume; UBYTE dsk; UBYTE pack; UBYTE flags; ULONG c2spd; UBYTE unused[12]; CHAR sampname[28]; CHAR scrs[4]; } S3MSAMPLE; typedef struct S3MNOTE { UBYTE note, ins, vol, cmd, inf; } S3MNOTE; /*========== Loader variables */ static S3MNOTE *s3mbuf = NULL; /* pointer to a complete S3M pattern */ static S3MHEADER *mh = NULL; static UWORD *paraptr = NULL; /* parapointer array (see S3M docs) */ /* tracker identifiers */ #define NUMTRACKERS 4 static CHAR *S3M_Version[] = { "Screamtracker x.xx", "Imago Orpheus x.xx (S3M format)", "Impulse Tracker x.xx (S3M format)", "Unknown tracker x.xx (S3M format)", "Impulse Tracker 2.14p3 (S3M format)", "Impulse Tracker 2.14p4 (S3M format)" }; /* version number position in above array */ static int numeric[NUMTRACKERS] = {14, 14, 16, 16}; /*========== Loader code */ BOOL S3M_Test (void) { UBYTE id[4]; _mm_fseek (modreader, 0x2c, SEEK_SET); if (!_mm_read_UBYTES (id, 4, modreader)) return 0; if (!memcmp (id, "SCRM", 4)) return 1; return 0; } BOOL S3M_Init (void) { if (!(s3mbuf = (S3MNOTE *) _mm_malloc (32 * 64 * sizeof (S3MNOTE)))) return 0; if (!(mh = (S3MHEADER *) _mm_malloc (sizeof (S3MHEADER)))) return 0; if (!(poslookup = (UBYTE *) _mm_malloc (sizeof (UBYTE) * 256))) return 0; memset (poslookup, -1, 256); return 1; } void S3M_Cleanup (void) { _mm_free (s3mbuf); _mm_free (paraptr); _mm_free (poslookup); _mm_free (mh); _mm_free (origpositions); } /* Because so many s3m files have 16 channels as the set number used, but really only use far less (usually 8 to 12 still), I had to make this function, which determines the number of channels that are actually USED by a pattern. For every channel that's used, it sets the appropriate array entry of the global variable 'remap' NOTE: You must first seek to the file location of the pattern before calling this procedure. Returns 1 on fail. */ static BOOL S3M_GetNumChannels (void) { int row = 0, flag, ch; while (row < 64) { flag = _mm_read_UBYTE (modreader); if (_mm_eof (modreader)) { _mm_errno = MMERR_LOADING_PATTERN; return 1; } if (flag) { ch = flag & 31; if (mh->channels[ch] < 32) remap[ch] = 0; if (flag & 32) { _mm_read_UBYTE (modreader); _mm_read_UBYTE (modreader); } if (flag & 64) _mm_read_UBYTE (modreader); if (flag & 128) { _mm_read_UBYTE (modreader); _mm_read_UBYTE (modreader); } } else row++; } return 0; } static BOOL S3M_ReadPattern (void) { int row = 0, flag, ch; S3MNOTE *n, dummy; /* clear pattern data */ memset (s3mbuf, 255, 32 * 64 * sizeof (S3MNOTE)); while (row < 64) { flag = _mm_read_UBYTE (modreader); if (_mm_eof (modreader)) { _mm_errno = MMERR_LOADING_PATTERN; return 0; } if (flag) { ch = remap[flag & 31]; if (ch != -1) n = &s3mbuf[(64U * ch) + row]; else n = &dummy; if (flag & 32) { n->note = _mm_read_UBYTE (modreader); n->ins = _mm_read_UBYTE (modreader); } if (flag & 64) n->vol = _mm_read_UBYTE (modreader); if (flag & 128) { n->cmd = _mm_read_UBYTE (modreader); n->inf = _mm_read_UBYTE (modreader); } } else row++; } return 1; } static UBYTE * S3M_ConvertTrack (S3MNOTE * tr) { int t; UniReset (); for (t = 0; t < 64; t++) { UBYTE note, ins, vol; note = tr[t].note; ins = tr[t].ins; vol = tr[t].vol; if ((ins) && (ins != 255)) UniInstrument (ins - 1); if (note != 255) { if (note == 254) { UniPTEffect (0xc, 0); /* note cut command */ vol = 255; } else UniNote (((note >> 4) * OCTAVE) + (note & 0xf)); /* normal note */ } if (vol < 255) UniPTEffect (0xc, vol); S3MIT_ProcessCmd (tr[t].cmd, tr[t].inf, 1); UniNewline (); } return UniDup (); } BOOL S3M_Load (BOOL curious) { int t, u, track = 0; SAMPLE *q; UBYTE pan[32]; /* try to read module header */ _mm_read_string (mh->songname, 28, modreader); mh->t1a = _mm_read_UBYTE (modreader); mh->type = _mm_read_UBYTE (modreader); _mm_read_UBYTES (mh->unused1, 2, modreader); mh->ordnum = _mm_read_I_UWORD (modreader); mh->insnum = _mm_read_I_UWORD (modreader); mh->patnum = _mm_read_I_UWORD (modreader); mh->flags = _mm_read_I_UWORD (modreader); mh->tracker = _mm_read_I_UWORD (modreader); mh->fileformat = _mm_read_I_UWORD (modreader); _mm_read_string (mh->scrm, 4, modreader); mh->mastervol = _mm_read_UBYTE (modreader); mh->initspeed = _mm_read_UBYTE (modreader); mh->inittempo = _mm_read_UBYTE (modreader); mh->mastermult = _mm_read_UBYTE (modreader); mh->ultraclick = _mm_read_UBYTE (modreader); mh->pantable = _mm_read_UBYTE (modreader); _mm_read_UBYTES (mh->unused2, 8, modreader); mh->special = _mm_read_I_UWORD (modreader); _mm_read_UBYTES (mh->channels, 32, modreader); if (_mm_eof (modreader)) { _mm_errno = MMERR_LOADING_HEADER; return 0; } /* set module variables */ of.songname = DupStr (mh->songname, 28, 0); of.numpat = mh->patnum; of.reppos = 0; of.numins = of.numsmp = mh->insnum; of.initspeed = mh->initspeed; of.inittempo = mh->inittempo; of.initvolume = mh->mastervol << 1; of.flags |= UF_ARPMEM; if ((mh->tracker == 0x1300) || (mh->flags & 64)) of.flags |= UF_S3MSLIDES; /* read the order data */ if (!AllocPositions (mh->ordnum)) return 0; if (!(origpositions = _mm_calloc (mh->ordnum, sizeof (UWORD)))) return 0; for (t = 0; t < mh->ordnum; t++) { origpositions[t] = _mm_read_UBYTE (modreader); if ((origpositions[t] >= mh->patnum) && (origpositions[t] < 254)) origpositions[t] = 255 /*mh->patnum-1 */ ; } if (_mm_eof (modreader)) { _mm_errno = MMERR_LOADING_HEADER; return 0; } poslookupcnt = mh->ordnum; S3MIT_CreateOrders (curious); if (!(paraptr = (UWORD *) _mm_malloc ((of.numins + of.numpat) * sizeof (UWORD)))) return 0; /* read the instrument+pattern parapointers */ _mm_read_I_UWORDS (paraptr, of.numins + of.numpat, modreader); if (mh->pantable == 252) { /* read the panning table (ST 3.2 addition. See below for further portions of channel panning [past reampper]). */ _mm_read_UBYTES (pan, 32, modreader); } if (_mm_eof (modreader)) { _mm_errno = MMERR_LOADING_HEADER; return 0; } /* load samples */ if (!AllocSamples ()) return 0; q = of.samples; for (t = 0; t < of.numins; t++) { S3MSAMPLE s; /* seek to instrument position */ _mm_fseek (modreader, ((long) paraptr[t]) << 4, SEEK_SET); /* and load sample info */ s.type = _mm_read_UBYTE (modreader); _mm_read_string (s.filename, 12, modreader); s.memsegh = _mm_read_UBYTE (modreader); s.memsegl = _mm_read_I_UWORD (modreader); s.length = _mm_read_I_ULONG (modreader); s.loopbeg = _mm_read_I_ULONG (modreader); s.loopend = _mm_read_I_ULONG (modreader); s.volume = _mm_read_UBYTE (modreader); s.dsk = _mm_read_UBYTE (modreader); s.pack = _mm_read_UBYTE (modreader); s.flags = _mm_read_UBYTE (modreader); s.c2spd = _mm_read_I_ULONG (modreader); _mm_read_UBYTES (s.unused, 12, modreader); _mm_read_string (s.sampname, 28, modreader); _mm_read_string (s.scrs, 4, modreader); if (_mm_eof (modreader)) { _mm_errno = MMERR_LOADING_SAMPLEINFO; return 0; } q->samplename = DupStr (s.sampname, 28, 0); q->speed = s.c2spd; q->length = s.length; q->loopstart = s.loopbeg > s.length ? s.length : s.loopbeg; q->loopend = s.loopend > s.length ? s.length : s.loopend; q->volume = s.volume; q->seekpos = (((long) s.memsegh) << 16 | s.memsegl) << 4; if (s.flags & 1) q->flags |= SF_LOOP; if (s.flags & 4) q->flags |= SF_16BITS; if (mh->fileformat == 1) q->flags |= SF_SIGNED; /* don't load sample if it doesn't have the SCRS tag */ if (memcmp (s.scrs, "SCRS", 4)) q->length = 0; q++; } /* determine the number of channels actually used. */ of.numchn = 0; memset (remap, -1, 32 * sizeof (UBYTE)); for (t = 0; t < of.numpat; t++) { /* seek to pattern position (+2 skip pattern length) */ _mm_fseek (modreader, (long) ((paraptr[of.numins + t]) << 4) + 2, SEEK_SET); if (S3M_GetNumChannels ()) return 0; } /* then we can decide the module type */ t = mh->tracker >> 12; if ((!t) || (t > 3)) t = NUMTRACKERS - 1; /* unknown tracker */ else { if (mh->tracker >= 0x3217) t = NUMTRACKERS + 1; /* IT 2.14p4 */ else if (mh->tracker >= 0x3216) t = NUMTRACKERS; /* IT 2.14p3 */ else t--; } of.modtype = strdup (S3M_Version[t]); if (t < NUMTRACKERS) { of.modtype[numeric[t]] = ((mh->tracker >> 8) & 0xf) + '0'; of.modtype[numeric[t] + 2] = ((mh->tracker >> 4) & 0xf) + '0'; of.modtype[numeric[t] + 3] = ((mh->tracker) & 0xf) + '0'; } /* build the remap array */ for (t = 0; t < 32; t++) if (!remap[t]) remap[t] = of.numchn++; /* set panning positions after building remap chart! */ for (t = 0; t < 32; t++) if ((mh->channels[t] < 32) && (remap[t] != -1)) { if (mh->channels[t] < 8) of.panning[remap[t]] = 0x20; /* 0x30 = std s3m val */ else of.panning[remap[t]] = 0xd0; /* 0xc0 = std s3m val */ } if (mh->pantable == 252) /* set panning positions according to panning table (new for st3.2) */ for (t = 0; t < 32; t++) if ((pan[t] & 0x20) && (mh->channels[t] < 32) && (remap[t] != -1)) of.panning[remap[t]] = (pan[t] & 0xf) << 4; /* load pattern info */ of.numtrk = of.numpat * of.numchn; if (!AllocTracks ()) return 0; if (!AllocPatterns ()) return 0; for (t = 0; t < of.numpat; t++) { /* seek to pattern position (+2 skip pattern length) */ _mm_fseek (modreader, (((long) paraptr[of.numins + t]) << 4) + 2, SEEK_SET); if (!S3M_ReadPattern ()) return 0; for (u = 0; u < of.numchn; u++) if (!(of.tracks[track++] = S3M_ConvertTrack (&s3mbuf[u * 64]))) return 0; } return 1; } CHAR * S3M_LoadTitle (void) { CHAR s[28]; _mm_fseek (modreader, 0, SEEK_SET); if (!_mm_read_UBYTES (s, 28, modreader)) return NULL; return (DupStr (s, 28, 0)); } /*========== Loader information */ MLOADER load_s3m = { NULL, "S3M", "S3M (Scream Tracker 3)", S3M_Init, S3M_Test, S3M_Load, S3M_Cleanup, S3M_LoadTitle }; /* ex:set ts=4: */ TiMidity++-2.13.2/libunimod/load_stm.c0100644004711200001440000002361607421005041016626 0ustar tamukiusers/* MikMod sound library (c) 1998, 1999 Miodrag Vallat and others - see file AUTHORS for complete list. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /*============================================================================== $Id: load_stm.c,v 1.30 1999/10/25 16:31:41 miod Exp $ Screamtracker 2 (STM) module loader ==============================================================================*/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include "unimod_priv.h" /*========== Module structure */ /* sample information */ typedef struct STMSAMPLE { CHAR filename[12]; UBYTE unused; /* 0x00 */ UBYTE instdisk; /* Instrument disk */ UWORD reserved; UWORD length; /* Sample length */ UWORD loopbeg; /* Loop start point */ UWORD loopend; /* Loop end point */ UBYTE volume; /* Volume */ UBYTE reserved2; UWORD c2spd; /* Good old c2spd */ ULONG reserved3; UWORD isa; } STMSAMPLE; /* header */ typedef struct STMHEADER { CHAR songname[20]; CHAR trackername[8]; /* !Scream! for ST 2.xx */ UBYTE unused; /* 0x1A */ UBYTE filetype; /* 1=song, 2=module */ UBYTE ver_major; UBYTE ver_minor; UBYTE inittempo; /* initspeed= stm inittempo>>4 */ UBYTE numpat; /* number of patterns */ UBYTE globalvol; UBYTE reserved[13]; STMSAMPLE sample[31]; /* STM sample data */ UBYTE patorder[128]; /* Docs say 64 - actually 128 */ } STMHEADER; typedef struct STMNOTE { UBYTE note, insvol, volcmd, cmdinf; } STMNOTE; /*========== Loader variables */ static STMNOTE *stmbuf = NULL; static STMHEADER *mh = NULL; /*========== Loader code */ BOOL STM_Test (void) { UBYTE str[44]; int t; _mm_fseek (modreader, 20, SEEK_SET); _mm_read_UBYTES (str, 44, modreader); if (str[9] != 2) return 0; /* STM Module = filetype 2 */ if(!memcmp (str + 40, "SCRM", 4)) return 0; for (t=0;tnote; ins = n->insvol >> 3; vol = (n->insvol & 7) + ((n->volcmd & 0x70) >> 1); cmd = n->volcmd & 15; inf = n->cmdinf; if ((ins) && (ins < 32)) UniInstrument (ins - 1); /* special values of [SBYTE0] are handled here we have no idea if these strange values will ever be encountered. but it appears as those stms sound correct. */ if ((note == 254) || (note == 252)) { UniPTEffect (0xc, 0); /* note cut */ n->volcmd |= 0x80; } else /* if note < 251, then all three bytes are stored in the file */ if (note < 251) UniNote ((((note >> 4) + 2) * OCTAVE) + (note & 0xf)); if ((!(n->volcmd & 0x80)) && (vol < 65)) UniPTEffect (0xc, vol); if (cmd != 255) switch (cmd) { case 1: /* Axx set speed to xx */ UniPTEffect (0xf, inf >> 4); break; case 2: /* Bxx position jump */ UniPTEffect (0xb, inf); break; case 3: /* Cxx patternbreak to row xx */ UniPTEffect (0xd, (((inf & 0xf0) >> 4) * 10) + (inf & 0xf)); break; case 4: /* Dxy volumeslide */ UniEffect (UNI_S3MEFFECTD, inf); break; case 5: /* Exy toneslide down */ UniEffect (UNI_S3MEFFECTE, inf); break; case 6: /* Fxy toneslide up */ UniEffect (UNI_S3MEFFECTF, inf); break; case 7: /* Gxx Tone portamento,speed xx */ UniPTEffect (0x3, inf); break; case 8: /* Hxy vibrato */ UniPTEffect (0x4, inf); break; case 9: /* Ixy tremor, ontime x, offtime y */ UniEffect (UNI_S3MEFFECTI, inf); break; case 0: /* protracker arpeggio */ if (!inf) break; /* fall through */ case 0xa: /* Jxy arpeggio */ UniPTEffect (0x0, inf); break; case 0xb: /* Kxy Dual command H00 & Dxy */ UniPTEffect (0x4, 0); UniEffect (UNI_S3MEFFECTD, inf); break; case 0xc: /* Lxy Dual command G00 & Dxy */ UniPTEffect (0x3, 0); UniEffect (UNI_S3MEFFECTD, inf); break; /* Support all these above, since ST2 can LOAD these values but can actually only play up to J - and J is only half-way implemented in ST2 */ case 0x18: /* Xxx amiga panning command 8xx */ UniPTEffect (0x8, inf); break; } } static UBYTE * STM_ConvertTrack (STMNOTE * n) { int t; UniReset (); for (t = 0; t < 64; t++) { STM_ConvertNote (n); UniNewline (); n += of.numchn; } return UniDup (); } static BOOL STM_LoadPatterns (void) { int t, s, tracks = 0; if (!AllocPatterns ()) return 0; if (!AllocTracks ()) return 0; /* Allocate temporary buffer for loading and converting the patterns */ for (t = 0; t < of.numpat; t++) { for (s = 0; s < (64U * of.numchn); s++) { stmbuf[s].note = _mm_read_UBYTE (modreader); stmbuf[s].insvol = _mm_read_UBYTE (modreader); stmbuf[s].volcmd = _mm_read_UBYTE (modreader); stmbuf[s].cmdinf = _mm_read_UBYTE (modreader); } if (_mm_eof (modreader)) { _mm_errno = MMERR_LOADING_PATTERN; return 0; } for (s = 0; s < of.numchn; s++) if (!(of.tracks[tracks++] = STM_ConvertTrack (stmbuf + s))) return 0; } return 1; } BOOL STM_Load (BOOL curious) { int t; ULONG ourISA; /* We must generate our own ISA, it's not stored in stm */ SAMPLE *q; /* try to read stm header */ _mm_read_string (mh->songname, 20, modreader); _mm_read_string (mh->trackername, 8, modreader); mh->unused = _mm_read_UBYTE (modreader); mh->filetype = _mm_read_UBYTE (modreader); mh->ver_major = _mm_read_UBYTE (modreader); mh->ver_minor = _mm_read_UBYTE (modreader); mh->inittempo = _mm_read_UBYTE (modreader); if (!mh->inittempo) { _mm_errno = MMERR_NOT_A_MODULE; return 0; } mh->numpat = _mm_read_UBYTE (modreader); mh->globalvol = _mm_read_UBYTE (modreader); _mm_read_UBYTES (mh->reserved, 13, modreader); for (t = 0; t < 31; t++) { STMSAMPLE *s = &mh->sample[t]; /* STM sample data */ _mm_read_string (s->filename, 12, modreader); s->unused = _mm_read_UBYTE (modreader); s->instdisk = _mm_read_UBYTE (modreader); s->reserved = _mm_read_I_UWORD (modreader); s->length = _mm_read_I_UWORD (modreader); s->loopbeg = _mm_read_I_UWORD (modreader); s->loopend = _mm_read_I_UWORD (modreader); s->volume = _mm_read_UBYTE (modreader); s->reserved2 = _mm_read_UBYTE (modreader); s->c2spd = _mm_read_I_UWORD (modreader); s->reserved3 = _mm_read_I_ULONG (modreader); s->isa = _mm_read_I_UWORD (modreader); } _mm_read_UBYTES (mh->patorder, 128, modreader); if (_mm_eof (modreader)) { _mm_errno = MMERR_LOADING_HEADER; return 0; } /* set module variables */ for (t = 0; t < STM_NTRACKERS; t++) if (!memcmp (mh->trackername, STM_Signatures[t], 8)) break; of.modtype = strdup (STM_Version[t]); of.songname = DupStr (mh->songname, 20, 1); /* make a cstr of songname */ of.numpat = mh->numpat; of.inittempo = 125; /* mh->inittempo+0x1c; */ of.initspeed = mh->inittempo >> 4; of.numchn = 4; /* get number of channels */ of.reppos = 0; of.flags |= UF_S3MSLIDES; t = 0; if (!AllocPositions (0x80)) return 0; /* 99 terminates the patorder list */ while ((mh->patorder[t] != 99) && (mh->patorder[t] < mh->numpat)) { of.positions[t] = mh->patorder[t]; t++; } if (mh->patorder[t] != 99) t++; of.numpos = t; of.numtrk = of.numpat * of.numchn; of.numins = of.numsmp = 31; if (!AllocSamples ()) return 0; if (!STM_LoadPatterns ()) return 0; ourISA = _mm_ftell (modreader); ourISA = (ourISA + 15) & 0xfffffff0; /* normalize */ for (q = of.samples, t = 0; t < of.numsmp; t++, q++) { /* load sample info */ q->samplename = DupStr (mh->sample[t].filename, 12, 1); q->speed = (mh->sample[t].c2spd * 8363L) / 8448; q->volume = mh->sample[t].volume; q->length = mh->sample[t].length; if ( /*(!mh->sample[t].volume)|| */ (q->length == 1)) q->length = 0; q->loopstart = mh->sample[t].loopbeg; q->loopend = mh->sample[t].loopend; q->seekpos = ourISA; ourISA += q->length; ourISA = (ourISA + 15) & 0xfffffff0; /* normalize */ /* contrary to the STM specs, sample data is signed */ q->flags = SF_SIGNED; /* fix for bad STMs */ if (q->loopstart >= q->length) q->loopstart = q->loopend = 0; if ((q->loopend > 0) && (q->loopend != 0xffff) && (q->loopend!=q->loopstart)) q->flags |= SF_LOOP; /* fix replen if repend>length */ if (q->loopend > q->length) q->loopend = q->length; } return 1; } CHAR * STM_LoadTitle (void) { CHAR s[20]; _mm_fseek (modreader, 0, SEEK_SET); if (!_mm_read_UBYTES (s, 20, modreader)) return NULL; return (DupStr (s, 20, 1)); } /*========== Loader information */ MLOADER load_stm = { NULL, "STM", "STM (Scream Tracker)", STM_Init, STM_Test, STM_Load, STM_Cleanup, STM_LoadTitle }; /* ex:set ts=4: */ TiMidity++-2.13.2/libunimod/load_stx.c0100644004711200001440000002755007421005041016642 0ustar tamukiusers/* MikMod sound library (c) 1998, 1999 Miodrag Vallat and others - see file AUTHORS for complete list. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /*============================================================================== $Id: load_stx.c,v 1.12 1999/10/25 16:31:41 miod Exp $ STMIK 0.2 (STX) module loader ==============================================================================*/ /* Written by Claudio Matsuoka */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include "unimod_priv.h" /*========== Module structure */ /* header */ typedef struct STXHEADER { CHAR songname[20]; CHAR trackername[8]; UWORD patsize; UWORD unknown1; UWORD patptr; UWORD insptr; UWORD chnptr; /* not sure */ UWORD unknown2; UWORD unknown3; UBYTE mastermult; UBYTE initspeed; UWORD unknown4; UWORD unknown5; UWORD patnum; UWORD insnum; UWORD ordnum; UWORD unknown6; UWORD unknown7; UWORD unknown8; CHAR scrm[4]; } STXHEADER; /* sample information */ typedef struct STXSAMPLE { UBYTE type; CHAR filename[12]; UBYTE memsegh; UWORD memsegl; ULONG length; ULONG loopbeg; ULONG loopend; UBYTE volume; UBYTE dsk; UBYTE pack; UBYTE flags; ULONG c2spd; UBYTE unused[12]; CHAR sampname[28]; CHAR scrs[4]; } STXSAMPLE; typedef struct STXNOTE { UBYTE note, ins, vol, cmd, inf; } STXNOTE; /*========== Loader variables */ static STXNOTE *stxbuf = NULL; /* pointer to a complete STX pattern */ static STXHEADER *mh = NULL; static UWORD *paraptr = NULL; /* parapointer array (see STX docs) */ /*========== Loader code */ static BOOL STX_Test (void) { UBYTE id[8]; int t; _mm_fseek(modreader,0x14,SEEK_SET); if(!_mm_read_UBYTES(id, 8, modreader)) return 0; for(t=0;t= 0) && (ch < 4)) n = &stxbuf[(64U * ch) + row]; else n = &dummy; if (flag & 32) { n->note = _mm_read_UBYTE (modreader); n->ins = _mm_read_UBYTE (modreader); } if (flag & 64) { n->vol = _mm_read_UBYTE (modreader); if (n->vol > 64) n->vol = 64; } if (flag & 128) { n->cmd = _mm_read_UBYTE (modreader); n->inf = _mm_read_UBYTE (modreader); } } else row++; } return 1; } static UBYTE * STX_ConvertTrack (STXNOTE * tr) { int t; UniReset (); for (t = 0; t < 64; t++) { UBYTE note, ins, vol, cmd, inf; note = tr[t].note; ins = tr[t].ins; vol = tr[t].vol; cmd = tr[t].cmd; inf = tr[t].inf; if ((ins) && (ins != 255)) UniInstrument (ins - 1); if ((note) && (note != 255)) { if (note == 254) { UniPTEffect (0xc, 0); /* note cut command */ vol = 255; } else UniNote (24 + ((note >> 4) * OCTAVE) + (note & 0xf)); /* normal note */ } if (vol < 255) UniPTEffect (0xc, vol); if (cmd < 255) switch (cmd) { case 1: /* Axx set speed to xx */ UniPTEffect (0xf, inf >> 4); break; case 2: /* Bxx position jump */ UniPTEffect (0xb, inf); break; case 3: /* Cxx patternbreak to row xx */ UniPTEffect (0xd, (((inf & 0xf0) >> 4) * 10) + (inf & 0xf)); break; case 4: /* Dxy volumeslide */ UniEffect (UNI_S3MEFFECTD, inf); break; case 5: /* Exy toneslide down */ UniEffect (UNI_S3MEFFECTE, inf); break; case 6: /* Fxy toneslide up */ UniEffect (UNI_S3MEFFECTF, inf); break; case 7: /* Gxx Tone portamento,speed xx */ UniPTEffect (0x3, inf); break; case 8: /* Hxy vibrato */ UniPTEffect (0x4, inf); break; case 9: /* Ixy tremor, ontime x, offtime y */ UniEffect (UNI_S3MEFFECTI, inf); break; case 0: /* protracker arpeggio */ if (!inf) break; /* fall through */ case 0xa: /* Jxy arpeggio */ UniPTEffect (0x0, inf); break; case 0xb: /* Kxy Dual command H00 & Dxy */ UniPTEffect (0x4, 0); UniEffect (UNI_S3MEFFECTD, inf); break; case 0xc: /* Lxy Dual command G00 & Dxy */ UniPTEffect (0x3, 0); UniEffect (UNI_S3MEFFECTD, inf); break; /* Support all these above, since ST2 can LOAD these values but can actually only play up to J - and J is only half-way implemented in ST2 */ case 0x18: /* Xxx amiga panning command 8xx */ UniPTEffect (0x8, inf); break; } UniNewline (); } return UniDup (); } static BOOL STX_Load (BOOL curious) { int t, u, track = 0; int version = 0; SAMPLE *q; char *tracker; /* try to read module header */ _mm_read_string (mh->songname, 20, modreader); _mm_read_string (mh->trackername, 8, modreader); mh->patsize = _mm_read_I_UWORD (modreader); mh->unknown1 = _mm_read_I_UWORD (modreader); mh->patptr = _mm_read_I_UWORD (modreader); mh->insptr = _mm_read_I_UWORD (modreader); mh->chnptr = _mm_read_I_UWORD (modreader); mh->unknown2 = _mm_read_I_UWORD (modreader); mh->unknown3 = _mm_read_I_UWORD (modreader); mh->mastermult = _mm_read_UBYTE (modreader); mh->initspeed = _mm_read_UBYTE (modreader) >> 4; mh->unknown4 = _mm_read_I_UWORD (modreader); mh->unknown5 = _mm_read_I_UWORD (modreader); mh->patnum = _mm_read_I_UWORD (modreader); mh->insnum = _mm_read_I_UWORD (modreader); mh->ordnum = _mm_read_I_UWORD (modreader); mh->unknown6 = _mm_read_I_UWORD (modreader); mh->unknown7 = _mm_read_I_UWORD (modreader); mh->unknown8 = _mm_read_I_UWORD (modreader); _mm_read_string (mh->scrm, 4, modreader); if (_mm_eof (modreader)) { _mm_errno = MMERR_LOADING_HEADER; return 0; } tracker = "unknown tracker"; for (t = 0; t < STM_NTRACKERS; t++) if (!memcmp (mh->trackername, STM_Signatures[t], 8)) { tracker = STM_Version[t]; break; } of.modtype = _mm_malloc( strlen(tracker) + strlen("STM2STX 1.x ()") + 1); sprintf(of.modtype, "STM2STX 1.x (%s)", tracker); /* set module variables */ of.songname = DupStr (mh->songname, 20, 1); of.numpat = mh->patnum; of.reppos = 0; of.numins = of.numsmp = mh->insnum; of.initspeed = mh->initspeed; of.inittempo = 125; of.numchn = 4; of.flags |= UF_S3MSLIDES; if (!(paraptr = (UWORD *) _mm_malloc ((of.numins + of.numpat) * sizeof (UWORD)))) return 0; /* read the instrument+pattern parapointers */ _mm_fseek (modreader, mh->insptr << 4, SEEK_SET); _mm_read_I_UWORDS (paraptr, of.numins, modreader); _mm_fseek (modreader, mh->patptr << 4, SEEK_SET); _mm_read_I_UWORDS (paraptr + of.numins, of.numpat, modreader); /* check module version */ _mm_fseek (modreader, paraptr[of.numins] << 4, SEEK_SET); version = _mm_read_I_UWORD (modreader); if (version == mh->patsize) { version = 0x10; of.modtype[10] = '0'; } else { version = 0x11; of.modtype[10] = '1'; } /* read the order data */ _mm_fseek (modreader, (mh->chnptr << 4) + 32, SEEK_SET); if (!AllocPositions (mh->ordnum)) return 0; for (t = 0; t < mh->ordnum; t++) { of.positions[t] = _mm_read_UBYTE (modreader); _mm_fseek (modreader, 4, SEEK_CUR); } of.numpos = 0; poslookupcnt = mh->ordnum; for (t = 0; t < mh->ordnum; t++) { of.positions[of.numpos] = of.positions[t]; poslookup[t] = of.numpos; /* bug fix for freaky S3Ms */ if (of.positions[t] < 254) of.numpos++; else /* special end of song pattern */ if ((of.positions[t] == 255) && (!curious)) break; } if (_mm_eof (modreader)) { _mm_errno = MMERR_LOADING_HEADER; return 0; } /* load samples */ if (!AllocSamples ()) return 0; for (q = of.samples, t = 0; t < of.numins; t++, q++) { STXSAMPLE s; /* seek to instrument position */ _mm_fseek (modreader, ((long) paraptr[t]) << 4, SEEK_SET); /* and load sample info */ s.type = _mm_read_UBYTE (modreader); _mm_read_string (s.filename, 12, modreader); s.memsegh = _mm_read_UBYTE (modreader); s.memsegl = _mm_read_I_UWORD (modreader); s.length = _mm_read_I_ULONG (modreader); s.loopbeg = _mm_read_I_ULONG (modreader); s.loopend = _mm_read_I_ULONG (modreader); s.volume = _mm_read_UBYTE (modreader); s.dsk = _mm_read_UBYTE (modreader); s.pack = _mm_read_UBYTE (modreader); s.flags = _mm_read_UBYTE (modreader); s.c2spd = _mm_read_I_ULONG (modreader); _mm_read_UBYTES (s.unused, 12, modreader); _mm_read_string (s.sampname, 28, modreader); _mm_read_string (s.scrs, 4, modreader); if (_mm_eof (modreader)) { _mm_errno = MMERR_LOADING_SAMPLEINFO; return 0; } q->samplename = DupStr (s.sampname, 28, 1); q->speed = (s.c2spd * 8363) / 8448; q->length = s.length; q->loopstart = s.loopbeg; q->loopend = s.loopend; q->volume = s.volume; q->seekpos = (((long) s.memsegh) << 16 | s.memsegl) << 4; q->flags |= SF_SIGNED; /* fix for bad converted STMs */ if (q->loopstart >= q->length) q->loopstart = q->loopend = 0; /* some modules come with loopstart == loopend == 0, yet have the * looping flag set */ if ((s.flags & 1) && (q->loopstart != q->loopend)) { q->flags |= SF_LOOP; if (q->loopend > q->length) q->loopend = q->length; } if (s.flags & 4) q->flags |= SF_16BITS; } /* load pattern info */ of.numtrk = of.numpat * of.numchn; if (!AllocTracks ()) return 0; if (!AllocPatterns ()) return 0; for (t = 0; t < of.numpat; t++) { /* seek to pattern position (+2 skip pattern length) */ _mm_fseek (modreader, (((long) paraptr[of.numins + t]) << 4) + (version == 0x10 ? 2 : 0), SEEK_SET); if (!STX_ReadPattern ()) return 0; for (u = 0; u < of.numchn; u++) if (!(of.tracks[track++] = STX_ConvertTrack (&stxbuf[u * 64]))) return 0; } return 1; } static CHAR * STX_LoadTitle (void) { CHAR s[28]; _mm_fseek (modreader, 0, SEEK_SET); if (!_mm_read_UBYTES (s, 20, modreader)) return NULL; return (DupStr (s, 28, 1)); } /*========== Loader information */ MLOADER load_stx = { NULL, "STX", "STX (Scream Tracker Music Interface Kit)", STX_Init, STX_Test, STX_Load, STX_Cleanup, STX_LoadTitle }; /* ex:set ts=4: */ TiMidity++-2.13.2/libunimod/load_ult.c0100644004711200001440000001733607421005041016631 0ustar tamukiusers/* MikMod sound library (c) 1998, 1999 Miodrag Vallat and others - see file AUTHORS for complete list. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /*============================================================================== $Id: load_ult.c,v 1.27 1999/10/25 16:31:41 miod Exp $ Ultratracker (ULT) module loader ==============================================================================*/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include "unimod_priv.h" /*========== Module structure */ /* header */ typedef struct ULTHEADER { CHAR id[16]; CHAR songtitle[32]; UBYTE reserved; } ULTHEADER; /* sample information */ typedef struct ULTSAMPLE { CHAR samplename[32]; CHAR dosname[12]; SLONG loopstart; SLONG loopend; SLONG sizestart; SLONG sizeend; UBYTE volume; UBYTE flags; UWORD speed; SWORD finetune; } ULTSAMPLE; typedef struct ULTEVENT { UBYTE note, sample, eff, dat1, dat2; } ULTEVENT; /*========== Loader variables */ #define ULTS_16BITS 4 #define ULTS_LOOP 8 #define ULTS_REVERSE 16 #define ULT_VERSION_LEN 18 static CHAR ULT_Version[ULT_VERSION_LEN] = "Ultra Tracker v1.x"; static ULTEVENT ev; /*========== Loader code */ BOOL ULT_Test (void) { CHAR id[16]; if (!_mm_read_string (id, 15, modreader)) return 0; if (strncmp (id, "MAS_UTrack_V00", 14)) return 0; if ((id[14] < '1') || (id[14] > '4')) return 0; return 1; } BOOL ULT_Init (void) { return 1; } void ULT_Cleanup (void) { } static UBYTE ReadUltEvent (ULTEVENT * event) { UBYTE flag, rep = 1; flag = _mm_read_UBYTE (modreader); if (flag == 0xfc) { rep = _mm_read_UBYTE (modreader); event->note = _mm_read_UBYTE (modreader); } else event->note = flag; event->sample = _mm_read_UBYTE (modreader); event->eff = _mm_read_UBYTE (modreader); event->dat1 = _mm_read_UBYTE (modreader); event->dat2 = _mm_read_UBYTE (modreader); return rep; } BOOL ULT_Load (BOOL curious) { int t, u, tracks = 0; SAMPLE *q; ULTSAMPLE s; ULTHEADER mh; UBYTE nos, noc, nop; /* try to read module header */ _mm_read_string (mh.id, 15, modreader); _mm_read_string (mh.songtitle, 32, modreader); mh.reserved = _mm_read_UBYTE (modreader); if (_mm_eof (modreader)) { _mm_errno = MMERR_LOADING_HEADER; return 0; } ULT_Version[ULT_VERSION_LEN - 1] = '3' + (mh.id[14] - '1'); of.modtype = DupStr (ULT_Version, ULT_VERSION_LEN, 1); of.initspeed = 6; of.inittempo = 125; of.reppos = 0; /* read songtext */ if ((mh.id[14] > '1') && (mh.reserved)) if (!ReadLinedComment (mh.reserved, 32)) return 0; nos = _mm_read_UBYTE (modreader); if (_mm_eof (modreader)) { _mm_errno = MMERR_LOADING_HEADER; return 0; } of.songname = DupStr (mh.songtitle, 32, 1); of.numins = of.numsmp = nos; if (!AllocSamples ()) return 0; q = of.samples; for (t = 0; t < nos; t++) { /* try to read sample info */ _mm_read_string (s.samplename, 32, modreader); _mm_read_string (s.dosname, 12, modreader); s.loopstart = _mm_read_I_ULONG (modreader); s.loopend = _mm_read_I_ULONG (modreader); s.sizestart = _mm_read_I_ULONG (modreader); s.sizeend = _mm_read_I_ULONG (modreader); s.volume = _mm_read_UBYTE (modreader); s.flags = _mm_read_UBYTE (modreader); s.speed = (mh.id[14] >= '4') ? _mm_read_I_UWORD (modreader) : 8363; s.finetune = _mm_read_I_SWORD (modreader); if (_mm_eof (modreader)) { _mm_errno = MMERR_LOADING_SAMPLEINFO; return 0; } q->samplename = DupStr (s.samplename, 32, 1); /* The correct formula for the coefficient would be pow(2,(double)s.finetume/OCTAVE/32768), but to avoid floating point here, we'll use a first order approximation here. 1/567290 == Ln(2)/OCTAVE/32768 */ q->speed = s.speed + s.speed * (((SLONG) s.speed * (SLONG) s.finetune) / 567290); q->length = s.sizeend - s.sizestart; q->volume = s.volume >> 2; q->loopstart = s.loopstart; q->loopend = s.loopend; q->flags = SF_SIGNED; if (s.flags & ULTS_LOOP) q->flags |= SF_LOOP; if (s.flags & ULTS_16BITS) { s.sizeend += (s.sizeend - s.sizestart); s.sizestart <<= 1; q->flags |= SF_16BITS; q->loopstart >>= 1; q->loopend >>= 1; } q++; } if (!AllocPositions (256)) return 0; for (t = 0; t < 256; t++) of.positions[t] = _mm_read_UBYTE (modreader); for (t = 0; t < 256; t++) if (of.positions[t] == 255) break; of.numpos = t; noc = _mm_read_UBYTE (modreader); nop = _mm_read_UBYTE (modreader); of.numchn = ++noc; of.numpat = ++nop; of.numtrk = of.numchn * of.numpat; if (!AllocTracks ()) return 0; if (!AllocPatterns ()) return 0; for (u = 0; u < of.numchn; u++) for (t = 0; t < of.numpat; t++) of.patterns[(t * of.numchn) + u] = tracks++; /* read pan position table for v1.5 and higher */ if (mh.id[14] >= '3') for (t = 0; t < of.numchn; t++) of.panning[t] = _mm_read_UBYTE (modreader) << 4; for (t = 0; t < of.numtrk; t++) { int rep, row = 0; UniReset (); while (row < 64) { rep = ReadUltEvent (&ev); if (_mm_eof (modreader)) { _mm_errno = MMERR_LOADING_TRACK; return 0; } while (rep--) { UBYTE eff; int offset; if (ev.sample) UniInstrument (ev.sample - 1); if (ev.note) UniNote (ev.note + 2 * OCTAVE - 1); /* first effect - various fixes by Alexander Kerkhove and Thomas Neumann */ eff = ev.eff >> 4; switch (eff) { case 0x3: /* tone portamento */ UniEffect (UNI_ITEFFECTG, ev.dat2); break; case 0x5: break; case 0x9: /* sample offset */ offset = (ev.dat2 << 8) | ((ev.eff & 0xf) == 9 ? ev.dat1 : 0); UniEffect (UNI_ULTEFFECT9, offset); break; case 0xb: /* panning */ UniPTEffect (8, ev.dat2 * 0xf); break; case 0xc: /* volume */ UniPTEffect (eff, ev.dat2 >> 2); break; default: UniPTEffect (eff, ev.dat2); break; } /* second effect */ eff = ev.eff & 0xf; switch (eff) { case 0x3: /* tone portamento */ UniEffect (UNI_ITEFFECTG, ev.dat1); break; case 0x5: break; case 0x9: /* sample offset */ if ((ev.eff >> 4) != 9) UniEffect (UNI_ULTEFFECT9, ((UWORD) ev.dat1) << 8); break; case 0xb: /* panning */ UniPTEffect (8, ev.dat1 * 0xf); break; case 0xc: /* volume */ UniPTEffect (eff, ev.dat1 >> 2); break; default: UniPTEffect (eff, ev.dat1); break; } UniNewline (); row++; } } if (!(of.tracks[t] = UniDup ())) return 0; } return 1; } CHAR * ULT_LoadTitle (void) { CHAR s[32]; _mm_fseek (modreader, 15, SEEK_SET); if (!_mm_read_UBYTES (s, 32, modreader)) return NULL; return (DupStr (s, 32, 1)); } /*========== Loader information */ MLOADER load_ult = { NULL, "ULT", "ULT (UltraTracker)", ULT_Init, ULT_Test, ULT_Load, ULT_Cleanup, ULT_LoadTitle }; /* ex:set ts=4: */ TiMidity++-2.13.2/libunimod/load_uni.c0100644004711200001440000004236307421005041016616 0ustar tamukiusers/* MikMod sound library (c) 1998, 1999 Miodrag Vallat and others - see file AUTHORS for complete list. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /*============================================================================== $Id: load_uni.c,v 1.13 1999/10/25 16:31:41 miod Exp $ UNIMOD (libmikmod's and APlayer's internal module format) loader ==============================================================================*/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include "unimod_priv.h" /*========== Module structure */ typedef struct UNIHEADER { CHAR id[4]; UBYTE numchn; UWORD numpos; UWORD reppos; UWORD numpat; UWORD numtrk; UWORD numins; UWORD numsmp; UBYTE initspeed; UBYTE inittempo; UBYTE initvolume; UBYTE flags; UBYTE numvoices; UBYTE positions[256]; UBYTE panning[32]; } UNIHEADER; typedef struct UNISMP05 { UWORD c2spd; UWORD transpose; UBYTE volume; UBYTE panning; ULONG length; ULONG loopstart; ULONG loopend; UWORD flags; CHAR *samplename; UBYTE vibtype; UBYTE vibsweep; UBYTE vibdepth; UBYTE vibrate; } UNISMP05; /*========== Loader variables */ static UWORD universion; static UNIHEADER mh; #define UNI_SMPINCR 64 static UNISMP05 *wh = NULL, *s = NULL; /*========== Loader code */ static char * readstring (void) { char *s = NULL; UWORD len; len = _mm_read_I_UWORD (modreader); if (len) { s = _mm_malloc (len + 1); _mm_read_UBYTES (s, len, modreader); s[len] = 0; } return s; } BOOL UNI_Test (void) { char id[6]; if (!_mm_read_UBYTES (id, 6, modreader)) return 0; /* UNIMod created by MikCvt */ if (!(memcmp (id, "UN0", 3))) { if ((id[3] >= '4') && (id[3] <= '6')) return 1; } /* UNIMod created by APlayer */ if (!(memcmp (id, "APUN\01", 5))) { if ((id[5] >= 1) && (id[5] <= 4)) return 1; } return 0; } BOOL UNI_Init (void) { return 1; } void UNI_Cleanup (void) { _mm_free (wh); s = NULL; } static UBYTE * readtrack (void) { UBYTE *t; UWORD len; int cur = 0, chunk; if (universion >= 6) len = _mm_read_M_UWORD (modreader); else len = _mm_read_I_UWORD (modreader); if (!len) return NULL; if (!(t = _mm_malloc (len))) return NULL; _mm_read_UBYTES (t, len, modreader); /* Check if the track is correct */ while (1) { chunk = t[cur++]; if (!chunk) break; chunk = (chunk & 0x1f) - 1; while (chunk > 0) { int opcode, oplen; if (cur >= len) { free (t); return NULL; } opcode = t[cur]; /* Remap opcodes */ if (universion <= 5) { if (opcode > 29) { free (t); return NULL; } switch (opcode) { /* UNI_NOTE .. UNI_S3MEFFECTQ are the same */ case 25: opcode = UNI_S3MEFFECTT; break; case 26: opcode = UNI_XMEFFECTA; break; case 27: opcode = UNI_XMEFFECTG; break; case 28: opcode = UNI_XMEFFECTH; break; case 29: opcode = UNI_XMEFFECTP; break; } } else { if (opcode > UNI_ITEFFECTP) { /* APlayer < 1.03 does not have ITEFFECTT */ if (universion < 0x103) opcode++; /* APlayer < 1.02 does not have ITEFFECTZ */ if ((opcode > UNI_ITEFFECTY) && (universion < 0x102)) opcode++; } } if ((!opcode) || (opcode >= UNI_LAST)) { free (t); return NULL; } oplen = unioperands[opcode] + 1; cur += oplen; chunk -= oplen; } if ((chunk < 0) || (cur >= len)) { free (t); return NULL; } } return t; } static BOOL loadsmp6 (void) { int t; SAMPLE *s; s = of.samples; for (t = 0; t < of.numsmp; t++, s++) { int flags; flags = _mm_read_M_UWORD (modreader); s->flags = 0; if (flags & 0x0100) s->flags |= SF_REVERSE; if (flags & 0x0004) s->flags |= SF_STEREO; if (flags & 0x0002) s->flags |= SF_SIGNED; if (flags & 0x0001) s->flags |= SF_16BITS; /* convert flags */ if (universion >= 0x102) { if (flags & 0x0800) s->flags |= SF_UST_LOOP; if (flags & 0x0400) s->flags |= SF_OWNPAN; if (flags & 0x0200) s->flags |= SF_SUSTAIN; if (flags & 0x0080) s->flags |= SF_BIDI; if (flags & 0x0040) s->flags |= SF_LOOP; if (flags & 0x0020) s->flags |= SF_ITPACKED; if (flags & 0x0010) s->flags |= SF_DELTA; if (flags & 0x0008) s->flags |= SF_BIG_ENDIAN; } else { if (flags & 0x400) s->flags |= SF_UST_LOOP; if (flags & 0x200) s->flags |= SF_OWNPAN; if (flags & 0x080) s->flags |= SF_SUSTAIN; if (flags & 0x040) s->flags |= SF_BIDI; if (flags & 0x020) s->flags |= SF_LOOP; if (flags & 0x010) s->flags |= SF_BIG_ENDIAN; if (flags & 0x008) s->flags |= SF_DELTA; } s->speed = _mm_read_M_ULONG (modreader); s->volume = _mm_read_UBYTE (modreader); s->panning = _mm_read_M_UWORD (modreader); s->length = _mm_read_M_ULONG (modreader); s->loopstart = _mm_read_M_ULONG (modreader); s->loopend = _mm_read_M_ULONG (modreader); s->susbegin = _mm_read_M_ULONG (modreader); s->susend = _mm_read_M_ULONG (modreader); s->globvol = _mm_read_UBYTE (modreader); s->vibflags = _mm_read_UBYTE (modreader); s->vibtype = _mm_read_UBYTE (modreader); s->vibsweep = _mm_read_UBYTE (modreader); s->vibdepth = _mm_read_UBYTE (modreader); s->vibrate = _mm_read_UBYTE (modreader); s->samplename = readstring (); if (_mm_eof (modreader)) { _mm_errno = MMERR_LOADING_SAMPLEINFO; return 0; } } return 1; } static BOOL loadinstr6 (void) { int t, w; INSTRUMENT *i; i = of.instruments; for (t = 0; t < of.numins; t++, i++) { i->flags = _mm_read_UBYTE (modreader); i->nnatype = _mm_read_UBYTE (modreader); i->dca = _mm_read_UBYTE (modreader); i->dct = _mm_read_UBYTE (modreader); i->globvol = _mm_read_UBYTE (modreader); i->panning = _mm_read_M_UWORD (modreader); i->pitpansep = _mm_read_UBYTE (modreader); i->pitpancenter = _mm_read_UBYTE (modreader); i->rvolvar = _mm_read_UBYTE (modreader); i->rpanvar = _mm_read_UBYTE (modreader); i->volfade = _mm_read_M_UWORD (modreader); #define UNI_LoadEnvelope6(name) \ i->name##flg=_mm_read_UBYTE(modreader); \ i->name##pts=_mm_read_UBYTE(modreader); \ i->name##susbeg=_mm_read_UBYTE(modreader); \ i->name##susend=_mm_read_UBYTE(modreader); \ i->name##beg=_mm_read_UBYTE(modreader); \ i->name##end=_mm_read_UBYTE(modreader); \ for(w=0;w<(universion>=0x100?32:i->name##pts);w++) { \ i->name##env[w].pos=_mm_read_M_SWORD(modreader); \ i->name##env[w].val=_mm_read_M_SWORD(modreader); \ } UNI_LoadEnvelope6 (vol); UNI_LoadEnvelope6 (pan); UNI_LoadEnvelope6 (pit); #undef UNI_LoadEnvelope6 if (universion == 0x103) _mm_read_M_UWORDS (i->samplenumber, 120, modreader); else for (w = 0; w < 120; w++) i->samplenumber[w] = _mm_read_UBYTE (modreader); _mm_read_UBYTES (i->samplenote, 120, modreader); i->insname = readstring (); if (_mm_eof (modreader)) { _mm_errno = MMERR_LOADING_SAMPLEINFO; return 0; } } return 1; } static BOOL loadinstr5 (void) { INSTRUMENT *i; int t; UWORD wavcnt = 0; UBYTE vibtype, vibsweep, vibdepth, vibrate; i = of.instruments; for (of.numsmp = t = 0; t < of.numins; t++, i++) { int u, numsmp; numsmp = _mm_read_UBYTE (modreader); memset (i->samplenumber, 0xff, INSTNOTES * sizeof (UWORD)); for (u = 0; u < 96; u++) i->samplenumber[u] = of.numsmp + _mm_read_UBYTE (modreader); #define UNI_LoadEnvelope5(name) \ i->name##flg=_mm_read_UBYTE(modreader); \ i->name##pts=_mm_read_UBYTE(modreader); \ i->name##susbeg=_mm_read_UBYTE(modreader); \ i->name##susend=i->name##susbeg; \ i->name##beg=_mm_read_UBYTE(modreader); \ i->name##end=_mm_read_UBYTE(modreader); \ for(u=0;u<12;u++) { \ i->name##env[u].pos=_mm_read_I_SWORD(modreader); \ i->name##env[u].val=_mm_read_I_SWORD(modreader); \ } UNI_LoadEnvelope5 (vol); UNI_LoadEnvelope5 (pan); #undef UNI_LoadEnvelope5 vibtype = _mm_read_UBYTE (modreader); vibsweep = _mm_read_UBYTE (modreader); vibdepth = _mm_read_UBYTE (modreader); vibrate = _mm_read_UBYTE (modreader); i->volfade = _mm_read_I_UWORD (modreader); i->insname = readstring (); for (u = 0; u < numsmp; u++, s++, of.numsmp++) { /* Allocate more room for sample information if necessary */ if (of.numsmp + u == wavcnt) { wavcnt += UNI_SMPINCR; if (!(wh = realloc (wh, wavcnt * sizeof (UNISMP05)))) { _mm_errno = MMERR_OUT_OF_MEMORY; return 0; } s = wh + (wavcnt - UNI_SMPINCR); } s->c2spd = _mm_read_I_UWORD (modreader); s->transpose = _mm_read_SBYTE (modreader); s->volume = _mm_read_UBYTE (modreader); s->panning = _mm_read_UBYTE (modreader); s->length = _mm_read_I_ULONG (modreader); s->loopstart = _mm_read_I_ULONG (modreader); s->loopend = _mm_read_I_ULONG (modreader); s->flags = _mm_read_I_UWORD (modreader); s->samplename = readstring (); s->vibtype = vibtype; s->vibsweep = vibsweep; s->vibdepth = vibdepth; s->vibrate = vibrate; if (_mm_eof (modreader)) { free (wh); wh = NULL; _mm_errno = MMERR_LOADING_SAMPLEINFO; return 0; } } } /* sanity check */ if (!of.numsmp) { if (wh) { free (wh); wh = NULL; } _mm_errno = MMERR_LOADING_SAMPLEINFO; return 0; } return 1; } static BOOL loadsmp5 (void) { int t, u; SAMPLE *q; INSTRUMENT *d; q = of.samples; s = wh; for (u = 0; u < of.numsmp; u++, q++, s++) { q->samplename = s->samplename; q->length = s->length; q->loopstart = s->loopstart; q->loopend = s->loopend; q->volume = s->volume; q->speed = s->c2spd; q->panning = s->panning; q->vibtype = s->vibtype; q->vibsweep = s->vibsweep; q->vibdepth = s->vibdepth; q->vibrate = s->vibrate; /* convert flags */ q->flags = 0; if (s->flags & 128) q->flags |= SF_REVERSE; if (s->flags & 64) q->flags |= SF_SUSTAIN; if (s->flags & 32) q->flags |= SF_BIDI; if (s->flags & 16) q->flags |= SF_LOOP; if (s->flags & 8) q->flags |= SF_BIG_ENDIAN; if (s->flags & 4) q->flags |= SF_DELTA; if (s->flags & 2) q->flags |= SF_SIGNED; if (s->flags & 1) q->flags |= SF_16BITS; } d = of.instruments; s = wh; for (u = 0; u < of.numins; u++, d++) for (t = 0; t < INSTNOTES; t++) d->samplenote[t] = (d->samplenumber[t] >= of.numsmp) ? 255 : (t + s[d->samplenumber[t]].transpose); free (wh); wh = NULL; return 1; } BOOL UNI_Load (BOOL curious) { int t; char *modtype, *oldtype = NULL; INSTRUMENT *d; SAMPLE *q; /* read module header */ _mm_read_UBYTES (mh.id, 4, modreader); if (mh.id[3] != 'N') universion = mh.id[3] - '0'; else universion = 0x100; if (universion >= 6) { if (universion == 6) _mm_read_UBYTE (modreader); else universion = _mm_read_M_UWORD (modreader); mh.flags = _mm_read_M_UWORD (modreader); mh.numchn = _mm_read_UBYTE (modreader); mh.numvoices = _mm_read_UBYTE (modreader); mh.numpos = _mm_read_M_UWORD (modreader); mh.numpat = _mm_read_M_UWORD (modreader); mh.numtrk = _mm_read_M_UWORD (modreader); mh.numins = _mm_read_M_UWORD (modreader); mh.numsmp = _mm_read_M_UWORD (modreader); mh.reppos = _mm_read_M_UWORD (modreader); mh.initspeed = _mm_read_UBYTE (modreader); mh.inittempo = _mm_read_UBYTE (modreader); mh.initvolume = _mm_read_UBYTE (modreader); mh.flags &= (UF_XMPERIODS | UF_LINEAR | UF_INST | UF_NNA); } else { mh.numchn = _mm_read_UBYTE (modreader); mh.numpos = _mm_read_I_UWORD (modreader); mh.reppos = (universion == 5) ? _mm_read_I_UWORD (modreader) : 0; mh.numpat = _mm_read_I_UWORD (modreader); mh.numtrk = _mm_read_I_UWORD (modreader); mh.numins = _mm_read_I_UWORD (modreader); mh.initspeed = _mm_read_UBYTE (modreader); mh.inittempo = _mm_read_UBYTE (modreader); _mm_read_UBYTES (mh.positions, 256, modreader); _mm_read_UBYTES (mh.panning, 32, modreader); mh.flags = _mm_read_UBYTE (modreader); mh.flags &= (UF_XMPERIODS | UF_LINEAR); mh.flags |= UF_INST | UF_NOWRAP; } /* set module parameters */ of.flags = mh.flags; of.numchn = mh.numchn; of.numpos = mh.numpos; of.numpat = mh.numpat; of.numtrk = mh.numtrk; of.numins = mh.numins; of.reppos = mh.reppos; of.initspeed = mh.initspeed; of.inittempo = mh.inittempo; of.songname = readstring (); if (universion < 0x102) oldtype = readstring (); if (oldtype) { int len = strlen (oldtype) + 20; if (!(modtype = _mm_malloc (len))) return 0; #ifdef HAVE_SNPRINTF snprintf (modtype, len, "%s (was %s)", (universion >= 0x100) ? "APlayer" : "MikCvt2", oldtype); #else sprintf (modtype, "%s (was %s)", (universion >= 0x100) ? "APlayer" : "MikCvt2", oldtype); #endif } else { if (!(modtype = _mm_malloc (10))) return 0; #ifdef HAVE_SNPRINTF snprintf (modtype, 10, "%s", (universion >= 0x100) ? "APlayer" : "MikCvt3"); #else sprintf (modtype, "%s", (universion >= 0x100) ? "APlayer" : "MikCvt3"); #endif } of.modtype = strdup (modtype); free (modtype); free (oldtype); of.comment = readstring (); if (universion >= 6) { of.numvoices = mh.numvoices; of.initvolume = mh.initvolume; } if (_mm_eof (modreader)) { _mm_errno = MMERR_LOADING_HEADER; return 0; } /* positions */ if (!AllocPositions (of.numpos)) return 0; if (universion >= 6) { if (universion >= 0x100) _mm_read_M_UWORDS (of.positions, of.numpos, modreader); else for (t = 0; t < of.numpos; t++) of.positions[t] = _mm_read_UBYTE (modreader); _mm_read_M_UWORDS (of.panning, of.numchn, modreader); _mm_read_UBYTES (of.chanvol, of.numchn, modreader); } else { if ((mh.numpos > 256) || (mh.numchn > 32)) { _mm_errno = MMERR_LOADING_HEADER; return 0; } for (t = 0; t < of.numpos; t++) of.positions[t] = mh.positions[t]; for (t = 0; t < of.numchn; t++) of.panning[t] = mh.panning[t]; } /* instruments and samples */ if (universion >= 6) { of.numsmp = mh.numsmp; if (!AllocSamples ()) return 0; if (!loadsmp6 ()) return 0; if (of.flags & UF_INST) { if (!AllocInstruments ()) return 0; if (!loadinstr6 ()) return 0; } } else { if (!AllocInstruments ()) return 0; if (!loadinstr5 ()) return 0; if (!AllocSamples ()) { if (wh) { free (wh); wh = NULL; } return 0; } if (!loadsmp5 ()) return 0; /* check if the original file had no instruments */ if (of.numsmp == of.numins) { for (t = 0, d = of.instruments; t < of.numins; t++, d++) { int u; if ((d->volpts) || (d->panpts) || (d->globvol != 64)) break; for (u = 0; u < 96; u++) if ((d->samplenumber[u] != t) || (d->samplenote[u] != u)) break; if (u != 96) break; } if (t == of.numins) { of.flags &= ~UF_INST; of.flags &= ~UF_NOWRAP; for (t = 0, d = of.instruments, q = of.samples; t < of.numins; t++, d++, q++) { q->samplename = d->insname; d->insname = NULL; } } } } /* patterns */ if (!AllocPatterns ()) return 0; if (universion >= 6) { _mm_read_M_UWORDS (of.pattrows, of.numpat, modreader); _mm_read_M_UWORDS (of.patterns, of.numpat * of.numchn, modreader); } else { _mm_read_I_UWORDS (of.pattrows, of.numpat, modreader); _mm_read_I_UWORDS (of.patterns, of.numpat * of.numchn, modreader); } /* tracks */ if (!AllocTracks ()) return 0; for (t = 0; t < of.numtrk; t++) if (!(of.tracks[t] = readtrack ())) { _mm_errno = MMERR_LOADING_TRACK; return 0; } return 1; } CHAR * UNI_LoadTitle (void) { UBYTE ver; int posit[3] = {304, 306, 26}; _mm_fseek (modreader, 3, SEEK_SET); ver = _mm_read_UBYTE (modreader); if (ver == 'N') ver = '6'; _mm_fseek (modreader, posit[ver - '4'], SEEK_SET); return readstring (); } /*========== Loader information */ MLOADER load_uni = { NULL, "UNI", "APUN (APlayer) and UNI (MikMod)", UNI_Init, UNI_Test, UNI_Load, UNI_Cleanup, UNI_LoadTitle }; /* ex:set ts=4: */ TiMidity++-2.13.2/libunimod/load_xm.c0100644004711200001440000005370407515607670016474 0ustar tamukiusers/* MikMod sound library (c) 1998, 1999 Miodrag Vallat and others - see file AUTHORS for complete list. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /*============================================================================== $Id: load_xm.c,v 1.32 1999/10/25 16:31:41 miod Exp $ Fasttracker (XM) module loader ==============================================================================*/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include extern char *safe_strdup(const char *s); #include "unimod_priv.h" /*========== Module structure */ typedef struct XMHEADER { CHAR id[17]; /* ID text: 'Extended module: ' */ CHAR songname[21]; /* Module name */ CHAR trackername[20]; /* Tracker name */ UWORD version; /* Version number */ ULONG headersize; /* Header size */ UWORD songlength; /* Song length (in patten order table) */ UWORD restart; /* Restart position */ UWORD numchn; /* Number of channels (2,4,6,8,10,...,32) */ UWORD numpat; /* Number of patterns (max 256) */ UWORD numins; /* Number of instruments (max 128) */ UWORD flags; UWORD tempo; /* Default tempo */ UWORD bpm; /* Default BPM */ UBYTE orders[256]; /* Pattern order table */ } XMHEADER; typedef struct XMINSTHEADER { ULONG size; /* Instrument size */ CHAR name[22]; /* Instrument name */ UBYTE type; /* Instrument type (always 0) */ UWORD numsmp; /* Number of samples in instrument */ ULONG ssize; } XMINSTHEADER; #define XMENVCNT (12*2) #define XMNOTECNT (8*OCTAVE) typedef struct XMPATCHHEADER { UBYTE what[XMNOTECNT]; /* Sample number for all notes */ UWORD volenv[XMENVCNT]; /* Points for volume envelope */ UWORD panenv[XMENVCNT]; /* Points for panning envelope */ UBYTE volpts; /* Number of volume points */ UBYTE panpts; /* Number of panning points */ UBYTE volsus; /* Volume sustain point */ UBYTE volbeg; /* Volume loop start point */ UBYTE volend; /* Volume loop end point */ UBYTE pansus; /* Panning sustain point */ UBYTE panbeg; /* Panning loop start point */ UBYTE panend; /* Panning loop end point */ UBYTE volflg; /* Volume type: bit 0: On; 1: Sustain; 2: Loop */ UBYTE panflg; /* Panning type: bit 0: On; 1: Sustain; 2: Loop */ UBYTE vibflg; /* Vibrato type */ UBYTE vibsweep; /* Vibrato sweep */ UBYTE vibdepth; /* Vibrato depth */ UBYTE vibrate; /* Vibrato rate */ UWORD volfade; /* Volume fadeout */ } XMPATCHHEADER; typedef struct XMWAVHEADER { ULONG length; /* Sample length */ ULONG loopstart; /* Sample loop start */ ULONG looplength; /* Sample loop length */ UBYTE volume; /* Volume */ SBYTE finetune; /* Finetune (signed byte -128..+127) */ UBYTE type; /* Loop type */ UBYTE panning; /* Panning (0-255) */ SBYTE relnote; /* Relative note number (signed byte) */ UBYTE reserved; CHAR samplename[22]; /* Sample name */ UBYTE vibtype; /* Vibrato type */ UBYTE vibsweep; /* Vibrato sweep */ UBYTE vibdepth; /* Vibrato depth */ UBYTE vibrate; /* Vibrato rate */ } XMWAVHEADER; typedef struct XMPATHEADER { ULONG size; /* Pattern header length */ UBYTE packing; /* Packing type (always 0) */ UWORD numrows; /* Number of rows in pattern (1..256) */ SWORD packsize; /* Packed patterndata size */ } XMPATHEADER; typedef struct XMNOTE { UBYTE note, ins, vol, eff, dat; } XMNOTE; /*========== Loader variables */ static XMNOTE *xmpat = NULL; static XMHEADER *mh = NULL; /* increment unit for sample array reallocation */ #define XM_SMPINCR 64 static ULONG *nextwav = NULL; static XMWAVHEADER *wh = NULL, *s = NULL; /*========== Loader code */ BOOL XM_Test (void) { UBYTE id[38]; if (!_mm_read_UBYTES (id, 38, modreader)) return 0; if (memcmp (id, "Extended Module: ", 17)) return 0; if (id[37] == 0x1a) return 1; return 0; } BOOL XM_Init (void) { if (!(mh = (XMHEADER *) _mm_malloc (sizeof (XMHEADER)))) return 0; return 1; } void XM_Cleanup (void) { _mm_free (mh); } static int XM_ReadNote (XMNOTE * n) { UBYTE cmp, result = 1; memset (n, 0, sizeof (XMNOTE)); cmp = _mm_read_UBYTE (modreader); if (cmp & 0x80) { if (cmp & 1) { result++; n->note = _mm_read_UBYTE (modreader); } if (cmp & 2) { result++; n->ins = _mm_read_UBYTE (modreader); } if (cmp & 4) { result++; n->vol = _mm_read_UBYTE (modreader); } if (cmp & 8) { result++; n->eff = _mm_read_UBYTE (modreader); } if (cmp & 16) { result++; n->dat = _mm_read_UBYTE (modreader); } } else { n->note = cmp; n->ins = _mm_read_UBYTE (modreader); n->vol = _mm_read_UBYTE (modreader); n->eff = _mm_read_UBYTE (modreader); n->dat = _mm_read_UBYTE (modreader); result += 4; } return result; } static UBYTE * XM_Convert (XMNOTE * xmtrack, UWORD rows) { int t; UBYTE note, ins, vol, eff, dat; UniReset (); for (t = 0; t < rows; t++) { note = xmtrack->note; ins = xmtrack->ins; vol = xmtrack->vol; eff = xmtrack->eff; dat = xmtrack->dat; if (note) { if (note > XMNOTECNT) UniEffect (UNI_KEYFADE, 0); else UniNote (note - 1); } if (ins) UniInstrument (ins - 1); switch (vol >> 4) { case 0x6: /* volslide down */ if (vol & 0xf) UniEffect (UNI_XMEFFECTA, vol & 0xf); break; case 0x7: /* volslide up */ if (vol & 0xf) UniEffect (UNI_XMEFFECTA, vol << 4); break; /* volume-row fine volume slide is compatible with protracker EBx and EAx effects i.e. a zero nibble means DO NOT SLIDE, as opposed to 'take the last sliding value'. */ case 0x8: /* finevol down */ UniPTEffect (0xe, 0xb0 | (vol & 0xf)); break; case 0x9: /* finevol up */ UniPTEffect (0xe, 0xa0 | (vol & 0xf)); break; case 0xa: /* set vibrato speed */ UniPTEffect (0x4, vol << 4); break; case 0xb: /* vibrato */ UniPTEffect (0x4, vol & 0xf); break; case 0xc: /* set panning */ UniPTEffect (0x8, vol << 4); break; case 0xd: /* panning slide left (only slide when data not zero) */ if (vol & 0xf) UniEffect (UNI_XMEFFECTP, vol & 0xf); break; case 0xe: /* panning slide right (only slide when data not zero) */ if (vol & 0xf) UniEffect (UNI_XMEFFECTP, vol << 4); break; case 0xf: /* tone porta */ UniPTEffect (0x3, vol << 4); break; default: if ((vol >= 0x10) && (vol <= 0x50)) UniPTEffect (0xc, vol - 0x10); } switch (eff) { case 0x4: UniEffect (UNI_XMEFFECT4, dat); break; case 0xa: UniEffect (UNI_XMEFFECTA, dat); break; case 0xe: /* Extended effects */ switch (dat >> 4) { case 0x1: /* XM fine porta up */ UniEffect (UNI_XMEFFECTE1, dat & 0xf); break; case 0x2: /* XM fine porta down */ UniEffect (UNI_XMEFFECTE2, dat & 0xf); break; case 0xa: /* XM fine volume up */ UniEffect (UNI_XMEFFECTEA, dat & 0xf); break; case 0xb: /* XM fine volume down */ UniEffect (UNI_XMEFFECTEB, dat & 0xf); break; default: UniPTEffect (eff, dat); } break; case 'G' - 55: /* G - set global volume */ UniEffect (UNI_XMEFFECTG, dat > 64 ? 64 : dat); break; case 'H' - 55: /* H - global volume slide */ UniEffect (UNI_XMEFFECTH, dat); break; case 'K' - 55: /* K - keyOff and KeyFade */ UniEffect (UNI_KEYFADE, dat); break; case 'L' - 55: /* L - set envelope position */ UniEffect (UNI_XMEFFECTL, dat); break; case 'P' - 55: /* P - panning slide */ UniEffect (UNI_XMEFFECTP, dat); break; case 'R' - 55: /* R - multi retrig note */ UniEffect (UNI_S3MEFFECTQ, dat); break; case 'T' - 55: /* T - Tremor */ UniEffect (UNI_S3MEFFECTI, dat); break; case 'X' - 55: switch (dat >> 4) { case 1: /* X1 - Extra Fine Porta up */ UniEffect (UNI_XMEFFECTX1, dat & 0xf); break; case 2: /* X2 - Extra Fine Porta down */ UniEffect (UNI_XMEFFECTX2, dat & 0xf); break; } break; default: if (eff <= 0xf) { /* the pattern jump destination is written in decimal, but it seems some poor tracker software writes them in hexadecimal... (sigh) */ if (eff == 0xd) /* don't change anything if we're sure it's in hexa */ if ((((dat & 0xf0) >> 4) <= 9) && ((dat & 0xf) <= 9)) /* otherwise, convert from dec to hex */ dat = (((dat & 0xf0) >> 4) * 10) + (dat & 0xf); UniPTEffect (eff, dat); } break; } UniNewline (); xmtrack++; } return UniDup (); } static BOOL LoadPatterns (BOOL dummypat) { int t, u, v, numtrk; if (!AllocTracks ()) return 0; if (!AllocPatterns ()) return 0; numtrk = 0; for (t = 0; t < mh->numpat; t++) { XMPATHEADER ph; ph.size = _mm_read_I_ULONG (modreader); if (ph.size < (mh->version == 0x0102 ? 8 : 9)) { _mm_errno = MMERR_LOADING_PATTERN; return 0; } ph.packing = _mm_read_UBYTE (modreader); if (ph.packing) { _mm_errno = MMERR_LOADING_PATTERN; return 0; } if (mh->version == 0x0102) ph.numrows = _mm_read_UBYTE (modreader) + 1; else ph.numrows = _mm_read_I_UWORD (modreader); ph.packsize = _mm_read_I_UWORD (modreader); ph.size -= (mh->version == 0x0102 ? 8 : 9); if (ph.size) _mm_fseek (modreader, ph.size, SEEK_CUR); of.pattrows[t] = ph.numrows; if (ph.numrows) { if (!(xmpat = (XMNOTE *) _mm_calloc (ph.numrows * of.numchn, sizeof (XMNOTE)))) return 0; /* when packsize is 0, don't try to load a pattern.. it's empty. */ if (ph.packsize) for (u = 0; u < ph.numrows; u++) for (v = 0; v < of.numchn; v++) { if (!ph.packsize) break; ph.packsize -= XM_ReadNote (&xmpat[(v * ph.numrows) + u]); if (ph.packsize < 0) { free (xmpat); xmpat = NULL; _mm_errno = MMERR_LOADING_PATTERN; return 0; } } if (ph.packsize) { _mm_fseek (modreader, ph.packsize, SEEK_CUR); } if (_mm_eof (modreader)) { free (xmpat); xmpat = NULL; _mm_errno = MMERR_LOADING_PATTERN; return 0; } for (v = 0; v < of.numchn; v++) of.tracks[numtrk++] = XM_Convert (&xmpat[v * ph.numrows], ph.numrows); free (xmpat); xmpat = NULL; } else { for (v = 0; v < of.numchn; v++) of.tracks[numtrk++] = XM_Convert (NULL, ph.numrows); } } if (dummypat) { of.pattrows[t] = 64; if (!(xmpat = (XMNOTE *) _mm_calloc (64 * of.numchn, sizeof (XMNOTE)))) return 0; for (v = 0; v < of.numchn; v++) of.tracks[numtrk++] = XM_Convert (&xmpat[v * 64], 64); free (xmpat); xmpat = NULL; } return 1; } static BOOL LoadInstruments (void) { int t, u; INSTRUMENT *d; long next = 0; UWORD wavcnt = 0; if (!AllocInstruments ()) return 0; d = of.instruments; for (t = 0; t < of.numins; t++, d++) { XMINSTHEADER ih; long headend; memset (d->samplenumber, 0xff, INSTNOTES * sizeof (UWORD)); /* read instrument header */ headend = _mm_ftell (modreader); ih.size = _mm_read_I_ULONG (modreader); headend += ih.size; _mm_read_string (ih.name, 22, modreader); ih.type = _mm_read_UBYTE (modreader); ih.numsmp = _mm_read_I_UWORD (modreader); d->insname = DupStr (ih.name, 22, 1); if ((SWORD) ih.size > 29) { ih.ssize = _mm_read_I_ULONG (modreader); if (((SWORD) ih.numsmp > 0) && (ih.numsmp <= XMNOTECNT)) { XMPATCHHEADER pth; int p; _mm_read_UBYTES (pth.what, XMNOTECNT, modreader); _mm_read_I_UWORDS (pth.volenv, XMENVCNT, modreader); _mm_read_I_UWORDS (pth.panenv, XMENVCNT, modreader); pth.volpts = _mm_read_UBYTE (modreader); pth.panpts = _mm_read_UBYTE (modreader); pth.volsus = _mm_read_UBYTE (modreader); pth.volbeg = _mm_read_UBYTE (modreader); pth.volend = _mm_read_UBYTE (modreader); pth.pansus = _mm_read_UBYTE (modreader); pth.panbeg = _mm_read_UBYTE (modreader); pth.panend = _mm_read_UBYTE (modreader); pth.volflg = _mm_read_UBYTE (modreader); pth.panflg = _mm_read_UBYTE (modreader); pth.vibflg = _mm_read_UBYTE (modreader); pth.vibsweep = _mm_read_UBYTE (modreader); pth.vibdepth = _mm_read_UBYTE (modreader); pth.vibrate = _mm_read_UBYTE (modreader); pth.volfade = _mm_read_I_UWORD (modreader); /* read the remainder of the header (2 bytes for 1.03, 22 for 1.04) */ for (u = headend - _mm_ftell (modreader); u; u--) _mm_read_UBYTE (modreader); /* #@!$&% fix for K_OSPACE.XM and possibly others */ if(pth.volpts > XMENVCNT/2) pth.volpts = XMENVCNT/2; if(pth.panpts > XMENVCNT/2) pth.panpts = XMENVCNT/2; if ((_mm_eof (modreader)) || (pth.volpts > XMENVCNT / 2) || (pth.panpts > XMENVCNT / 2)) { if (nextwav) { free (nextwav); nextwav = NULL; } if (wh) { free (wh); wh = NULL; } _mm_errno = MMERR_LOADING_SAMPLEINFO; return 0; } for (u = 0; u < XMNOTECNT; u++) d->samplenumber[u] = pth.what[u] + of.numsmp; d->volfade = pth.volfade; #define XM_ProcessEnvelope(name) \ for (u = 0; u < (XMENVCNT / 2); u++) { \ d->name##env[u].pos = pth.name##env[2*u]; \ d->name##env[u].val = pth.name##env[2*u + 1]; \ } \ memcpy(d->name##env,pth.name##env,XMENVCNT); \ if (pth.name##flg&1) d->name##flg|=EF_ON; \ if (pth.name##flg&2) d->name##flg|=EF_SUSTAIN; \ if (pth.name##flg&4) d->name##flg|=EF_LOOP; \ d->name##susbeg=d->name##susend=pth.name##sus; \ d->name##beg=pth.name##beg; \ d->name##end=pth.name##end; \ d->name##pts=pth.name##pts; \ \ /* scale envelope */ \ for (p=0;pname##env[p].val<<=2; \ \ if ((d->name##flg&EF_ON)&&(d->name##pts<2)) \ d->name##flg&=~EF_ON; XM_ProcessEnvelope (vol); XM_ProcessEnvelope (pan); #undef XM_ProcessEnvelope /* Samples are stored outside the instrument struct now, so we have to load them all into a temp area, count the of.numsmp along the way and then do an AllocSamples() and move everything over */ if (mh->version > 0x0103) next = 0; for (u = 0; u < ih.numsmp; u++, s++) { /* Allocate more room for sample information if necessary */ if (of.numsmp + u == wavcnt) { wavcnt += XM_SMPINCR; if (!(nextwav = realloc (nextwav, wavcnt * sizeof (ULONG)))) { if (wh) { free (wh); wh = NULL; } _mm_errno = MMERR_OUT_OF_MEMORY; return 0; } if (!(wh = realloc (wh, wavcnt * sizeof (XMWAVHEADER)))) { free (nextwav); nextwav = NULL; _mm_errno = MMERR_OUT_OF_MEMORY; return 0; } s = wh + (wavcnt - XM_SMPINCR); } s->length = _mm_read_I_ULONG (modreader); s->loopstart = _mm_read_I_ULONG (modreader); s->looplength = _mm_read_I_ULONG (modreader); s->volume = _mm_read_UBYTE (modreader); s->finetune = _mm_read_SBYTE (modreader); s->type = _mm_read_UBYTE (modreader); s->panning = _mm_read_UBYTE (modreader); s->relnote = _mm_read_SBYTE (modreader); s->vibtype = pth.vibflg; s->vibsweep = pth.vibsweep; s->vibdepth = pth.vibdepth * 4; s->vibrate = pth.vibrate; s->reserved = _mm_read_UBYTE (modreader); _mm_read_string (s->samplename, 22, modreader); nextwav[of.numsmp + u] = next; next += s->length; if (_mm_eof (modreader)) { free (nextwav); free (wh); nextwav = NULL; wh = NULL; _mm_errno = MMERR_LOADING_SAMPLEINFO; return 0; } } if (mh->version > 0x0103) { for (u = 0; u < ih.numsmp; u++) nextwav[of.numsmp++] += _mm_ftell (modreader); _mm_fseek (modreader, next, SEEK_CUR); } else of.numsmp += ih.numsmp; } else { /* read the remainder of the header */ for (u = headend - _mm_ftell (modreader); u; u--) _mm_read_UBYTE (modreader); if (_mm_eof (modreader)) { free (nextwav); free (wh); nextwav = NULL; wh = NULL; _mm_errno = MMERR_LOADING_SAMPLEINFO; return 0; } } } } /* sanity check */ if (!of.numsmp) { if (nextwav) { free (nextwav); nextwav = NULL; } if (wh) { free (wh); wh = NULL; } _mm_errno = MMERR_LOADING_SAMPLEINFO; return 0; } return 1; } BOOL XM_Load (BOOL curious) { INSTRUMENT *d; SAMPLE *q; int t, u; BOOL dummypat = 0; char tracker[21], modtype[60]; /* try to read module header */ _mm_read_string (mh->id, 17, modreader); _mm_read_string (mh->songname, 21, modreader); _mm_read_string (mh->trackername, 20, modreader); mh->version = _mm_read_I_UWORD (modreader); if ((mh->version < 0x102) || (mh->version > 0x104)) { _mm_errno = MMERR_NOT_A_MODULE; return 0; } mh->headersize = _mm_read_I_ULONG (modreader); mh->songlength = _mm_read_I_UWORD (modreader); mh->restart = _mm_read_I_UWORD (modreader); mh->numchn = _mm_read_I_UWORD (modreader); mh->numpat = _mm_read_I_UWORD (modreader); mh->numins = _mm_read_I_UWORD (modreader); mh->flags = _mm_read_I_UWORD (modreader); mh->tempo = _mm_read_I_UWORD (modreader); mh->bpm = _mm_read_I_UWORD (modreader); if (!mh->bpm) { _mm_errno = MMERR_NOT_A_MODULE; return 0; } _mm_read_UBYTES (mh->orders, 256, modreader); if (_mm_eof (modreader)) { _mm_errno = MMERR_LOADING_HEADER; return 0; } /* set module variables */ of.initspeed = mh->tempo; of.inittempo = mh->bpm; strncpy (tracker, mh->trackername, 20); tracker[20] = 0; for (t = 20; (tracker[t] <= ' ') && (t >= 0); t--) tracker[t] = 0; /* some modules have the tracker name empty */ if (!tracker[0]) strcpy (tracker, "Unknown tracker"); #ifdef HAVE_SNPRINTF snprintf (modtype, 60, "%s (XM format %d.%02d)", tracker, mh->version >> 8, mh->version & 0xff); #else sprintf (modtype, "%s (XM format %d.%02d)", tracker, mh->version >> 8, mh->version & 0xff); #endif of.modtype = safe_strdup (modtype); of.numchn = mh->numchn; of.numpat = mh->numpat; of.numtrk = (UWORD) of.numpat * of.numchn; /* get number of channels */ of.songname = DupStr (mh->songname, 20, 1); of.numpos = mh->songlength; /* copy the songlength */ of.reppos = mh->restart < mh->songlength ? mh->restart : 0; of.numins = mh->numins; of.flags |= UF_XMPERIODS | UF_INST | UF_BGSLIDES | UF_NOWRAP | UF_FT2QUIRKS; if (mh->flags & 1) of.flags |= UF_LINEAR; memset (of.chanvol, 64, of.numchn); /* store channel volumes */ if (!AllocPositions (of.numpos + 1)) return 0; for (t = 0; t < of.numpos; t++) of.positions[t] = mh->orders[t]; /* We have to check for any pattern numbers in the order list greater than the number of patterns total. If one or more is found, we set it equal to the pattern total and make a dummy pattern to workaround the problem */ for (t = 0; t < of.numpos; t++) { if (of.positions[t] >= of.numpat) { of.positions[t] = of.numpat; dummypat = 1; } } if (dummypat) { of.numpat++; of.numtrk += of.numchn; } if (mh->version < 0x0104) { if (!LoadInstruments ()) return 0; if (!LoadPatterns (dummypat)) return 0; for (t = 0; t < of.numsmp; t++) nextwav[t] += _mm_ftell (modreader); } else { if (!LoadPatterns (dummypat)) return 0; if (!LoadInstruments ()) return 0; } if (!AllocSamples ()) { free (nextwav); free (wh); nextwav = NULL; wh = NULL; return 0; } q = of.samples; s = wh; for (u = 0; u < of.numsmp; u++, q++, s++) { q->samplename = DupStr (s->samplename, 22, 1); q->length = s->length; q->loopstart = s->loopstart; q->loopend = s->loopstart + s->looplength; q->volume = s->volume; q->speed = s->finetune + 128; q->panning = s->panning; q->seekpos = nextwav[u]; q->vibtype = s->vibtype; q->vibsweep = s->vibsweep; q->vibdepth = s->vibdepth; q->vibrate = s->vibrate; if (s->type & 0x10) { q->length >>= 1; q->loopstart >>= 1; q->loopend >>= 1; } q->flags |= SF_OWNPAN; if (s->type & 0x3) q->flags |= SF_LOOP; if (s->type & 0x2) q->flags |= SF_BIDI; if (s->type & 0x10) q->flags |= SF_16BITS; q->flags |= SF_DELTA | SF_SIGNED; } d = of.instruments; s = wh; for (u = 0; u < of.numins; u++, d++) for (t = 0; t < XMNOTECNT; t++) { if (d->samplenumber[t] >= of.numsmp) d->samplenote[t] = 255; else { int note = t + s[d->samplenumber[t]].relnote; d->samplenote[t] = (note < 0) ? 0 : note; } } free (wh); free (nextwav); wh = NULL; nextwav = NULL; return 1; } CHAR * XM_LoadTitle (void) { CHAR s[21]; _mm_fseek (modreader, 17, SEEK_SET); if (!_mm_read_UBYTES (s, 21, modreader)) return NULL; return (DupStr (s, 21, 1)); } /*========== Loader information */ MLOADER load_xm = { NULL, "XM", "XM (FastTracker 2)", XM_Init, XM_Test, XM_Load, XM_Cleanup, XM_LoadTitle }; /* ex:set ts=4: */ TiMidity++-2.13.2/libunimod/mloader.c0100644004711200001440000005665110014435412016455 0ustar tamukiusers/* MikMod sound library (c) 1998, 1999 Miodrag Vallat and others - see file AUTHORS for complete list. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /*============================================================================== $Id: mloader.c,v 1.33 1999/10/25 16:31:41 miod Exp $ These routines are used to access the available module loaders ==============================================================================*/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #ifdef HAVE_MEMORY_H #include #endif #include "unimod_priv.h" #include URL modreader; MODULE of; BOOL ML_8bitsamples; BOOL ML_monosamples; static MLOADER *firstloader = NULL; UWORD finetune[16] = { 8363, 8413, 8463, 8529, 8581, 8651, 8723, 8757, 7895, 7941, 7985, 8046, 8107, 8169, 8232, 8280 }; /* This is a handle of sorts attached to any sample registered with SL_RegisterSample. */ typedef struct SAMPLOAD { struct SAMPLOAD *next; ULONG length; /* length of sample (in samples!) */ ULONG loopstart; /* repeat position (relative to start, in samples) */ ULONG loopend; /* repeat end */ UWORD infmt, outfmt; int scalefactor; SAMPLE *sample; URL reader; } SAMPLOAD; static int sl_rlength; static SWORD sl_old; static SWORD *sl_buffer = NULL; static SAMPLOAD *musiclist = NULL; /* size of the loader buffer in words */ #define SLBUFSIZE 2048 /* max # of KB to be devoted to samples */ /* #define MAX_SAMPLESPACE 1024 */ /* IT-Compressed status structure */ typedef struct ITPACK { UWORD bits; /* current number of bits */ UWORD bufbits; /* bits in buffer */ SWORD last; /* last output */ UBYTE buf; /* bit buffer */ } ITPACK; #ifdef MAX_SAMPLESPACE static void SL_HalveSample (SAMPLOAD *); #endif static void SL_Sample8to16 (SAMPLOAD *); static void SL_Sample16to8 (SAMPLOAD *); static void SL_SampleSigned (SAMPLOAD *); static void SL_SampleUnsigned (SAMPLOAD *); static SAMPLOAD *SL_RegisterSample (SAMPLE *, URL); static SWORD *SL_Load (SAMPLOAD *); static BOOL SL_Init (SAMPLOAD *); static void SL_Exit (SAMPLOAD *); BOOL SL_Init (SAMPLOAD * s) { if (!sl_buffer) if (!(sl_buffer = _mm_malloc (SLBUFSIZE * sizeof (SWORD)))) return 0; sl_rlength = s->length; if (s->infmt & SF_16BITS) sl_rlength >>= 1; sl_old = 0; return 1; } void SL_Exit (SAMPLOAD * s) { if (sl_rlength > 0) _mm_fseek (s->reader, sl_rlength, SEEK_CUR); if (sl_buffer) { free (sl_buffer); sl_buffer = NULL; } } /* unpack a 8bit IT packed sample */ static BOOL read_itcompr8 (ITPACK * status, URL reader, SWORD * sl_buffer, UWORD count, UWORD * incnt) { SWORD *dest = sl_buffer, *end = sl_buffer + count; UWORD x, y, needbits, havebits, new_count = 0; UWORD bits = status->bits; UWORD bufbits = status->bufbits; SBYTE last = status->last; UBYTE buf = status->buf; while (dest < end) { needbits = new_count ? 3 : bits; x = havebits = 0; while (needbits) { /* feed buffer */ if (!bufbits) { if ((*incnt)--) buf = _mm_read_UBYTE (reader); else buf = 0; bufbits = 8; } /* get as many bits as necessary */ y = needbits < bufbits ? needbits : bufbits; x |= (buf & ((1 << y) - 1)) << havebits; buf >>= y; bufbits -= y; needbits -= y; havebits += y; } if (new_count) { new_count = 0; if (++x >= bits) x++; bits = x; continue; } if (bits < 7) { if (x == (1 << (bits - 1))) { new_count = 1; continue; } } else if (bits < 9) { y = (0xff >> (9 - bits)) - 4; if ((x > y) && (x <= y + 8)) { if ((x -= y) >= bits) x++; bits = x; continue; } } else if (bits < 10) { if (x >= 0x100) { bits = x - 0x100 + 1; continue; } } else { /* error in compressed data... */ _mm_errno = MMERR_ITPACK_INVALID_DATA; return 0; } if (bits < 8) /* extend sign */ x = ((SBYTE) (x << (8 - bits))) >> (8 - bits); *(dest++) = (last += x) << 8; /* convert to 16 bit */ } status->bits = bits; status->bufbits = bufbits; status->last = last; status->buf = buf; return dest - sl_buffer; } /* unpack a 16bit IT packed sample */ static BOOL read_itcompr16 (ITPACK * status, URL reader, SWORD * sl_buffer, UWORD count, UWORD * incnt) { SWORD *dest = sl_buffer, *end = sl_buffer + count; SLONG x, y, needbits, havebits, new_count = 0; UWORD bits = status->bits; UWORD bufbits = status->bufbits; SWORD last = status->last; UBYTE buf = status->buf; while (dest < end) { needbits = new_count ? 4 : bits; x = havebits = 0; while (needbits) { /* feed buffer */ if (!bufbits) { if ((*incnt)--) buf = _mm_read_UBYTE (reader); else buf = 0; bufbits = 8; } /* get as many bits as necessary */ y = needbits < bufbits ? needbits : bufbits; x |= (buf & ((1 << y) - 1)) << havebits; buf >>= y; bufbits -= y; needbits -= y; havebits += y; } if (new_count) { new_count = 0; if (++x >= bits) x++; bits = x; continue; } if (bits < 7) { if (x == (1 << (bits - 1))) { new_count = 1; continue; } } else if (bits < 17) { y = (0xffff >> (17 - bits)) - 8; if ((x > y) && (x <= y + 16)) { if ((x -= y) >= bits) x++; bits = x; continue; } } else if (bits < 18) { if (x >= 0x10000) { bits = x - 0x10000 + 1; continue; } } else { /* error in compressed data... */ _mm_errno = MMERR_ITPACK_INVALID_DATA; return 0; } if (bits < 16) /* extend sign */ x = ((SWORD) (x << (16 - bits))) >> (16 - bits); *(dest++) = (last += x); } status->bits = bits; status->bufbits = bufbits; status->last = last; status->buf = buf; return dest - sl_buffer; } static BOOL SL_LoadInternal (void *buffer, UWORD infmt, UWORD outfmt, int scalefactor, ULONG length, URL reader) { SBYTE *bptr = (SBYTE *) buffer; SWORD *wptr = (SWORD *) buffer; int stodo, t, u; int result, c_block = 0; /* compression bytes until next block */ ITPACK status; UWORD incnt; while (length) { stodo = (length < SLBUFSIZE) ? length : SLBUFSIZE; if (infmt & SF_ITPACKED) { sl_rlength = 0; if (!c_block) { status.bits = (infmt & SF_16BITS) ? 17 : 9; status.last = status.bufbits = 0; incnt = _mm_read_I_UWORD (reader); c_block = (infmt & SF_16BITS) ? 0x4000 : 0x8000; if (infmt & SF_DELTA) sl_old = 0; } if (infmt & SF_16BITS) { if (!(result = read_itcompr16 (&status, reader, sl_buffer, stodo, &incnt))) return 1; } else { if (!(result = read_itcompr8 (&status, reader, sl_buffer, stodo, &incnt))) return 1; } if (result != stodo) { _mm_errno = MMERR_ITPACK_INVALID_DATA; return 1; } c_block -= stodo; } else { if (infmt & SF_16BITS) { if (infmt & SF_BIG_ENDIAN) _mm_read_M_SWORDS (sl_buffer, stodo, reader); else _mm_read_I_SWORDS (sl_buffer, stodo, reader); } else { /* Always convert to 16 bits for internal use */ SBYTE *src; SWORD *dest; _mm_read_UBYTES (sl_buffer, stodo, reader); src = (SBYTE *) sl_buffer; dest = sl_buffer; src += stodo; dest += stodo; for (t = 0; t < stodo; t++) { src--; dest--; *dest = (*src) << 8; } } sl_rlength -= stodo; } if (infmt & SF_DELTA) for (t = 0; t < stodo; t++) { sl_buffer[t] += sl_old; sl_old = sl_buffer[t]; } if ((infmt ^ outfmt) & SF_SIGNED) for (t = 0; t < stodo; t++) sl_buffer[t] ^= 0x8000; /* Dithering... */ if ((infmt & SF_STEREO) && !(outfmt & SF_STEREO)) { /* dither stereo to mono, average together every two samples */ SLONG avgval; int idx = 0; t = 0; while (t < stodo && length) { avgval = sl_buffer[t++]; avgval += sl_buffer[t++]; sl_buffer[idx++] = avgval >> 1; length -= 2; } stodo = idx; } else if (scalefactor) { int idx = 0; SLONG scaleval; /* Sample Scaling... average values for better results. */ t = 0; while (t < stodo && length) { scaleval = 0; for (u = scalefactor; u && t < stodo; u--, t++) scaleval += sl_buffer[t]; sl_buffer[idx++] = scaleval / (scalefactor - u); length--; } stodo = idx; } else length -= stodo; if (outfmt & SF_16BITS) { for (t = 0; t < stodo; t++) *(wptr++) = sl_buffer[t]; } else { for (t = 0; t < stodo; t++) *(bptr++) = sl_buffer[t] >> 8; } } return 0; } static SWORD * SL_Load (struct SAMPLOAD *sload) { SAMPLE *s = sload->sample; SWORD *data; ULONG t, length, loopstart, loopend; length = s->length; loopstart = s->loopstart; loopend = s->loopend; if (!(data = (SWORD *) _mm_malloc ((length + 20) << 1))) { _mm_errno = MMERR_SAMPLE_TOO_BIG; return NULL; } /* read sample into buffer */ if (SL_LoadInternal (data, sload->infmt, sload->outfmt, sload->scalefactor, length, sload->reader)) return NULL; /* Unclick sample */ if (s->flags & SF_LOOP) { if (s->flags & SF_BIDI) for (t = 0; t < 16; t++) data[loopend + t] = data[(loopend - t) - 1]; else for (t = 0; t < 16; t++) data[loopend + t] = data[t + loopstart]; } else for (t = 0; t < 16; t++) data[t + length] = 0; return data; } /* Registers a sample for loading when SL_LoadSamples() is called. */ SAMPLOAD * SL_RegisterSample (SAMPLE * s, URL reader) { SAMPLOAD *news, *cruise; cruise = musiclist; /* Allocate and add structure to the END of the list */ if (!(news = (SAMPLOAD *) _mm_malloc (sizeof (SAMPLOAD)))) return NULL; if (cruise) { while (cruise->next) cruise = cruise->next; cruise->next = news; } else musiclist = news; news->infmt = s->flags & SF_FORMATMASK; news->outfmt = news->infmt; news->reader = reader; news->sample = s; news->length = s->length; news->loopstart = s->loopstart; news->loopend = s->loopend; if (ML_monosamples) { news->outfmt &= ~SF_STEREO; } if (ML_8bitsamples) { SL_SampleUnsigned (news); SL_Sample16to8 (news); } else { SL_SampleSigned (news); SL_Sample8to16 (news); } return news; } static void FreeSampleList () { SAMPLOAD *old, *s = musiclist; while (s) { old = s; s = s->next; free (old); } musiclist = NULL; } /* Returns the total amount of memory required by the musiclist queue. */ #ifdef MAX_SAMPLESPACE static ULONG SampleTotal () { int total = 0; SAMPLOAD *samplist = musiclist; SAMPLE *s; while (samplist) { s = samplist->sample; s->flags = (s->flags & ~SF_FORMATMASK) | samplist->outfmt; total += (s->length * ((s->flags & SF_16BITS) ? 2 : 1)) + 16; samplist = samplist->next; } return total; } static ULONG RealSpeed (SAMPLOAD * s) { return (s->sample->speed / (s->scalefactor ? s->scalefactor : 1)); } #endif BOOL SL_LoadSamples (void) { SAMPLOAD *s; if (!musiclist) return 0; #ifdef MAX_SAMPLESPACE while (SampleTotal () > (MAX_SAMPLESPACE * 1024)) { /* First Pass - check for any 16 bit samples */ s = musiclist; while (s) { if (s->outfmt & SF_16BITS) { SL_Sample16to8 (s); break; } s = s->next; } /* Second pass (if no 16bits found above) is to take the sample with the highest speed and dither it by half. */ if (!s) { SAMPLOAD *c2smp = NULL; ULONG maxsize, speed; s = musiclist; speed = 0; while (s) { if ((s->sample->length) && (RealSpeed (s) > speed)) { speed = RealSpeed (s); c2smp = s; } s = s->next; } if (c2smp) SL_HalveSample (c2smp); } } #endif /* Samples dithered, now load them ! */ s = musiclist; while (s) { /* sample has to be loaded ? -> increase number of samples, allocate memory and load sample. */ if (s->sample->length) { if (s->sample->seekpos) _mm_fseek (s->reader, s->sample->seekpos, SEEK_SET); /* Call the sample load routine of the driver module. It has to return a pointer to sample dat). */ if (SL_Init (s)) { s->sample->data = SL_Load (s); SL_Exit (s); } s->sample->flags = (s->sample->flags & ~SF_FORMATMASK) | s->outfmt; if (s->sample->data == NULL) { FreeSampleList (musiclist); return 1; } } s = s->next; } FreeSampleList (musiclist); return 0; } void SL_Sample16to8 (SAMPLOAD * s) { s->outfmt &= ~SF_16BITS; s->sample->flags = (s->sample->flags & ~SF_FORMATMASK) | s->outfmt; } void SL_Sample8to16 (SAMPLOAD * s) { s->outfmt |= SF_16BITS; s->sample->flags = (s->sample->flags & ~SF_FORMATMASK) | s->outfmt; } void SL_SampleSigned (SAMPLOAD * s) { s->outfmt |= SF_SIGNED; s->sample->flags = (s->sample->flags & ~SF_FORMATMASK) | s->outfmt; } void SL_SampleUnsigned (SAMPLOAD * s) { s->outfmt &= ~SF_SIGNED; s->sample->flags = (s->sample->flags & ~SF_FORMATMASK) | s->outfmt; } #ifdef MAX_SAMPLESPACE void SL_HalveSample (SAMPLOAD * s) { s->scalefactor = 2; /* this is a divisor */ s->sample->divfactor = 1; /* this is a shift count */ s->sample->length = s->length / s->scalefactor; s->sample->loopstart = s->loopstart / s->scalefactor; s->sample->loopend = s->loopend / s->scalefactor; } #endif CHAR * ML_InfoLoader (void) { int len = 0; MLOADER *l; CHAR *list = NULL; /* compute size of buffer */ for (l = firstloader; l; l = l->next) len += 1 + (l->next ? 1 : 0) + strlen (l->version); if (len) if ((list = _mm_malloc (len * sizeof (CHAR)))) { list[0] = 0; /* list all registered module loders */ for (l = firstloader; l; l = l->next) sprintf (list, (l->next) ? "%s%s\n" : "%s%s", list, l->version); } return list; } BOOL ReadComment (UWORD len) { if (len) { int i; if (!(of.comment = (CHAR *) _mm_malloc (len + 1))) return 0; _mm_read_UBYTES (of.comment, len, modreader); /* translate IT linefeeds */ for (i = 0; i < len; i++) if (of.comment[i] == '\r') of.comment[i] = '\n'; of.comment[len] = 0; /* just in case */ } if (!of.comment[0]) { free (of.comment); of.comment = NULL; } return 1; } BOOL ReadLinedComment (UWORD lines, UWORD linelen) { CHAR *tempcomment, *line, *storage; UWORD total = 0, t, len = lines * linelen; int i; if (lines) { if (!(tempcomment = (CHAR *) _mm_malloc (len + 1))) return 0; if (!(storage = (CHAR *) _mm_malloc (linelen + 1))) { free (tempcomment); return 0; } _mm_read_UBYTES (tempcomment, len, modreader); /* compute message length */ for (line = tempcomment, total = t = 0; t < lines; t++, line += linelen) { for (i = linelen; (i >= 0) && (line[i] == ' '); i--) line[i] = 0; for (i = 0; i < linelen; i++) if (!line[i]) break; total += 1 + i; } if (total > lines) { if (!(of.comment = (CHAR *) _mm_malloc (total + 1))) { free (storage); free (tempcomment); return 0; } /* convert message */ for (line = tempcomment, t = 0; t < lines; t++, line += linelen) { for (i = 0; i < linelen; i++) if (!(storage[i] = line[i])) break; storage[i] = 0; /* if (i==linelen) */ strcat (of.comment, storage); strcat (of.comment, "\r"); } free (storage); free (tempcomment); } } return 1; } BOOL AllocPositions (int total) { if (!total) { _mm_errno = MMERR_NOT_A_MODULE; return 0; } if (!(of.positions = _mm_calloc (total, sizeof (UWORD)))) return 0; return 1; } BOOL AllocPatterns (void) { int s, t, tracks = 0; if ((!of.numpat) || (!of.numchn)) { _mm_errno = MMERR_NOT_A_MODULE; return 0; } /* Allocate track sequencing array */ if (!(of.patterns = (UWORD *) _mm_calloc ((ULONG) (of.numpat + 1) * of.numchn, sizeof (UWORD)))) return 0; if (!(of.pattrows = (UWORD *) _mm_calloc (of.numpat + 1, sizeof (UWORD)))) return 0; for (t = 0; t <= of.numpat; t++) { of.pattrows[t] = 64; for (s = 0; s < of.numchn; s++) of.patterns[(t * of.numchn) + s] = tracks++; } return 1; } BOOL AllocTracks (void) { if (!of.numtrk) { _mm_errno = MMERR_NOT_A_MODULE; return 0; } if (!(of.tracks = (UBYTE **) _mm_calloc (of.numtrk, sizeof (UBYTE *)))) return 0; return 1; } BOOL AllocInstruments (void) { int t, n; if (!of.numins) { _mm_errno = MMERR_NOT_A_MODULE; return 0; } if (!(of.instruments = (INSTRUMENT *) _mm_calloc (of.numins, sizeof (INSTRUMENT)))) return 0; for (t = 0; t < of.numins; t++) { for (n = 0; n < INSTNOTES; n++) { /* Init note / sample lookup table */ of.instruments[t].samplenote[n] = n; of.instruments[t].samplenumber[n] = t; } of.instruments[t].globvol = 64; } return 1; } BOOL AllocSamples (void) { UWORD u; if (!of.numsmp) { _mm_errno = MMERR_NOT_A_MODULE; return 0; } if (!(of.samples = (SAMPLE *) _mm_calloc (of.numsmp, sizeof (SAMPLE)))) return 0; for (u = 0; u < of.numsmp; u++) { of.samples[u].panning = 128; /* center */ of.samples[u].data = NULL; of.samples[u].globvol = 64; of.samples[u].volume = 64; } return 1; } static BOOL ML_LoadSamples (void) { SAMPLE *s; int u; for (u = of.numsmp, s = of.samples; u; u--, s++) if (s->length) SL_RegisterSample (s, modreader); return 1; } /* Creates a CSTR out of a character buffer of 'len' bytes, but strips any terminating non-printing characters like 0, spaces etc. */ CHAR * DupStr (CHAR * s, UWORD len, BOOL strict) { UWORD t; CHAR *d = NULL; /* Scan for last printing char in buffer [includes high ascii up to 254] */ while (len) { if (s[len - 1] > 0x20) break; len--; } /* Scan forward for possible NULL character */ if (strict) { for (t = 0; t < len; t++) if (!s[t]) break; if (t < len) len = t; } /* When the buffer wasn't completely empty, allocate a cstring and copy the buffer into that string, except for any control-chars */ if ((d = (CHAR *) _mm_malloc (sizeof (CHAR) * (len + 1)))) { for (t = 0; t < len; t++) d[t] = (s[t] < 32) ? '.' : s[t]; d[len] = 0; } return d; } static void ML_XFreeSample (SAMPLE * s) { if (s->data) free (s->data); if (s->samplename) free (s->samplename); } static void ML_XFreeInstrument (INSTRUMENT * i) { if (i->insname) free (i->insname); } void ML_Free (MODULE * mf) { UWORD t; if (!mf) return; if (mf->songname) free (mf->songname); if (mf->comment) free (mf->comment); if (mf->modtype) free (mf->modtype); if (mf->positions) free (mf->positions); if (mf->patterns) free (mf->patterns); if (mf->pattrows) free (mf->pattrows); if (mf->tracks) { for (t = 0; t < mf->numtrk; t++) if (mf->tracks[t]) free (mf->tracks[t]); free (mf->tracks); } if (mf->instruments) { for (t = 0; t < mf->numins; t++) ML_XFreeInstrument (&mf->instruments[t]); free (mf->instruments); } if (mf->samples) { for (t = 0; t < mf->numsmp; t++) if (mf->samples[t].length) ML_XFreeSample (&mf->samples[t]); free (mf->samples); } memset (mf, 0, sizeof (MODULE)); if (mf != &of) free (mf); } static MODULE * ML_AllocUniMod (void) { return (_mm_malloc (sizeof (MODULE))); } CHAR * ML_LoadTitle (URL reader) { MLOADER *l; modreader = reader; _mm_errno = 0; /* Try to find a loader that recognizes the module */ for (l = firstloader; l; l = l->next) { _mm_rewind (modreader); if (l->Test ()) break; } if (!l) { _mm_errno = MMERR_NOT_A_MODULE; return NULL; } return l->LoadTitle (); } /* Check if it is a module given a reader */ BOOL ML_Test (URL reader) { MLOADER *l; modreader = reader; _mm_errno = 0; /* Try to find a loader that recognizes the module */ for (l = firstloader; l; l = l->next) { _mm_rewind (modreader); if (l->Test ()) return 1; } return 0; } /* Loads a module given a reader */ MODULE * ML_Load (URL reader, int maxchan, BOOL curious) { int t; MLOADER *l; BOOL ok; MODULE *mf; modreader = reader; _mm_errno = 0; /* Try to find a loader that recognizes the module */ for (l = firstloader; l; l = l->next) { _mm_rewind (modreader); if (l->Test ()) break; } if (!l) { _mm_errno = MMERR_NOT_A_MODULE; _mm_rewind (modreader); return NULL; } /* init unitrk routines */ if (!UniInit ()) { _mm_rewind (modreader); return NULL; } /* load the song using the song's loader variable */ memset (&of, 0, sizeof (MODULE)); of.initvolume = 128; /* init panning array */ for (t = 0; t < 64; t++) of.panning[t] = ((t + 1) & 2) ? 255 : 0; for (t = 0; t < 64; t++) of.chanvol[t] = 64; /* init module loader and load the header / patterns */ if (l->Init ()) { _mm_rewind (modreader); ok = l->Load (curious); } else ok = 0; /* free loader and unitrk allocations */ l->Cleanup (); UniCleanup (); if (!ok) { ML_Free (&of); _mm_rewind (modreader); return NULL; } if (!ML_LoadSamples ()) { ML_Free (&of); _mm_rewind (modreader); return NULL; } if (!(mf = ML_AllocUniMod ())) { ML_Free (&of); return NULL; } /* Copy the static MODULE contents into the dynamic MODULE struct. */ memcpy (mf, &of, sizeof (MODULE)); if (maxchan > 0) { if (!(mf->flags & UF_NNA) && (mf->numchn < maxchan)) maxchan = mf->numchn; else if ((mf->numvoices) && (mf->numvoices < maxchan)) maxchan = mf->numvoices; if (maxchan < mf->numchn) mf->flags |= UF_NNA; } if (SL_LoadSamples ()) { ML_Free (mf); return NULL; } return mf; } void ML_RegisterAllLoaders (void) { MLOADER *last = NULL; if (firstloader) return; #define LOADER(fmt) { \ extern MLOADER fmt; \ if (!last) \ firstloader = &fmt; \ else \ last->next = &fmt; \ last = &fmt; \ } /* Most likely first */ LOADER (load_xm); LOADER (load_s3m); LOADER (load_mod); LOADER (load_it); /* Then the others in alphabetic order */ LOADER (load_669); LOADER (load_amf); LOADER (load_dsm); LOADER (load_far); LOADER (load_gdm); LOADER (load_imf); LOADER (load_med); LOADER (load_mtm); LOADER (load_okt); LOADER (load_stm); LOADER (load_stx); LOADER (load_ult); LOADER (load_uni); /* must be last! */ LOADER (load_m15); } /* ex:set ts=4: */ TiMidity++-2.13.2/libunimod/mlutil.c0100644004711200001440000004330007515605566016350 0ustar tamukiusers/* MikMod sound library (c) 1998, 1999 Miodrag Vallat and others - see file AUTHORS for complete list. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /*============================================================================== $Id: mlutil.c,v 1.12 1999/10/25 16:31:41 miod Exp $ Utility functions for the module loader ==============================================================================*/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #ifdef HAVE_MEMORY_H #include #endif #include #include "unimod_priv.h" extern void *safe_realloc(void *old_ptr, size_t new_size); SBYTE remap[64]; /* for removing empty channels */ UBYTE* poslookup=NULL; /* lookup table for pattern jumps after blank pattern removal */ UBYTE poslookupcnt; UWORD* origpositions=NULL; BOOL filters; /* resonant filters in use */ UBYTE activemacro; /* active midi macro number for Sxx,xx<80h */ UBYTE filtermacros[16]; /* midi macros settings */ FILTER filtersettings[256]; /* computed filter settings */ /* tracker identifiers */ CHAR *STM_Signatures[STM_NTRACKERS] = { "!Scream!", "BMOD2STM", "WUZAMOD!" }; CHAR *STM_Version[STM_NTRACKERS] = { "Screamtracker 2", "Converted by MOD2STM (STM format)", "Wuzamod (STM format)" }; /*========== Linear periods stuff */ /* Triton's linear periods to frequency translation table (for XM modules) */ static ULONG lintab[768] = { 535232, 534749, 534266, 533784, 533303, 532822, 532341, 531861, 531381, 530902, 530423, 529944, 529466, 528988, 528511, 528034, 527558, 527082, 526607, 526131, 525657, 525183, 524709, 524236, 523763, 523290, 522818, 522346, 521875, 521404, 520934, 520464, 519994, 519525, 519057, 518588, 518121, 517653, 517186, 516720, 516253, 515788, 515322, 514858, 514393, 513929, 513465, 513002, 512539, 512077, 511615, 511154, 510692, 510232, 509771, 509312, 508852, 508393, 507934, 507476, 507018, 506561, 506104, 505647, 505191, 504735, 504280, 503825, 503371, 502917, 502463, 502010, 501557, 501104, 500652, 500201, 499749, 499298, 498848, 498398, 497948, 497499, 497050, 496602, 496154, 495706, 495259, 494812, 494366, 493920, 493474, 493029, 492585, 492140, 491696, 491253, 490809, 490367, 489924, 489482, 489041, 488600, 488159, 487718, 487278, 486839, 486400, 485961, 485522, 485084, 484647, 484210, 483773, 483336, 482900, 482465, 482029, 481595, 481160, 480726, 480292, 479859, 479426, 478994, 478562, 478130, 477699, 477268, 476837, 476407, 475977, 475548, 475119, 474690, 474262, 473834, 473407, 472979, 472553, 472126, 471701, 471275, 470850, 470425, 470001, 469577, 469153, 468730, 468307, 467884, 467462, 467041, 466619, 466198, 465778, 465358, 464938, 464518, 464099, 463681, 463262, 462844, 462427, 462010, 461593, 461177, 460760, 460345, 459930, 459515, 459100, 458686, 458272, 457859, 457446, 457033, 456621, 456209, 455797, 455386, 454975, 454565, 454155, 453745, 453336, 452927, 452518, 452110, 451702, 451294, 450887, 450481, 450074, 449668, 449262, 448857, 448452, 448048, 447644, 447240, 446836, 446433, 446030, 445628, 445226, 444824, 444423, 444022, 443622, 443221, 442821, 442422, 442023, 441624, 441226, 440828, 440430, 440033, 439636, 439239, 438843, 438447, 438051, 437656, 437261, 436867, 436473, 436079, 435686, 435293, 434900, 434508, 434116, 433724, 433333, 432942, 432551, 432161, 431771, 431382, 430992, 430604, 430215, 429827, 429439, 429052, 428665, 428278, 427892, 427506, 427120, 426735, 426350, 425965, 425581, 425197, 424813, 424430, 424047, 423665, 423283, 422901, 422519, 422138, 421757, 421377, 420997, 420617, 420237, 419858, 419479, 419101, 418723, 418345, 417968, 417591, 417214, 416838, 416462, 416086, 415711, 415336, 414961, 414586, 414212, 413839, 413465, 413092, 412720, 412347, 411975, 411604, 411232, 410862, 410491, 410121, 409751, 409381, 409012, 408643, 408274, 407906, 407538, 407170, 406803, 406436, 406069, 405703, 405337, 404971, 404606, 404241, 403876, 403512, 403148, 402784, 402421, 402058, 401695, 401333, 400970, 400609, 400247, 399886, 399525, 399165, 398805, 398445, 398086, 397727, 397368, 397009, 396651, 396293, 395936, 395579, 395222, 394865, 394509, 394153, 393798, 393442, 393087, 392733, 392378, 392024, 391671, 391317, 390964, 390612, 390259, 389907, 389556, 389204, 388853, 388502, 388152, 387802, 387452, 387102, 386753, 386404, 386056, 385707, 385359, 385012, 384664, 384317, 383971, 383624, 383278, 382932, 382587, 382242, 381897, 381552, 381208, 380864, 380521, 380177, 379834, 379492, 379149, 378807, 378466, 378124, 377783, 377442, 377102, 376762, 376422, 376082, 375743, 375404, 375065, 374727, 374389, 374051, 373714, 373377, 373040, 372703, 372367, 372031, 371695, 371360, 371025, 370690, 370356, 370022, 369688, 369355, 369021, 368688, 368356, 368023, 367691, 367360, 367028, 366697, 366366, 366036, 365706, 365376, 365046, 364717, 364388, 364059, 363731, 363403, 363075, 362747, 362420, 362093, 361766, 361440, 361114, 360788, 360463, 360137, 359813, 359488, 359164, 358840, 358516, 358193, 357869, 357547, 357224, 356902, 356580, 356258, 355937, 355616, 355295, 354974, 354654, 354334, 354014, 353695, 353376, 353057, 352739, 352420, 352103, 351785, 351468, 351150, 350834, 350517, 350201, 349885, 349569, 349254, 348939, 348624, 348310, 347995, 347682, 347368, 347055, 346741, 346429, 346116, 345804, 345492, 345180, 344869, 344558, 344247, 343936, 343626, 343316, 343006, 342697, 342388, 342079, 341770, 341462, 341154, 340846, 340539, 340231, 339924, 339618, 339311, 339005, 338700, 338394, 338089, 337784, 337479, 337175, 336870, 336566, 336263, 335959, 335656, 335354, 335051, 334749, 334447, 334145, 333844, 333542, 333242, 332941, 332641, 332341, 332041, 331741, 331442, 331143, 330844, 330546, 330247, 329950, 329652, 329355, 329057, 328761, 328464, 328168, 327872, 327576, 327280, 326985, 326690, 326395, 326101, 325807, 325513, 325219, 324926, 324633, 324340, 324047, 323755, 323463, 323171, 322879, 322588, 322297, 322006, 321716, 321426, 321136, 320846, 320557, 320267, 319978, 319690, 319401, 319113, 318825, 318538, 318250, 317963, 317676, 317390, 317103, 316817, 316532, 316246, 315961, 315676, 315391, 315106, 314822, 314538, 314254, 313971, 313688, 313405, 313122, 312839, 312557, 312275, 311994, 311712, 311431, 311150, 310869, 310589, 310309, 310029, 309749, 309470, 309190, 308911, 308633, 308354, 308076, 307798, 307521, 307243, 306966, 306689, 306412, 306136, 305860, 305584, 305308, 305033, 304758, 304483, 304208, 303934, 303659, 303385, 303112, 302838, 302565, 302292, 302019, 301747, 301475, 301203, 300931, 300660, 300388, 300117, 299847, 299576, 299306, 299036, 298766, 298497, 298227, 297958, 297689, 297421, 297153, 296884, 296617, 296349, 296082, 295815, 295548, 295281, 295015, 294749, 294483, 294217, 293952, 293686, 293421, 293157, 292892, 292628, 292364, 292100, 291837, 291574, 291311, 291048, 290785, 290523, 290261, 289999, 289737, 289476, 289215, 288954, 288693, 288433, 288173, 287913, 287653, 287393, 287134, 286875, 286616, 286358, 286099, 285841, 285583, 285326, 285068, 284811, 284554, 284298, 284041, 283785, 283529, 283273, 283017, 282762, 282507, 282252, 281998, 281743, 281489, 281235, 280981, 280728, 280475, 280222, 279969, 279716, 279464, 279212, 278960, 278708, 278457, 278206, 277955, 277704, 277453, 277203, 276953, 276703, 276453, 276204, 275955, 275706, 275457, 275209, 274960, 274712, 274465, 274217, 273970, 273722, 273476, 273229, 272982, 272736, 272490, 272244, 271999, 271753, 271508, 271263, 271018, 270774, 270530, 270286, 270042, 269798, 269555, 269312, 269069, 268826, 268583, 268341, 268099, 267857 }; static UWORD oldperiods[OCTAVE * 2] = { 1712 * 16, 1664 * 16, 1616 * 16, 1570 * 16, 1524 * 16, 1480 * 16, 1438 * 16, 1396 * 16, 1356 * 16, 1318 * 16, 1280 * 16, 1244 * 16, 1208 * 16, 1174 * 16, 1140 * 16, 1108 * 16, 1076 * 16, 1046 * 16, 1016 * 16, 988 * 16, 960 * 16, 932 * 16, 906 * 16, 880 * 16 }; #define LOGFAC 2*16 static UWORD logtab[104] = { LOGFAC * 907, LOGFAC * 900, LOGFAC * 894, LOGFAC * 887, LOGFAC * 881, LOGFAC * 875, LOGFAC * 868, LOGFAC * 862, LOGFAC * 856, LOGFAC * 850, LOGFAC * 844, LOGFAC * 838, LOGFAC * 832, LOGFAC * 826, LOGFAC * 820, LOGFAC * 814, LOGFAC * 808, LOGFAC * 802, LOGFAC * 796, LOGFAC * 791, LOGFAC * 785, LOGFAC * 779, LOGFAC * 774, LOGFAC * 768, LOGFAC * 762, LOGFAC * 757, LOGFAC * 752, LOGFAC * 746, LOGFAC * 741, LOGFAC * 736, LOGFAC * 730, LOGFAC * 725, LOGFAC * 720, LOGFAC * 715, LOGFAC * 709, LOGFAC * 704, LOGFAC * 699, LOGFAC * 694, LOGFAC * 689, LOGFAC * 684, LOGFAC * 678, LOGFAC * 675, LOGFAC * 670, LOGFAC * 665, LOGFAC * 660, LOGFAC * 655, LOGFAC * 651, LOGFAC * 646, LOGFAC * 640, LOGFAC * 636, LOGFAC * 632, LOGFAC * 628, LOGFAC * 623, LOGFAC * 619, LOGFAC * 614, LOGFAC * 610, LOGFAC * 604, LOGFAC * 601, LOGFAC * 597, LOGFAC * 592, LOGFAC * 588, LOGFAC * 584, LOGFAC * 580, LOGFAC * 575, LOGFAC * 570, LOGFAC * 567, LOGFAC * 563, LOGFAC * 559, LOGFAC * 555, LOGFAC * 551, LOGFAC * 547, LOGFAC * 543, LOGFAC * 538, LOGFAC * 535, LOGFAC * 532, LOGFAC * 528, LOGFAC * 524, LOGFAC * 520, LOGFAC * 516, LOGFAC * 513, LOGFAC * 508, LOGFAC * 505, LOGFAC * 502, LOGFAC * 498, LOGFAC * 494, LOGFAC * 491, LOGFAC * 487, LOGFAC * 484, LOGFAC * 480, LOGFAC * 477, LOGFAC * 474, LOGFAC * 470, LOGFAC * 467, LOGFAC * 463, LOGFAC * 460, LOGFAC * 457, LOGFAC * 453, LOGFAC * 450, LOGFAC * 447, LOGFAC * 443, LOGFAC * 440, LOGFAC * 437, LOGFAC * 434, LOGFAC * 431 }; int* noteindex=NULL; /* remap value for linear period modules */ static int noteindexcount=0; int *AllocLinear(void) { if(of.numsmp>noteindexcount) { noteindexcount=of.numsmp; noteindex=safe_realloc(noteindex,noteindexcount*sizeof(int)); } return noteindex; } void FreeLinear(void) { if(noteindex) { free(noteindex); noteindex=NULL; } noteindexcount=0; } static SWORD Interpolate (SWORD p, SWORD p1, SWORD p2, SWORD v1, SWORD v2) { if ((p1 == p2) || (p == p1)) return v1; return v1 + ((SLONG) ((p - p1) * (v2 - v1)) / (p2 - p1)); } UWORD getlinearperiod (UWORD note, ULONG fine) { UWORD t; t = (20L * OCTAVE + 2 - note) * 32L - (fine >> 1); return t; } /* XM linear period to MOD period conversion */ ULONG getfrequency (UBYTE flags, ULONG period) { if (flags & UF_LINEAR) return lintab[period % 768] >> (period / 768); else return (8363L * 1712L) / (period ? period : 1); } UWORD getlogperiod (UWORD note, ULONG fine) { UWORD n, o; UWORD p1, p2; ULONG i; n = note % (2 * OCTAVE); o = note / (2 * OCTAVE); i = (n << 2) + (fine >> 4); /* n*8 + fine/16 */ p1 = logtab[i]; p2 = logtab[i + 1]; return (Interpolate (fine >> 4, 0, 15, p1, p2) >> o); } UWORD getoldperiod (UWORD note, ULONG speed) { UWORD n, o; if (!speed) { #ifdef MIKMOD_DEBUG fprintf (stderr, "\rmplayer: getoldperiod() called with note=%d, speed=0 !\n", note); #endif return 4242; /* <- prevent divide overflow.. (42 hehe) */ } n = note % (2 * OCTAVE); o = note / (2 * OCTAVE); return ((8363L * (ULONG) oldperiods[n]) >> o) / speed; } int speed_to_finetune(ULONG speed,int sample) { int ctmp=0,tmp,note=1,finetune=0; speed>>=1; while((tmp=getfrequency(of.flags,getlinearperiod(note<<1,0)))speed) tmp=getfrequency(of.flags,getlinearperiod(note<<1,--finetune)); else { note--; while(ctmp> (period / 768); period = (8363L * 1712L) / period; } return (period); } /*========== Order stuff */ /* handles S3M and IT orders */ void S3MIT_CreateOrders(BOOL curious) { int t; of.numpos = 0; memset(of.positions,0,poslookupcnt*sizeof(UWORD)); memset(poslookup,-1,256); for(t=0;t>4; /* process S3M / IT specific command structure */ if(cmd!=255) { switch(cmd) { case 1: /* Axx set speed to xx */ UniEffect(UNI_S3MEFFECTA,inf); break; case 2: /* Bxx position jump */ if (inf>4)*10+(inf&0xf)); else UniPTEffect(0xd,inf); break; case 4: /* Dxy volumeslide */ UniEffect(UNI_S3MEFFECTD,inf); break; case 5: /* Exy toneslide down */ UniEffect(UNI_S3MEFFECTE,inf); break; case 6: /* Fxy toneslide up */ UniEffect(UNI_S3MEFFECTF,inf); break; case 7: /* Gxx Tone portamento, speed xx */ UniEffect(UNI_ITEFFECTG,inf); break; case 8: /* Hxy vibrato */ if(oldeffect&1) UniPTEffect(0x4,inf); else UniEffect(UNI_ITEFFECTH,inf); break; case 9: /* Ixy tremor, ontime x, offtime y */ if(oldeffect&1) UniEffect(UNI_S3MEFFECTI,inf); else UniEffect(UNI_ITEFFECTI,inf); break; case 0xa: /* Jxy arpeggio */ UniPTEffect(0x0,inf); break; case 0xb: /* Kxy Dual command H00 & Dxy */ if(oldeffect&1) UniPTEffect(0x4,0); else UniEffect(UNI_ITEFFECTH,0); UniEffect(UNI_S3MEFFECTD,inf); break; case 0xc: /* Lxy Dual command G00 & Dxy */ if(oldeffect&1) UniPTEffect(0x3,0); else UniEffect(UNI_ITEFFECTG,0); UniEffect(UNI_S3MEFFECTD,inf); break; case 0xd: /* Mxx Set Channel Volume */ UniEffect(UNI_ITEFFECTM,inf); break; case 0xe: /* Nxy Slide Channel Volume */ UniEffect(UNI_ITEFFECTN,inf); break; case 0xf: /* Oxx set sampleoffset xx00h */ UniPTEffect(0x9,inf); break; case 0x10: /* Pxy Slide Panning Commands */ UniEffect(UNI_ITEFFECTP,inf); break; case 0x11: /* Qxy Retrig (+volumeslide) */ UniWriteByte(UNI_S3MEFFECTQ); if(inf && !lo && !(oldeffect&1)) UniWriteByte(1); else UniWriteByte(inf); break; case 0x12: /* Rxy tremolo speed x, depth y */ UniEffect(UNI_S3MEFFECTR,inf); break; case 0x13: /* Sxx special commands */ if (inf>=0xf0) { /* change resonant filter settings if necessary */ if((filters)&&((inf&0xf)!=activemacro)) { activemacro=inf&0xf; for(inf=0;inf<0x80;inf++) filtersettings[inf].filter=filtermacros[activemacro]; } } else UniEffect(UNI_ITEFFECTS0,inf); break; case 0x14: /* Txx tempo */ if(inf>=0x20) UniEffect(UNI_S3MEFFECTT,inf); else { if(!(oldeffect&1)) /* IT Tempo slide */ UniEffect(UNI_ITEFFECTT,inf); } break; case 0x15: /* Uxy Fine Vibrato speed x, depth y */ if(oldeffect&1) UniEffect(UNI_S3MEFFECTU,inf); else UniEffect(UNI_ITEFFECTU,inf); break; case 0x16: /* Vxx Set Global Volume */ UniEffect(UNI_XMEFFECTG,inf); break; case 0x17: /* Wxy Global Volume Slide */ UniEffect(UNI_ITEFFECTW,inf); break; case 0x18: /* Xxx amiga command 8xx */ if(oldeffect&1) { if(inf>128) UniEffect(UNI_ITEFFECTS0,0x91); /* surround */ else UniPTEffect(0x8,(inf==128)?255:(inf<<1)); } else UniPTEffect(0x8,inf); break; case 0x19: /* Yxy Panbrello speed x, depth y */ UniEffect(UNI_ITEFFECTY,inf); break; case 0x1a: /* Zxx midi/resonant filters */ if(filtersettings[inf].filter) { UniWriteByte(UNI_ITEFFECTZ); UniWriteByte(filtersettings[inf].filter); UniWriteByte(filtersettings[inf].inf); } break; } } } /*========== Unitrk stuff */ /* Generic effect writing routine */ void UniEffect(UWORD eff,UWORD dat) { if((!eff)||(eff>=UNI_LAST)) return; UniWriteByte(eff); if(unioperands[eff]==2) UniWriteWord(dat); else UniWriteByte(dat); } /* Appends UNI_PTEFFECTX opcode to the unitrk stream. */ void UniPTEffect(UBYTE eff, UBYTE dat) { #ifdef MIKMOD_DEBUG if (eff>=0x10) fprintf(stderr,"UniPTEffect called with incorrect eff value %d\n",eff); else #endif if((eff)||(dat)||(of.flags & UF_ARPMEM)) UniEffect(UNI_PTEFFECT0+eff,dat); } /* Appends UNI_VOLEFFECT + effect/dat to unistream. */ void UniVolEffect(UWORD eff,UBYTE dat) { if((eff)||(dat)) { /* don't write empty effect */ UniWriteByte(UNI_VOLEFFECTS); UniWriteByte(eff);UniWriteByte(dat); } } /* ex:set ts=4: */ TiMidity++-2.13.2/libunimod/mmsup.c0100644004711200001440000001073607421005041016164 0ustar tamukiusers/* MikMod sound library (c) 1998, 1999 Miodrag Vallat and others - see file AUTHORS for complete list. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /*============================================================================== $Id: mmsup.c,v 1.30 1999/10/25 16:31:41 miod Exp $ Error handling, memory, I/O functions. ==============================================================================*/ #include "unimod_priv.h" int _mm_errno = 0; static CHAR *_mm_errmsg[MMERR_MAX + 1] = { /* No error */ "No error", /* Generic errors */ "Could not open requested file", "Out of memory", "Dynamic linking failed", /* Sample errors */ "Out of memory to load sample", "Out of sample handles to load sample", "Sample format not recognized", /* Module errors */ "Failure loading module pattern", "Failure loading module track", "Failure loading module header", "Failure loading sampleinfo", "Module format not recognized", "Module sample format not recognized", "Synthsounds not supported in MED files", "Compressed sample is invalid", /* Invalid error */ "Invalid error code" }; char * ML_strerror (int code) { if ((code < 0) || (code > MMERR_MAX)) code = MMERR_MAX + 1; return _mm_errmsg[code]; } /* Same as malloc, but sets error variable _mm_error when fails */ void * _mm_malloc (size_t size) { void *d; if (!(d = calloc (1, size))) { _mm_errno = MMERR_OUT_OF_MEMORY; } return d; } /* Same as calloc, but sets error variable _mm_error when fails */ void * _mm_calloc (size_t nitems, size_t size) { void *d; if (!(d = calloc (nitems, size))) { _mm_errno = MMERR_OUT_OF_MEMORY; } return d; } /* I/O - wrappers around liburl The way this module works: - _mm_read_I_* and _mm_read_M_* differ : the first is for reading data written by a little endian (intel) machine, and the second is for reading big endian (Mac, RISC, Alpha) machine data. - _mm_read_string is for reading binary strings. It is basically the same as an fread of bytes. */ #define COPY_BUFSIZE 1024 /*========== Read functions */ int _mm_read_string (CHAR * buffer, int number, URL reader) { return url_nread (reader, buffer, number); } UWORD _mm_read_M_UWORD (URL reader) { UWORD result = ((UWORD) _mm_read_UBYTE (reader)) << 8; result |= _mm_read_UBYTE (reader); return result; } UWORD _mm_read_I_UWORD (URL reader) { UWORD result = _mm_read_UBYTE (reader); result |= ((UWORD) _mm_read_UBYTE (reader)) << 8; return result; } ULONG _mm_read_M_ULONG (URL reader) { ULONG result = ((ULONG) _mm_read_M_UWORD (reader)) << 16; result |= _mm_read_M_UWORD (reader); return result; } ULONG _mm_read_I_ULONG (URL reader) { ULONG result = _mm_read_I_UWORD (reader); result |= ((ULONG) _mm_read_I_UWORD (reader)) << 16; return result; } SWORD _mm_read_M_SWORD (URL reader) { return ((SWORD) _mm_read_M_UWORD (reader)); } SWORD _mm_read_I_SWORD (URL reader) { return ((SWORD) _mm_read_I_UWORD (reader)); } SLONG _mm_read_M_SLONG (URL reader) { return ((SLONG) _mm_read_M_ULONG (reader)); } SLONG _mm_read_I_SLONG (URL reader) { return ((SLONG) _mm_read_I_ULONG (reader)); } #define DEFINE_MULTIPLE_READ_FUNCTION(type_name,type) \ int _mm_read_##type_name##S (type *buffer,int number,URL reader) \ { \ while(number-->0) \ *(buffer++)=_mm_read_##type_name(reader); \ return !url_eof(reader); \ } DEFINE_MULTIPLE_READ_FUNCTION (M_SWORD, SWORD) DEFINE_MULTIPLE_READ_FUNCTION (M_UWORD, UWORD) DEFINE_MULTIPLE_READ_FUNCTION (I_SWORD, SWORD) DEFINE_MULTIPLE_READ_FUNCTION (I_UWORD, UWORD) DEFINE_MULTIPLE_READ_FUNCTION (M_SLONG, SLONG) DEFINE_MULTIPLE_READ_FUNCTION (M_ULONG, ULONG) DEFINE_MULTIPLE_READ_FUNCTION (I_SLONG, SLONG) DEFINE_MULTIPLE_READ_FUNCTION (I_ULONG, ULONG) /* ex:set ts=4: */ TiMidity++-2.13.2/libunimod/munitrk.c0100644004711200001440000002007507421005041016511 0ustar tamukiusers/* MikMod sound library (c) 1998, 1999 Miodrag Vallat and others - see file AUTHORS for complete list. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /*============================================================================== $Id: munitrk.c,v 1.27 1999/10/25 16:31:41 miod Exp $ All routines dealing with the manipulation of UNITRK streams ==============================================================================*/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "unimod_priv.h" #include /* Unibuffer chunk size */ #define BUFPAGE 128 UWORD unioperands[UNI_LAST] = { 0, /* not used */ 1, /* UNI_NOTE */ 1, /* UNI_INSTRUMENT */ 1, /* UNI_PTEFFECT0 */ 1, /* UNI_PTEFFECT1 */ 1, /* UNI_PTEFFECT2 */ 1, /* UNI_PTEFFECT3 */ 1, /* UNI_PTEFFECT4 */ 1, /* UNI_PTEFFECT5 */ 1, /* UNI_PTEFFECT6 */ 1, /* UNI_PTEFFECT7 */ 1, /* UNI_PTEFFECT8 */ 1, /* UNI_PTEFFECT9 */ 1, /* UNI_PTEFFECTA */ 1, /* UNI_PTEFFECTB */ 1, /* UNI_PTEFFECTC */ 1, /* UNI_PTEFFECTD */ 1, /* UNI_PTEFFECTE */ 1, /* UNI_PTEFFECTF */ 1, /* UNI_S3MEFFECTA */ 1, /* UNI_S3MEFFECTD */ 1, /* UNI_S3MEFFECTE */ 1, /* UNI_S3MEFFECTF */ 1, /* UNI_S3MEFFECTI */ 1, /* UNI_S3MEFFECTQ */ 1, /* UNI_S3MEFFECTR */ 1, /* UNI_S3MEFFECTT */ 1, /* UNI_S3MEFFECTU */ 0, /* UNI_KEYOFF */ 1, /* UNI_KEYFADE */ 2, /* UNI_VOLEFFECTS */ 1, /* UNI_XMEFFECT4 */ 1, /* UNI_XMEFFECTA */ 1, /* UNI_XMEFFECTE1 */ 1, /* UNI_XMEFFECTE2 */ 1, /* UNI_XMEFFECTEA */ 1, /* UNI_XMEFFECTEB */ 1, /* UNI_XMEFFECTG */ 1, /* UNI_XMEFFECTH */ 1, /* UNI_XMEFFECTL */ 1, /* UNI_XMEFFECTP */ 1, /* UNI_XMEFFECTX1 */ 1, /* UNI_XMEFFECTX2 */ 1, /* UNI_ITEFFECTG */ 1, /* UNI_ITEFFECTH */ 1, /* UNI_ITEFFECTI */ 1, /* UNI_ITEFFECTM */ 1, /* UNI_ITEFFECTN */ 1, /* UNI_ITEFFECTP */ 1, /* UNI_ITEFFECTT */ 1, /* UNI_ITEFFECTU */ 1, /* UNI_ITEFFECTW */ 1, /* UNI_ITEFFECTY */ 2, /* UNI_ITEFFECTZ */ 1, /* UNI_ITEFFECTS0 */ 2, /* UNI_ULTEFFECT9 */ 2, /* UNI_MEDSPEED */ 0, /* UNI_MEDEFFECTF1 */ 0, /* UNI_MEDEFFECTF2 */ 0 /* UNI_MEDEFFECTF3 */ }; /* Sparse description of the internal module format ------------------------------------------------ A UNITRK stream is an array of bytes representing a single track of a pattern. It's made up of 'repeat/length' bytes, opcodes and operands (sort of a assembly language): rrrlllll [REP/LEN][OPCODE][OPERAND][OPCODE][OPERAND] [REP/LEN][OPCODE][OPERAND].. ^ ^ ^ |-------ROWS 0 - 0+REP of a track---------| |-------ROWS xx - xx+REP of a track... The rep/len byte contains the number of bytes in the current row, _including_ the length byte itself (So the LENGTH byte of row 0 in the previous example would have a value of 5). This makes it easy to search through a stream for a particular row. A track is concluded by a 0-value length byte. The upper 3 bits of the rep/len byte contain the number of times -1 this row is repeated for this track. (so a value of 7 means this row is repeated 8 times) Opcodes can range from 1 to 255 but currently only opcodes 1 to 52 are being used. Each opcode can have a different number of operands. You can find the number of operands to a particular opcode by using the opcode as an index into the 'unioperands' table. */ /*========== Reading routines */ static UBYTE *rowstart; /* startadress of a row */ static UBYTE *rowend; /* endaddress of a row (exclusive) */ static UBYTE *rowpc; /* current unimod(tm) programcounter */ void UniSetRow (UBYTE * t) { rowstart = t; rowpc = rowstart; rowend = t ? rowstart + (*(rowpc++) & 0x1f) : t; } UBYTE UniGetByte (void) { return (rowpc < rowend) ? *(rowpc++) : 0; } UWORD UniGetWord (void) { return ((UWORD) UniGetByte () << 8) | UniGetByte (); } void UniSkipOpcode (UBYTE op) { if (op < UNI_LAST) { UWORD t = unioperands[op]; while (t--) UniGetByte (); } } /* Finds the address of row number 'row' in the UniMod(tm) stream 't' returns NULL if the row can't be found. */ UBYTE * UniFindRow (UBYTE * t, UWORD row) { UBYTE c, l; if (t) while (1) { c = *t; /* get rep/len byte */ if (!c) return NULL; /* zero ? -> end of track.. */ l = (c >> 5) + 1; /* extract repeat value */ if (l > row) break; /* reached wanted row? -> return pointer */ row -= l; /* haven't reached row yet.. update row */ t += c & 0x1f; /* point t to the next row */ } return t; } /*========== Writing routines */ static UBYTE *unibuf; /* pointer to the temporary unitrk buffer */ static UWORD unimax; /* buffer size */ static UWORD unipc; /* buffer cursor */ static UWORD unitt; /* current row index */ static UWORD lastp; /* previous row index */ /* Resets index-pointers to create a new track. */ void UniReset (void) { unitt = 0; /* reset index to rep/len byte */ unipc = 1; /* first opcode will be written to index 1 */ lastp = 0; /* no previous row yet */ unibuf[0] = 0; /* clear rep/len byte */ } /* Expands the buffer */ static BOOL UniExpand (int wanted) { if ((unipc + wanted) >= unimax) { UBYTE *newbuf; /* Expand the buffer by BUFPAGE bytes */ newbuf = (UBYTE *) realloc (unibuf, (unimax + BUFPAGE) * sizeof (UBYTE)); /* Check if realloc succeeded */ if (newbuf) { unibuf = newbuf; unimax += BUFPAGE; return 1; } else return 0; } return 1; } /* Appends one byte of data to the current row of a track. */ void UniWriteByte (UBYTE data) { if (UniExpand (1)) /* write byte to current position and update */ unibuf[unipc++] = data; } void UniWriteWord (UWORD data) { if (UniExpand (2)) { unibuf[unipc++] = data >> 8; unibuf[unipc++] = data & 0xff; } } static BOOL MyCmp (UBYTE * a, UBYTE * b, UWORD l) { UWORD t; for (t = 0; t < l; t++) if (*(a++) != *(b++)) return 0; return 1; } /* Closes the current row of a unitrk stream (updates the rep/len byte) and sets pointers to start a new row. */ void UniNewline (void) { UWORD n, l, len; n = (unibuf[lastp] >> 5) + 1; /* repeat of previous row */ l = (unibuf[lastp] & 0x1f); /* length of previous row */ len = unipc - unitt; /* length of current row */ /* Now, check if the previous and the current row are identical.. when they are, just increase the repeat field of the previous row */ if (n < 8 && len == l && MyCmp (&unibuf[lastp + 1], &unibuf[unitt + 1], len - 1)) { unibuf[lastp] += 0x20; unipc = unitt + 1; } else { if (UniExpand (unitt - unipc)) { /* current and previous row aren't equal... update the pointers */ unibuf[unitt] = len; lastp = unitt; unitt = unipc++; } } } /* Terminates the current unitrk stream and returns a pointer to a copy of the stream. */ UBYTE * UniDup (void) { UBYTE *d; if (!UniExpand (unitt - unipc)) return NULL; unibuf[unitt] = 0; if (!(d = (UBYTE *) _mm_malloc (unipc))) return NULL; memcpy (d, unibuf, unipc); return d; } BOOL UniInit (void) { unimax = BUFPAGE; if (!(unibuf = (UBYTE *) _mm_malloc (unimax * sizeof (UBYTE)))) return 0; return 1; } void UniCleanup (void) { if (unibuf) free (unibuf); unibuf = NULL; } /* ex:set ts=4: */ TiMidity++-2.13.2/libunimod/unimod.h0100644004711200001440000003247707421005041016331 0ustar tamukiusers/* MikMod sound library (c) 1998, 1999 Miodrag Vallat and others - see file AUTHORS for complete list. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /*============================================================================== $Id: unimod.h,v 1.35 1999/10/25 16:31:41 miod Exp $ MikMod sound library include file ==============================================================================*/ #ifndef _UNIMOD_H_ #define _UNIMOD_H_ #include #include #include "url.h" #ifdef __cplusplus extern "C" { #endif /* * ========== Platform independent-type definitions */ #ifdef __W32__ #define WIN32_LEAN_AND_MEAN #include #include #elif defined(__OS2__)||defined(__EMX__) #define INCL_DOSSEMAPHORES #include #else typedef char CHAR; #endif #if defined(__alpha) /* 64 bit architectures */ typedef signed char SBYTE; /* 1 byte, signed */ typedef unsigned char UBYTE; /* 1 byte, unsigned */ typedef signed short SWORD; /* 2 bytes, signed */ typedef unsigned short UWORD; /* 2 bytes, unsigned */ typedef signed int SLONG; /* 4 bytes, signed */ typedef unsigned int ULONG; /* 4 bytes, unsigned */ typedef int BOOL; /* 0=false, <>0 true */ #else /* 32 bit architectures */ typedef signed char SBYTE; /* 1 byte, signed */ typedef unsigned char UBYTE; /* 1 byte, unsigned */ typedef signed short SWORD; /* 2 bytes, signed */ typedef unsigned short UWORD; /* 2 bytes, unsigned */ typedef signed long SLONG; /* 4 bytes, signed */ #if !defined(__OS2__)&&!defined(__EMX__)&&!defined(__W32__) typedef unsigned long ULONG; /* 4 bytes, unsigned */ typedef int BOOL; /* 0=false, <>0 true */ #endif #endif /* * ========== Error handling and error codes */ extern int ML_errno; extern char *ML_strerror (int); enum { MMERR_OPENING_FILE = 1, MMERR_OUT_OF_MEMORY, MMERR_DYNAMIC_LINKING, MMERR_SAMPLE_TOO_BIG, MMERR_OUT_OF_HANDLES, MMERR_UNKNOWN_WAVE_TYPE, MMERR_LOADING_PATTERN, MMERR_LOADING_TRACK, MMERR_LOADING_HEADER, MMERR_LOADING_SAMPLEINFO, MMERR_NOT_A_MODULE, MMERR_NOT_A_STREAM, MMERR_MED_SYNTHSAMPLES, MMERR_ITPACK_INVALID_DATA, MMERR_MAX }; /*========== Internal module representation (UniMod) interface */ /* number of notes in an octave */ #define OCTAVE 12 extern void UniSetRow (UBYTE *); extern UBYTE UniGetByte (void); extern UWORD UniGetWord (void); extern UBYTE *UniFindRow (UBYTE *, UWORD); extern void UniSkipOpcode (UBYTE); extern void UniReset (void); extern void UniWriteByte (UBYTE); extern void UniWriteWord (UWORD); extern void UniNewline (void); extern UBYTE *UniDup (void); extern BOOL UniInit (void); extern void UniCleanup (void); extern void UniEffect (UWORD, UWORD); #define UniInstrument(x) UniEffect(UNI_INSTRUMENT,x) #define UniNote(x) UniEffect(UNI_NOTE,x) extern void UniPTEffect (UBYTE, UBYTE); extern void UniVolEffect (UWORD, UBYTE); /*========== Module Commands */ enum { /* Simple note */ UNI_NOTE = 1, /* Instrument change */ UNI_INSTRUMENT, /* Protracker effects */ UNI_PTEFFECT0, /* arpeggio */ UNI_PTEFFECT1, /* porta up */ UNI_PTEFFECT2, /* porta down */ UNI_PTEFFECT3, /* porta to note */ UNI_PTEFFECT4, /* vibrato */ UNI_PTEFFECT5, /* dual effect 3+A */ UNI_PTEFFECT6, /* dual effect 4+A */ UNI_PTEFFECT7, /* tremolo */ UNI_PTEFFECT8, /* pan */ UNI_PTEFFECT9, /* sample offset */ UNI_PTEFFECTA, /* volume slide */ UNI_PTEFFECTB, /* pattern jump */ UNI_PTEFFECTC, /* set volume */ UNI_PTEFFECTD, /* pattern break */ UNI_PTEFFECTE, /* extended effects */ UNI_PTEFFECTF, /* set speed */ /* Scream Tracker effects */ UNI_S3MEFFECTA, /* set speed */ UNI_S3MEFFECTD, /* volume slide */ UNI_S3MEFFECTE, /* porta down */ UNI_S3MEFFECTF, /* porta up */ UNI_S3MEFFECTI, /* tremor */ UNI_S3MEFFECTQ, /* retrig */ UNI_S3MEFFECTR, /* tremolo */ UNI_S3MEFFECTT, /* set tempo */ UNI_S3MEFFECTU, /* fine vibrato */ UNI_KEYOFF, /* note off */ /* Fast Tracker effects */ UNI_KEYFADE, /* note fade */ UNI_VOLEFFECTS, /* volume column effects */ UNI_XMEFFECT4, /* vibrato */ UNI_XMEFFECTA, /* volume slide */ UNI_XMEFFECTE1, /* fine porta up */ UNI_XMEFFECTE2, /* fine porta down */ UNI_XMEFFECTEA, /* fine volume slide up */ UNI_XMEFFECTEB, /* fine volume slide down */ UNI_XMEFFECTG, /* set global volume */ UNI_XMEFFECTH, /* global volume slide */ UNI_XMEFFECTL, /* set envelope position */ UNI_XMEFFECTP, /* pan slide */ UNI_XMEFFECTX1, /* extra fine porta up */ UNI_XMEFFECTX2, /* extra fine porta down */ /* Impulse Tracker effects */ UNI_ITEFFECTG, /* porta to note */ UNI_ITEFFECTH, /* vibrato */ UNI_ITEFFECTI, /* tremor (xy not incremented) */ UNI_ITEFFECTM, /* set channel volume */ UNI_ITEFFECTN, /* slide / fineslide channel volume */ UNI_ITEFFECTP, /* slide / fineslide channel panning */ UNI_ITEFFECTT, /* slide tempo */ UNI_ITEFFECTU, /* fine vibrato */ UNI_ITEFFECTW, /* slide / fineslide global volume */ UNI_ITEFFECTY, /* panbrello */ UNI_ITEFFECTZ, /* resonant filters */ UNI_ITEFFECTS0, /* UltraTracker effects */ UNI_ULTEFFECT9, /* Sample fine offset */ /* OctaMED effects */ UNI_MEDSPEED, UNI_MEDEFFECTF1, /* play note twice */ UNI_MEDEFFECTF2, /* delay note */ UNI_MEDEFFECTF3, /* play note three times */ UNI_LAST }; extern UWORD unioperands[UNI_LAST]; /* IT / S3M Extended SS effects: */ enum { SS_GLISSANDO = 1, SS_FINETUNE, SS_VIBWAVE, SS_TREMWAVE, SS_PANWAVE, SS_FRAMEDELAY, SS_S7EFFECTS, SS_PANNING, SS_SURROUND, SS_HIOFFSET, SS_PATLOOP, SS_NOTECUT, SS_NOTEDELAY, SS_PATDELAY }; /* IT Volume column effects */ enum { VOL_VOLUME = 1, VOL_PANNING, VOL_VOLSLIDE, VOL_PITCHSLIDEDN, VOL_PITCHSLIDEUP, VOL_PORTAMENTO, VOL_VIBRATO }; /* IT resonant filter information */ #define FILT_CUT 0x80 #define FILT_RESONANT 0x81 typedef struct FILTER { UBYTE filter, inf; } FILTER; /*========== Instruments */ /* Instrument format flags */ #define IF_OWNPAN 1 #define IF_PITCHPAN 2 /* Envelope flags: */ #define EF_ON 1 #define EF_SUSTAIN 2 #define EF_LOOP 4 #define EF_VOLENV 8 /* New Note Action Flags */ #define NNA_CUT 0 #define NNA_CONTINUE 1 #define NNA_OFF 2 #define NNA_FADE 3 #define NNA_MASK 3 #define DCT_OFF 0 #define DCT_NOTE 1 #define DCT_SAMPLE 2 #define DCT_INST 3 #define DCA_CUT 0 #define DCA_OFF 1 #define DCA_FADE 2 #define KEY_KICK 0 #define KEY_OFF 1 #define KEY_FADE 2 #define KEY_KILL (KEY_OFF|KEY_FADE) #define KICK_ABSENT 0 #define KICK_NOTE 1 #define KICK_KEYOFF 2 #define KICK_ENV 4 #define AV_IT 1 /* IT vs. XM vibrato info */ /* * ========== Samples */ /* Sample format [loading and in-memory] flags: */ #define SF_16BITS 0x0001 #define SF_STEREO 0x0002 #define SF_SIGNED 0x0004 #define SF_BIG_ENDIAN 0x0008 #define SF_DELTA 0x0010 #define SF_ITPACKED 0x0020 #define SF_FORMATMASK 0x003F /* General Playback flags */ #define SF_LOOP 0x0100 #define SF_BIDI 0x0200 #define SF_REVERSE 0x0400 #define SF_SUSTAIN 0x0800 #define SF_PLAYBACKMASK 0x0C00 /* Module-only Playback Flags */ #define SF_OWNPAN 0x1000 #define SF_UST_LOOP 0x2000 #define SF_EXTRAPLAYBACKMASK 0x3000 /* Panning constants */ #define PAN_LEFT 0 #define PAN_CENTER 128 #define PAN_RIGHT 255 #define PAN_SURROUND 512 /* panning value for Dolby Surround */ /* This stuff is all filled -- it's up to you whether to implement it. */ typedef struct SAMPLE { SWORD panning; /* panning (0-255 or PAN_SURROUND) */ ULONG speed; /* Base playing speed/frequency of note */ UBYTE volume; /* volume 0-64 */ UWORD inflags; /* sample format on disk */ UWORD flags; /* sample format in memory */ ULONG length; /* length of sample (in samples!) */ ULONG loopstart; /* repeat position (relative to start, in samples) */ ULONG loopend; /* repeat end */ ULONG susbegin; /* sustain loop begin (in samples) */ ULONG susend; /* sustain loop end */ UBYTE globvol; /* global volume */ UBYTE vibflags; /* autovibrato flag stuffs */ UBYTE vibtype; /* Vibratos moved from INSTRUMENT to SAMPLE */ UBYTE vibsweep; UBYTE vibdepth; UBYTE vibrate; CHAR *samplename; /* name of the sample */ UWORD id; /* available for user */ UBYTE divfactor; /* for sample scaling */ ULONG seekpos; /* seek position in file -- internal */ SWORD *data; /* ptr to actual sample data */ } SAMPLE; /* * ========== Internal module representation (UniMod) */ /* Instrument definition - for information only, the only field which may be of use in user programs is the name field */ /* Instrument note count */ #define INSTNOTES 120 /* Envelope point */ typedef struct ENVPT { SWORD pos; SWORD val; } ENVPT; /* Envelope point count */ #define ENVPOINTS 32 /* Instrument structure */ typedef struct INSTRUMENT { CHAR *insname; UBYTE flags; UWORD samplenumber[INSTNOTES]; UBYTE samplenote[INSTNOTES]; UBYTE nnatype; UBYTE dca; /* duplicate check action */ UBYTE dct; /* duplicate check type */ UBYTE globvol; UWORD volfade; SWORD panning; /* instrument-based panning var */ UBYTE pitpansep; /* pitch pan separation (0 to 255) */ UBYTE pitpancenter; /* pitch pan center (0 to 119) */ UBYTE rvolvar; /* random volume varations (0 - 100%) */ UBYTE rpanvar; /* random panning varations (0 - 100%) */ /* volume envelope */ UBYTE volflg; /* bit 0: on 1: sustain 2: loop */ UBYTE volpts; UBYTE volsusbeg; UBYTE volsusend; UBYTE volbeg; UBYTE volend; ENVPT volenv[ENVPOINTS]; /* panning envelope */ UBYTE panflg; /* bit 0: on 1: sustain 2: loop */ UBYTE panpts; UBYTE pansusbeg; UBYTE pansusend; UBYTE panbeg; UBYTE panend; ENVPT panenv[ENVPOINTS]; /* pitch envelope */ UBYTE pitflg; /* bit 0: on 1: sustain 2: loop */ UBYTE pitpts; UBYTE pitsusbeg; UBYTE pitsusend; UBYTE pitbeg; UBYTE pitend; ENVPT pitenv[ENVPOINTS]; } INSTRUMENT; /* Module flags */ #define UF_XMPERIODS 0x0001 /* XM periods / finetuning */ #define UF_LINEAR 0x0002 /* LINEAR periods (UF_XMPERIODS must be set) */ #define UF_INST 0x0004 /* Instruments are used */ #define UF_NNA 0x0008 /* IT: NNA used, set numvoices rather than numchn */ #define UF_S3MSLIDES 0x0010 /* uses old S3M volume slides */ #define UF_BGSLIDES 0x0020 /* continue volume slides in the background */ #define UF_HIGHBPM 0x0040 /* MED: can use >255 bpm */ #define UF_NOWRAP 0x0080 /* XM-type (i.e. illogical) pattern brk semantics */ #define UF_ARPMEM 0x0100 /* IT: need arpeggio memory */ #define UF_FT2QUIRKS 0x0200 /* emulate some FT2 replay quirks */ typedef struct MODULE { /* general module information */ CHAR *songname; /* name of the song */ CHAR *modtype; /* string type of module loaded */ CHAR *comment; /* module comments */ UWORD flags; /* See module flags above */ UBYTE numchn; /* number of module channels */ UBYTE numvoices; /* max # voices used for full NNA playback */ UWORD numpos; /* number of positions in this song */ UWORD numpat; /* number of patterns in this song */ UWORD numins; /* number of instruments */ UWORD numsmp; /* number of samples */ INSTRUMENT *instruments; /* all instruments */ SAMPLE *samples; /* all samples */ /* playback settings */ UWORD reppos; /* restart position */ UBYTE initspeed; /* initial song speed */ UWORD inittempo; /* initial song tempo */ UBYTE initvolume; /* initial global volume (0 - 128) */ UWORD panning[64]; /* 64 panning positions */ UBYTE chanvol[64]; /* 64 channel positions */ UWORD bpm; /* current beats-per-minute speed */ /* internal module representation */ UWORD numtrk; /* number of tracks */ UBYTE **tracks; /* array of numtrk pointers to tracks */ UWORD *patterns; /* array of Patterns */ UWORD *pattrows; /* array of number of rows for each pattern */ UWORD *positions; /* all positions */ } MODULE; /* used to convert c4spd to linear XM periods (IT and IMF loaders). */ extern UWORD finetune[]; extern UWORD getlinearperiod (UWORD, ULONG); extern UWORD getlogperiod (UWORD note, ULONG fine); extern UWORD getoldperiod (UWORD, ULONG); extern ULONG getfrequency (UBYTE, ULONG); extern ULONG getAmigaPeriod (UBYTE, ULONG); /* * ========== External interface */ extern UWORD finetune[]; extern BOOL ML_8bitsamples; extern BOOL ML_monosamples; extern CHAR *ML_InfoLoader (void); extern void ML_RegisterAllLoaders (void); extern BOOL ML_Test (URL); extern MODULE *ML_Load (URL, int, BOOL); extern CHAR *ML_LoadTitle (URL); extern void ML_Free (MODULE *); #ifdef __cplusplus } #endif #endif /* ex:set ts=4: */ TiMidity++-2.13.2/libunimod/unimod_priv.h0100644004711200001440000001067410055547346017404 0ustar tamukiusers/* MikMod sound library (c) 1998, 1999 Miodrag Vallat and others - see file AUTHORS for complete list. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /*============================================================================== $Id: unimod_priv.h,v 1.23 1999/10/25 16:31:41 miod Exp $ MikMod sound library internal definitions ==============================================================================*/ #ifndef _UNIMOD_PRIV_H #define _UNIMOD_PRIV_H #ifdef __cplusplus extern "C" { #endif #if defined(HAVE_MALLOC_H) && !defined(_MSC_VER) && !defined(__BORLANDC__) && !defined(__WATCOMC__) #include #endif #include #if defined(__OS2__)||defined(__EMX__)||defined(__W32__) #ifndef strcasecmp #define strcasecmp(s,t) stricmp(s,t) #endif #endif #include "unimod.h" #include "url.h" #ifdef __W32__ #pragma warning(disable:4761) #endif /*========== Error handling */ #define _mm_errno ML_errno /*========== Memory allocation */ extern void *_mm_malloc (size_t); extern void *_mm_calloc (size_t, size_t); #define _mm_free(p) do { if (p) free(p); p = NULL; } while(0) /*========== Portable file I/O */ #define _mm_read_SBYTE(x) ((SBYTE)url_getc(x)) #define _mm_read_UBYTE(x) ((UBYTE)url_getc(x)) #define _mm_read_SBYTES(x,y,z) url_nread(z,(void *)x,y) #define _mm_read_UBYTES(x,y,z) url_nread(z,(void *)x,y) #define _mm_fseek(x,y,z) url_seek(x,y,z) #define _mm_ftell(x) url_tell(x) #define _mm_eof(x) url_eof(x) #define _mm_rewind(x) _mm_fseek(x,0,SEEK_SET) extern int _mm_read_string (CHAR *, int, URL); extern SWORD _mm_read_M_SWORD (URL); extern SWORD _mm_read_I_SWORD (URL); extern UWORD _mm_read_M_UWORD (URL); extern UWORD _mm_read_I_UWORD (URL); extern SLONG _mm_read_M_SLONG (URL); extern SLONG _mm_read_I_SLONG (URL); extern ULONG _mm_read_M_ULONG (URL); extern ULONG _mm_read_I_ULONG (URL); extern int _mm_read_M_SWORDS (SWORD *, int, URL); extern int _mm_read_I_SWORDS (SWORD *, int, URL); extern int _mm_read_M_UWORDS (UWORD *, int, URL); extern int _mm_read_I_UWORDS (UWORD *, int, URL); extern int _mm_read_M_SLONGS (SLONG *, int, URL); extern int _mm_read_I_SLONGS (SLONG *, int, URL); extern int _mm_read_M_ULONGS (ULONG *, int, URL); extern int _mm_read_I_ULONGS (ULONG *, int, URL); /*========== Loaders */ typedef struct MLOADER { struct MLOADER *next; CHAR *type; CHAR *version; BOOL (*Init) (void); BOOL (*Test) (void); BOOL (*Load) (BOOL); void (*Cleanup) (void); CHAR *(*LoadTitle) (void); } MLOADER; /* internal loader variables: */ extern URL modreader; extern UWORD finetune[16]; extern MODULE of; /* static unimod loading space */ extern SBYTE remap[64]; /* for removing empty channels */ extern UBYTE *poslookup; /* lookup table for pattern jumps after blank pattern removal */ extern UBYTE poslookupcnt; extern UWORD *origpositions; extern BOOL filters; /* resonant filters in use */ extern UBYTE activemacro; /* active midi macro number for Sxx */ extern UBYTE filtermacros[16]; /* midi macros settings */ extern FILTER filtersettings[256]; /* computed filter settings */ extern int *noteindex; /* tracker identifiers */ #define STM_NTRACKERS 3 extern CHAR *STM_Signatures[]; extern CHAR *STM_Version[]; /*========== Internal loader interface */ extern BOOL ReadComment (UWORD); extern BOOL ReadLinedComment (UWORD, UWORD); extern BOOL AllocPositions (int); extern BOOL AllocPatterns (void); extern BOOL AllocTracks (void); extern BOOL AllocInstruments (void); extern BOOL AllocSamples (void); extern CHAR *DupStr (CHAR *, UWORD, BOOL); /* loader utility functions */ extern int *AllocLinear (void); extern void FreeLinear (void); extern int speed_to_finetune (ULONG, int); extern void S3MIT_ProcessCmd (UBYTE, UBYTE, BOOL); extern void S3MIT_CreateOrders (BOOL); #ifdef __cplusplus } #endif #endif /* ex:set ts=4: */ TiMidity++-2.13.2/interface/0040755004711200001440000000000010031564160014634 5ustar tamukiusersTiMidity++-2.13.2/interface/Makefile.am0100644004711200001440000002347610057342074016707 0ustar tamukiusers# TiMidity++ -- MIDI to WAVE converter and player # Copyright (C) 1999-2004 Masanao Izumo # Copyright (C) 1995 Tuukka Toivonen # # 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA include $(top_srcdir)/common.makefile.in SUFFIXES = .ptcl .tcl .@so@ SUBDIRS = motif_bitmaps bitmaps pixmaps INCLUDES = \ -I$(top_srcdir)/timidity \ -I$(top_srcdir)/libarc \ -I$(top_srcdir)/utils noinst_LIBRARIES = libinterface.a libinterface_a_SOURCES = \ dumb_c.c \ wrdt_dumb.c \ wrdt_tty.c EXTRA_libinterface_a_SOURCES = \ ncurs_c.c \ slang_c.c \ motif.h \ motif_c.c \ motif_i.c \ motif_p.c \ tk_c.c \ emacs_c.c \ vt100.h \ vt100.c \ vt100_c.c \ xaw.h \ xaw_c.c \ xaw_i.c \ xaw_redef.c \ xskin.h \ xskin_c.c \ xskin_i.c \ xskin_loadBMP.c \ xskin_spectrum.c \ wrdt_x.c \ x_sherry.c \ x_sherry.h \ x_wrdwindow.c \ x_wrdwindow.h \ VTPrsTbl.c \ VTparse.h \ x_mag.c \ x_mag.h \ dynamic_c.c \ mac_c.c \ mac_c.h \ mac_mag.c \ mac_mag.h \ mac_trace.c \ mac_wrdwindow.c \ mac_wrdwindow.h \ wrdt_mac.c \ wrdt_wcon.c \ gtk_c.c \ gtk_h.h \ gtk_i.c \ gtk_p.c \ soundspec.c \ soundspec.h \ x_sherry.c \ x_sherry.h \ check.xbm \ arrow.xbm \ on.xbm \ off.xbm \ server_c.c \ server_defs.h \ alsaseq_c.c \ w32g.h \ w32g_c.c \ w32g_ini.c \ w32g_rec.h \ w32g_res.h \ w32g_res.rc \ w32g_utl.c \ w32g_utl.h \ w32g_ut2.c \ w32g_ut2.h \ w32g_i.c \ w32g_playlist.c \ w32g_pref.c \ w32g_pref.h \ w32g_subwin.c \ w32g_subwin.h \ w32g_syn.c \ w32g_btn.bmp \ w32g_icon.ico \ w32g_sleep.bmp \ w32g_subbtn.bmp \ w32g_subwin2.c \ w32g_wrd.h \ wrdt_w32g.c \ w32g_subwin3.c \ w32g_tracer.h \ w32g_tracer.bmp \ w32g_mag.c \ w32g_mag.h \ w32g_dib.c \ w32g_dib.h \ winsyn_c.c \ rtsyn.h \ rtsyn_common.c \ rtsyn_winmm.c \ rtsyn_portmidi.c \ portmidisyn_c.c if ENABLE_WRD WRD_OBJS = \ wrdt_x.$(OBJEXT) \ x_wrdwindow.$(OBJEXT) \ VTPrsTbl.$(OBJEXT) \ x_mag.$(OBJEXT) \ x_sherry.$(OBJEXT) endif if CYGNUS WRD_WINCON_OBJS = wrdt_wcon.$(OBJEXT) endif if MSYS WRD_WINCON_OBJS2 = wrdt_wcon.$(OBJEXT) endif if NEEDDLOPEN DYNAMIC_OBJS = dynamic_c.$(OBJEXT) endif if ENABLE_SOUND_SPEC SOUND_SPEC_OBJS = \ soundspec.$(OBJEXT) endif if ENABLE_W32GUI W32GUI_DEPS = w32g_res.res endif if ENABLE_W32G_SYN W32GUI_DEPS = w32g_res.res endif INTERFACE_OBJS = $(INTERFACE_SRCS:.c=.$(OBJEXT)) libinterface_LIBADD = \ $(INTERFACE_OBJS) \ $(WRD_OBJS) \ $(WRD_WINCON_OBJS) \ $(WRD_WINCON_OBJS2) \ $(DYNAMIC_OBJS) \ $(SOUND_SPEC_OBJS) libinterface_a_LIBADD=$(libinterface_LIBADD) libinterface_dep = \ $(top_builddir)/interface.h \ $(libinterface_a_LIBADD) \ $(tcltk_dep) \ $(W32GUI_DEPS) libinterface.a: $(libinterface_a_OBJECTS) $(libinterface_a_DEPENDENCIES) $(libinterface_dep) if VCPP rm -f libinterface.a rm -f interface.lib link -lib $(libinterface_a_OBJECTS) $(libinterface_LIBADD) -out:interface.lib if test -f interface.lib ; then touch $@ ; fi else if BORLANDC rm -f libinterface.a rm -f interface.lib for foo in $(libinterface_a_OBJECTS) $(libinterface_LIBADD) ;do \ tlib interface.lib +$$foo; \ done if test -f interface.lib ; then touch $@ ; fi else if WATCOM_C rm -f libinterface.a rm -f interface.lib for foo in $(libinterface_a_OBJECTS) $(libinterface_LIBADD) ;do \ wlib -q interface.lib +$$foo; \ done if test -f interface.lib ; then touch $@ ; fi else rm -f libinterface.a $(AR) cru libinterface.a $(libinterface_a_OBJECTS) $(libinterface_a_LIBADD) $(RANLIB) libinterface.a endif endif endif # Tcl interface sources TCLSRCS = tkmidity.ptcl tkpanel.tcl browser.tcl misc.tcl # Tcl/Tk sources TCLF = tkmidity.tcl tkpanel.tcl browser.tcl misc.tcl ALLTCLF = $(TCLF) tclIndex EXTRA_DIST = \ escape_sjis.pl \ tkmidity.ptcl \ tkpanel.tcl \ browser.tcl \ misc.tcl \ timidity.el \ tclIndex \ interface_A.txt \ interface_T.txt \ interface_a.txt \ interface_e.txt \ interface_g.txt \ interface_i.txt \ interface_k.txt \ interface_m.txt \ interface_n.txt \ interface_s.txt .ptcl.tcl: sed -e 's@%TCL_DIR%@$(TCL_DIR)@g' $< > $@ clean: rm -f tkmidity.tcl rm -f *.$(OBJEXT) rm -f *.$(so) rm -f *.res rm -f *.RES rm -f *escaped.c rm -f *.a rm -f *.lib tclIndex: $(TCLSRCS) rm -f tclIndex echo 'auto_mkindex . *.tcl; exit' | $(WISH) if ENABLE_TCLTK install_tk = install.tk endif if ENABLE_DYNAMIC_TCLTK install_tk = install.tk endif if ENABLE_XAW install_xaw = install.xaw endif if ENABLE_DYNAMIC_XAW install_xaw = install.xaw endif install.tk: $(ALLTCLF) install.bitmaps test -d $(DESTDIR)$(TCL_DIR) || mkdir -p $(DESTDIR)$(TCL_DIR) for f in $(ALLTCLF) ''; do case ".$$f" in .);; *) $(INSTALL_DATA) $$f $(DESTDIR)$(TCL_DIR);; esac; done install.xaw: install.bitmaps install.bitmaps: cd bitmaps; $(MAKE) install.bitmaps if ENABLE_EMACS # ELFILES = @ELFILES@ # autoconf already define this install_el = install.el endif install.el: $(ELFILES) test -d $(DESTDIR)$(ELISP_DIR) || mkdir -p $(DESTDIR)$(ELISP_DIR) for f in $(ELFILES) ''; do case ".$$f" in .);; *) $(INSTALL_DATA) $$f $(DESTDIR)$(ELISP_DIR);; esac; done if VCPP w32g_res.res: w32g_res.h w32g_rec.h w32g_res.rc \ w32g_btn.bmp w32g_icon.ico w32g_sleep.bmp w32g_subbtn.bmp rc w32g_res.rc else if WATCOM_C w32g_res.res: w32g_res.h w32g_rec.h w32g_res.rc \ w32g_btn.bmp w32g_icon.ico w32g_sleep.bmp w32g_subbtn.bmp rc w32g_res.rc else if BORLANDC w32g_res.res: w32g_res.h w32g_rec.h w32g_res.rc \ w32g_btn.bmp w32g_icon.ico w32g_sleep.bmp w32g_subbtn.bmp perl -pe 's/(^FONT.*".*").*$$/$$1/' w32g_res.rc >w32g_res_bc.rc brcc32 -ic:/borland/bcc55/include w32g_res_bc.rc mv w32g_res_bc.RES w32g_res.res rm w32g_res_bc.rc else w32g_syn_escaped.c:w32g_syn.c escape_sjis.pl escape_sjis.pl < w32g_syn.c > w32g_syn_escaped.c w32g_subwin_escaped.c:w32g_subwin.c escape_sjis.pl escape_sjis.pl < w32g_subwin.c > w32g_subwin_escaped.c w32g_res.res: w32g_res.h w32g_rec.h w32g_res.rc \ w32g_btn.bmp w32g_icon.ico w32g_sleep.bmp w32g_subbtn.bmp \ escape_sjis.pl escape_sjis.pl w32g_res_escaped.rc windres -o $@ -O coff w32g_res.rc 2>&1|grep escape - >/dev/null && \ windres -o $@ -O coff w32g_res_escaped.rc || echo rm w32g_res_escaped.rc endif endif endif ## This is another way to build japanese resource for mingw. #BRCC32 = c:/borland/bcc55/bin/brcc32.exe #BRCC32_FLAGS = -ic:/borland/bcc55/include #w32g_res.res: w32g_res.h w32g_rec.h w32g_res.rc \ # w32g_btn.bmp w32g_icon.ico w32g_sleep.bmp w32g_subbtn.bmp # perl -pe 's/(^FONT.*".*").*$$/$$1/' w32g_res.rc >w32g_res_bc.rc # $(BRCC32) $(BRCC32_FLAGS) w32g_res_bc.rc # windres -o tmp.res -O coff w32g_res_bc.RES # mv tmp.res w32g_res.res # rm w32g_res_bc.RES if NEEDDLOPEN # dynamic_targets = @dynamic_targets@ # autoconf already define this install_dynamics = install.dynamics #n_so_libs = @n_so_libs@ #s_so_libs = @s_so_libs@ #m_so_libs = @m_so_libs@ #k_so_libs = @k_so_libs@ #e_so_libs = @e_so_libs@ #T_so_libs = @T_so_libs@ #a_so_libs = @a_so_libs@ #i_so_libs = @i_so_libs@ #g_so_libs = @g_so_libs@ all-am: $(dynamic_targets) install.dynamics: $(dynamic_targets) test -d $(DESTDIR)$(SHLIB_DIR) || mkdir -p $(DESTDIR)$(SHLIB_DIR) for f in $(dynamic_targets) ''; do case ".$$f" in .);; *) $(INSTALL_PROGRAM) $$f $(DESTDIR)$(SHLIB_DIR) ; $(INSTALL_DATA) $${f%%$(so)}txt $(DESTDIR)$(SHLIB_DIR);; esac; done .c.$(so): $(COMPILE) $(SHCFLAGS) -c $< -o $@ bitset.$(so): $(top_srcdir)/utils/bitset.c $(COMPILE) $(SHCFLAGS) -o $@ -c $< timer.$(so): $(top_srcdir)/utils/timer.c $(COMPILE) $(SHCFLAGS) -o $@ -c $< url_buff.$(so): $(top_srcdir)/libarc/url_buff.c $(COMPILE) $(SHCFLAGS) -o $@ -c $< support.$(so): $(top_srcdir)/utils/support.c $(COMPILE) $(SHCFLAGS) -o $@ -c $< interface_n.$(so): ncurs_c.$(so) support.$(so) bitset.$(so) timer.$(so) $(SHLD) -o $@ ncurs_c.$(so) support.$(so) bitset.$(so) timer.$(so) $(n_so_libs) interface_s.$(so): slang_c.$(so) support.$(so) timer.$(so) $(SHLD) -o $@ slang_c.$(so) support.$(so) timer.$(so) $(s_so_libs) interface_m.$(so): motif_c.$(so) support.$(so) motif_i.$(so) motif_p.$(so) $(SHLD) -o $@ motif_c.$(so) support.$(so) motif_i.$(so) motif_p.$(so) $(m_so_libs) interface_k.$(so): tk_c.$(so) support.$(so) $(SHLD) -o $@ tk_c.$(so) support.$(so) $(k_so_libs) interface_e.$(so): emacs_c.$(so) support.$(so) $(SHLD) -o $@ emacs_c.$(so) support.$(so) $(e_so_libs) interface_T.$(so): vt100_c.$(so) support.$(so) vt100.$(so) bitset.$(so) timer.$(so) $(SHLD) -o $@ vt100_c.$(so) support.$(so) vt100.$(so) bitset.$(so) timer.$(so) $(T_so_libs) interface_a.$(so): xaw_c.$(so) support.$(so) xaw_i.$(so) timer.$(so) $(SHLD) -o $@ xaw_c.$(so) support.$(so) xaw_i.$(so) timer.$(so) $(a_so_libs) interface_i.$(so): xskin_c.$(so) support.$(so) xskin_i.$(so) xskin_loadBMP.$(so) xskin_spectrum.$(so) url_buff.$(so) $(SHLD) -o $@ xskin_c.$(so) support.$(so) xskin_i.$(so) xskin_loadBMP.$(so) xskin_spectrum.$(so) url_buff.$(so) $(i_so_libs) interface_g.$(so): gtk_c.$(so) support.$(so) gtk_i.$(so) gtk_p.$(so) $(SHLD) -o $@ gtk_c.$(so) support.$(so) gtk_i.$(so) gtk_p.$(so) $(g_so_libs) interface_r.$(so): server_c.$(so) support.$(so) $(SHLD) -o $@ server_c.$(so) support.$(so) interface_A.$(so): alsaseq_c.$(so) support.$(so) $(SHLD) -o $@ alsaseq_c.$(so) support.$(so) endif clean-compile: -rm -f *.$(so) -rm -f *.res -rm -f *.RES install-exec-local: $(install_tk) $(install_xaw) $(install_el) $(install_dynamics) ########## End of Makefile TiMidity++-2.13.2/interface/Makefile.in0100644004711200001440000016662010127771432016721 0ustar tamukiusers# Makefile.in generated by automake 1.7.6 from Makefile.am. # @configure_input@ # Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 # 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@ # TiMidity++ -- MIDI to WAVE converter and player # Copyright (C) 1999-2004 Masanao Izumo # Copyright (C) 1995 Tuukka Toivonen # # 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # Define follows if you want to change. # Note that the definition of beginning with just one `#' implies # default value from configure. srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = .. am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ 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 = : host_triplet = @host@ pkgdatadir = @pkgdatadir@ #CC= @CC@ #CFLAGS = @CFLAGS@ # For pentium gcc # For PGCC #CPPFLAGS = @CPPFLAGS@ #DEFS = @DEFS@ #LDFLAGS = @LDFLAGS@ #LIBS = @LIBS@ #SHLD = @SHLD@ #SHCFLAGS = @SHCFLAGS@ #@SET_MAKE@ #prefix = @prefix@ #exec_prefix = @exec_prefix@ #bindir = @bindir@ #libdir = @libdir@ #datadir = @datadir@ #mandir = @mandir@ pkglibdir = @pkglibdir@ ACLOCAL = @ACLOCAL@ ALSA_CFLAGS = @ALSA_CFLAGS@ ALSA_LIBS = @ALSA_LIBS@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AO_CFLAGS = @AO_CFLAGS@ AO_LIBS = @AO_LIBS@ ARTS_CFLAGS = @ARTS_CFLAGS@ ARTS_CONFIG = @ARTS_CONFIG@ ARTS_LIBS = @ARTS_LIBS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ A_so_libs = @A_so_libs@ BORLANDC_FALSE = @BORLANDC_FALSE@ BORLANDC_LDFLAGS = @BORLANDC_LDFLAGS@ BORLANDC_START = @BORLANDC_START@ BORLANDC_TRUE = @BORLANDC_TRUE@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGNUS_FALSE = @CYGNUS_FALSE@ CYGNUS_TRUE = @CYGNUS_TRUE@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ELFILES = @ELFILES@ EMACS = @EMACS@ ENABLE_ALSASEQ_FALSE = @ENABLE_ALSASEQ_FALSE@ ENABLE_ALSASEQ_TRUE = @ENABLE_ALSASEQ_TRUE@ ENABLE_DYNAMIC_TCLTK_FALSE = @ENABLE_DYNAMIC_TCLTK_FALSE@ ENABLE_DYNAMIC_TCLTK_TRUE = @ENABLE_DYNAMIC_TCLTK_TRUE@ ENABLE_DYNAMIC_XAW_FALSE = @ENABLE_DYNAMIC_XAW_FALSE@ ENABLE_DYNAMIC_XAW_TRUE = @ENABLE_DYNAMIC_XAW_TRUE@ ENABLE_EMACS_FALSE = @ENABLE_EMACS_FALSE@ ENABLE_EMACS_TRUE = @ENABLE_EMACS_TRUE@ ENABLE_GTK_FALSE = @ENABLE_GTK_FALSE@ ENABLE_GTK_TRUE = @ENABLE_GTK_TRUE@ ENABLE_MOTIF_FALSE = @ENABLE_MOTIF_FALSE@ ENABLE_MOTIF_TRUE = @ENABLE_MOTIF_TRUE@ ENABLE_NCURSES_FALSE = @ENABLE_NCURSES_FALSE@ ENABLE_NCURSES_TRUE = @ENABLE_NCURSES_TRUE@ ENABLE_NETWORK_FALSE = @ENABLE_NETWORK_FALSE@ ENABLE_NETWORK_TRUE = @ENABLE_NETWORK_TRUE@ ENABLE_PLUGIN_FALSE = @ENABLE_PLUGIN_FALSE@ ENABLE_PLUGIN_TRUE = @ENABLE_PLUGIN_TRUE@ ENABLE_PORTMIDISYN_FALSE = @ENABLE_PORTMIDISYN_FALSE@ ENABLE_PORTMIDISYN_TRUE = @ENABLE_PORTMIDISYN_TRUE@ ENABLE_SERVER_FALSE = @ENABLE_SERVER_FALSE@ ENABLE_SERVER_TRUE = @ENABLE_SERVER_TRUE@ ENABLE_SLANG_FALSE = @ENABLE_SLANG_FALSE@ ENABLE_SLANG_TRUE = @ENABLE_SLANG_TRUE@ ENABLE_SOUND_SPEC_FALSE = @ENABLE_SOUND_SPEC_FALSE@ ENABLE_SOUND_SPEC_TRUE = @ENABLE_SOUND_SPEC_TRUE@ ENABLE_TCLTK_FALSE = @ENABLE_TCLTK_FALSE@ ENABLE_TCLTK_TRUE = @ENABLE_TCLTK_TRUE@ ENABLE_VT100_FALSE = @ENABLE_VT100_FALSE@ ENABLE_VT100_TRUE = @ENABLE_VT100_TRUE@ ENABLE_W32GUI_FALSE = @ENABLE_W32GUI_FALSE@ ENABLE_W32GUI_TRUE = @ENABLE_W32GUI_TRUE@ ENABLE_W32G_SYN_FALSE = @ENABLE_W32G_SYN_FALSE@ ENABLE_W32G_SYN_TRUE = @ENABLE_W32G_SYN_TRUE@ ENABLE_WINSYN_FALSE = @ENABLE_WINSYN_FALSE@ ENABLE_WINSYN_TRUE = @ENABLE_WINSYN_TRUE@ ENABLE_WRD_FALSE = @ENABLE_WRD_FALSE@ ENABLE_WRD_TRUE = @ENABLE_WRD_TRUE@ ENABLE_XAW_FALSE = @ENABLE_XAW_FALSE@ ENABLE_XAW_TRUE = @ENABLE_XAW_TRUE@ ENABLE_XSKIN_FALSE = @ENABLE_XSKIN_FALSE@ ENABLE_XSKIN_TRUE = @ENABLE_XSKIN_TRUE@ ESD_CFLAGS = @ESD_CFLAGS@ ESD_CONFIG = @ESD_CONFIG@ ESD_LIBS = @ESD_LIBS@ EXEEXT = @EXEEXT@ EXTRALIBS = @EXTRALIBS@ GTK_CFLAGS = @GTK_CFLAGS@ GTK_CONFIG = @GTK_CONFIG@ GTK_LIBS = @GTK_LIBS@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INTERFACE_SRCS = @INTERFACE_SRCS@ LDFLAGS = @LDFLAGS@ LIBFLAC_CFLAGS = @LIBFLAC_CFLAGS@ LIBFLAC_LIBS = @LIBFLAC_LIBS@ LIBOBJS = @LIBOBJS@ LIBOGGFLAC_CFLAGS = @LIBOGGFLAC_CFLAGS@ LIBOGGFLAC_LIBS = @LIBOGGFLAC_LIBS@ LIBS = @LIBS@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ MAKEINFO = @MAKEINFO@ MSYS_FALSE = @MSYS_FALSE@ MSYS_TRUE = @MSYS_TRUE@ NEEDDLOPEN_FALSE = @NEEDDLOPEN_FALSE@ NEEDDLOPEN_TRUE = @NEEDDLOPEN_TRUE@ NEEDGETOPT_FALSE = @NEEDGETOPT_FALSE@ NEEDGETOPT_TRUE = @NEEDGETOPT_TRUE@ NETSRCS = @NETSRCS@ OBJEXT = @OBJEXT@ OGG_CFLAGS = @OGG_CFLAGS@ OGG_LIBS = @OGG_LIBS@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PKG_CONFIG = @PKG_CONFIG@ P_so_libs = @P_so_libs@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ SHCFLAGS = @SHCFLAGS@ SHELL = @SHELL@ SHLD = @SHLD@ STRIP = @STRIP@ SYSEXTRAS = @SYSEXTRAS@ T_so_libs = @T_so_libs@ VCPP_FALSE = @VCPP_FALSE@ VCPP_LDFLAGS = @VCPP_LDFLAGS@ VCPP_TRUE = @VCPP_TRUE@ VERSION = @VERSION@ VORBISENC_LIBS = @VORBISENC_LIBS@ VORBISFILE_LIBS = @VORBISFILE_LIBS@ VORBIS_CFLAGS = @VORBIS_CFLAGS@ VORBIS_LIBS = @VORBIS_LIBS@ W32READDIR_FALSE = @W32READDIR_FALSE@ W32READDIR_TRUE = @W32READDIR_TRUE@ WATCOM_C_FALSE = @WATCOM_C_FALSE@ WATCOM_C_TRUE = @WATCOM_C_TRUE@ WATCOM_LDFLAGS = @WATCOM_LDFLAGS@ WISH = @WISH@ W_so_libs = @W_so_libs@ X_CFLAGS = @X_CFLAGS@ X_EXTRA_LIBS = @X_EXTRA_LIBS@ X_LIBS = @X_LIBS@ X_PRE_LIBS = @X_PRE_LIBS@ a_so_libs = @a_so_libs@ ac_ct_CC = @ac_ct_CC@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ datadir = @datadir@ dynamic_targets = @dynamic_targets@ e_so_libs = @e_so_libs@ exec_prefix = @exec_prefix@ g_so_libs = @g_so_libs@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ i_so_libs = @i_so_libs@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ k_so_libs = @k_so_libs@ libdir = @libdir@ libexecdir = @libexecdir@ lispdir = @lispdir@ localstatedir = @localstatedir@ m_so_libs = @m_so_libs@ mandir = @mandir@ n_so_libs = @n_so_libs@ oldincludedir = @oldincludedir@ p_so_libs = @p_so_libs@ prefix = @prefix@ program_transform_name = @program_transform_name@ r_so_libs = @r_so_libs@ s_so_libs = @s_so_libs@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ so = @so@ sysconfdir = @sysconfdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ tcltk_dep = @tcltk_dep@ timidity_LDFLAGS = @timidity_LDFLAGS@ w_so_libs = @w_so_libs@ #INSTALL = @INSTALL@ # Where to install the patches, config files. PKGDATADIR = $(pkgdatadir) # Where to install the Tcl code and the bitmaps. # It also contains bitmaps which are shared with XAW interface. PKGLIBDIR = $(pkglibdir) # Where to install the dynamic link interface. SHLIB_DIR = $(pkglibdir) # Where to install timidity.el ELISP_DIR = $(lispdir) # If you want to change TCL_DIR, please do follows. # * Add -DTKPROGPATH=\"$(TCL_DIR)/tkmidity.tcl\" to CPPFLAGS. # * Make a symbolic link $(PKGLIBDIR)/bitmaps to $(TCL_DIR)/bitmaps TCL_DIR = $(PKGLIBDIR) # Define the timidity default file search path. DEF_DEFAULT_PATH = -DDEFAULT_PATH=\"$(PKGDATADIR)\" # You sould not change follows definitions. DEF_PKGDATADIR = -DPKGDATADIR=\"$(PKGDATADIR)\" DEF_PKGLIBDIR = -DPKGLIBDIR=\"$(PKGLIBDIR)\" DEF_SHLIB_DIR = -DSHLIB_DIR=\"$(SHLIB_DIR)\" BITMAP_DIR = $(TCL_DIR)/bitmaps SUFFIXES = .ptcl .tcl .@so@ SUBDIRS = motif_bitmaps bitmaps pixmaps INCLUDES = \ -I$(top_srcdir)/timidity \ -I$(top_srcdir)/libarc \ -I$(top_srcdir)/utils noinst_LIBRARIES = libinterface.a libinterface_a_SOURCES = \ dumb_c.c \ wrdt_dumb.c \ wrdt_tty.c EXTRA_libinterface_a_SOURCES = \ ncurs_c.c \ slang_c.c \ motif.h \ motif_c.c \ motif_i.c \ motif_p.c \ tk_c.c \ emacs_c.c \ vt100.h \ vt100.c \ vt100_c.c \ xaw.h \ xaw_c.c \ xaw_i.c \ xaw_redef.c \ xskin.h \ xskin_c.c \ xskin_i.c \ xskin_loadBMP.c \ xskin_spectrum.c \ wrdt_x.c \ x_sherry.c \ x_sherry.h \ x_wrdwindow.c \ x_wrdwindow.h \ VTPrsTbl.c \ VTparse.h \ x_mag.c \ x_mag.h \ dynamic_c.c \ mac_c.c \ mac_c.h \ mac_mag.c \ mac_mag.h \ mac_trace.c \ mac_wrdwindow.c \ mac_wrdwindow.h \ wrdt_mac.c \ wrdt_wcon.c \ gtk_c.c \ gtk_h.h \ gtk_i.c \ gtk_p.c \ soundspec.c \ soundspec.h \ x_sherry.c \ x_sherry.h \ check.xbm \ arrow.xbm \ on.xbm \ off.xbm \ server_c.c \ server_defs.h \ alsaseq_c.c \ w32g.h \ w32g_c.c \ w32g_ini.c \ w32g_rec.h \ w32g_res.h \ w32g_res.rc \ w32g_utl.c \ w32g_utl.h \ w32g_ut2.c \ w32g_ut2.h \ w32g_i.c \ w32g_playlist.c \ w32g_pref.c \ w32g_pref.h \ w32g_subwin.c \ w32g_subwin.h \ w32g_syn.c \ w32g_btn.bmp \ w32g_icon.ico \ w32g_sleep.bmp \ w32g_subbtn.bmp \ w32g_subwin2.c \ w32g_wrd.h \ wrdt_w32g.c \ w32g_subwin3.c \ w32g_tracer.h \ w32g_tracer.bmp \ w32g_mag.c \ w32g_mag.h \ w32g_dib.c \ w32g_dib.h \ winsyn_c.c \ rtsyn.h \ rtsyn_common.c \ rtsyn_winmm.c \ rtsyn_portmidi.c \ portmidisyn_c.c @ENABLE_WRD_TRUE@WRD_OBJS = \ @ENABLE_WRD_TRUE@ wrdt_x.$(OBJEXT) \ @ENABLE_WRD_TRUE@ x_wrdwindow.$(OBJEXT) \ @ENABLE_WRD_TRUE@ VTPrsTbl.$(OBJEXT) \ @ENABLE_WRD_TRUE@ x_mag.$(OBJEXT) \ @ENABLE_WRD_TRUE@ x_sherry.$(OBJEXT) @CYGNUS_TRUE@WRD_WINCON_OBJS = wrdt_wcon.$(OBJEXT) @MSYS_TRUE@WRD_WINCON_OBJS2 = wrdt_wcon.$(OBJEXT) @NEEDDLOPEN_TRUE@DYNAMIC_OBJS = dynamic_c.$(OBJEXT) @ENABLE_SOUND_SPEC_TRUE@SOUND_SPEC_OBJS = \ @ENABLE_SOUND_SPEC_TRUE@ soundspec.$(OBJEXT) @ENABLE_W32G_SYN_TRUE@W32GUI_DEPS = w32g_res.res @ENABLE_W32GUI_TRUE@W32GUI_DEPS = w32g_res.res INTERFACE_OBJS = $(INTERFACE_SRCS:.c=.$(OBJEXT)) libinterface_LIBADD = \ $(INTERFACE_OBJS) \ $(WRD_OBJS) \ $(WRD_WINCON_OBJS) \ $(WRD_WINCON_OBJS2) \ $(DYNAMIC_OBJS) \ $(SOUND_SPEC_OBJS) libinterface_a_LIBADD = $(libinterface_LIBADD) libinterface_dep = \ $(top_builddir)/interface.h \ $(libinterface_a_LIBADD) \ $(tcltk_dep) \ $(W32GUI_DEPS) # Tcl interface sources TCLSRCS = tkmidity.ptcl tkpanel.tcl browser.tcl misc.tcl # Tcl/Tk sources TCLF = tkmidity.tcl tkpanel.tcl browser.tcl misc.tcl ALLTCLF = $(TCLF) tclIndex EXTRA_DIST = \ escape_sjis.pl \ tkmidity.ptcl \ tkpanel.tcl \ browser.tcl \ misc.tcl \ timidity.el \ tclIndex \ interface_A.txt \ interface_T.txt \ interface_a.txt \ interface_e.txt \ interface_g.txt \ interface_i.txt \ interface_k.txt \ interface_m.txt \ interface_n.txt \ interface_s.txt @ENABLE_TCLTK_TRUE@install_tk = install.tk @ENABLE_DYNAMIC_TCLTK_TRUE@install_tk = install.tk @ENABLE_DYNAMIC_XAW_TRUE@install_xaw = install.xaw @ENABLE_XAW_TRUE@install_xaw = install.xaw # ELFILES = @ELFILES@ # autoconf already define this @ENABLE_EMACS_TRUE@install_el = install.el #BRCC32 = c:/borland/bcc55/bin/brcc32.exe #BRCC32_FLAGS = -ic:/borland/bcc55/include #w32g_res.res: w32g_res.h w32g_rec.h w32g_res.rc \ # w32g_btn.bmp w32g_icon.ico w32g_sleep.bmp w32g_subbtn.bmp # perl -pe 's/(^FONT.*".*").*$$/$$1/' w32g_res.rc >w32g_res_bc.rc # $(BRCC32) $(BRCC32_FLAGS) w32g_res_bc.rc # windres -o tmp.res -O coff w32g_res_bc.RES # mv tmp.res w32g_res.res # rm w32g_res_bc.RES # dynamic_targets = @dynamic_targets@ # autoconf already define this @NEEDDLOPEN_TRUE@install_dynamics = install.dynamics subdir = interface ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 mkinstalldirs = $(SHELL) $(top_srcdir)/autoconf/mkinstalldirs CONFIG_HEADER = $(top_builddir)/config.h $(top_builddir)/interface.h CONFIG_CLEAN_FILES = LIBRARIES = $(noinst_LIBRARIES) libinterface_a_AR = $(AR) cru @CYGNUS_FALSE@@ENABLE_SOUND_SPEC_FALSE@@ENABLE_WRD_FALSE@@MSYS_FALSE@@NEEDDLOPEN_TRUE@libinterface_a_DEPENDENCIES = \ @CYGNUS_FALSE@@ENABLE_SOUND_SPEC_FALSE@@ENABLE_WRD_FALSE@@MSYS_FALSE@@NEEDDLOPEN_TRUE@ $(INTERFACE_SRCS:.c=.$(OBJEXT)) \ @CYGNUS_FALSE@@ENABLE_SOUND_SPEC_FALSE@@ENABLE_WRD_FALSE@@MSYS_FALSE@@NEEDDLOPEN_TRUE@ dynamic_c.$(OBJEXT) @CYGNUS_FALSE@@ENABLE_SOUND_SPEC_FALSE@@ENABLE_WRD_FALSE@@MSYS_FALSE@@NEEDDLOPEN_FALSE@libinterface_a_DEPENDENCIES = \ @CYGNUS_FALSE@@ENABLE_SOUND_SPEC_FALSE@@ENABLE_WRD_FALSE@@MSYS_FALSE@@NEEDDLOPEN_FALSE@ $(INTERFACE_SRCS:.c=.$(OBJEXT)) @CYGNUS_FALSE@@ENABLE_SOUND_SPEC_FALSE@@ENABLE_WRD_FALSE@@MSYS_TRUE@@NEEDDLOPEN_TRUE@libinterface_a_DEPENDENCIES = \ @CYGNUS_FALSE@@ENABLE_SOUND_SPEC_FALSE@@ENABLE_WRD_FALSE@@MSYS_TRUE@@NEEDDLOPEN_TRUE@ $(INTERFACE_SRCS:.c=.$(OBJEXT)) \ @CYGNUS_FALSE@@ENABLE_SOUND_SPEC_FALSE@@ENABLE_WRD_FALSE@@MSYS_TRUE@@NEEDDLOPEN_TRUE@ wrdt_wcon.$(OBJEXT) \ @CYGNUS_FALSE@@ENABLE_SOUND_SPEC_FALSE@@ENABLE_WRD_FALSE@@MSYS_TRUE@@NEEDDLOPEN_TRUE@ dynamic_c.$(OBJEXT) @CYGNUS_FALSE@@ENABLE_SOUND_SPEC_FALSE@@ENABLE_WRD_FALSE@@MSYS_TRUE@@NEEDDLOPEN_FALSE@libinterface_a_DEPENDENCIES = \ @CYGNUS_FALSE@@ENABLE_SOUND_SPEC_FALSE@@ENABLE_WRD_FALSE@@MSYS_TRUE@@NEEDDLOPEN_FALSE@ $(INTERFACE_SRCS:.c=.$(OBJEXT)) \ @CYGNUS_FALSE@@ENABLE_SOUND_SPEC_FALSE@@ENABLE_WRD_FALSE@@MSYS_TRUE@@NEEDDLOPEN_FALSE@ wrdt_wcon.$(OBJEXT) @CYGNUS_FALSE@@ENABLE_SOUND_SPEC_FALSE@@ENABLE_WRD_TRUE@@MSYS_FALSE@@NEEDDLOPEN_TRUE@libinterface_a_DEPENDENCIES = \ @CYGNUS_FALSE@@ENABLE_SOUND_SPEC_FALSE@@ENABLE_WRD_TRUE@@MSYS_FALSE@@NEEDDLOPEN_TRUE@ $(INTERFACE_SRCS:.c=.$(OBJEXT)) \ @CYGNUS_FALSE@@ENABLE_SOUND_SPEC_FALSE@@ENABLE_WRD_TRUE@@MSYS_FALSE@@NEEDDLOPEN_TRUE@ wrdt_x.$(OBJEXT) \ @CYGNUS_FALSE@@ENABLE_SOUND_SPEC_FALSE@@ENABLE_WRD_TRUE@@MSYS_FALSE@@NEEDDLOPEN_TRUE@ x_wrdwindow.$(OBJEXT) \ @CYGNUS_FALSE@@ENABLE_SOUND_SPEC_FALSE@@ENABLE_WRD_TRUE@@MSYS_FALSE@@NEEDDLOPEN_TRUE@ VTPrsTbl.$(OBJEXT) \ @CYGNUS_FALSE@@ENABLE_SOUND_SPEC_FALSE@@ENABLE_WRD_TRUE@@MSYS_FALSE@@NEEDDLOPEN_TRUE@ x_mag.$(OBJEXT) \ @CYGNUS_FALSE@@ENABLE_SOUND_SPEC_FALSE@@ENABLE_WRD_TRUE@@MSYS_FALSE@@NEEDDLOPEN_TRUE@ x_sherry.$(OBJEXT) \ @CYGNUS_FALSE@@ENABLE_SOUND_SPEC_FALSE@@ENABLE_WRD_TRUE@@MSYS_FALSE@@NEEDDLOPEN_TRUE@ dynamic_c.$(OBJEXT) @CYGNUS_FALSE@@ENABLE_SOUND_SPEC_FALSE@@ENABLE_WRD_TRUE@@MSYS_FALSE@@NEEDDLOPEN_FALSE@libinterface_a_DEPENDENCIES = \ @CYGNUS_FALSE@@ENABLE_SOUND_SPEC_FALSE@@ENABLE_WRD_TRUE@@MSYS_FALSE@@NEEDDLOPEN_FALSE@ $(INTERFACE_SRCS:.c=.$(OBJEXT)) \ @CYGNUS_FALSE@@ENABLE_SOUND_SPEC_FALSE@@ENABLE_WRD_TRUE@@MSYS_FALSE@@NEEDDLOPEN_FALSE@ wrdt_x.$(OBJEXT) \ @CYGNUS_FALSE@@ENABLE_SOUND_SPEC_FALSE@@ENABLE_WRD_TRUE@@MSYS_FALSE@@NEEDDLOPEN_FALSE@ x_wrdwindow.$(OBJEXT) \ @CYGNUS_FALSE@@ENABLE_SOUND_SPEC_FALSE@@ENABLE_WRD_TRUE@@MSYS_FALSE@@NEEDDLOPEN_FALSE@ VTPrsTbl.$(OBJEXT) \ @CYGNUS_FALSE@@ENABLE_SOUND_SPEC_FALSE@@ENABLE_WRD_TRUE@@MSYS_FALSE@@NEEDDLOPEN_FALSE@ x_mag.$(OBJEXT) \ @CYGNUS_FALSE@@ENABLE_SOUND_SPEC_FALSE@@ENABLE_WRD_TRUE@@MSYS_FALSE@@NEEDDLOPEN_FALSE@ x_sherry.$(OBJEXT) @CYGNUS_FALSE@@ENABLE_SOUND_SPEC_FALSE@@ENABLE_WRD_TRUE@@MSYS_TRUE@@NEEDDLOPEN_TRUE@libinterface_a_DEPENDENCIES = \ @CYGNUS_FALSE@@ENABLE_SOUND_SPEC_FALSE@@ENABLE_WRD_TRUE@@MSYS_TRUE@@NEEDDLOPEN_TRUE@ $(INTERFACE_SRCS:.c=.$(OBJEXT)) \ @CYGNUS_FALSE@@ENABLE_SOUND_SPEC_FALSE@@ENABLE_WRD_TRUE@@MSYS_TRUE@@NEEDDLOPEN_TRUE@ wrdt_x.$(OBJEXT) \ @CYGNUS_FALSE@@ENABLE_SOUND_SPEC_FALSE@@ENABLE_WRD_TRUE@@MSYS_TRUE@@NEEDDLOPEN_TRUE@ x_wrdwindow.$(OBJEXT) \ @CYGNUS_FALSE@@ENABLE_SOUND_SPEC_FALSE@@ENABLE_WRD_TRUE@@MSYS_TRUE@@NEEDDLOPEN_TRUE@ VTPrsTbl.$(OBJEXT) \ @CYGNUS_FALSE@@ENABLE_SOUND_SPEC_FALSE@@ENABLE_WRD_TRUE@@MSYS_TRUE@@NEEDDLOPEN_TRUE@ x_mag.$(OBJEXT) \ @CYGNUS_FALSE@@ENABLE_SOUND_SPEC_FALSE@@ENABLE_WRD_TRUE@@MSYS_TRUE@@NEEDDLOPEN_TRUE@ x_sherry.$(OBJEXT) \ @CYGNUS_FALSE@@ENABLE_SOUND_SPEC_FALSE@@ENABLE_WRD_TRUE@@MSYS_TRUE@@NEEDDLOPEN_TRUE@ wrdt_wcon.$(OBJEXT) \ @CYGNUS_FALSE@@ENABLE_SOUND_SPEC_FALSE@@ENABLE_WRD_TRUE@@MSYS_TRUE@@NEEDDLOPEN_TRUE@ dynamic_c.$(OBJEXT) @CYGNUS_FALSE@@ENABLE_SOUND_SPEC_FALSE@@ENABLE_WRD_TRUE@@MSYS_TRUE@@NEEDDLOPEN_FALSE@libinterface_a_DEPENDENCIES = \ @CYGNUS_FALSE@@ENABLE_SOUND_SPEC_FALSE@@ENABLE_WRD_TRUE@@MSYS_TRUE@@NEEDDLOPEN_FALSE@ $(INTERFACE_SRCS:.c=.$(OBJEXT)) \ @CYGNUS_FALSE@@ENABLE_SOUND_SPEC_FALSE@@ENABLE_WRD_TRUE@@MSYS_TRUE@@NEEDDLOPEN_FALSE@ wrdt_x.$(OBJEXT) \ @CYGNUS_FALSE@@ENABLE_SOUND_SPEC_FALSE@@ENABLE_WRD_TRUE@@MSYS_TRUE@@NEEDDLOPEN_FALSE@ x_wrdwindow.$(OBJEXT) \ @CYGNUS_FALSE@@ENABLE_SOUND_SPEC_FALSE@@ENABLE_WRD_TRUE@@MSYS_TRUE@@NEEDDLOPEN_FALSE@ VTPrsTbl.$(OBJEXT) \ @CYGNUS_FALSE@@ENABLE_SOUND_SPEC_FALSE@@ENABLE_WRD_TRUE@@MSYS_TRUE@@NEEDDLOPEN_FALSE@ x_mag.$(OBJEXT) \ @CYGNUS_FALSE@@ENABLE_SOUND_SPEC_FALSE@@ENABLE_WRD_TRUE@@MSYS_TRUE@@NEEDDLOPEN_FALSE@ x_sherry.$(OBJEXT) \ @CYGNUS_FALSE@@ENABLE_SOUND_SPEC_FALSE@@ENABLE_WRD_TRUE@@MSYS_TRUE@@NEEDDLOPEN_FALSE@ wrdt_wcon.$(OBJEXT) @CYGNUS_FALSE@@ENABLE_SOUND_SPEC_TRUE@@ENABLE_WRD_FALSE@@MSYS_FALSE@@NEEDDLOPEN_TRUE@libinterface_a_DEPENDENCIES = \ @CYGNUS_FALSE@@ENABLE_SOUND_SPEC_TRUE@@ENABLE_WRD_FALSE@@MSYS_FALSE@@NEEDDLOPEN_TRUE@ $(INTERFACE_SRCS:.c=.$(OBJEXT)) \ @CYGNUS_FALSE@@ENABLE_SOUND_SPEC_TRUE@@ENABLE_WRD_FALSE@@MSYS_FALSE@@NEEDDLOPEN_TRUE@ dynamic_c.$(OBJEXT) \ @CYGNUS_FALSE@@ENABLE_SOUND_SPEC_TRUE@@ENABLE_WRD_FALSE@@MSYS_FALSE@@NEEDDLOPEN_TRUE@ soundspec.$(OBJEXT) @CYGNUS_FALSE@@ENABLE_SOUND_SPEC_TRUE@@ENABLE_WRD_FALSE@@MSYS_FALSE@@NEEDDLOPEN_FALSE@libinterface_a_DEPENDENCIES = \ @CYGNUS_FALSE@@ENABLE_SOUND_SPEC_TRUE@@ENABLE_WRD_FALSE@@MSYS_FALSE@@NEEDDLOPEN_FALSE@ $(INTERFACE_SRCS:.c=.$(OBJEXT)) \ @CYGNUS_FALSE@@ENABLE_SOUND_SPEC_TRUE@@ENABLE_WRD_FALSE@@MSYS_FALSE@@NEEDDLOPEN_FALSE@ soundspec.$(OBJEXT) @CYGNUS_FALSE@@ENABLE_SOUND_SPEC_TRUE@@ENABLE_WRD_FALSE@@MSYS_TRUE@@NEEDDLOPEN_TRUE@libinterface_a_DEPENDENCIES = \ @CYGNUS_FALSE@@ENABLE_SOUND_SPEC_TRUE@@ENABLE_WRD_FALSE@@MSYS_TRUE@@NEEDDLOPEN_TRUE@ $(INTERFACE_SRCS:.c=.$(OBJEXT)) \ @CYGNUS_FALSE@@ENABLE_SOUND_SPEC_TRUE@@ENABLE_WRD_FALSE@@MSYS_TRUE@@NEEDDLOPEN_TRUE@ wrdt_wcon.$(OBJEXT) \ @CYGNUS_FALSE@@ENABLE_SOUND_SPEC_TRUE@@ENABLE_WRD_FALSE@@MSYS_TRUE@@NEEDDLOPEN_TRUE@ dynamic_c.$(OBJEXT) \ @CYGNUS_FALSE@@ENABLE_SOUND_SPEC_TRUE@@ENABLE_WRD_FALSE@@MSYS_TRUE@@NEEDDLOPEN_TRUE@ soundspec.$(OBJEXT) @CYGNUS_FALSE@@ENABLE_SOUND_SPEC_TRUE@@ENABLE_WRD_FALSE@@MSYS_TRUE@@NEEDDLOPEN_FALSE@libinterface_a_DEPENDENCIES = \ @CYGNUS_FALSE@@ENABLE_SOUND_SPEC_TRUE@@ENABLE_WRD_FALSE@@MSYS_TRUE@@NEEDDLOPEN_FALSE@ $(INTERFACE_SRCS:.c=.$(OBJEXT)) \ @CYGNUS_FALSE@@ENABLE_SOUND_SPEC_TRUE@@ENABLE_WRD_FALSE@@MSYS_TRUE@@NEEDDLOPEN_FALSE@ wrdt_wcon.$(OBJEXT) \ @CYGNUS_FALSE@@ENABLE_SOUND_SPEC_TRUE@@ENABLE_WRD_FALSE@@MSYS_TRUE@@NEEDDLOPEN_FALSE@ soundspec.$(OBJEXT) @CYGNUS_FALSE@@ENABLE_SOUND_SPEC_TRUE@@ENABLE_WRD_TRUE@@MSYS_FALSE@@NEEDDLOPEN_TRUE@libinterface_a_DEPENDENCIES = \ @CYGNUS_FALSE@@ENABLE_SOUND_SPEC_TRUE@@ENABLE_WRD_TRUE@@MSYS_FALSE@@NEEDDLOPEN_TRUE@ $(INTERFACE_SRCS:.c=.$(OBJEXT)) \ @CYGNUS_FALSE@@ENABLE_SOUND_SPEC_TRUE@@ENABLE_WRD_TRUE@@MSYS_FALSE@@NEEDDLOPEN_TRUE@ wrdt_x.$(OBJEXT) \ @CYGNUS_FALSE@@ENABLE_SOUND_SPEC_TRUE@@ENABLE_WRD_TRUE@@MSYS_FALSE@@NEEDDLOPEN_TRUE@ x_wrdwindow.$(OBJEXT) \ @CYGNUS_FALSE@@ENABLE_SOUND_SPEC_TRUE@@ENABLE_WRD_TRUE@@MSYS_FALSE@@NEEDDLOPEN_TRUE@ VTPrsTbl.$(OBJEXT) \ @CYGNUS_FALSE@@ENABLE_SOUND_SPEC_TRUE@@ENABLE_WRD_TRUE@@MSYS_FALSE@@NEEDDLOPEN_TRUE@ x_mag.$(OBJEXT) \ @CYGNUS_FALSE@@ENABLE_SOUND_SPEC_TRUE@@ENABLE_WRD_TRUE@@MSYS_FALSE@@NEEDDLOPEN_TRUE@ x_sherry.$(OBJEXT) \ @CYGNUS_FALSE@@ENABLE_SOUND_SPEC_TRUE@@ENABLE_WRD_TRUE@@MSYS_FALSE@@NEEDDLOPEN_TRUE@ dynamic_c.$(OBJEXT) \ @CYGNUS_FALSE@@ENABLE_SOUND_SPEC_TRUE@@ENABLE_WRD_TRUE@@MSYS_FALSE@@NEEDDLOPEN_TRUE@ soundspec.$(OBJEXT) @CYGNUS_FALSE@@ENABLE_SOUND_SPEC_TRUE@@ENABLE_WRD_TRUE@@MSYS_FALSE@@NEEDDLOPEN_FALSE@libinterface_a_DEPENDENCIES = \ @CYGNUS_FALSE@@ENABLE_SOUND_SPEC_TRUE@@ENABLE_WRD_TRUE@@MSYS_FALSE@@NEEDDLOPEN_FALSE@ $(INTERFACE_SRCS:.c=.$(OBJEXT)) \ @CYGNUS_FALSE@@ENABLE_SOUND_SPEC_TRUE@@ENABLE_WRD_TRUE@@MSYS_FALSE@@NEEDDLOPEN_FALSE@ wrdt_x.$(OBJEXT) \ @CYGNUS_FALSE@@ENABLE_SOUND_SPEC_TRUE@@ENABLE_WRD_TRUE@@MSYS_FALSE@@NEEDDLOPEN_FALSE@ x_wrdwindow.$(OBJEXT) \ @CYGNUS_FALSE@@ENABLE_SOUND_SPEC_TRUE@@ENABLE_WRD_TRUE@@MSYS_FALSE@@NEEDDLOPEN_FALSE@ VTPrsTbl.$(OBJEXT) \ @CYGNUS_FALSE@@ENABLE_SOUND_SPEC_TRUE@@ENABLE_WRD_TRUE@@MSYS_FALSE@@NEEDDLOPEN_FALSE@ x_mag.$(OBJEXT) \ @CYGNUS_FALSE@@ENABLE_SOUND_SPEC_TRUE@@ENABLE_WRD_TRUE@@MSYS_FALSE@@NEEDDLOPEN_FALSE@ x_sherry.$(OBJEXT) \ @CYGNUS_FALSE@@ENABLE_SOUND_SPEC_TRUE@@ENABLE_WRD_TRUE@@MSYS_FALSE@@NEEDDLOPEN_FALSE@ soundspec.$(OBJEXT) @CYGNUS_FALSE@@ENABLE_SOUND_SPEC_TRUE@@ENABLE_WRD_TRUE@@MSYS_TRUE@@NEEDDLOPEN_TRUE@libinterface_a_DEPENDENCIES = \ @CYGNUS_FALSE@@ENABLE_SOUND_SPEC_TRUE@@ENABLE_WRD_TRUE@@MSYS_TRUE@@NEEDDLOPEN_TRUE@ $(INTERFACE_SRCS:.c=.$(OBJEXT)) \ @CYGNUS_FALSE@@ENABLE_SOUND_SPEC_TRUE@@ENABLE_WRD_TRUE@@MSYS_TRUE@@NEEDDLOPEN_TRUE@ wrdt_x.$(OBJEXT) \ @CYGNUS_FALSE@@ENABLE_SOUND_SPEC_TRUE@@ENABLE_WRD_TRUE@@MSYS_TRUE@@NEEDDLOPEN_TRUE@ x_wrdwindow.$(OBJEXT) \ @CYGNUS_FALSE@@ENABLE_SOUND_SPEC_TRUE@@ENABLE_WRD_TRUE@@MSYS_TRUE@@NEEDDLOPEN_TRUE@ VTPrsTbl.$(OBJEXT) \ @CYGNUS_FALSE@@ENABLE_SOUND_SPEC_TRUE@@ENABLE_WRD_TRUE@@MSYS_TRUE@@NEEDDLOPEN_TRUE@ x_mag.$(OBJEXT) \ @CYGNUS_FALSE@@ENABLE_SOUND_SPEC_TRUE@@ENABLE_WRD_TRUE@@MSYS_TRUE@@NEEDDLOPEN_TRUE@ x_sherry.$(OBJEXT) \ @CYGNUS_FALSE@@ENABLE_SOUND_SPEC_TRUE@@ENABLE_WRD_TRUE@@MSYS_TRUE@@NEEDDLOPEN_TRUE@ wrdt_wcon.$(OBJEXT) \ @CYGNUS_FALSE@@ENABLE_SOUND_SPEC_TRUE@@ENABLE_WRD_TRUE@@MSYS_TRUE@@NEEDDLOPEN_TRUE@ dynamic_c.$(OBJEXT) \ @CYGNUS_FALSE@@ENABLE_SOUND_SPEC_TRUE@@ENABLE_WRD_TRUE@@MSYS_TRUE@@NEEDDLOPEN_TRUE@ soundspec.$(OBJEXT) @CYGNUS_FALSE@@ENABLE_SOUND_SPEC_TRUE@@ENABLE_WRD_TRUE@@MSYS_TRUE@@NEEDDLOPEN_FALSE@libinterface_a_DEPENDENCIES = \ @CYGNUS_FALSE@@ENABLE_SOUND_SPEC_TRUE@@ENABLE_WRD_TRUE@@MSYS_TRUE@@NEEDDLOPEN_FALSE@ $(INTERFACE_SRCS:.c=.$(OBJEXT)) \ @CYGNUS_FALSE@@ENABLE_SOUND_SPEC_TRUE@@ENABLE_WRD_TRUE@@MSYS_TRUE@@NEEDDLOPEN_FALSE@ wrdt_x.$(OBJEXT) \ @CYGNUS_FALSE@@ENABLE_SOUND_SPEC_TRUE@@ENABLE_WRD_TRUE@@MSYS_TRUE@@NEEDDLOPEN_FALSE@ x_wrdwindow.$(OBJEXT) \ @CYGNUS_FALSE@@ENABLE_SOUND_SPEC_TRUE@@ENABLE_WRD_TRUE@@MSYS_TRUE@@NEEDDLOPEN_FALSE@ VTPrsTbl.$(OBJEXT) \ @CYGNUS_FALSE@@ENABLE_SOUND_SPEC_TRUE@@ENABLE_WRD_TRUE@@MSYS_TRUE@@NEEDDLOPEN_FALSE@ x_mag.$(OBJEXT) \ @CYGNUS_FALSE@@ENABLE_SOUND_SPEC_TRUE@@ENABLE_WRD_TRUE@@MSYS_TRUE@@NEEDDLOPEN_FALSE@ x_sherry.$(OBJEXT) \ @CYGNUS_FALSE@@ENABLE_SOUND_SPEC_TRUE@@ENABLE_WRD_TRUE@@MSYS_TRUE@@NEEDDLOPEN_FALSE@ wrdt_wcon.$(OBJEXT) \ @CYGNUS_FALSE@@ENABLE_SOUND_SPEC_TRUE@@ENABLE_WRD_TRUE@@MSYS_TRUE@@NEEDDLOPEN_FALSE@ soundspec.$(OBJEXT) @CYGNUS_TRUE@@ENABLE_SOUND_SPEC_FALSE@@ENABLE_WRD_FALSE@@MSYS_FALSE@@NEEDDLOPEN_TRUE@libinterface_a_DEPENDENCIES = \ @CYGNUS_TRUE@@ENABLE_SOUND_SPEC_FALSE@@ENABLE_WRD_FALSE@@MSYS_FALSE@@NEEDDLOPEN_TRUE@ $(INTERFACE_SRCS:.c=.$(OBJEXT)) \ @CYGNUS_TRUE@@ENABLE_SOUND_SPEC_FALSE@@ENABLE_WRD_FALSE@@MSYS_FALSE@@NEEDDLOPEN_TRUE@ wrdt_wcon.$(OBJEXT) \ @CYGNUS_TRUE@@ENABLE_SOUND_SPEC_FALSE@@ENABLE_WRD_FALSE@@MSYS_FALSE@@NEEDDLOPEN_TRUE@ dynamic_c.$(OBJEXT) @CYGNUS_TRUE@@ENABLE_SOUND_SPEC_FALSE@@ENABLE_WRD_FALSE@@MSYS_FALSE@@NEEDDLOPEN_FALSE@libinterface_a_DEPENDENCIES = \ @CYGNUS_TRUE@@ENABLE_SOUND_SPEC_FALSE@@ENABLE_WRD_FALSE@@MSYS_FALSE@@NEEDDLOPEN_FALSE@ $(INTERFACE_SRCS:.c=.$(OBJEXT)) \ @CYGNUS_TRUE@@ENABLE_SOUND_SPEC_FALSE@@ENABLE_WRD_FALSE@@MSYS_FALSE@@NEEDDLOPEN_FALSE@ wrdt_wcon.$(OBJEXT) @CYGNUS_TRUE@@ENABLE_SOUND_SPEC_FALSE@@ENABLE_WRD_FALSE@@MSYS_TRUE@@NEEDDLOPEN_TRUE@libinterface_a_DEPENDENCIES = \ @CYGNUS_TRUE@@ENABLE_SOUND_SPEC_FALSE@@ENABLE_WRD_FALSE@@MSYS_TRUE@@NEEDDLOPEN_TRUE@ $(INTERFACE_SRCS:.c=.$(OBJEXT)) \ @CYGNUS_TRUE@@ENABLE_SOUND_SPEC_FALSE@@ENABLE_WRD_FALSE@@MSYS_TRUE@@NEEDDLOPEN_TRUE@ wrdt_wcon.$(OBJEXT) \ @CYGNUS_TRUE@@ENABLE_SOUND_SPEC_FALSE@@ENABLE_WRD_FALSE@@MSYS_TRUE@@NEEDDLOPEN_TRUE@ wrdt_wcon.$(OBJEXT) \ @CYGNUS_TRUE@@ENABLE_SOUND_SPEC_FALSE@@ENABLE_WRD_FALSE@@MSYS_TRUE@@NEEDDLOPEN_TRUE@ dynamic_c.$(OBJEXT) @CYGNUS_TRUE@@ENABLE_SOUND_SPEC_FALSE@@ENABLE_WRD_FALSE@@MSYS_TRUE@@NEEDDLOPEN_FALSE@libinterface_a_DEPENDENCIES = \ @CYGNUS_TRUE@@ENABLE_SOUND_SPEC_FALSE@@ENABLE_WRD_FALSE@@MSYS_TRUE@@NEEDDLOPEN_FALSE@ $(INTERFACE_SRCS:.c=.$(OBJEXT)) \ @CYGNUS_TRUE@@ENABLE_SOUND_SPEC_FALSE@@ENABLE_WRD_FALSE@@MSYS_TRUE@@NEEDDLOPEN_FALSE@ wrdt_wcon.$(OBJEXT) \ @CYGNUS_TRUE@@ENABLE_SOUND_SPEC_FALSE@@ENABLE_WRD_FALSE@@MSYS_TRUE@@NEEDDLOPEN_FALSE@ wrdt_wcon.$(OBJEXT) @CYGNUS_TRUE@@ENABLE_SOUND_SPEC_FALSE@@ENABLE_WRD_TRUE@@MSYS_FALSE@@NEEDDLOPEN_TRUE@libinterface_a_DEPENDENCIES = \ @CYGNUS_TRUE@@ENABLE_SOUND_SPEC_FALSE@@ENABLE_WRD_TRUE@@MSYS_FALSE@@NEEDDLOPEN_TRUE@ $(INTERFACE_SRCS:.c=.$(OBJEXT)) \ @CYGNUS_TRUE@@ENABLE_SOUND_SPEC_FALSE@@ENABLE_WRD_TRUE@@MSYS_FALSE@@NEEDDLOPEN_TRUE@ wrdt_x.$(OBJEXT) \ @CYGNUS_TRUE@@ENABLE_SOUND_SPEC_FALSE@@ENABLE_WRD_TRUE@@MSYS_FALSE@@NEEDDLOPEN_TRUE@ x_wrdwindow.$(OBJEXT) \ @CYGNUS_TRUE@@ENABLE_SOUND_SPEC_FALSE@@ENABLE_WRD_TRUE@@MSYS_FALSE@@NEEDDLOPEN_TRUE@ VTPrsTbl.$(OBJEXT) \ @CYGNUS_TRUE@@ENABLE_SOUND_SPEC_FALSE@@ENABLE_WRD_TRUE@@MSYS_FALSE@@NEEDDLOPEN_TRUE@ x_mag.$(OBJEXT) \ @CYGNUS_TRUE@@ENABLE_SOUND_SPEC_FALSE@@ENABLE_WRD_TRUE@@MSYS_FALSE@@NEEDDLOPEN_TRUE@ x_sherry.$(OBJEXT) \ @CYGNUS_TRUE@@ENABLE_SOUND_SPEC_FALSE@@ENABLE_WRD_TRUE@@MSYS_FALSE@@NEEDDLOPEN_TRUE@ wrdt_wcon.$(OBJEXT) \ @CYGNUS_TRUE@@ENABLE_SOUND_SPEC_FALSE@@ENABLE_WRD_TRUE@@MSYS_FALSE@@NEEDDLOPEN_TRUE@ dynamic_c.$(OBJEXT) @CYGNUS_TRUE@@ENABLE_SOUND_SPEC_FALSE@@ENABLE_WRD_TRUE@@MSYS_FALSE@@NEEDDLOPEN_FALSE@libinterface_a_DEPENDENCIES = \ @CYGNUS_TRUE@@ENABLE_SOUND_SPEC_FALSE@@ENABLE_WRD_TRUE@@MSYS_FALSE@@NEEDDLOPEN_FALSE@ $(INTERFACE_SRCS:.c=.$(OBJEXT)) \ @CYGNUS_TRUE@@ENABLE_SOUND_SPEC_FALSE@@ENABLE_WRD_TRUE@@MSYS_FALSE@@NEEDDLOPEN_FALSE@ wrdt_x.$(OBJEXT) \ @CYGNUS_TRUE@@ENABLE_SOUND_SPEC_FALSE@@ENABLE_WRD_TRUE@@MSYS_FALSE@@NEEDDLOPEN_FALSE@ x_wrdwindow.$(OBJEXT) \ @CYGNUS_TRUE@@ENABLE_SOUND_SPEC_FALSE@@ENABLE_WRD_TRUE@@MSYS_FALSE@@NEEDDLOPEN_FALSE@ VTPrsTbl.$(OBJEXT) \ @CYGNUS_TRUE@@ENABLE_SOUND_SPEC_FALSE@@ENABLE_WRD_TRUE@@MSYS_FALSE@@NEEDDLOPEN_FALSE@ x_mag.$(OBJEXT) \ @CYGNUS_TRUE@@ENABLE_SOUND_SPEC_FALSE@@ENABLE_WRD_TRUE@@MSYS_FALSE@@NEEDDLOPEN_FALSE@ x_sherry.$(OBJEXT) \ @CYGNUS_TRUE@@ENABLE_SOUND_SPEC_FALSE@@ENABLE_WRD_TRUE@@MSYS_FALSE@@NEEDDLOPEN_FALSE@ wrdt_wcon.$(OBJEXT) @CYGNUS_TRUE@@ENABLE_SOUND_SPEC_FALSE@@ENABLE_WRD_TRUE@@MSYS_TRUE@@NEEDDLOPEN_TRUE@libinterface_a_DEPENDENCIES = \ @CYGNUS_TRUE@@ENABLE_SOUND_SPEC_FALSE@@ENABLE_WRD_TRUE@@MSYS_TRUE@@NEEDDLOPEN_TRUE@ $(INTERFACE_SRCS:.c=.$(OBJEXT)) \ @CYGNUS_TRUE@@ENABLE_SOUND_SPEC_FALSE@@ENABLE_WRD_TRUE@@MSYS_TRUE@@NEEDDLOPEN_TRUE@ wrdt_x.$(OBJEXT) \ @CYGNUS_TRUE@@ENABLE_SOUND_SPEC_FALSE@@ENABLE_WRD_TRUE@@MSYS_TRUE@@NEEDDLOPEN_TRUE@ x_wrdwindow.$(OBJEXT) \ @CYGNUS_TRUE@@ENABLE_SOUND_SPEC_FALSE@@ENABLE_WRD_TRUE@@MSYS_TRUE@@NEEDDLOPEN_TRUE@ VTPrsTbl.$(OBJEXT) \ @CYGNUS_TRUE@@ENABLE_SOUND_SPEC_FALSE@@ENABLE_WRD_TRUE@@MSYS_TRUE@@NEEDDLOPEN_TRUE@ x_mag.$(OBJEXT) \ @CYGNUS_TRUE@@ENABLE_SOUND_SPEC_FALSE@@ENABLE_WRD_TRUE@@MSYS_TRUE@@NEEDDLOPEN_TRUE@ x_sherry.$(OBJEXT) \ @CYGNUS_TRUE@@ENABLE_SOUND_SPEC_FALSE@@ENABLE_WRD_TRUE@@MSYS_TRUE@@NEEDDLOPEN_TRUE@ wrdt_wcon.$(OBJEXT) \ @CYGNUS_TRUE@@ENABLE_SOUND_SPEC_FALSE@@ENABLE_WRD_TRUE@@MSYS_TRUE@@NEEDDLOPEN_TRUE@ wrdt_wcon.$(OBJEXT) \ @CYGNUS_TRUE@@ENABLE_SOUND_SPEC_FALSE@@ENABLE_WRD_TRUE@@MSYS_TRUE@@NEEDDLOPEN_TRUE@ dynamic_c.$(OBJEXT) @CYGNUS_TRUE@@ENABLE_SOUND_SPEC_FALSE@@ENABLE_WRD_TRUE@@MSYS_TRUE@@NEEDDLOPEN_FALSE@libinterface_a_DEPENDENCIES = \ @CYGNUS_TRUE@@ENABLE_SOUND_SPEC_FALSE@@ENABLE_WRD_TRUE@@MSYS_TRUE@@NEEDDLOPEN_FALSE@ $(INTERFACE_SRCS:.c=.$(OBJEXT)) \ @CYGNUS_TRUE@@ENABLE_SOUND_SPEC_FALSE@@ENABLE_WRD_TRUE@@MSYS_TRUE@@NEEDDLOPEN_FALSE@ wrdt_x.$(OBJEXT) \ @CYGNUS_TRUE@@ENABLE_SOUND_SPEC_FALSE@@ENABLE_WRD_TRUE@@MSYS_TRUE@@NEEDDLOPEN_FALSE@ x_wrdwindow.$(OBJEXT) \ @CYGNUS_TRUE@@ENABLE_SOUND_SPEC_FALSE@@ENABLE_WRD_TRUE@@MSYS_TRUE@@NEEDDLOPEN_FALSE@ VTPrsTbl.$(OBJEXT) \ @CYGNUS_TRUE@@ENABLE_SOUND_SPEC_FALSE@@ENABLE_WRD_TRUE@@MSYS_TRUE@@NEEDDLOPEN_FALSE@ x_mag.$(OBJEXT) \ @CYGNUS_TRUE@@ENABLE_SOUND_SPEC_FALSE@@ENABLE_WRD_TRUE@@MSYS_TRUE@@NEEDDLOPEN_FALSE@ x_sherry.$(OBJEXT) \ @CYGNUS_TRUE@@ENABLE_SOUND_SPEC_FALSE@@ENABLE_WRD_TRUE@@MSYS_TRUE@@NEEDDLOPEN_FALSE@ wrdt_wcon.$(OBJEXT) \ @CYGNUS_TRUE@@ENABLE_SOUND_SPEC_FALSE@@ENABLE_WRD_TRUE@@MSYS_TRUE@@NEEDDLOPEN_FALSE@ wrdt_wcon.$(OBJEXT) @CYGNUS_TRUE@@ENABLE_SOUND_SPEC_TRUE@@ENABLE_WRD_FALSE@@MSYS_FALSE@@NEEDDLOPEN_TRUE@libinterface_a_DEPENDENCIES = \ @CYGNUS_TRUE@@ENABLE_SOUND_SPEC_TRUE@@ENABLE_WRD_FALSE@@MSYS_FALSE@@NEEDDLOPEN_TRUE@ $(INTERFACE_SRCS:.c=.$(OBJEXT)) \ @CYGNUS_TRUE@@ENABLE_SOUND_SPEC_TRUE@@ENABLE_WRD_FALSE@@MSYS_FALSE@@NEEDDLOPEN_TRUE@ wrdt_wcon.$(OBJEXT) \ @CYGNUS_TRUE@@ENABLE_SOUND_SPEC_TRUE@@ENABLE_WRD_FALSE@@MSYS_FALSE@@NEEDDLOPEN_TRUE@ dynamic_c.$(OBJEXT) \ @CYGNUS_TRUE@@ENABLE_SOUND_SPEC_TRUE@@ENABLE_WRD_FALSE@@MSYS_FALSE@@NEEDDLOPEN_TRUE@ soundspec.$(OBJEXT) @CYGNUS_TRUE@@ENABLE_SOUND_SPEC_TRUE@@ENABLE_WRD_FALSE@@MSYS_FALSE@@NEEDDLOPEN_FALSE@libinterface_a_DEPENDENCIES = \ @CYGNUS_TRUE@@ENABLE_SOUND_SPEC_TRUE@@ENABLE_WRD_FALSE@@MSYS_FALSE@@NEEDDLOPEN_FALSE@ $(INTERFACE_SRCS:.c=.$(OBJEXT)) \ @CYGNUS_TRUE@@ENABLE_SOUND_SPEC_TRUE@@ENABLE_WRD_FALSE@@MSYS_FALSE@@NEEDDLOPEN_FALSE@ wrdt_wcon.$(OBJEXT) \ @CYGNUS_TRUE@@ENABLE_SOUND_SPEC_TRUE@@ENABLE_WRD_FALSE@@MSYS_FALSE@@NEEDDLOPEN_FALSE@ soundspec.$(OBJEXT) @CYGNUS_TRUE@@ENABLE_SOUND_SPEC_TRUE@@ENABLE_WRD_FALSE@@MSYS_TRUE@@NEEDDLOPEN_TRUE@libinterface_a_DEPENDENCIES = \ @CYGNUS_TRUE@@ENABLE_SOUND_SPEC_TRUE@@ENABLE_WRD_FALSE@@MSYS_TRUE@@NEEDDLOPEN_TRUE@ $(INTERFACE_SRCS:.c=.$(OBJEXT)) \ @CYGNUS_TRUE@@ENABLE_SOUND_SPEC_TRUE@@ENABLE_WRD_FALSE@@MSYS_TRUE@@NEEDDLOPEN_TRUE@ wrdt_wcon.$(OBJEXT) \ @CYGNUS_TRUE@@ENABLE_SOUND_SPEC_TRUE@@ENABLE_WRD_FALSE@@MSYS_TRUE@@NEEDDLOPEN_TRUE@ wrdt_wcon.$(OBJEXT) \ @CYGNUS_TRUE@@ENABLE_SOUND_SPEC_TRUE@@ENABLE_WRD_FALSE@@MSYS_TRUE@@NEEDDLOPEN_TRUE@ dynamic_c.$(OBJEXT) \ @CYGNUS_TRUE@@ENABLE_SOUND_SPEC_TRUE@@ENABLE_WRD_FALSE@@MSYS_TRUE@@NEEDDLOPEN_TRUE@ soundspec.$(OBJEXT) @CYGNUS_TRUE@@ENABLE_SOUND_SPEC_TRUE@@ENABLE_WRD_FALSE@@MSYS_TRUE@@NEEDDLOPEN_FALSE@libinterface_a_DEPENDENCIES = \ @CYGNUS_TRUE@@ENABLE_SOUND_SPEC_TRUE@@ENABLE_WRD_FALSE@@MSYS_TRUE@@NEEDDLOPEN_FALSE@ $(INTERFACE_SRCS:.c=.$(OBJEXT)) \ @CYGNUS_TRUE@@ENABLE_SOUND_SPEC_TRUE@@ENABLE_WRD_FALSE@@MSYS_TRUE@@NEEDDLOPEN_FALSE@ wrdt_wcon.$(OBJEXT) \ @CYGNUS_TRUE@@ENABLE_SOUND_SPEC_TRUE@@ENABLE_WRD_FALSE@@MSYS_TRUE@@NEEDDLOPEN_FALSE@ wrdt_wcon.$(OBJEXT) \ @CYGNUS_TRUE@@ENABLE_SOUND_SPEC_TRUE@@ENABLE_WRD_FALSE@@MSYS_TRUE@@NEEDDLOPEN_FALSE@ soundspec.$(OBJEXT) @CYGNUS_TRUE@@ENABLE_SOUND_SPEC_TRUE@@ENABLE_WRD_TRUE@@MSYS_FALSE@@NEEDDLOPEN_TRUE@libinterface_a_DEPENDENCIES = \ @CYGNUS_TRUE@@ENABLE_SOUND_SPEC_TRUE@@ENABLE_WRD_TRUE@@MSYS_FALSE@@NEEDDLOPEN_TRUE@ $(INTERFACE_SRCS:.c=.$(OBJEXT)) \ @CYGNUS_TRUE@@ENABLE_SOUND_SPEC_TRUE@@ENABLE_WRD_TRUE@@MSYS_FALSE@@NEEDDLOPEN_TRUE@ wrdt_x.$(OBJEXT) \ @CYGNUS_TRUE@@ENABLE_SOUND_SPEC_TRUE@@ENABLE_WRD_TRUE@@MSYS_FALSE@@NEEDDLOPEN_TRUE@ x_wrdwindow.$(OBJEXT) \ @CYGNUS_TRUE@@ENABLE_SOUND_SPEC_TRUE@@ENABLE_WRD_TRUE@@MSYS_FALSE@@NEEDDLOPEN_TRUE@ VTPrsTbl.$(OBJEXT) \ @CYGNUS_TRUE@@ENABLE_SOUND_SPEC_TRUE@@ENABLE_WRD_TRUE@@MSYS_FALSE@@NEEDDLOPEN_TRUE@ x_mag.$(OBJEXT) \ @CYGNUS_TRUE@@ENABLE_SOUND_SPEC_TRUE@@ENABLE_WRD_TRUE@@MSYS_FALSE@@NEEDDLOPEN_TRUE@ x_sherry.$(OBJEXT) \ @CYGNUS_TRUE@@ENABLE_SOUND_SPEC_TRUE@@ENABLE_WRD_TRUE@@MSYS_FALSE@@NEEDDLOPEN_TRUE@ wrdt_wcon.$(OBJEXT) \ @CYGNUS_TRUE@@ENABLE_SOUND_SPEC_TRUE@@ENABLE_WRD_TRUE@@MSYS_FALSE@@NEEDDLOPEN_TRUE@ dynamic_c.$(OBJEXT) \ @CYGNUS_TRUE@@ENABLE_SOUND_SPEC_TRUE@@ENABLE_WRD_TRUE@@MSYS_FALSE@@NEEDDLOPEN_TRUE@ soundspec.$(OBJEXT) @CYGNUS_TRUE@@ENABLE_SOUND_SPEC_TRUE@@ENABLE_WRD_TRUE@@MSYS_FALSE@@NEEDDLOPEN_FALSE@libinterface_a_DEPENDENCIES = \ @CYGNUS_TRUE@@ENABLE_SOUND_SPEC_TRUE@@ENABLE_WRD_TRUE@@MSYS_FALSE@@NEEDDLOPEN_FALSE@ $(INTERFACE_SRCS:.c=.$(OBJEXT)) \ @CYGNUS_TRUE@@ENABLE_SOUND_SPEC_TRUE@@ENABLE_WRD_TRUE@@MSYS_FALSE@@NEEDDLOPEN_FALSE@ wrdt_x.$(OBJEXT) \ @CYGNUS_TRUE@@ENABLE_SOUND_SPEC_TRUE@@ENABLE_WRD_TRUE@@MSYS_FALSE@@NEEDDLOPEN_FALSE@ x_wrdwindow.$(OBJEXT) \ @CYGNUS_TRUE@@ENABLE_SOUND_SPEC_TRUE@@ENABLE_WRD_TRUE@@MSYS_FALSE@@NEEDDLOPEN_FALSE@ VTPrsTbl.$(OBJEXT) \ @CYGNUS_TRUE@@ENABLE_SOUND_SPEC_TRUE@@ENABLE_WRD_TRUE@@MSYS_FALSE@@NEEDDLOPEN_FALSE@ x_mag.$(OBJEXT) \ @CYGNUS_TRUE@@ENABLE_SOUND_SPEC_TRUE@@ENABLE_WRD_TRUE@@MSYS_FALSE@@NEEDDLOPEN_FALSE@ x_sherry.$(OBJEXT) \ @CYGNUS_TRUE@@ENABLE_SOUND_SPEC_TRUE@@ENABLE_WRD_TRUE@@MSYS_FALSE@@NEEDDLOPEN_FALSE@ wrdt_wcon.$(OBJEXT) \ @CYGNUS_TRUE@@ENABLE_SOUND_SPEC_TRUE@@ENABLE_WRD_TRUE@@MSYS_FALSE@@NEEDDLOPEN_FALSE@ soundspec.$(OBJEXT) @CYGNUS_TRUE@@ENABLE_SOUND_SPEC_TRUE@@ENABLE_WRD_TRUE@@MSYS_TRUE@@NEEDDLOPEN_TRUE@libinterface_a_DEPENDENCIES = \ @CYGNUS_TRUE@@ENABLE_SOUND_SPEC_TRUE@@ENABLE_WRD_TRUE@@MSYS_TRUE@@NEEDDLOPEN_TRUE@ $(INTERFACE_SRCS:.c=.$(OBJEXT)) \ @CYGNUS_TRUE@@ENABLE_SOUND_SPEC_TRUE@@ENABLE_WRD_TRUE@@MSYS_TRUE@@NEEDDLOPEN_TRUE@ wrdt_x.$(OBJEXT) \ @CYGNUS_TRUE@@ENABLE_SOUND_SPEC_TRUE@@ENABLE_WRD_TRUE@@MSYS_TRUE@@NEEDDLOPEN_TRUE@ x_wrdwindow.$(OBJEXT) \ @CYGNUS_TRUE@@ENABLE_SOUND_SPEC_TRUE@@ENABLE_WRD_TRUE@@MSYS_TRUE@@NEEDDLOPEN_TRUE@ VTPrsTbl.$(OBJEXT) \ @CYGNUS_TRUE@@ENABLE_SOUND_SPEC_TRUE@@ENABLE_WRD_TRUE@@MSYS_TRUE@@NEEDDLOPEN_TRUE@ x_mag.$(OBJEXT) \ @CYGNUS_TRUE@@ENABLE_SOUND_SPEC_TRUE@@ENABLE_WRD_TRUE@@MSYS_TRUE@@NEEDDLOPEN_TRUE@ x_sherry.$(OBJEXT) \ @CYGNUS_TRUE@@ENABLE_SOUND_SPEC_TRUE@@ENABLE_WRD_TRUE@@MSYS_TRUE@@NEEDDLOPEN_TRUE@ wrdt_wcon.$(OBJEXT) \ @CYGNUS_TRUE@@ENABLE_SOUND_SPEC_TRUE@@ENABLE_WRD_TRUE@@MSYS_TRUE@@NEEDDLOPEN_TRUE@ wrdt_wcon.$(OBJEXT) \ @CYGNUS_TRUE@@ENABLE_SOUND_SPEC_TRUE@@ENABLE_WRD_TRUE@@MSYS_TRUE@@NEEDDLOPEN_TRUE@ dynamic_c.$(OBJEXT) \ @CYGNUS_TRUE@@ENABLE_SOUND_SPEC_TRUE@@ENABLE_WRD_TRUE@@MSYS_TRUE@@NEEDDLOPEN_TRUE@ soundspec.$(OBJEXT) @CYGNUS_TRUE@@ENABLE_SOUND_SPEC_TRUE@@ENABLE_WRD_TRUE@@MSYS_TRUE@@NEEDDLOPEN_FALSE@libinterface_a_DEPENDENCIES = \ @CYGNUS_TRUE@@ENABLE_SOUND_SPEC_TRUE@@ENABLE_WRD_TRUE@@MSYS_TRUE@@NEEDDLOPEN_FALSE@ $(INTERFACE_SRCS:.c=.$(OBJEXT)) \ @CYGNUS_TRUE@@ENABLE_SOUND_SPEC_TRUE@@ENABLE_WRD_TRUE@@MSYS_TRUE@@NEEDDLOPEN_FALSE@ wrdt_x.$(OBJEXT) \ @CYGNUS_TRUE@@ENABLE_SOUND_SPEC_TRUE@@ENABLE_WRD_TRUE@@MSYS_TRUE@@NEEDDLOPEN_FALSE@ x_wrdwindow.$(OBJEXT) \ @CYGNUS_TRUE@@ENABLE_SOUND_SPEC_TRUE@@ENABLE_WRD_TRUE@@MSYS_TRUE@@NEEDDLOPEN_FALSE@ VTPrsTbl.$(OBJEXT) \ @CYGNUS_TRUE@@ENABLE_SOUND_SPEC_TRUE@@ENABLE_WRD_TRUE@@MSYS_TRUE@@NEEDDLOPEN_FALSE@ x_mag.$(OBJEXT) \ @CYGNUS_TRUE@@ENABLE_SOUND_SPEC_TRUE@@ENABLE_WRD_TRUE@@MSYS_TRUE@@NEEDDLOPEN_FALSE@ x_sherry.$(OBJEXT) \ @CYGNUS_TRUE@@ENABLE_SOUND_SPEC_TRUE@@ENABLE_WRD_TRUE@@MSYS_TRUE@@NEEDDLOPEN_FALSE@ wrdt_wcon.$(OBJEXT) \ @CYGNUS_TRUE@@ENABLE_SOUND_SPEC_TRUE@@ENABLE_WRD_TRUE@@MSYS_TRUE@@NEEDDLOPEN_FALSE@ wrdt_wcon.$(OBJEXT) \ @CYGNUS_TRUE@@ENABLE_SOUND_SPEC_TRUE@@ENABLE_WRD_TRUE@@MSYS_TRUE@@NEEDDLOPEN_FALSE@ soundspec.$(OBJEXT) am_libinterface_a_OBJECTS = dumb_c.$(OBJEXT) wrdt_dumb.$(OBJEXT) \ wrdt_tty.$(OBJEXT) libinterface_a_OBJECTS = $(am_libinterface_a_OBJECTS) DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/autoconf/depcomp am__depfiles_maybe = depfiles @AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/VTPrsTbl.Po ./$(DEPDIR)/alsaseq_c.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/dumb_c.Po ./$(DEPDIR)/dynamic_c.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/emacs_c.Po ./$(DEPDIR)/gtk_c.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/gtk_i.Po ./$(DEPDIR)/gtk_p.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/mac_c.Po ./$(DEPDIR)/mac_mag.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/mac_trace.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/mac_wrdwindow.Po ./$(DEPDIR)/motif_c.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/motif_i.Po ./$(DEPDIR)/motif_p.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/ncurs_c.Po ./$(DEPDIR)/portmidisyn_c.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/rtsyn_common.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/rtsyn_portmidi.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/rtsyn_winmm.Po ./$(DEPDIR)/server_c.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/slang_c.Po ./$(DEPDIR)/soundspec.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/tk_c.Po ./$(DEPDIR)/vt100.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/vt100_c.Po ./$(DEPDIR)/w32g_c.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/w32g_dib.Po ./$(DEPDIR)/w32g_i.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/w32g_ini.Po ./$(DEPDIR)/w32g_mag.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/w32g_playlist.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/w32g_pref.Po ./$(DEPDIR)/w32g_subwin.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/w32g_subwin2.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/w32g_subwin3.Po ./$(DEPDIR)/w32g_syn.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/w32g_ut2.Po ./$(DEPDIR)/w32g_utl.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/winsyn_c.Po ./$(DEPDIR)/wrdt_dumb.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/wrdt_mac.Po ./$(DEPDIR)/wrdt_tty.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/wrdt_w32g.Po ./$(DEPDIR)/wrdt_wcon.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/wrdt_x.Po ./$(DEPDIR)/x_mag.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/x_sherry.Po ./$(DEPDIR)/x_wrdwindow.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/xaw_c.Po ./$(DEPDIR)/xaw_i.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/xaw_redef.Po ./$(DEPDIR)/xskin_c.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/xskin_i.Po ./$(DEPDIR)/xskin_loadBMP.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/xskin_spectrum.Po COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ DIST_SOURCES = $(libinterface_a_SOURCES) $(EXTRA_libinterface_a_SOURCES) RECURSIVE_TARGETS = info-recursive dvi-recursive pdf-recursive \ ps-recursive install-info-recursive uninstall-info-recursive \ all-recursive install-data-recursive install-exec-recursive \ installdirs-recursive install-recursive uninstall-recursive \ check-recursive installcheck-recursive DIST_COMMON = $(top_srcdir)/common.makefile.in Makefile.am Makefile.in DIST_SUBDIRS = $(SUBDIRS) SOURCES = $(libinterface_a_SOURCES) $(EXTRA_libinterface_a_SOURCES) all: all-recursive .SUFFIXES: .SUFFIXES: .ptcl .tcl .@so@ .$(so) .c .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/common.makefile.in $(top_srcdir)/configure.in $(ACLOCAL_M4) cd $(top_srcdir) && \ $(AUTOMAKE) --gnu interface/Makefile Makefile: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.in $(top_builddir)/config.status cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) AR = ar clean-noinstLIBRARIES: -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) mostlyclean-compile: -rm -f *.$(OBJEXT) core *.core distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/VTPrsTbl.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/alsaseq_c.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dumb_c.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dynamic_c.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/emacs_c.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gtk_c.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gtk_i.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gtk_p.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mac_c.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mac_mag.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mac_trace.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mac_wrdwindow.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/motif_c.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/motif_i.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/motif_p.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ncurs_c.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/portmidisyn_c.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rtsyn_common.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rtsyn_portmidi.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rtsyn_winmm.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/server_c.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/slang_c.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/soundspec.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tk_c.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vt100.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vt100_c.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/w32g_c.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/w32g_dib.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/w32g_i.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/w32g_ini.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/w32g_mag.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/w32g_playlist.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/w32g_pref.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/w32g_subwin.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/w32g_subwin2.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/w32g_subwin3.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/w32g_syn.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/w32g_ut2.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/w32g_utl.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/winsyn_c.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wrdt_dumb.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wrdt_mac.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wrdt_tty.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wrdt_w32g.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wrdt_wcon.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wrdt_x.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/x_mag.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/x_sherry.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/x_wrdwindow.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xaw_c.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xaw_i.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xaw_redef.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xskin_c.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xskin_i.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xskin_loadBMP.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xskin_spectrum.Po@am__quote@ distclean-depend: -rm -rf ./$(DEPDIR) .c.o: @am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ @am__fastdepCC_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ @am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ @am__fastdepCC_TRUE@ fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `test -f '$<' || echo '$(srcdir)/'`$< .c.obj: @am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ @am__fastdepCC_TRUE@ -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ @am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ @am__fastdepCC_TRUE@ fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi` uninstall-info-am: # 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. $(RECURSIVE_TARGETS): @set fnord $$MAKEFLAGS; amf=$$2; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ list='$(SUBDIRS)'; 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; \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" mostlyclean-recursive clean-recursive distclean-recursive \ maintainer-clean-recursive: @set fnord $$MAKEFLAGS; amf=$$2; \ dot_seen=no; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ rev=''; for subdir in $$list; do \ if test "$$subdir" = "."; then :; else \ rev="$$subdir $$rev"; \ fi; \ done; \ rev="$$rev ."; \ target=`echo $@ | sed s/-recursive//`; \ for subdir in $$rev; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ done && test -z "$$fail" tags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ done ctags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ done ETAGS = etags ETAGSFLAGS = CTAGS = ctags CTAGSFLAGS = tags: TAGS ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ mkid -fID $$unique TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ if (etags --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ else \ include_option=--include; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test -f $$subdir/TAGS && \ tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ test -z "$(ETAGS_ARGS)$$tags$$unique" \ || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$tags $$unique ctags: CTAGS CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ test -z "$(CTAGS_ARGS)$$tags$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$tags $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && cd $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) $$here distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) top_distdir = .. distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) distdir: $(DISTFILES) $(mkinstalldirs) $(distdir)/.. @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ list='$(DISTFILES)'; for file in $$list; do \ case $$file in \ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ esac; \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ $(mkinstalldirs) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ if test -d $$d/$$file; then \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test -d $(distdir)/$$subdir \ || mkdir $(distdir)/$$subdir \ || exit 1; \ (cd $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$(top_distdir)" \ distdir=../$(distdir)/$$subdir \ distdir) \ || exit 1; \ fi; \ done check-am: all-am check: check-recursive all-am: Makefile $(LIBRARIES) 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: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -rm -f Makefile $(CONFIG_CLEAN_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 clean-noinstLIBRARIES mostlyclean-am distclean: distclean-recursive distclean-am: clean-am distclean-compile distclean-depend \ distclean-generic distclean-tags dvi: dvi-recursive dvi-am: info: info-recursive info-am: install-data-am: install-exec-am: install-exec-local install-info: install-info-recursive install-man: installcheck-am: maintainer-clean: maintainer-clean-recursive 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-info-am uninstall-info: uninstall-info-recursive .PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am clean \ clean-generic clean-noinstLIBRARIES clean-recursive ctags \ ctags-recursive distclean distclean-compile distclean-depend \ distclean-generic distclean-recursive distclean-tags distdir \ dvi dvi-am dvi-recursive info info-am info-recursive install \ install-am install-data install-data-am install-data-recursive \ install-exec install-exec-am install-exec-local \ install-exec-recursive install-info install-info-am \ install-info-recursive install-man install-recursive \ install-strip installcheck installcheck-am installdirs \ installdirs-am installdirs-recursive maintainer-clean \ maintainer-clean-generic maintainer-clean-recursive mostlyclean \ mostlyclean-compile mostlyclean-generic mostlyclean-recursive \ pdf pdf-am pdf-recursive ps ps-am ps-recursive tags \ tags-recursive uninstall uninstall-am uninstall-info-am \ uninstall-info-recursive uninstall-recursive libinterface.a: $(libinterface_a_OBJECTS) $(libinterface_a_DEPENDENCIES) $(libinterface_dep) @VCPP_TRUE@ rm -f libinterface.a @VCPP_TRUE@ rm -f interface.lib @VCPP_TRUE@ link -lib $(libinterface_a_OBJECTS) $(libinterface_LIBADD) -out:interface.lib @VCPP_TRUE@ if test -f interface.lib ; then touch $@ ; fi @BORLANDC_TRUE@@VCPP_FALSE@ rm -f libinterface.a @BORLANDC_TRUE@@VCPP_FALSE@ rm -f interface.lib @BORLANDC_TRUE@@VCPP_FALSE@ for foo in $(libinterface_a_OBJECTS) $(libinterface_LIBADD) ;do \ @BORLANDC_TRUE@@VCPP_FALSE@ tlib interface.lib +$$foo; \ @BORLANDC_TRUE@@VCPP_FALSE@ done @BORLANDC_TRUE@@VCPP_FALSE@ if test -f interface.lib ; then touch $@ ; fi @BORLANDC_FALSE@@VCPP_FALSE@@WATCOM_C_TRUE@ rm -f libinterface.a @BORLANDC_FALSE@@VCPP_FALSE@@WATCOM_C_TRUE@ rm -f interface.lib @BORLANDC_FALSE@@VCPP_FALSE@@WATCOM_C_TRUE@ for foo in $(libinterface_a_OBJECTS) $(libinterface_LIBADD) ;do \ @BORLANDC_FALSE@@VCPP_FALSE@@WATCOM_C_TRUE@ wlib -q interface.lib +$$foo; \ @BORLANDC_FALSE@@VCPP_FALSE@@WATCOM_C_TRUE@ done @BORLANDC_FALSE@@VCPP_FALSE@@WATCOM_C_TRUE@ if test -f interface.lib ; then touch $@ ; fi @BORLANDC_FALSE@@VCPP_FALSE@@WATCOM_C_FALSE@ rm -f libinterface.a @BORLANDC_FALSE@@VCPP_FALSE@@WATCOM_C_FALSE@ $(AR) cru libinterface.a $(libinterface_a_OBJECTS) $(libinterface_a_LIBADD) @BORLANDC_FALSE@@VCPP_FALSE@@WATCOM_C_FALSE@ $(RANLIB) libinterface.a .ptcl.tcl: sed -e 's@%TCL_DIR%@$(TCL_DIR)@g' $< > $@ clean: rm -f tkmidity.tcl rm -f *.$(OBJEXT) rm -f *.$(so) rm -f *.res rm -f *.RES rm -f *escaped.c rm -f *.a rm -f *.lib tclIndex: $(TCLSRCS) rm -f tclIndex echo 'auto_mkindex . *.tcl; exit' | $(WISH) install.tk: $(ALLTCLF) install.bitmaps test -d $(DESTDIR)$(TCL_DIR) || mkdir -p $(DESTDIR)$(TCL_DIR) for f in $(ALLTCLF) ''; do case ".$$f" in .);; *) $(INSTALL_DATA) $$f $(DESTDIR)$(TCL_DIR);; esac; done install.xaw: install.bitmaps install.bitmaps: cd bitmaps; $(MAKE) install.bitmaps install.el: $(ELFILES) test -d $(DESTDIR)$(ELISP_DIR) || mkdir -p $(DESTDIR)$(ELISP_DIR) for f in $(ELFILES) ''; do case ".$$f" in .);; *) $(INSTALL_DATA) $$f $(DESTDIR)$(ELISP_DIR);; esac; done @VCPP_TRUE@w32g_res.res: w32g_res.h w32g_rec.h w32g_res.rc \ @VCPP_TRUE@ w32g_btn.bmp w32g_icon.ico w32g_sleep.bmp w32g_subbtn.bmp @VCPP_TRUE@ rc w32g_res.rc @VCPP_FALSE@@WATCOM_C_TRUE@w32g_res.res: w32g_res.h w32g_rec.h w32g_res.rc \ @VCPP_FALSE@@WATCOM_C_TRUE@ w32g_btn.bmp w32g_icon.ico w32g_sleep.bmp w32g_subbtn.bmp @VCPP_FALSE@@WATCOM_C_TRUE@ rc w32g_res.rc @BORLANDC_TRUE@@VCPP_FALSE@@WATCOM_C_FALSE@w32g_res.res: w32g_res.h w32g_rec.h w32g_res.rc \ @BORLANDC_TRUE@@VCPP_FALSE@@WATCOM_C_FALSE@ w32g_btn.bmp w32g_icon.ico w32g_sleep.bmp w32g_subbtn.bmp @BORLANDC_TRUE@@VCPP_FALSE@@WATCOM_C_FALSE@ perl -pe 's/(^FONT.*".*").*$$/$$1/' w32g_res.rc >w32g_res_bc.rc @BORLANDC_TRUE@@VCPP_FALSE@@WATCOM_C_FALSE@ brcc32 -ic:/borland/bcc55/include w32g_res_bc.rc @BORLANDC_TRUE@@VCPP_FALSE@@WATCOM_C_FALSE@ mv w32g_res_bc.RES w32g_res.res @BORLANDC_TRUE@@VCPP_FALSE@@WATCOM_C_FALSE@ rm w32g_res_bc.rc @BORLANDC_FALSE@@VCPP_FALSE@@WATCOM_C_FALSE@w32g_syn_escaped.c:w32g_syn.c escape_sjis.pl @BORLANDC_FALSE@@VCPP_FALSE@@WATCOM_C_FALSE@ escape_sjis.pl < w32g_syn.c > w32g_syn_escaped.c @BORLANDC_FALSE@@VCPP_FALSE@@WATCOM_C_FALSE@w32g_subwin_escaped.c:w32g_subwin.c escape_sjis.pl @BORLANDC_FALSE@@VCPP_FALSE@@WATCOM_C_FALSE@ escape_sjis.pl < w32g_subwin.c > w32g_subwin_escaped.c @BORLANDC_FALSE@@VCPP_FALSE@@WATCOM_C_FALSE@w32g_res.res: w32g_res.h w32g_rec.h w32g_res.rc \ @BORLANDC_FALSE@@VCPP_FALSE@@WATCOM_C_FALSE@ w32g_btn.bmp w32g_icon.ico w32g_sleep.bmp w32g_subbtn.bmp \ @BORLANDC_FALSE@@VCPP_FALSE@@WATCOM_C_FALSE@ escape_sjis.pl @BORLANDC_FALSE@@VCPP_FALSE@@WATCOM_C_FALSE@ escape_sjis.pl w32g_res_escaped.rc @BORLANDC_FALSE@@VCPP_FALSE@@WATCOM_C_FALSE@ windres -o $@ -O coff w32g_res.rc 2>&1|grep escape - >/dev/null && \ @BORLANDC_FALSE@@VCPP_FALSE@@WATCOM_C_FALSE@ windres -o $@ -O coff w32g_res_escaped.rc || echo @BORLANDC_FALSE@@VCPP_FALSE@@WATCOM_C_FALSE@ rm w32g_res_escaped.rc #n_so_libs = @n_so_libs@ #s_so_libs = @s_so_libs@ #m_so_libs = @m_so_libs@ #k_so_libs = @k_so_libs@ #e_so_libs = @e_so_libs@ #T_so_libs = @T_so_libs@ #a_so_libs = @a_so_libs@ #i_so_libs = @i_so_libs@ #g_so_libs = @g_so_libs@ @NEEDDLOPEN_TRUE@all-am: $(dynamic_targets) @NEEDDLOPEN_TRUE@install.dynamics: $(dynamic_targets) @NEEDDLOPEN_TRUE@ test -d $(DESTDIR)$(SHLIB_DIR) || mkdir -p $(DESTDIR)$(SHLIB_DIR) @NEEDDLOPEN_TRUE@ for f in $(dynamic_targets) ''; do case ".$$f" in .);; *) $(INSTALL_PROGRAM) $$f $(DESTDIR)$(SHLIB_DIR) ; $(INSTALL_DATA) $${f%%$(so)}txt $(DESTDIR)$(SHLIB_DIR);; esac; done @NEEDDLOPEN_TRUE@.c.$(so): @NEEDDLOPEN_TRUE@ $(COMPILE) $(SHCFLAGS) -c $< -o $@ @NEEDDLOPEN_TRUE@bitset.$(so): $(top_srcdir)/utils/bitset.c @NEEDDLOPEN_TRUE@ $(COMPILE) $(SHCFLAGS) -o $@ -c $< @NEEDDLOPEN_TRUE@timer.$(so): $(top_srcdir)/utils/timer.c @NEEDDLOPEN_TRUE@ $(COMPILE) $(SHCFLAGS) -o $@ -c $< @NEEDDLOPEN_TRUE@url_buff.$(so): $(top_srcdir)/libarc/url_buff.c @NEEDDLOPEN_TRUE@ $(COMPILE) $(SHCFLAGS) -o $@ -c $< @NEEDDLOPEN_TRUE@support.$(so): $(top_srcdir)/utils/support.c @NEEDDLOPEN_TRUE@ $(COMPILE) $(SHCFLAGS) -o $@ -c $< @NEEDDLOPEN_TRUE@interface_n.$(so): ncurs_c.$(so) support.$(so) bitset.$(so) timer.$(so) @NEEDDLOPEN_TRUE@ $(SHLD) -o $@ ncurs_c.$(so) support.$(so) bitset.$(so) timer.$(so) $(n_so_libs) @NEEDDLOPEN_TRUE@interface_s.$(so): slang_c.$(so) support.$(so) timer.$(so) @NEEDDLOPEN_TRUE@ $(SHLD) -o $@ slang_c.$(so) support.$(so) timer.$(so) $(s_so_libs) @NEEDDLOPEN_TRUE@interface_m.$(so): motif_c.$(so) support.$(so) motif_i.$(so) motif_p.$(so) @NEEDDLOPEN_TRUE@ $(SHLD) -o $@ motif_c.$(so) support.$(so) motif_i.$(so) motif_p.$(so) $(m_so_libs) @NEEDDLOPEN_TRUE@interface_k.$(so): tk_c.$(so) support.$(so) @NEEDDLOPEN_TRUE@ $(SHLD) -o $@ tk_c.$(so) support.$(so) $(k_so_libs) @NEEDDLOPEN_TRUE@interface_e.$(so): emacs_c.$(so) support.$(so) @NEEDDLOPEN_TRUE@ $(SHLD) -o $@ emacs_c.$(so) support.$(so) $(e_so_libs) @NEEDDLOPEN_TRUE@interface_T.$(so): vt100_c.$(so) support.$(so) vt100.$(so) bitset.$(so) timer.$(so) @NEEDDLOPEN_TRUE@ $(SHLD) -o $@ vt100_c.$(so) support.$(so) vt100.$(so) bitset.$(so) timer.$(so) $(T_so_libs) @NEEDDLOPEN_TRUE@interface_a.$(so): xaw_c.$(so) support.$(so) xaw_i.$(so) timer.$(so) @NEEDDLOPEN_TRUE@ $(SHLD) -o $@ xaw_c.$(so) support.$(so) xaw_i.$(so) timer.$(so) $(a_so_libs) @NEEDDLOPEN_TRUE@interface_i.$(so): xskin_c.$(so) support.$(so) xskin_i.$(so) xskin_loadBMP.$(so) xskin_spectrum.$(so) url_buff.$(so) @NEEDDLOPEN_TRUE@ $(SHLD) -o $@ xskin_c.$(so) support.$(so) xskin_i.$(so) xskin_loadBMP.$(so) xskin_spectrum.$(so) url_buff.$(so) $(i_so_libs) @NEEDDLOPEN_TRUE@interface_g.$(so): gtk_c.$(so) support.$(so) gtk_i.$(so) gtk_p.$(so) @NEEDDLOPEN_TRUE@ $(SHLD) -o $@ gtk_c.$(so) support.$(so) gtk_i.$(so) gtk_p.$(so) $(g_so_libs) @NEEDDLOPEN_TRUE@interface_r.$(so): server_c.$(so) support.$(so) @NEEDDLOPEN_TRUE@ $(SHLD) -o $@ server_c.$(so) support.$(so) @NEEDDLOPEN_TRUE@interface_A.$(so): alsaseq_c.$(so) support.$(so) @NEEDDLOPEN_TRUE@ $(SHLD) -o $@ alsaseq_c.$(so) support.$(so) clean-compile: -rm -f *.$(so) -rm -f *.res -rm -f *.RES install-exec-local: $(install_tk) $(install_xaw) $(install_el) $(install_dynamics) ########## End of 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: TiMidity++-2.13.2/interface/dumb_c.c0100644004711200001440000001136510003216574016236 0ustar tamukiusers/* TiMidity++ -- MIDI to WAVE converter and player Copyright (C) 1999-2002 Masanao Izumo Copyright (C) 1995 Tuukka Toivonen 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA dumb_c.c Minimal control mode -- no interaction, just prints out messages. */ #ifdef HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ #include #include #include #ifndef NO_STRING_H #include #else #include #endif #include "timidity.h" #include "common.h" #include "output.h" #include "controls.h" #include "instrum.h" #include "playmidi.h" #include "readmidi.h" #ifdef __W32__ #include "wrd.h" #endif /* __W32__ */ static int ctl_open(int using_stdin, int using_stdout); static void ctl_close(void); static int ctl_read(int32 *valp); static int cmsg(int type, int verbosity_level, char *fmt, ...); static void ctl_total_time(long tt); static void ctl_file_name(char *name); static void ctl_current_time(int ct); static void ctl_lyric(int lyricid); static void ctl_event(CtlEvent *e); /**********************************/ /* export the interface functions */ #define ctl dumb_control_mode ControlMode ctl= { "dumb interface", 'd', 1,0,0, 0, ctl_open, ctl_close, dumb_pass_playing_list, ctl_read, cmsg, ctl_event }; static FILE *outfp; int dumb_error_count; /*ARGSUSED*/ static int ctl_open(int using_stdin, int using_stdout) { if(using_stdout) outfp=stderr; else outfp=stdout; ctl.opened=1; return 0; } static void ctl_close(void) { fflush(outfp); ctl.opened=0; } /*ARGSUSED*/ static int ctl_read(int32 *valp) { return RC_NONE; } static int cmsg(int type, int verbosity_level, char *fmt, ...) { va_list ap; if ((type==CMSG_TEXT || type==CMSG_INFO || type==CMSG_WARNING) && ctl.verbosityrate); mins=secs/60; secs-=mins*60; cmsg(CMSG_INFO, VERB_NORMAL, "Total playing time: %3d min %02d s", mins, secs); } } static void ctl_file_name(char *name) { if (ctl.verbosity>=0 || ctl.trace_playing) cmsg(CMSG_INFO, VERB_NORMAL, "Playing %s", name); } static void ctl_current_time(int secs) { int mins; static int prev_secs = -1; #ifdef __W32__ if(wrdt->id == 'w') return; #endif /* __W32__ */ if (ctl.trace_playing && secs != prev_secs) { prev_secs = secs; mins=secs/60; secs-=mins*60; fprintf(outfp, "\r%3d:%02d", mins, secs); fflush(outfp); } } static void ctl_lyric(int lyricid) { char *lyric; lyric = event2string(lyricid); if(lyric != NULL) { if(lyric[0] == ME_KARAOKE_LYRIC) { if(lyric[1] == '/' || lyric[1] == '\\') { fprintf(outfp, "\n%s", lyric + 2); fflush(outfp); } else if(lyric[1] == '@') { if(lyric[2] == 'L') fprintf(outfp, "\nLanguage: %s\n", lyric + 3); else if(lyric[2] == 'T') fprintf(outfp, "Title: %s\n", lyric + 3); else fprintf(outfp, "%s\n", lyric + 1); } else { fputs(lyric + 1, outfp); fflush(outfp); } } else { if(lyric[0] == ME_CHORUS_TEXT || lyric[0] == ME_INSERT_TEXT) fprintf(outfp, "\r"); fputs(lyric + 1, outfp); fflush(outfp); } } } static void ctl_event(CtlEvent *e) { switch(e->type) { case CTLE_NOW_LOADING: ctl_file_name((char *)e->v1); break; case CTLE_PLAY_START: ctl_total_time(e->v1); break; case CTLE_CURRENT_TIME: ctl_current_time((int)e->v1); break; #ifndef CFG_FOR_SF case CTLE_LYRIC: ctl_lyric((int)e->v1); break; #endif } } /* * interface__loader(); */ ControlMode *interface_d_loader(void) { return &ctl; } TiMidity++-2.13.2/interface/wrdt_dumb.c0100644004711200001440000002074010125651536016777 0ustar tamukiusers/* TiMidity++ -- MIDI to WAVE converter and player Copyright (C) 1999-2002 Masanao Izumo Copyright (C) 1995 Tuukka Toivonen 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ #include #ifndef NO_STRING_H #include #else #include #endif #include "timidity.h" #include "common.h" #include "instrum.h" #include "playmidi.h" #include "readmidi.h" #include "controls.h" #include "wrd.h" static int wrdt_open(char *wrdt_opts); static void wrdt_apply(int cmd, int wrd_argc, int wrd_args[]); static void wrdt_update_events(void); static void wrdt_end(void); static void wrdt_close(void); #define wrdt dumb_wrdt_mode WRDTracer wrdt = { "dumb WRD tracer", 'd', 0, wrdt_open, wrdt_apply, NULL, wrdt_update_events, NULL, wrdt_end, wrdt_close }; static int inkey_flag; /*ARGSUSED*/ static int wrdt_open(char *wrdt_opts) { wrdt.opened = 1; inkey_flag = 0; return 0; } static void wrdt_update_events(void) { } static void wrdt_end(void) { inkey_flag = 0; } static void wrdt_close(void) { wrdt.opened = 0; inkey_flag = 0; } static char *wrd_event2string(int id) { char *name; name = event2string(id); if(name != NULL) return name + 1; return ""; } static void wrdt_apply(int cmd, int wrd_argc, int wrd_args[]) { char *p; char *text; int i, len; if(cmd == WRD_MAGPRELOAD) return; /* Load MAG file */ if(cmd == WRD_PHOPRELOAD) return; /* Load PHO file - Not implemented */ if(inkey_flag) printf("* "); switch(cmd) { case WRD_LYRIC: p = wrd_event2string(wrd_args[0]); len = strlen(p); text = (char *)new_segment(&tmpbuffer, SAFE_CONVERT_LENGTH(len)); code_convert(p, text, SAFE_CONVERT_LENGTH(len), NULL, NULL); ctl->cmsg(CMSG_INFO, VERB_VERBOSE, "%s", text); reuse_mblock(&tmpbuffer); break; case WRD_NL: /* Newline (Ignored) */ break; case WRD_COLOR: ctl->cmsg(CMSG_INFO, VERB_VERBOSE, "@COLOR(%d)", wrd_args[0]); break; case WRD_END: /* Never call */ break; case WRD_ESC: ctl->cmsg(CMSG_INFO, VERB_VERBOSE, "@ESC(%s)", wrd_event2string(wrd_args[0])); break; case WRD_EXEC: ctl->cmsg(CMSG_INFO, VERB_VERBOSE, "@EXEC(%s)", wrd_event2string(wrd_args[0])); break; case WRD_FADE: ctl->cmsg(CMSG_INFO, VERB_VERBOSE, "@FADE(%d,%d,%d)", wrd_args[0], wrd_args[1], wrd_args[2]); break; case WRD_FADESTEP: ctl->cmsg(CMSG_INFO, VERB_VERBOSE, "@FADESTEP(%d/%d)", wrd_args[0], WRD_MAXFADESTEP); break; case WRD_GCIRCLE: ctl->cmsg(CMSG_INFO, VERB_VERBOSE, "@GCIRCLE(%d,%d,%d,%d,%d,%d)", wrd_args[0], wrd_args[1], wrd_args[2], wrd_args[3], wrd_args[4], wrd_args[5]); break; case WRD_GCLS: ctl->cmsg(CMSG_INFO, VERB_VERBOSE, "@GCLS(%d)", wrd_args[0]); break; case WRD_GINIT: ctl->cmsg(CMSG_INFO, VERB_VERBOSE, "@GINIT()"); break; case WRD_GLINE: ctl->cmsg(CMSG_INFO, VERB_VERBOSE, "@GLINE(%d,%d,%d,%d,%d,%d,%d)", wrd_args[0], wrd_args[1], wrd_args[2], wrd_args[3], wrd_args[4], wrd_args[5], wrd_args[6]); break; case WRD_GMODE: ctl->cmsg(CMSG_INFO, VERB_VERBOSE, "@GMODE(%d)", wrd_args[0]); break; case WRD_GMOVE: ctl->cmsg(CMSG_INFO, VERB_VERBOSE, "@GMOVE(%d,%d,%d,%d,%d,%d,%d)", wrd_args[0], wrd_args[1], wrd_args[2], wrd_args[3], wrd_args[4], wrd_args[5], wrd_args[6], wrd_args[7], wrd_args[8]); break; case WRD_GON: ctl->cmsg(CMSG_INFO, VERB_VERBOSE, "@GON(%d)", wrd_args[0]); break; case WRD_GSCREEN: ctl->cmsg(CMSG_INFO, VERB_VERBOSE, "@GSCREEN(%d,%d)", wrd_args[0], wrd_args[1]); break; case WRD_INKEY: inkey_flag = 1; ctl->cmsg(CMSG_INFO, VERB_VERBOSE, "@INKEY - begin"); break; case WRD_OUTKEY: inkey_flag = 0; ctl->cmsg(CMSG_INFO, VERB_VERBOSE, "@INKEY - end"); break; case WRD_LOCATE: ctl->cmsg(CMSG_INFO, VERB_VERBOSE, "@LOCATE(%d,%d)", wrd_args[0], wrd_args[1]); break; case WRD_LOOP: /* Never call */ break; case WRD_MAG: p = (char *)new_segment(&tmpbuffer, MIN_MBLOCK_SIZE); snprintf(p, MIN_MBLOCK_SIZE-1, "@MAG(%s", wrd_event2string(wrd_args[0])); p[MIN_MBLOCK_SIZE-1] = '\0'; /* fail safe */ for(i = 1; i < 5; i++) { if(wrd_args[i] == WRD_NOARG) strncat(p, ",*", MIN_MBLOCK_SIZE - strlen(p) - 1); else { char q[CHAR_BIT*sizeof(int)]; snprintf(q, sizeof(q)-1, ",%d", wrd_args[i]); strncat(p, q, MIN_MBLOCK_SIZE - strlen(p) - 1); } } strncat(p, ")", MIN_MBLOCK_SIZE - strlen(p) - 1); ctl->cmsg(CMSG_INFO, VERB_VERBOSE, "%s", p); reuse_mblock(&tmpbuffer); break; case WRD_MIDI: /* Never call */ break; case WRD_OFFSET: /* Never call */ break; case WRD_PAL: p = (char *)new_segment(&tmpbuffer, MIN_MBLOCK_SIZE); snprintf(p, MIN_MBLOCK_SIZE, "@PAL(%03x", wrd_args[0]); for(i = 1; i < 17; i++) { char q[5]; snprintf(q, sizeof(q)-1, ",%03x", wrd_args[i]); strncat(p, q, MIN_MBLOCK_SIZE - strlen(p) - 1); } strncat(p, ")", MIN_MBLOCK_SIZE - strlen(p) - 1); ctl->cmsg(CMSG_INFO, VERB_VERBOSE, "%s", p); reuse_mblock(&tmpbuffer); break; case WRD_PALCHG: ctl->cmsg(CMSG_INFO, VERB_VERBOSE, "@PALCHG(%s)", wrd_event2string(wrd_args[0])); break; case WRD_PALREV: ctl->cmsg(CMSG_INFO, VERB_VERBOSE, "@PALREV(%d)", wrd_args[0]); break; case WRD_PATH: ctl->cmsg(CMSG_INFO, VERB_VERBOSE, "@PATH(%s)", wrd_event2string(wrd_args[0])); break; case WRD_PLOAD: ctl->cmsg(CMSG_INFO, VERB_VERBOSE, "@PLOAD(%s)", wrd_event2string(wrd_args[0])); break; case WRD_REM: p = wrd_event2string(wrd_args[0]); len = strlen(p); text = (char *)new_segment(&tmpbuffer, SAFE_CONVERT_LENGTH(len)); code_convert(p, text, SAFE_CONVERT_LENGTH(len), NULL, NULL); ctl->cmsg(CMSG_INFO, VERB_VERBOSE, "@REM %s", text); reuse_mblock(&tmpbuffer); break; case WRD_REMARK: ctl->cmsg(CMSG_INFO, VERB_VERBOSE, "@REMARK(%s)", wrd_event2string(wrd_args[0])); break; case WRD_REST: /* Never call */ break; case WRD_SCREEN: /* Not supported */ break; case WRD_SCROLL: ctl->cmsg(CMSG_INFO, VERB_VERBOSE, "@SCROLL(%d,%d,%d,%d,%d,%d,%d)", wrd_args[0], wrd_args[1], wrd_args[2], wrd_args[3], wrd_args[4], wrd_args[5], wrd_args[6]); break; case WRD_STARTUP: inkey_flag = 0; ctl->cmsg(CMSG_INFO, VERB_VERBOSE, "@STARTUP(%d)", wrd_args[0]); break; case WRD_STOP: /* Never call */ break; case WRD_TCLS: ctl->cmsg(CMSG_INFO, VERB_VERBOSE, "@TCLS(%d,%d,%d,%d,%d,%d,%d)", wrd_args[0], wrd_args[1], wrd_args[2], wrd_args[3], wrd_args[4], wrd_args[5]); break; case WRD_TON: ctl->cmsg(CMSG_INFO, VERB_VERBOSE, "@TON(%d)", wrd_args[0]); break; case WRD_WAIT: /* Never call */ break; case WRD_WMODE: /* Never call */ break; /* Ensyutsukun */ case WRD_eFONTM: print_ecmd("FONTM", wrd_args, 1); break; case WRD_eFONTP: print_ecmd("FONTP", wrd_args, 4); break; case WRD_eFONTR: print_ecmd("FONTR", wrd_args, 17); break; case WRD_eGSC: print_ecmd("GSC", wrd_args, 1); break; case WRD_eLINE: print_ecmd("LINE", wrd_args, 1); break; case WRD_ePAL: print_ecmd("PAL", wrd_args, 2); break; case WRD_eREGSAVE: print_ecmd("REGSAVE", wrd_args, 17); break; case WRD_eSCROLL: print_ecmd("SCROLL",wrd_args, 2); break; case WRD_eTEXTDOT: print_ecmd("TEXTDOT", wrd_args, 1); break; case WRD_eTMODE: print_ecmd("TMODE", wrd_args, 1); break; case WRD_eTSCRL: print_ecmd("TSCRL", wrd_args, 0); break; case WRD_eVCOPY: print_ecmd("VCOPY", wrd_args, 9); break; case WRD_eVSGET: print_ecmd("VSGE", wrd_args, 4); break; case WRD_eVSRES: print_ecmd("VSRES", wrd_args, 0); break; case WRD_eXCOPY: print_ecmd("XCOPY", wrd_args, 14); break; default: break; } wrd_argc = 0; } TiMidity++-2.13.2/interface/wrdt_tty.c0100644004711200001440000002165110125651536016672 0ustar tamukiusers/* TiMidity++ -- MIDI to WAVE converter and player Copyright (C) 1999-2002 Masanao Izumo Copyright (C) 1995 Tuukka Toivonen 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* * WRD Tracer for vt100 control terminal * Written by Takanori Watanabe */ #ifdef HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ #include #ifndef NO_STRING_H #include #else #include #endif #include "timidity.h" #include "common.h" #include "instrum.h" #include "playmidi.h" #include "readmidi.h" #include "controls.h" #include "wrd.h" static int wrdt_open(char *dummy); static void wrdt_apply(int cmd, int wrd_argc, int wrd_args[]); static void wrdt_update_events(void); static void wrdt_end(void); static void wrdt_close(void); #define NO_GRAPHIC_SUPPORT #define wrdt tty_wrdt_mode WRDTracer wrdt = { "TTY WRD tracer", 't', 0, wrdt_open, wrdt_apply, NULL, wrdt_update_events, NULL, wrdt_end, wrdt_close }; static int inkey_flag; static int wrdt_open(char *dummy) { wrdt.opened = 1; inkey_flag = 0; return 0; } static void wrdt_update_events(void) { } static void wrdt_end(void) { printf("\033[0m\n");/*Restore Attributes*/ inkey_flag = 0; } static void wrdt_close(void) { printf("\033[0m"); fflush(stdout); wrdt.opened = 0; inkey_flag = 0; } static char *wrd_event2string(int id) { char *name; name = event2string(id); if(name != NULL) return name + 1; return ""; } static void wrdt_apply(int cmd, int wrd_argc, int wrd_args[]) { char *p; char *text; int i, len; static int txtclr_preserve=0; #if 0 if(inkey_flag) printf("* "); #endif switch(cmd) { case WRD_LYRIC: p = wrd_event2string(wrd_args[0]); len = strlen(p); text = (char *)new_segment(&tmpbuffer, SAFE_CONVERT_LENGTH(len)); /*This must be not good thing,but as far as I know no wrd file written in EUC-JP code found*/ code_convert(p, text, SAFE_CONVERT_LENGTH(len), "SJIS", (char *)-1); printf("%s",text); fflush(stdout); reuse_mblock(&tmpbuffer); break; case WRD_NL: /* Newline (Ignored) */ putchar('\n'); break; case WRD_COLOR: txtclr_preserve=wrd_args[0]; if(16 <= txtclr_preserve && txtclr_preserve <= 23) txtclr_preserve = wrd_color_remap[txtclr_preserve - 16] + 30; printf("\033[%dm", txtclr_preserve); break; case WRD_END: /* Never call */ break; case WRD_ESC: printf("\033[%s", wrd_event2string(wrd_args[0])); break; case WRD_EXEC: /*I don't spaun another program*/ ctl->cmsg(CMSG_INFO, VERB_DEBUG, "@EXEC(%s)", wrd_event2string(wrd_args[0])); break; case WRD_FADE: ctl->cmsg(CMSG_INFO, VERB_DEBUG, "@FADE(%d,%d,%d)", wrd_args[0], wrd_args[1], wrd_args[2]); break; case WRD_FADESTEP: ctl->cmsg(CMSG_INFO, VERB_DEBUG, "@FADESTEP(%d/%d)", wrd_args[0], WRD_MAXFADESTEP); break; case WRD_GCIRCLE: ctl->cmsg(CMSG_INFO, VERB_DEBUG, "@GCIRCLE(%d,%d,%d,%d,%d,%d)", wrd_args[0], wrd_args[1], wrd_args[2], wrd_args[3], wrd_args[4], wrd_args[5]); break; case WRD_GCLS: ctl->cmsg(CMSG_INFO, VERB_DEBUG, "@GCLS(%d)", wrd_args[0]); break; case WRD_GINIT: ctl->cmsg(CMSG_INFO, VERB_DEBUG, "@GINIT()"); break; case WRD_GLINE: ctl->cmsg(CMSG_INFO, VERB_DEBUG, "@GLINE(%d,%d,%d,%d,%d,%d,%d)", wrd_args[0], wrd_args[1], wrd_args[2], wrd_args[3], wrd_args[4], wrd_args[5], wrd_args[6]); fflush(stdout); break; case WRD_GMODE: ctl->cmsg(CMSG_INFO, VERB_DEBUG, "@GMODE(%d)", wrd_args[0]); break; case WRD_GMOVE: ctl->cmsg(CMSG_INFO, VERB_DEBUG, "@GMOVE(%d,%d,%d,%d,%d,%d,%d)", wrd_args[0], wrd_args[1], wrd_args[2], wrd_args[3], wrd_args[4], wrd_args[5], wrd_args[6], wrd_args[7], wrd_args[8]); break; case WRD_GON: ctl->cmsg(CMSG_INFO, VERB_DEBUG, "@GON(%d)", wrd_args[0]); break; case WRD_GSCREEN: ctl->cmsg(CMSG_INFO, VERB_DEBUG, "@GSCREEN(%d,%d)", wrd_args[0], wrd_args[1]); break; case WRD_INKEY: inkey_flag = 1; ctl->cmsg(CMSG_INFO, VERB_DEBUG, "@INKEY - begin"); break; case WRD_OUTKEY: inkey_flag = 0; ctl->cmsg(CMSG_INFO, VERB_DEBUG, "@INKEY - end"); break; case WRD_LOCATE: printf("\033[%d;%dH", wrd_args[1], wrd_args[0]); break; case WRD_LOOP: /* Never call */ break; case WRD_MAG: p = (char *)new_segment(&tmpbuffer, MIN_MBLOCK_SIZE); snprintf(p, MIN_MBLOCK_SIZE-1, "@MAG(%s", wrd_event2string(wrd_args[0])); p[MIN_MBLOCK_SIZE-1] = '\0'; /* fail safe */ for(i = 1; i < 5; i++) { if(wrd_args[i] == WRD_NOARG) strncat(p, ",*", MIN_MBLOCK_SIZE - strlen(p) - 1); else { char q[CHAR_BIT*sizeof(int)]; snprintf(q, sizeof(q)-1, ",%d", wrd_args[i]); strncat(p, q, MIN_MBLOCK_SIZE - strlen(p) - 1); } } strncat(p, ")", MIN_MBLOCK_SIZE - strlen(p) - 1); ctl->cmsg(CMSG_INFO, VERB_VERBOSE, "%s", p); reuse_mblock(&tmpbuffer); break; case WRD_MIDI: /* Never call */ break; case WRD_OFFSET: /* Never call */ break; case WRD_PAL: p = (char *)new_segment(&tmpbuffer, MIN_MBLOCK_SIZE); snprintf(p, MIN_MBLOCK_SIZE, "@PAL(%03x", wrd_args[0]); for(i = 1; i < 17; i++) { char q[5]; snprintf(q, sizeof(q)-1, ",%03x", wrd_args[i]); strncat(p, q, MIN_MBLOCK_SIZE - strlen(p) - 1); } strncat(p, ")", MIN_MBLOCK_SIZE - strlen(p) - 1); ctl->cmsg(CMSG_INFO, VERB_VERBOSE, "%s", p); reuse_mblock(&tmpbuffer); break; case WRD_PALCHG: ctl->cmsg(CMSG_INFO, VERB_DEBUG, "@PALCHG(%s)", wrd_event2string(wrd_args[0])); break; case WRD_PALREV: ctl->cmsg(CMSG_INFO, VERB_DEBUG, "@PALREV(%d)", wrd_args[0]); break; case WRD_PATH: ctl->cmsg(CMSG_INFO, VERB_DEBUG, "@PATH(%s)", wrd_event2string(wrd_args[0])); break; case WRD_PLOAD: ctl->cmsg(CMSG_INFO, VERB_DEBUG, "@PLOAD(%s)", wrd_event2string(wrd_args[0])); break; case WRD_REM: p = wrd_event2string(wrd_args[0]); len = strlen(p); text = (char *)new_segment(&tmpbuffer, SAFE_CONVERT_LENGTH(len)); code_convert(p, text, SAFE_CONVERT_LENGTH(len), NULL, NULL); ctl->cmsg(CMSG_INFO, VERB_DEBUG, "@REM %s", text); reuse_mblock(&tmpbuffer); break; case WRD_REMARK: ctl->cmsg(CMSG_INFO, VERB_DEBUG, "@REMARK(%s)", wrd_event2string(wrd_args[0])); break; case WRD_REST: /* Never call */ break; case WRD_SCREEN: /* Not supported */ break; case WRD_SCROLL: ctl->cmsg(CMSG_INFO, VERB_DEBUG, "@SCROLL(%d,%d,%d,%d,%d,%d,%d)", wrd_args[0], wrd_args[1], wrd_args[2], wrd_args[3], wrd_args[4], wrd_args[5], wrd_args[6]); break; case WRD_STARTUP: inkey_flag = 0; ctl->cmsg(CMSG_INFO, VERB_DEBUG, "@STARTUP(%d)", wrd_args[0]); printf("\033[0m\033[H\033[J"); fflush(stdout); break; case WRD_STOP: /* Never call */ break; case WRD_TCLS: { char fillbuf[1024]; fillbuf[0]=0x1b; fillbuf[1]='7'; fillbuf[2]=0; printf(fillbuf); /* 0-7: normal, 8-16: reverse */ if(wrd_args[4] <= 7) wrd_args[4] += 30; else wrd_args[4] += 32; printf("\033[%dm",wrd_args[4]); memset(fillbuf,wrd_args[5],wrd_args[2]-wrd_args[0]);/*X2-X1*/ fillbuf[wrd_args[2]-wrd_args[0]]=0; for(i=wrd_args[1];i<=wrd_args[3];i++)/*Y1 to Y2*/ printf("\033[%d;%dH%s",i,wrd_args[0],fillbuf);/*X1to....*/ fillbuf[0]=0x1b; fillbuf[1]='8'; fillbuf[2]=0; printf(fillbuf); printf("\033[%dm",txtclr_preserve); fflush(stdout); } #if 0 ctl->cmsg(CMSG_INFO, VERB_DEBUG, "@TCLS(%d,%d,%d,%d,%d,%d,%d)", wrd_args[0], wrd_args[1], wrd_args[2], wrd_args[3], wrd_args[4], wrd_args[5]); #endif break; case WRD_TON: ctl->cmsg(CMSG_INFO, VERB_DEBUG, "@TON(%d)", wrd_args[0]); break; case WRD_WAIT: /* Never call */ break; case WRD_WMODE: /* Never call */ break; /* Ensyutsukun */ case WRD_eFONTM: break; case WRD_eFONTP: break; case WRD_eFONTR: break; case WRD_eGSC: break; case WRD_eLINE: break; case WRD_ePAL: break; case WRD_eREGSAVE: break; case WRD_eSCROLL: break; case WRD_eTEXTDOT: break; case WRD_eTMODE: break; case WRD_eTSCRL: break; case WRD_eVCOPY: break; case WRD_eVSGET: break; case WRD_eVSRES: break; case WRD_eXCOPY: break; default: break; } wrd_argc = 0; } TiMidity++-2.13.2/interface/ncurs_c.c0100644004711200001440000024674010055515702016452 0ustar tamukiusers/* TiMidity++ -- MIDI to WAVE converter and player Copyright (C) 1999-2004 Masanao Izumo Copyright (C) 1995 Tuukka Toivonen 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ncurs_c.c: written by Masanao Izumo and Aoki Daisuke . This version is merged with title list mode from Aoki Daisuke. */ #ifdef HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ #include #if defined(__MINGW32__) && defined(USE_PDCURSES) #define _NO_OLDNAMES 1 /* avoid type mismatch of beep() */ #ifndef sleep extern void sleep(unsigned long); #endif /* sleep */ #include #undef _NO_OLDNAMES #else /* USE_PDCURSES */ #include #endif #include #include #ifndef NO_STRING_H #include #else #include #endif #include #ifdef HAVE_UNISTD_H #include #endif /* HAVE_UNISTD_H */ #ifdef __W32__ #include #endif /* __W32__ */ #ifdef HAVE_NCURSES_H #include #elif defined(HAVE_NCURSES_CURSES_H) #include #else #include #endif #include "timidity.h" #include "common.h" #include "instrum.h" #include "playmidi.h" #include "readmidi.h" #include "output.h" #include "controls.h" #include "miditrace.h" #include "timer.h" #include "bitset.h" #include "arc.h" #include "aq.h" #ifdef USE_PDCURSES int PDC_set_ctrl_break(bool setting); #endif /* USE_PDCURSES */ #define SCREEN_BUGFIX 1 /* FIX the old ncurses bug */ /* Define WREFRESH_CACHED if wrefresh isn't clear the internal cache */ #define WREFRESH_CACHED 1 #ifdef JAPANESE #define MULTIBUTE_CHAR_BUGFIX 1 /* Define to fix multibute overwrite bug */ #endif /* JAPANESE */ #define MIDI_TITLE #define DISPLAY_MID_MODE #define COMMAND_BUFFER_SIZE 4096 #define MINI_BUFF_MORE_C '$' #define LYRIC_OUT_THRESHOLD 10.0 #define CHECK_NOTE_SLEEP_TIME 5.0 #define NCURS_MIN_LINES 8 #define CTL_STATUS_UPDATE -98 #define CTL_STATUS_INIT -99 #ifndef MIDI_TITLE #undef DISPLAY_MID_MODE #endif /* MIDI_TITLE */ #ifdef DISPLAY_MID_MODE #if defined(JAPANESE) && !defined(__WATCOMC__) #include "mid-j.defs" #else #include "mid.defs" #endif /* JAPANESE */ #endif /* DISPLAY_MID_MODE */ #define MAX_U_PREFIX 256 /* GS LCD */ #define GS_LCD_MARK_ON -1 #define GS_LCD_MARK_OFF -2 #define GS_LCD_MARK_CLEAR -3 #define GS_LCD_MARK_CHAR '$' static double gslcd_last_display_time; static int gslcd_displayed_flag = 0; #define GS_LCD_CLEAR_TIME 10.0 #define GS_LCD_WIDTH 40 extern int set_extension_modes(char *flag); static struct { int mute, bank, bank_lsb, bank_msb, prog; int tt, vol, exp, pan, sus, pitch, wheel; int is_drum; int bend_mark; double last_note_on; char *comm; } ChannelStatus[MAX_CHANNELS]; enum indicator_mode_t { INDICATOR_DEFAULT, INDICATOR_LYRIC, INDICATOR_CMSG }; static int indicator_width = 78; static char *comment_indicator_buffer = NULL; static char *current_indicator_message = NULL; static char *indicator_msgptr = NULL; static int current_indicator_chan = 0; static double indicator_last_update; static int indicator_mode = INDICATOR_DEFAULT; static int display_velocity_flag = 0; static int display_channels = 16; static Bitset channel_program_flags[MAX_CHANNELS]; static Bitset gs_lcd_bits[MAX_CHANNELS]; static int is_display_lcd = 1; static int scr_modified_flag = 1; /* delay flush for trace mode */ static void update_indicator(void); static void reset_indicator(void); static void indicator_chan_update(int ch); static void display_lyric(char *lyric, int sep); static void display_play_system(int mode); static void display_intonation(int mode); static void display_aq_ratio(void); #define LYRIC_WORD_NOSEP 0 #define LYRIC_WORD_SEP ' ' static int ctl_open(int using_stdin, int using_stdout); static void ctl_close(void); static void ctl_pass_playing_list(int number_of_files, char *list_of_files[]); static int ctl_read(int32 *valp); static int cmsg(int type, int verbosity_level, char *fmt, ...); static void ctl_event(CtlEvent *e); static void ctl_refresh(void); static void ctl_help_mode(void); static void ctl_list_mode(int type); static void ctl_total_time(int tt); static void ctl_master_volume(int mv); static void ctl_metronome(int meas, int beat); static void ctl_keysig(int8 k, int ko); static void ctl_tempo(int t, int tr); static void ctl_file_name(char *name); static void ctl_current_time(int ct, int nv); static const char note_name_char[12] = { 'c', 'C', 'd', 'D', 'e', 'f', 'F', 'g', 'G', 'a', 'A', 'b' }; static void ctl_note(int status, int ch, int note, int vel); static void ctl_temper_keysig(int8 tk, int ko); static void ctl_temper_type(int ch, int8 tt); static void ctl_mute(int ch, int mute); static void ctl_drumpart(int ch, int is_drum); static void ctl_program(int ch, int prog, char *vp, unsigned int banks); static void ctl_volume(int channel, int val); static void ctl_expression(int channel, int val); static void ctl_panning(int channel, int val); static void ctl_sustain(int channel, int val); static void update_bend_mark(int ch); static void ctl_pitch_bend(int channel, int val); static void ctl_mod_wheel(int channel, int wheel); static void ctl_lyric(int lyricid); static void ctl_gslcd(int id); static void ctl_reset(void); /**********************************************/ /* define (LINE,ROW) */ #ifdef MIDI_TITLE #define VERSION_LINE 0 #define HELP_LINE 1 #define FILE_LINE 2 #define FILE_TITLE_LINE 3 #define TIME_LINE 4 #define VOICE_LINE 4 #define SEPARATE1_LINE 5 #define TITLE_LINE 6 #define NOTE_LINE 7 #else #define VERSION_LINE 0 #define HELP_LINE 1 #define FILE_LINE 2 #define TIME_LINE 3 #define VOICE_LINE 3 #define SEPARATE1_LINE 4 #define TITLE_LINE 5 #define SEPARATE2_LINE 6 #define NOTE_LINE 7 #endif #define LIST_TITLE_LINES (LINES - TITLE_LINE - 1) /**********************************************/ /* export the interface functions */ #define ctl ncurses_control_mode ControlMode ctl= { "ncurses interface", 'n', 1,0,0, 0, ctl_open, ctl_close, ctl_pass_playing_list, ctl_read, cmsg, ctl_event }; /***********************************************************************/ /* foreground/background checks disabled since switching to curses */ /* static int in_foreground=1; */ enum ctl_ncurs_mode_t { /* Major modes */ NCURS_MODE_NONE, /* None */ NCURS_MODE_MAIN, /* Normal mode */ NCURS_MODE_TRACE, /* Trace mode */ NCURS_MODE_HELP, /* Help mode */ NCURS_MODE_LIST, /* MIDI list mode */ NCURS_MODE_DIR, /* Directory list mode */ /* Minor modes */ /* Command input mode */ NCURS_MODE_CMD_J, /* Jump */ NCURS_MODE_CMD_L, /* Load file */ NCURS_MODE_CMD_E, /* Extensional mode */ NCURS_MODE_CMD_FSEARCH, /* forward search MIDI file */ NCURS_MODE_CMD_D, /* Change drum channel */ NCURS_MODE_CMD_S, /* Save as */ NCURS_MODE_CMD_R /* Change sample rate */ }; static int ctl_ncurs_mode = NCURS_MODE_MAIN; /* current mode */ static int ctl_ncurs_back = NCURS_MODE_MAIN; /* prev mode to back from help */ static int ctl_cmdmode = 0; static int ctl_mode_L_dispstart = 0; static char ctl_mode_L_lastenter[COMMAND_BUFFER_SIZE]; static char ctl_mode_SEARCH_lastenter[COMMAND_BUFFER_SIZE]; struct double_list_string { char *string; struct double_list_string *next, *prev; }; static struct double_list_string *ctl_mode_L_histh = NULL; /* head */ static struct double_list_string *ctl_mode_L_histc = NULL; /* current */ static void ctl_ncurs_mode_init(void); static void init_trace_window_chan(int ch); static void init_chan_status(void); static void ctl_cmd_J_move(int diff); static int ctl_cmd_J_enter(void); static void ctl_cmd_L_dir(int move); static int ctl_cmd_L_enter(void); static int selected_channel = -1; /* list_mode */ typedef struct _MFnode { char *file; #ifdef MIDI_TITLE char *title; #endif /* MIDI_TITLE */ struct midi_file_info *infop; struct _MFnode *next; } MFnode; static struct _file_list { int number; MFnode *MFnode_head; MFnode *MFnode_tail; } file_list; static MFnode *MFnode_nth_cdr(MFnode *p, int n); static MFnode *current_MFnode = NULL; #define NC_LIST_MAX 512 static int ctl_listmode=1; static int ctl_listmode_max=1; /* > 1 */ static int ctl_listmode_play=1; /* > 1 */ static int ctl_list_select[NC_LIST_MAX]; static int ctl_list_from[NC_LIST_MAX]; static int ctl_list_to[NC_LIST_MAX]; static void ctl_list_table_init(void); static MFnode *make_new_MFnode_entry(char *file); static void insert_MFnode_entrys(MFnode *mfp, int pos); #define NC_LIST_NEW 1 #define NC_LIST_NOW 2 #define NC_LIST_PLAY 3 #define NC_LIST_SELECT 4 #define NC_LIST_NEXT 5 #define NC_LIST_PREV 6 #define NC_LIST_UP 7 #define NC_LIST_DOWN 8 #define NC_LIST_UPPAGE 9 #define NC_LIST_DOWNPAGE 10 /* playing files */ static int nc_playfile=0; typedef struct MiniBuffer { char *buffer; /* base buffer */ int size; /* size of base buffer */ char *text; /* pointer to buffer + (prompt length) */ int maxlen; /* max text len */ int len; /* [0..maxlen] */ int cur; /* cursor pos [0..len] */ int uflag; /* update flag */ int cflag; /* for file completion flag */ MFnode *files; /* completed files */ char *lastcmpl; /* last completed pathname */ MBlockList pool; /* memory pool */ WINDOW *bufwin; /* buffer window */ int x, y; /* window position */ int w, h; /* window size */ } MiniBuffer; static MiniBuffer *command_buffer = NULL; /* command buffer */ static MiniBuffer *mini_buff_new(int size); static void mini_buff_set(MiniBuffer *b, WINDOW *bufwin, int line, char *prompt); static void mini_buff_clear(MiniBuffer *b); static void mini_buff_refresh(MiniBuffer *b); static int mini_buff_forward(MiniBuffer *b); static int mini_buff_backward(MiniBuffer *b); static int mini_buff_insertc(MiniBuffer *b, int c); static int mini_buff_inserts(MiniBuffer *b, char *s); static int mini_buff_delc(MiniBuffer *b); static char *mini_buff_gets(MiniBuffer *b); static void mini_buff_sets(MiniBuffer *b, char *s); static int mini_buff_len(MiniBuffer *b); static int mini_buff_completion(MiniBuffer *b); static WINDOW *dftwin=0, *msgwin=0, *listwin=0; static void N_ctl_refresh(void) { if(!ctl.opened) return; if(ctl_cmdmode) wmove(dftwin, command_buffer->y, command_buffer->x); else wmove(dftwin, 0,0); wrefresh(dftwin); scr_modified_flag = 0; } static void N_ctl_clrtoeol(int row) { int i; wmove(dftwin, row, 0); for(i = 0; i < COLS; i++) waddch(dftwin, ' '); wmove(dftwin, row, 0); wrefresh(dftwin); } /* werase() is not collectly work if multibyte font is displayed. */ static void N_ctl_werase(WINDOW *w) { #ifdef WREFRESH_CACHED int x, y, xsize, ysize; getmaxyx(w, ysize, xsize); for(y = 0; y < ysize; y++) { wmove(w, y, 0); for(x = 0; x < xsize; x++) waddch(w, ' '); } #else werase(w); #endif /* WREFRESH_CACHED */ wmove(w, 0, 0); wrefresh(w); } static void N_ctl_scrinit(void) { int i; N_ctl_werase(dftwin); wmove(dftwin, VERSION_LINE,0); waddstr(dftwin, "TiMidity++ "); if (strcmp(timidity_version, "current")) waddch(dftwin, 'v'); waddstr(dftwin, timidity_version); wmove(dftwin, VERSION_LINE,COLS-51); waddstr(dftwin, "(C) 1995,1999-2004 Tuukka Toivonen, Masanao Izumo"); wmove(dftwin, FILE_LINE,0); waddstr(dftwin, "File:"); #ifdef MIDI_TITLE wmove(dftwin, FILE_TITLE_LINE,0); waddstr(dftwin, "Title:"); for(i = 0; i < COLS - 6; i++) waddch(dftwin, ' '); #endif wmove(dftwin, TIME_LINE,0); waddstr(dftwin, "Time:"); wmove(dftwin, TIME_LINE,6 + 6); waddch(dftwin, '/'); wmove(dftwin, VOICE_LINE,40); wprintw(dftwin, "Voices: / %3d", voices); wmove(dftwin, VOICE_LINE, COLS-20); waddstr(dftwin, "Master volume:"); wmove(dftwin, SEPARATE1_LINE, 0); for(i = 0; i < COLS; i++) #ifdef MIDI_TITLE waddch(dftwin, '-'); #else waddch(dftwin, '_'); #endif wmove(dftwin, SEPARATE1_LINE, 0); waddstr(dftwin, "Meas: "); wmove(dftwin, SEPARATE1_LINE, 37); waddstr(dftwin, " Key: "); wmove(dftwin, SEPARATE1_LINE, 58); waddstr(dftwin, " Tempo: "); indicator_width = COLS - 2; if(indicator_width < 40) indicator_width = 40; if(comment_indicator_buffer != NULL) free(comment_indicator_buffer); if(current_indicator_message != NULL) free(current_indicator_message); memset(comment_indicator_buffer = (char *)safe_malloc(indicator_width), 0, indicator_width); memset(current_indicator_message = (char *)safe_malloc(indicator_width), 0, indicator_width); if(ctl.trace_playing) { int o; wmove(dftwin, TITLE_LINE, 0); waddstr(dftwin, "Ch "); o = (COLS - 28) / 12; for(i = 0; i < o; i++) { int j; for(j = 0; j < 12; j++) { int c; c = note_name_char[j]; if(islower(c)) waddch(dftwin, c); else waddch(dftwin, ' '); } } wmove(dftwin, TITLE_LINE, COLS - 20); waddstr(dftwin, "Prg Vol Exp Pan S B"); #ifndef MIDI_TITLE wmove(dftwin, SEPARATE2_LINE, 0); for(i = 0; i < COLS; i++) waddch(dftwin, '-'); #endif for(i = 0; i < MAX_CHANNELS; i++) { init_bitset(channel_program_flags + i, 128); init_bitset(gs_lcd_bits + i, 128); } } N_ctl_refresh(); } static void ctl_refresh(void) { if (scr_modified_flag) N_ctl_refresh(); } static void init_trace_window_chan(int ch) { int i, c; if(ch >= display_channels) return; N_ctl_clrtoeol(NOTE_LINE + ch); ctl_mute(ch, CTL_STATUS_UPDATE); waddch(dftwin, ' '); if(ch != selected_channel) { c = (COLS - 28) / 12 * 12; if(c <= 0) c = 1; for(i = 0; i < c; i++) waddch(dftwin, '.'); ctl_temper_type(ch, CTL_STATUS_UPDATE); ctl_program(ch, CTL_STATUS_UPDATE, NULL, 0); ctl_volume(ch, CTL_STATUS_UPDATE); ctl_expression(ch, CTL_STATUS_UPDATE); ctl_panning(ch, CTL_STATUS_UPDATE); ctl_sustain(ch, CTL_STATUS_UPDATE); update_bend_mark(ch); clear_bitset(channel_program_flags + ch, 0, 128); } else { ToneBankElement *prog; ToneBank *bank; int b, type, pr; b = ChannelStatus[ch].bank; pr = ChannelStatus[ch].prog; bank = tonebank[b]; if(bank == NULL || bank->tone[pr].instrument == NULL) { b = 0; bank = tonebank[0]; } if(ChannelStatus[ch].is_drum) { wprintw(dftwin, "Drumset Bank %d=>%d", ChannelStatus[ch].bank + progbase, b + progbase); } else { if(IS_CURRENT_MOD_FILE) { wprintw(dftwin, "MOD %d (%s)", ChannelStatus[ch].prog, ChannelStatus[ch].comm ? ChannelStatus[ch].comm : "Not installed"); } else { prog = &bank->tone[pr]; if(prog->instrument != NULL && !IS_MAGIC_INSTRUMENT(prog->instrument)) { type = prog->instrument->type; /* check instrument alias */ if(b != 0 && tonebank[0]->tone[pr].instrument == prog->instrument) { b = 0; bank = tonebank[0]; prog = &bank->tone[pr]; } } else type = -1; wprintw(dftwin, "%d Bank %d/%d=>%d Prog %d", type, ChannelStatus[ch].bank_msb, ChannelStatus[ch].bank_lsb, b, ChannelStatus[ch].prog + progbase); if(type == INST_GUS) { if(prog->name) { waddch(dftwin, ' '); waddstr(dftwin, prog->name); } if(prog->comment != NULL) wprintw(dftwin, "(%s)", prog->comment); } else if(type == INST_SF2) { char *name, *fn; waddstr(dftwin, " (SF "); if(prog->instype == 1) { /* Restore original one */ b = prog->font_bank; pr = prog->font_preset; } name = soundfont_preset_name(b, pr, -1, &fn); if(name == NULL && b != 0) { if((name = soundfont_preset_name(0, pr, -1, &fn)) != NULL) b = 0; } wprintw(dftwin, "%d,%d", b, pr + progbase); if(name != NULL) { char *p; if((p = pathsep_strrchr(fn)) != NULL) p++; else p = fn; wprintw(dftwin, ",%s", name, p); } waddch(dftwin, ')'); } } } } } static void init_chan_status(void) { int ch; for(ch = 0; ch < MAX_CHANNELS; ch++) { ChannelStatus[ch].mute = temper_type_mute & 1; ChannelStatus[ch].bank = 0; ChannelStatus[ch].bank_msb = 0; ChannelStatus[ch].bank_lsb = 0; ChannelStatus[ch].prog = 0; ChannelStatus[ch].tt = 0; ChannelStatus[ch].is_drum = ISDRUMCHANNEL(ch); ChannelStatus[ch].vol = 0; ChannelStatus[ch].exp = 0; ChannelStatus[ch].pan = NO_PANNING; ChannelStatus[ch].sus = 0; ChannelStatus[ch].pitch = 0x2000; ChannelStatus[ch].wheel = 0; ChannelStatus[ch].bend_mark = ' '; ChannelStatus[ch].last_note_on = 0.0; ChannelStatus[ch].comm = NULL; } } static void display_play_system(int mode) { wmove(dftwin, TIME_LINE, 22); switch(mode) { case GM_SYSTEM_MODE: waddstr(dftwin, "[GM]"); break; case GS_SYSTEM_MODE: waddstr(dftwin, "[GS]"); break; case XG_SYSTEM_MODE: waddstr(dftwin, "[XG]"); break; default: waddstr(dftwin, " "); break; } scr_modified_flag = 1; } static void display_intonation(int mode) { wmove(dftwin, TIME_LINE, 28); waddstr(dftwin, (mode == 1) ? "[PureInt]" : " "); scr_modified_flag = 1; } static void ctl_ncurs_mode_init(void) { int i; display_channels = LINES - 8; if(display_channels > MAX_CHANNELS) display_channels = MAX_CHANNELS; if(current_file_info != NULL && current_file_info->max_channel < 16) display_channels = 16; display_play_system(play_system_mode); display_intonation(opt_pure_intonation); switch(ctl_ncurs_mode) { case NCURS_MODE_MAIN: touchwin(msgwin); wrefresh(msgwin); break; case NCURS_MODE_TRACE: touchwin(dftwin); for(i = 0; i < MAX_CHANNELS; i++) init_trace_window_chan(i); N_ctl_refresh(); break; case NCURS_MODE_HELP: break; case NCURS_MODE_LIST: touchwin(listwin); ctl_list_mode(NC_LIST_NOW); break; case NCURS_MODE_DIR: ctl_cmd_L_dir(0); break; } } static void display_key_helpmsg(void) { if(ctl_cmdmode || ctl_ncurs_mode == NCURS_MODE_HELP) { if(!ctl.trace_playing) { wmove(dftwin, HELP_LINE, 0); waddstr(dftwin, "Press 'h' for help with keys, or 'q' to quit."); N_ctl_refresh(); } return; } N_ctl_clrtoeol(LINES - 1); if(!ctl.trace_playing) wmove(dftwin, HELP_LINE, 0); waddstr(dftwin, "Press 'h' for help with keys, or 'q' to quit."); N_ctl_refresh(); } static void ctl_help_mode(void) { static WINDOW *helpwin; if(ctl_ncurs_mode == NCURS_MODE_HELP) { ctl_ncurs_mode = ctl_ncurs_back; touchwin(dftwin); delwin(helpwin); N_ctl_refresh(); ctl_ncurs_mode_init(); display_key_helpmsg(); } else { int i; static char *help_message_list[] = { "V/Up=Louder b/Left=Skip back n/Next=Next file r/Home=Restart file", "v/Down=Softer f/Right=Skip forward p/Prev=Previous file q/End=Quit program", "h/?=Help mode s=Toggle pause E=ExtMode-Setting", "+=Key up -=Key down >=Speed up <=Speed down", "O=Voices up o=Voices down c/j/C/k=Move channel d=Toggle drum prt.", "J=Jump L=Load & play (TAB: File completion) t=Toggle trace mode", "%=Display velocity (toggle) D=Drum change S=Save as", "R=Change rate Space=Toggle ch. mute .=Solo ch. play /=Clear ch. mute", #ifdef SUPPORT_SOUNDSPEC "g=Open sound spectrogram window", #else "", #endif /* SUPPORT_SOUNDSPEC */ "", "l/INS=List mode", "k/Up=Cursor up j/Down=Cursor down Space=Select and play", "p=Previous file play n=Next file play RollUp=Page up RollDown=Page down", "/=Search file", NULL }; ctl_ncurs_back = ctl_ncurs_mode; ctl_ncurs_mode = NCURS_MODE_HELP; helpwin = newwin(LIST_TITLE_LINES, COLS, TITLE_LINE, 0); N_ctl_werase(helpwin); wattron(helpwin, A_BOLD); waddstr(helpwin, " ncurses interface Help"); wattroff(helpwin, A_BOLD); for(i = 0; help_message_list[i]; i++) { wmove(helpwin, i+1,0); waddstr(helpwin, help_message_list[i]); } wmove(helpwin, i+2,0); wattron(helpwin, A_BOLD); waddstr(helpwin, " Type `h' to go to previous screen"); wattroff(helpwin, A_BOLD); wrefresh(helpwin); N_ctl_clrtoeol(LINES - 1); N_ctl_refresh(); } } static MFnode *MFnode_nth_cdr(MFnode *p, int n) { while(p != NULL && n-- > 0) p = p->next; return p; } static void ctl_list_MFnode_files(MFnode *mfp, int select_id, int play_id) { int i, mk; #ifdef MIDI_TITLE char *item, *f, *title; int tlen, flen, mlen; #ifdef DISPLAY_MID_MODE char *mname; #endif /* DISPLAY_MID_MODE */ #endif /* MIDI_TITLE */ N_ctl_werase(listwin); mk = 0; for(i = 0; i < LIST_TITLE_LINES && mfp; i++, mfp = mfp->next) { if(i == select_id || i == play_id) { mk = 1; wattron(listwin,A_REVERSE); } wmove(listwin, i, 0); wprintw(listwin,"%03d%c", i + ctl_list_from[ctl_listmode], i == play_id ? '*' : ' '); #ifdef MIDI_TITLE if((f = pathsep_strrchr(mfp->file)) != NULL) f++; else f = mfp->file; flen = strlen(f); title = mfp->title; if(title != NULL) { while(*title == ' ') title++; tlen = strlen(title) + 1; } else tlen = 0; #ifdef DISPLAY_MID_MODE mname = mid2name(mfp->infop->mid); if(mname != NULL) mlen = strlen(mname); else mlen = 0; #else mlen = 0; #endif /* DISPLAY_MID_MODE */ item = (char *)new_segment(&tmpbuffer, tlen + flen + mlen + 4); if(title != NULL) { strcpy(item, title); strcat(item, " "); } else item[0] = '\0'; strcat(item, "("); strcat(item, f); strcat(item, ")"); #ifdef DISPLAY_MID_MODE if(mlen) { strcat(item, "/"); strcat(item, mname); } #endif /* DISPLAY_MID_MODE */ waddnstr(listwin, item, COLS-6); reuse_mblock(&tmpbuffer); #else waddnstr(listwin, mfp->file, COLS-6); #endif if(mk) { mk = 0; wattroff(listwin,A_REVERSE); } } } static void ctl_list_mode(int type) { for(ctl_listmode_play=1;;ctl_listmode_play++) { if(ctl_list_from[ctl_listmode_play]<=nc_playfile &&nc_playfile<=ctl_list_to[ctl_listmode_play]) break; } switch(type){ case NC_LIST_PREV: if(ctl_listmode<=1) ctl_listmode=ctl_listmode_max; else ctl_listmode--; break; case NC_LIST_NEXT: if(ctl_listmode>=ctl_listmode_max) ctl_listmode=1; else ctl_listmode++; break; case NC_LIST_UP: if(ctl_list_select[ctl_listmode]<=ctl_list_from[ctl_listmode]){ if(ctl_listmode<=1) ctl_listmode=ctl_listmode_max; else ctl_listmode--; ctl_list_select[ctl_listmode]=ctl_list_to[ctl_listmode]; } else ctl_list_select[ctl_listmode]--; break; case NC_LIST_DOWN: if(ctl_list_select[ctl_listmode]>=ctl_list_to[ctl_listmode]){ if(ctl_listmode>=ctl_listmode_max) ctl_listmode=1; else ctl_listmode++; ctl_list_select[ctl_listmode]=ctl_list_from[ctl_listmode]; } else ctl_list_select[ctl_listmode]++; break; case NC_LIST_UPPAGE: if(ctl_listmode<=1) ctl_listmode=ctl_listmode_max; else ctl_listmode--; ctl_list_select[ctl_listmode]=ctl_list_to[ctl_listmode]; break; case NC_LIST_DOWNPAGE: if(ctl_listmode>=ctl_listmode_max) ctl_listmode=1; else ctl_listmode++; ctl_list_select[ctl_listmode]=ctl_list_from[ctl_listmode]; break; case NC_LIST_PLAY: if(ctl_ncurs_mode == NCURS_MODE_LIST) { /* leave list mode */ if(ctl.trace_playing) ctl_ncurs_mode = NCURS_MODE_TRACE; else ctl_ncurs_mode = NCURS_MODE_MAIN; ctl_ncurs_mode_init(); } else { /* enter list mode */ ctl_ncurs_mode = NCURS_MODE_LIST; } ctl_ncurs_back = ctl_ncurs_mode; break; case NC_LIST_NEW: ctl_listmode=ctl_listmode_play; ctl_list_select[ctl_listmode]=nc_playfile; break; case NC_LIST_NOW: break; default: ; } if(ctl_ncurs_mode == NCURS_MODE_LIST) { int i; MFnode *mfp; i = ctl_list_from[ctl_listmode]; mfp = MFnode_nth_cdr(file_list.MFnode_head, i); ctl_list_MFnode_files(mfp, ctl_list_select[ctl_listmode] - i, nc_playfile - i); wrefresh(listwin); N_ctl_refresh(); } } static void redraw_all(void) { N_ctl_scrinit(); ctl_total_time(CTL_STATUS_UPDATE); ctl_master_volume(CTL_STATUS_UPDATE); ctl_metronome(CTL_STATUS_UPDATE, CTL_STATUS_UPDATE); ctl_keysig(CTL_STATUS_UPDATE, CTL_STATUS_UPDATE); ctl_tempo(CTL_STATUS_UPDATE, CTL_STATUS_UPDATE); ctl_temper_keysig(CTL_STATUS_UPDATE, CTL_STATUS_UPDATE); display_key_helpmsg(); ctl_file_name(NULL); ctl_ncurs_mode_init(); } static void ctl_event(CtlEvent *e) { if(midi_trace.flush_flag) return; switch(e->type) { case CTLE_NOW_LOADING: ctl_file_name((char *)e->v1); break; case CTLE_LOADING_DONE: redraw_all(); break; case CTLE_PLAY_START: init_chan_status(); ctl_ncurs_mode_init(); ctl_total_time((int)e->v1); break; case CTLE_PLAY_END: break; case CTLE_CURRENT_TIME: ctl_current_time((int)e->v1, (int)e->v2); display_aq_ratio(); break; case CTLE_NOTE: ctl_note((int)e->v1, (int)e->v2, (int)e->v3, (int)e->v4); break; case CTLE_MASTER_VOLUME: ctl_master_volume((int)e->v1); break; case CTLE_METRONOME: ctl_metronome((int) e->v1, (int) e->v2); update_indicator(); break; case CTLE_KEYSIG: ctl_keysig((int8) e->v1, CTL_STATUS_UPDATE); break; case CTLE_KEY_OFFSET: ctl_keysig(CTL_STATUS_UPDATE, (int) e->v1); ctl_temper_keysig(CTL_STATUS_UPDATE, (int) e->v1); break; case CTLE_TEMPO: ctl_tempo((int) e->v1, CTL_STATUS_UPDATE); break; case CTLE_TIME_RATIO: ctl_tempo(CTL_STATUS_UPDATE, (int) e->v1); break; case CTLE_TEMPER_KEYSIG: ctl_temper_keysig((int8) e->v1, CTL_STATUS_UPDATE); break; case CTLE_TEMPER_TYPE: ctl_temper_type((int) e->v1, (int8) e->v2); break; case CTLE_MUTE: ctl_mute((int) e->v1, (int) e->v2); break; case CTLE_PROGRAM: ctl_program((int)e->v1, (int)e->v2, (char *)e->v3, (unsigned int)e->v4); break; case CTLE_DRUMPART: ctl_drumpart((int)e->v1, (int)e->v2); break; case CTLE_VOLUME: ctl_volume((int)e->v1, (int)e->v2); break; case CTLE_EXPRESSION: ctl_expression((int)e->v1, (int)e->v2); break; case CTLE_PANNING: ctl_panning((int)e->v1, (int)e->v2); break; case CTLE_SUSTAIN: ctl_sustain((int)e->v1, (int)e->v2); break; case CTLE_PITCH_BEND: ctl_pitch_bend((int)e->v1, (int)e->v2); break; case CTLE_MOD_WHEEL: ctl_mod_wheel((int)e->v1, (int)e->v2); break; case CTLE_CHORUS_EFFECT: break; case CTLE_REVERB_EFFECT: break; case CTLE_LYRIC: ctl_lyric((int)e->v1); break; case CTLE_GSLCD: if(is_display_lcd) ctl_gslcd((int)e->v1); break; case CTLE_REFRESH: ctl_refresh(); break; case CTLE_RESET: ctl_reset(); break; case CTLE_SPEANA: break; case CTLE_PAUSE: ctl_current_time((int)e->v2, 0); N_ctl_refresh(); break; } } static void ctl_total_time(int tt) { static int last_tt = CTL_STATUS_UPDATE; int mins, secs; if(tt == CTL_STATUS_UPDATE) tt = last_tt; else last_tt = tt; secs=tt/play_mode->rate; mins=secs/60; secs-=mins*60; wmove(dftwin, TIME_LINE,6+6+1); wattron(dftwin, A_BOLD); wprintw(dftwin, "%3d:%02d ", mins, secs); wattroff(dftwin, A_BOLD); ctl_current_time(CTL_STATUS_INIT, 0); /* Init. */ ctl_current_time(0, 0); N_ctl_refresh(); } static void ctl_master_volume(int mv) { static int lastvol = CTL_STATUS_UPDATE; if(mv == CTL_STATUS_UPDATE) mv = lastvol; else lastvol = mv; wmove(dftwin, VOICE_LINE,COLS-5); wattron(dftwin, A_BOLD); wprintw(dftwin, "%03d %%", mv); wattroff(dftwin, A_BOLD); N_ctl_refresh(); } static void ctl_metronome(int meas, int beat) { static int lastmeas = CTL_STATUS_UPDATE; static int lastbeat = CTL_STATUS_UPDATE; if (meas == CTL_STATUS_UPDATE) meas = lastmeas; else lastmeas = meas; if (beat == CTL_STATUS_UPDATE) beat = lastbeat; else lastbeat = beat; wmove(dftwin, SEPARATE1_LINE, 6); wattron(dftwin, A_BOLD); wprintw(dftwin, "%03d.%02d ", meas, beat); wattroff(dftwin, A_BOLD); N_ctl_refresh(); } static void ctl_keysig(int8 k, int ko) { static int8 lastkeysig = CTL_STATUS_UPDATE; static int lastoffset = CTL_STATUS_UPDATE; static const char *keysig_name[] = { "Cb", "Gb", "Db", "Ab", "Eb", "Bb", "F ", "C ", "G ", "D ", "A ", "E ", "B ", "F#", "C#", "G#", "D#", "A#" }; int i, j; if (k == CTL_STATUS_UPDATE) k = lastkeysig; else lastkeysig = k; if (ko == CTL_STATUS_UPDATE) ko = lastoffset; else lastoffset = ko; i = k + ((k < 8) ? 7 : -6); if (ko > 0) for (j = 0; j < ko; j++) i += (i > 10) ? -5 : 7; else for (j = 0; j < abs(ko); j++) i += (i < 7) ? 5 : -7; wmove(dftwin, SEPARATE1_LINE, 43); wattron(dftwin, A_BOLD); wprintw(dftwin, "%s %s (%+03d) ", keysig_name[i], (k < 8) ? "Maj" : "Min", ko); wattroff(dftwin, A_BOLD); N_ctl_refresh(); } static void ctl_tempo(int t, int tr) { static int lasttempo = CTL_STATUS_UPDATE; static int lastratio = CTL_STATUS_UPDATE; if (t == CTL_STATUS_UPDATE) t = lasttempo; else lasttempo = t; if (tr == CTL_STATUS_UPDATE) tr = lastratio; else lastratio = tr; t = (int) (500000 / (double) t * 120 * (double) tr / 100 + 0.5); wmove(dftwin, SEPARATE1_LINE, 66); wattron(dftwin, A_BOLD); wprintw(dftwin, "%3d (%03d %%) ", t, tr); wattroff(dftwin, A_BOLD); N_ctl_refresh(); } static void ctl_file_name(char *name) { if(name == NULL) { if(current_MFnode != NULL) name = current_MFnode->file; else return; } N_ctl_clrtoeol(FILE_LINE); waddstr(dftwin, "File: "); wattron(dftwin, A_BOLD); waddnstr(dftwin, name, COLS - 8); wattroff(dftwin, A_BOLD); #ifdef MIDI_TITLE /* Display MIDI title */ N_ctl_clrtoeol(FILE_TITLE_LINE); waddstr(dftwin, "Title: "); if(current_MFnode != NULL && current_MFnode->title != NULL) waddnstr(dftwin, current_MFnode->title, COLS - 9); #endif N_ctl_refresh(); } static void ctl_current_time(int secs, int v) { int mins; static int last_voices = CTL_STATUS_INIT, last_v = CTL_STATUS_INIT; static int last_secs = CTL_STATUS_INIT; if(secs == CTL_STATUS_INIT) { last_voices = last_v = last_secs = CTL_STATUS_INIT; return; } if(last_secs != secs) { last_secs = secs; mins = secs/60; secs -= mins*60; wmove(dftwin, TIME_LINE, 5); wattron(dftwin, A_BOLD); wprintw(dftwin, "%3d:%02d", mins, secs); wattroff(dftwin, A_BOLD); scr_modified_flag = 1; } if(last_v != v) { last_v = v; wmove(dftwin, VOICE_LINE, 48); wattron(dftwin, A_BOLD); wprintw(dftwin, "%3d", v); wattroff(dftwin, A_BOLD); scr_modified_flag = 1; } if(last_voices != voices) { last_voices = voices; wmove(dftwin, VOICE_LINE, 54); wprintw(dftwin, "%3d", voices); scr_modified_flag = 1; } } static void ctl_note(int status, int ch, int note, int vel) { int n, c; unsigned int onoff = 0, check, prev_check; Bitset *bitset; if(ch >= display_channels || ctl_ncurs_mode != NCURS_MODE_TRACE || selected_channel == ch) return; scr_modified_flag = 1; if(display_velocity_flag) n = '0' + (10 * vel) / 128; else n = note_name_char[note % 12]; c = (COLS - 28) / 12 * 12; if(c <= 0) c = 1; note = note % c; wmove(dftwin, NOTE_LINE + ch, note + 3); bitset = channel_program_flags + ch; switch(status) { case VOICE_DIE: waddch(dftwin, ','); onoff = 0; break; case VOICE_FREE: if(get_bitset1(gs_lcd_bits + ch, note)) waddch(dftwin, GS_LCD_MARK_CHAR); else waddch(dftwin, '.'); onoff = 0; break; case VOICE_ON: wattron(dftwin, A_REVERSE); waddch(dftwin, n); wattroff(dftwin, A_REVERSE); indicator_chan_update(ch); onoff = 1; break; case VOICE_SUSTAINED: wattron(dftwin, A_BOLD); waddch(dftwin, n); wattroff(dftwin, A_BOLD); onoff = 0; break; case VOICE_OFF: waddch(dftwin, n); onoff = 0; break; case GS_LCD_MARK_ON: set_bitset1(gs_lcd_bits + ch, note, 1); if(!get_bitset1(bitset, note)) waddch(dftwin, GS_LCD_MARK_CHAR); return; case GS_LCD_MARK_OFF: set_bitset1(gs_lcd_bits + ch, note, 0); if(!get_bitset1(bitset, note)) waddch(dftwin, '.'); return; } prev_check = has_bitset(bitset); set_bitset1(bitset, note, onoff); if(prev_check == onoff) { /* Not change program mark */ return; } check = has_bitset(bitset); if(prev_check ^ check) { wmove(dftwin, NOTE_LINE + ch, COLS - 21); if(check) { wattron(dftwin, A_BOLD); waddch(dftwin, '*'); wattroff(dftwin, A_BOLD); } else { waddch(dftwin, ' '); } } } static void ctl_temper_keysig(int8 tk, int ko) { static int8 lastkeysig = CTL_STATUS_UPDATE; static int lastoffset = CTL_STATUS_UPDATE; static const char *keysig_name[] = { "Cb", "Gb", "Db", "Ab", "Eb", "Bb", " F", " C", " G", " D", " A", " E", " B", "F#", "C#", "G#", "D#", "A#" }; int adj, i, j; if (tk == CTL_STATUS_UPDATE) tk = lastkeysig; else lastkeysig = tk; if (ko == CTL_STATUS_UPDATE) ko = lastoffset; else lastoffset = ko; if (ctl_ncurs_mode != NCURS_MODE_TRACE) return; adj = (tk + 8) & 0x20, tk = (tk + 8) % 32 - 8; i = tk + ((tk < 8) ? 7 : -6); if (ko > 0) for (j = 0; j < ko; j++) i += (i > 10) ? -5 : 7; else for (j = 0; j < abs(ko); j++) i += (i < 7) ? 5 : -7; wmove(dftwin, TITLE_LINE, COLS - 24); if (adj) wattron(dftwin, A_BOLD); wprintw(dftwin, "%s%c", keysig_name[i], (tk < 8) ? ' ' : 'm'); if (adj) wattroff(dftwin, A_BOLD); N_ctl_refresh(); } static void ctl_temper_type(int ch, int8 tt) { if (ch >= display_channels) return; if (tt != CTL_STATUS_UPDATE) { if (ChannelStatus[ch].tt == tt) return; ChannelStatus[ch].tt = tt; } else tt = ChannelStatus[ch].tt; if (ctl_ncurs_mode != NCURS_MODE_TRACE || ch == selected_channel) return; wmove(dftwin, NOTE_LINE + ch, COLS - 23); switch (tt) { case 0: waddch(dftwin, ' '); break; case 1: waddch(dftwin, 'P'); break; case 2: waddch(dftwin, 'm'); break; case 3: wattron(dftwin, A_BOLD); waddch(dftwin, 'p'); wattroff(dftwin, A_BOLD); break; case 64: waddch(dftwin, '0'); break; case 65: waddch(dftwin, '1'); break; case 66: waddch(dftwin, '2'); break; case 67: waddch(dftwin, '3'); break; } scr_modified_flag = 1; } static void ctl_mute(int ch, int mute) { if (ch >= display_channels) return; if (mute != CTL_STATUS_UPDATE) { if (ChannelStatus[ch].mute == mute) return; ChannelStatus[ch].mute = mute; } else mute = ChannelStatus[ch].mute; if (ctl_ncurs_mode != NCURS_MODE_TRACE) return; wmove(dftwin, NOTE_LINE + ch, 0); if (ch != selected_channel) { wattron(dftwin, (mute) ? A_REVERSE : 0); wprintw(dftwin, "%02d", ch + 1); wattroff(dftwin, (mute) ? A_REVERSE : 0); } else { wattron(dftwin, A_BOLD | ((mute) ? A_REVERSE : 0)); wprintw(dftwin, "%02d", ch + 1); wattroff(dftwin, A_BOLD | ((mute) ? A_REVERSE : 0)); } scr_modified_flag = 1; } static void ctl_drumpart(int ch, int is_drum) { if(ch >= display_channels) return; ChannelStatus[ch].is_drum = is_drum; } static void ctl_program(int ch, int prog, char *comm, unsigned int banks) { int val; int bank; if(ch >= display_channels) return; if(prog != CTL_STATUS_UPDATE) { bank = banks & 0xff; ChannelStatus[ch].prog = prog; ChannelStatus[ch].bank = bank; ChannelStatus[ch].bank_lsb = (banks >> 8) & 0xff; ChannelStatus[ch].bank_msb = (banks >> 16) & 0xff; ChannelStatus[ch].comm = (comm ? comm : ""); } else { prog = ChannelStatus[ch].prog; bank = ChannelStatus[ch].bank; } ChannelStatus[ch].last_note_on = 0.0; /* reset */ if(ctl_ncurs_mode != NCURS_MODE_TRACE) return; if(selected_channel == ch) { init_trace_window_chan(ch); return; } if(ChannelStatus[ch].is_drum) val = bank; else val = prog; if(!IS_CURRENT_MOD_FILE) val += progbase; wmove(dftwin, NOTE_LINE + ch, COLS - 21); if(ChannelStatus[ch].is_drum) { wattron(dftwin, A_BOLD); wprintw(dftwin, " %03d", val); wattroff(dftwin, A_BOLD); } else wprintw(dftwin, " %03d", val); scr_modified_flag = 1; } static void ctl_volume(int ch, int vol) { if(ch >= display_channels) return; if(vol != CTL_STATUS_UPDATE) { if(ChannelStatus[ch].vol == vol) return; ChannelStatus[ch].vol = vol; } else vol = ChannelStatus[ch].vol; if(ctl_ncurs_mode != NCURS_MODE_TRACE || selected_channel == ch) return; wmove(dftwin, NOTE_LINE + ch, COLS - 16); wprintw(dftwin, "%3d", vol); scr_modified_flag = 1; } static void ctl_expression(int ch, int exp) { if(ch >= display_channels) return; if(exp != CTL_STATUS_UPDATE) { if(ChannelStatus[ch].exp == exp) return; ChannelStatus[ch].exp = exp; } else exp = ChannelStatus[ch].exp; if(ctl_ncurs_mode != NCURS_MODE_TRACE || selected_channel == ch) return; wmove(dftwin, NOTE_LINE + ch, COLS - 12); wprintw(dftwin, "%3d", exp); scr_modified_flag = 1; } static void ctl_panning(int ch, int pan) { if(ch >= display_channels) return; if(pan != CTL_STATUS_UPDATE) { if(pan == NO_PANNING) ; else if(pan < 5) pan = 0; else if(pan > 123) pan = 127; else if(pan > 60 && pan < 68) pan = 64; if(ChannelStatus[ch].pan == pan) return; ChannelStatus[ch].pan = pan; } else pan = ChannelStatus[ch].pan; if(ctl_ncurs_mode != NCURS_MODE_TRACE || selected_channel == ch) return; wmove(dftwin, NOTE_LINE + ch, COLS - 8); switch(pan) { case NO_PANNING: waddstr(dftwin, " "); break; case 0: waddstr(dftwin, " L "); break; case 64: waddstr(dftwin, " C "); break; case 127: waddstr(dftwin, " R "); break; default: pan -= 64; if(pan < 0) { waddch(dftwin, '-'); pan = -pan; } else waddch(dftwin, '+'); wprintw(dftwin, "%02d", pan); break; } scr_modified_flag = 1; } static void ctl_sustain(int ch, int sus) { if(ch >= display_channels) return; if(sus != CTL_STATUS_UPDATE) { if(ChannelStatus[ch].sus == sus) return; ChannelStatus[ch].sus = sus; } else sus = ChannelStatus[ch].sus; if(ctl_ncurs_mode != NCURS_MODE_TRACE || selected_channel == ch) return; wmove(dftwin, NOTE_LINE + ch, COLS - 4); if(sus) waddch(dftwin, 'S'); else waddch(dftwin, ' '); scr_modified_flag = 1; } static void update_bend_mark(int ch) { wmove(dftwin, NOTE_LINE + ch, COLS - 2); waddch(dftwin, ChannelStatus[ch].bend_mark); scr_modified_flag = 1; } static void ctl_pitch_bend(int ch, int pitch) { int mark; if(ch >= display_channels) return; ChannelStatus[ch].pitch = pitch; if(ctl_ncurs_mode != NCURS_MODE_TRACE || selected_channel == ch) return; if(ChannelStatus[ch].wheel) mark = '='; else if(pitch > 0x2000) mark = '>'; else if(pitch < 0x2000) mark = '<'; else mark = ' '; if(ChannelStatus[ch].bend_mark == mark) return; ChannelStatus[ch].bend_mark = mark; update_bend_mark(ch); } static void ctl_mod_wheel(int ch, int wheel) { int mark; if(ch >= display_channels) return; ChannelStatus[ch].wheel = wheel; if(ctl_ncurs_mode != NCURS_MODE_TRACE || selected_channel == ch) return; if(wheel) mark = '='; else { /* restore pitch bend mark */ if(ChannelStatus[ch].pitch > 0x2000) mark = '>'; else if(ChannelStatus[ch].pitch < 0x2000) mark = '<'; else mark = ' '; } if(ChannelStatus[ch].bend_mark == mark) return; ChannelStatus[ch].bend_mark = mark; update_bend_mark(ch); } static void ctl_lyric(int lyricid) { char *lyric; lyric = event2string(lyricid); if(lyric != NULL) { /* EAW -- if not a true KAR lyric, ignore \r, treat \n as \r */ if (*lyric != ME_KARAOKE_LYRIC) { while (strchr(lyric, '\r')) { *(strchr(lyric, '\r')) = ' '; } if (ctl.trace_playing) { while (strchr(lyric, '\n')) { *(strchr(lyric, '\n')) = '\r'; } } } if(ctl.trace_playing) { if(*lyric == ME_KARAOKE_LYRIC) { if(lyric[1] == '/') { display_lyric(" / ", LYRIC_WORD_NOSEP); display_lyric(lyric + 2, LYRIC_WORD_NOSEP); } else if(lyric[1] == '\\') { display_lyric("\r", LYRIC_WORD_NOSEP); display_lyric(lyric + 2, LYRIC_WORD_NOSEP); } else if(lyric[1] == '@') display_lyric(lyric + 3, LYRIC_WORD_SEP); else display_lyric(lyric + 1, LYRIC_WORD_NOSEP); } else { if(*lyric == ME_CHORUS_TEXT || *lyric == ME_INSERT_TEXT) display_lyric("\r", LYRIC_WORD_SEP); display_lyric(lyric + 1, LYRIC_WORD_SEP); } } else cmsg(CMSG_INFO, VERB_NORMAL, "%s", lyric + 1); } } static void ctl_lcd_mark(int status, int x, int y) { int w; if(!ctl.trace_playing) { waddch(msgwin, status == GS_LCD_MARK_ON ? GS_LCD_MARK_CHAR : ' '); return; } w = (COLS - 28) / 12 * 12; if(status == GS_LCD_MARK_CLEAR) { int x, y; for(y = 0; y < 16; y++) for(x = 0; x < 40; x++) ctl_note(GS_LCD_MARK_OFF, y, x + (w - 40) / 2, 0); return; } if(w < GS_LCD_WIDTH) { if(x < w) ctl_note(status, y, x, 0); } else { ctl_note(status, y, x + (w - GS_LCD_WIDTH) / 2, 0); } } static void ctl_gslcd(int id) { char *lcd; int i, j, k, data, mask; char tmp[3]; if((lcd = event2string(id)) == NULL) return; if(lcd[0] != ME_GSLCD) return; gslcd_last_display_time = get_current_calender_time(); gslcd_displayed_flag = 1; lcd++; for(i = 0; i < 16; i++) { for(j = 0; j < 4; j++) { tmp[0]= lcd[2 * (j * 16 + i)]; tmp[1]= lcd[2 * (j * 16 + i) + 1]; if(sscanf(tmp, "%02X", &data) != 1) { /* Invalid format */ return; } mask = 0x10; for(k = 0; k < 10; k += 2) { if(data & mask) { ctl_lcd_mark(GS_LCD_MARK_ON, j * 10 + k, i); ctl_lcd_mark(GS_LCD_MARK_ON, j * 10 + k + 1, i); } else { ctl_lcd_mark(GS_LCD_MARK_OFF, j * 10 + k, i); ctl_lcd_mark(GS_LCD_MARK_OFF, j * 10 + k + 1, i); } mask >>= 1; } } if(!ctl.trace_playing) { waddch(msgwin, '\n'); wrefresh(msgwin); } } } static void ctl_reset(void) { if(ctl.trace_playing) reset_indicator(); N_ctl_refresh(); ctl_ncurs_mode_init(); } /***********************************************************************/ /* #define CURSED_REDIR_HACK */ /*ARGSUSED*/ static int ctl_open(int using_stdin, int using_stdout) { static int open_init_flag = 0; #ifdef CURSED_REDIR_HACK FILE *infp = stdin, *outfp = stdout; SCREEN *dftscr; #endif #ifdef USE_PDCURSES PDC_set_ctrl_break(1); #endif /* USE_PDCURSES */ if(!open_init_flag) { #ifdef CURSED_REDIR_HACK /* This doesn't work right */ if(using_stdin && using_stdout) { infp = outfp = stderr; fflush(stderr); setvbuf(stderr, 0, _IOFBF, BUFSIZ); } else if(using_stdout) { outfp = stderr; fflush(stderr); setvbuf(stderr, 0, _IOFBF, BUFSIZ); } else if(using_stdin) { infp = stdout; fflush(stdout); setvbuf(stdout, 0, _IOFBF, BUFSIZ); } dftscr = newterm(0, outfp, infp); if (!dftscr) return -1; #else initscr(); #endif /* CURSED_REDIR_HACK */ if(LINES < NCURS_MIN_LINES) { endwin(); cmsg(CMSG_FATAL, VERB_NORMAL, "Error: Screen is too small."); return 1; } cbreak(); noecho(); nonl(); nodelay(stdscr, 1); scrollok(stdscr, 0); #ifndef USE_PDCURSES idlok(stdscr, 1); #endif /* USE_PDCURSES */ keypad(stdscr, TRUE); ctl.opened = 1; init_chan_status(); } open_init_flag = 1; dftwin=stdscr; if(ctl.trace_playing) ctl_ncurs_mode = NCURS_MODE_TRACE; else ctl_ncurs_mode = NCURS_MODE_MAIN; ctl_ncurs_back = ctl_ncurs_mode; N_ctl_scrinit(); if(ctl.trace_playing) { if(msgwin != NULL) { delwin(msgwin); msgwin = NULL; } } else { set_trace_loop_hook(NULL); msgwin = newwin(LINES - 6 - 1, COLS, 6, 0); N_ctl_werase(msgwin); scrollok(msgwin, 1); wrefresh(msgwin); } if(command_buffer == NULL) command_buffer = mini_buff_new(COMMAND_BUFFER_SIZE); N_ctl_refresh(); return 0; } static void ctl_close(void) { if (ctl.opened) { endwin(); ctl.opened=0; } } #if SCREEN_BUGFIX static void re_init_screen(void) { static int screen_bugfix = 0; if(screen_bugfix) return; screen_bugfix = 1; touchwin(dftwin); N_ctl_refresh(); if(msgwin) { touchwin(msgwin); wrefresh(msgwin); } } #endif static void move_select_channel(int diff) { if(selected_channel != -1) { int prev_chan; prev_chan = selected_channel; selected_channel += diff; init_trace_window_chan(prev_chan); } else selected_channel += diff; while(selected_channel < 0) selected_channel += display_channels + 1; while(selected_channel >= display_channels) selected_channel -= display_channels + 1; if(selected_channel != -1) { init_trace_window_chan(selected_channel); current_indicator_chan = selected_channel; } N_ctl_refresh(); } static void ctl_cmd_dir_close(void) { if(ctl_ncurs_mode == NCURS_MODE_DIR) { ctl_ncurs_mode = ctl_ncurs_back; ctl_ncurs_mode_init(); } } static void ctl_cmd_J_move(int diff) { int i; char num[16]; i = atoi(mini_buff_gets(command_buffer)) + diff; if(i < 0) i = 0; else if(i > file_list.number) i = file_list.number; sprintf(num, "%d", i); mini_buff_sets(command_buffer, num); } static int ctl_cmd_J_enter(void) { int i, rc; char *text; text = mini_buff_gets(command_buffer); if(*text == '\0') rc = RC_NONE; else { i = atoi(text); if(i < 0 || i > file_list.number) { beep(); rc = RC_NONE; } else { rc = RC_LOAD_FILE; ctl_listmode = 1 + i / LIST_TITLE_LINES; ctl_list_select[ctl_listmode] = i; } } mini_buff_clear(command_buffer); ctl_cmdmode = 0; return rc; } static void ctl_cmd_L_dir(int move) { MFnode *mfp; int i; if(ctl_ncurs_mode != NCURS_MODE_DIR) { ctl_ncurs_back = ctl_ncurs_mode; ctl_ncurs_mode = NCURS_MODE_DIR; move = 0; } N_ctl_werase(listwin); if(command_buffer->files == NULL) { wmove(listwin, 0, 0); waddstr(listwin, "No match"); wrefresh(listwin); N_ctl_refresh(); ctl_mode_L_dispstart = 0; return; } ctl_mode_L_dispstart += move * (LIST_TITLE_LINES-1); mfp = MFnode_nth_cdr(command_buffer->files, ctl_mode_L_dispstart); if(mfp == NULL) { mfp = command_buffer->files; ctl_mode_L_dispstart = 0; } N_ctl_werase(listwin); waddstr(listwin, "Possible completions are:"); for(i = 0; i < LIST_TITLE_LINES - 1 && mfp; i++, mfp = mfp->next) { wmove(listwin, i + 1, 0); waddnstr(listwin, mfp->file, COLS - 6); } wrefresh(listwin); N_ctl_refresh(); } static int ctl_cmd_L_enter(void) { char *text; MFnode *mfp; int i, rc = RC_NONE; struct double_list_string *hist; int nfiles; char *files[1], **new_files; MFnode *tail, *head; ctl_cmd_dir_close(); text = mini_buff_gets(command_buffer); if(*text == '\0') goto end_enter; strncpy(ctl_mode_L_lastenter, text, COMMAND_BUFFER_SIZE - 1); ctl_mode_L_lastenter[COMMAND_BUFFER_SIZE - 1] = '\0'; hist = (struct double_list_string *) safe_malloc(sizeof(struct double_list_string)); hist->string = safe_strdup(ctl_mode_L_lastenter); hist->prev = NULL; hist->next = ctl_mode_L_histh; if(ctl_mode_L_histh != NULL) ctl_mode_L_histh->prev = hist; ctl_mode_L_histh = hist; i = strlen(ctl_mode_L_lastenter); while(i > 0 && !IS_PATH_SEP(ctl_mode_L_lastenter[i - 1])) i--; ctl_mode_L_lastenter[i] = '\0'; /* Add new files */ files[0] = text; nfiles = 1; new_files = expand_file_archives(files, &nfiles); if(new_files == NULL) { rc = RC_NONE; beep(); } else { head = tail = NULL; for(i = 0; i < nfiles; i++) { if((mfp = make_new_MFnode_entry(new_files[i])) != NULL) { if(head == NULL) head = tail = mfp; else tail = tail->next = mfp; } } mfp = head; free(new_files[0]); free(new_files); if(mfp == NULL) { rc = RC_NONE; beep(); goto end_enter; } insert_MFnode_entrys(mfp, nc_playfile); ctl_list_mode(NC_LIST_NEW); rc = RC_NEXT; } end_enter: mini_buff_clear(command_buffer); ctl_cmdmode = 0; return rc; } static int ctl_cmd_E_enter(int32 *val) { int rc = RC_NONE; char *text; int lastb; *val = 1; text = mini_buff_gets(command_buffer); if(*text) { lastb = special_tonebank; if(set_extension_modes(text)) beep(); else { if(lastb == special_tonebank) rc = RC_SYNC_RESTART; else rc = RC_RELOAD; } } mini_buff_clear(command_buffer); ctl_cmdmode = 0; return rc; } static int ctl_cmd_S_enter(void) { char *file; ctl_cmd_dir_close(); file = mini_buff_gets(command_buffer); if(*file) { if(midi_file_save_as(NULL, file) == -1) beep(); } mini_buff_clear(command_buffer); ctl_cmdmode = 0; return RC_NONE; } static int ctl_cmd_R_enter(int32 *valp) { char *rateStr; int rc = RC_NONE; rateStr = mini_buff_gets(command_buffer); if(*rateStr) { *valp = atoi(rateStr); rc = RC_CHANGE_RATE; } mini_buff_clear(command_buffer); ctl_cmdmode = 0; return rc; } static int ctl_cmd_D_enter(int32 *val) { int rc = RC_NONE, ch; char *text; text = mini_buff_gets(command_buffer); if(*text) { if(*text == '+') { ch = atoi(text + 1) - 1; if(ch >= 0 && ChannelStatus[ch].is_drum) { *val = ch; rc = RC_TOGGLE_DRUMCHAN; } } else if(*text == '-') { ch = atoi(text + 1) - 1; if(ch >= 0 && ChannelStatus[ch].is_drum) { *val = ch; rc = RC_TOGGLE_DRUMCHAN; } } else { *val = atoi(text) - 1; if(*val >= 0) rc = RC_TOGGLE_DRUMCHAN; } } mini_buff_clear(command_buffer); ctl_cmdmode = 0; return rc; } /* Previous history */ static void ctl_cmd_L_phist(void) { if(ctl_mode_L_histh == NULL || (ctl_mode_L_histc != NULL && ctl_mode_L_histc->next == NULL)) { beep(); return; } if(ctl_mode_L_histc != NULL) ctl_mode_L_histc = ctl_mode_L_histc->next; else { strcpy(ctl_mode_L_lastenter, mini_buff_gets(command_buffer)); ctl_mode_L_lastenter[COMMAND_BUFFER_SIZE - 1] = '\0'; ctl_mode_L_histc = ctl_mode_L_histh; } mini_buff_sets(command_buffer, ctl_mode_L_histc->string); } /* Next history */ static void ctl_cmd_L_nhist(void) { if(ctl_mode_L_histc == NULL) { beep(); return; } ctl_mode_L_histc = ctl_mode_L_histc->prev; if(ctl_mode_L_histc != NULL) mini_buff_sets(command_buffer, ctl_mode_L_histc->string); else mini_buff_sets(command_buffer, ctl_mode_L_lastenter); } static int ctl_cmd_forward_search(void) { MFnode *mfp; int i, n, found; char *ptn, *name; if(mini_buff_len(command_buffer) == 0) { if(ctl_mode_SEARCH_lastenter[0] == 0) { mini_buff_clear(command_buffer); ctl_cmdmode = 0; return 1; } mini_buff_sets(command_buffer, ctl_mode_SEARCH_lastenter); } else strcpy(ctl_mode_SEARCH_lastenter, mini_buff_gets(command_buffer)); /* Put '*' into buffer with first and last */ while(mini_buff_backward(command_buffer)) ; mini_buff_insertc(command_buffer, '*'); while(mini_buff_forward(command_buffer)) ; mini_buff_insertc(command_buffer, '*'); ptn = mini_buff_gets(command_buffer); n = ctl_list_select[ctl_listmode] + 1; mfp = MFnode_nth_cdr(file_list.MFnode_head, n); found = 0; for(i = 0; i < file_list.number; i++, n++) { if(mfp == NULL) { mfp = file_list.MFnode_head; n = 0; } if((name = pathsep_strrchr(mfp->file)) == NULL) name = mfp->file; else name++; if(arc_wildmat(name, ptn)) { found = 1; break; } mfp = mfp->next; } mini_buff_clear(command_buffer); ctl_cmdmode = 0; if(found) { ctl_listmode = n / LIST_TITLE_LINES + 1; ctl_list_select[ctl_listmode] = n; ctl_list_mode(NC_LIST_NOW); } else { wmove(dftwin, LINES - 1, 0); wattron(dftwin, A_REVERSE); waddstr(dftwin, "Pattern not found"); wattroff(dftwin, A_REVERSE); } return found; } static int ctl_read(int32 *valp) { int c, i; static int u_prefix = 1, u_flag = 1; if(ctl_cmdmode) mini_buff_refresh(command_buffer); while ((c=getch())!=ERR) { #if SCREEN_BUGFIX re_init_screen(); #endif if(u_flag == 0) { u_prefix = 1; u_flag = 1; } if(ctl_ncurs_mode == NCURS_MODE_HELP) { switch(c) { case 'h': case '?': case KEY_F(1): ctl_help_mode(); break; case 'q': return RC_QUIT; } u_prefix = 1; continue; } if(ctl_cmdmode && ' ' <= c && c < 256) { if(!mini_buff_insertc(command_buffer, c)) beep(); u_prefix = 1; continue; } if(!ctl_cmdmode && c == 21) { u_prefix <<= 1; if(u_prefix > MAX_U_PREFIX) u_prefix = MAX_U_PREFIX; u_flag = 1; continue; } else u_flag = 0; switch(c) { case 'h': case '?': case KEY_F(1): ctl_help_mode(); continue; case 'V': *valp = 10 * u_prefix; return RC_CHANGE_VOLUME; case 'v': *valp = -10 * u_prefix; return RC_CHANGE_VOLUME; case 16: case 'P': case KEY_UP: if(ctl_cmdmode == NCURS_MODE_CMD_J) ctl_cmd_J_move(1); else if(ctl_cmdmode == NCURS_MODE_CMD_L) ctl_cmd_L_phist(); else if(ctl_ncurs_mode == NCURS_MODE_LIST) ctl_list_mode(NC_LIST_UP); else { *valp = 10 * u_prefix; return RC_CHANGE_VOLUME; } continue; case 14: case 'N': case KEY_DOWN: if(ctl_cmdmode == NCURS_MODE_CMD_J) ctl_cmd_J_move(-1); else if(ctl_cmdmode == NCURS_MODE_CMD_L) ctl_cmd_L_nhist(); else if(ctl_ncurs_mode == NCURS_MODE_LIST) ctl_list_mode(NC_LIST_DOWN); else { *valp = -10 * u_prefix; return RC_CHANGE_VOLUME; } continue; case KEY_PPAGE: if(ctl_ncurs_mode == NCURS_MODE_LIST) { ctl_list_mode(NC_LIST_UPPAGE); continue; } else return RC_REALLY_PREVIOUS; case 22: /* ^V */ case KEY_NPAGE: if(ctl_ncurs_mode == NCURS_MODE_LIST) { ctl_list_mode(NC_LIST_DOWNPAGE); continue; } else return RC_NEXT; #if 0 case '1': case '2': case '3': *valp = c - '2'; return RC_CHANGE_REV_EFFB; case '4': case '5': case '6': *valp = c - '5'; return RC_CHANGE_REV_TIME; #endif case 'q': case 3: /* ^C */ case KEY_END: trace_flush(); sleep(1); return RC_QUIT; case 'n': return RC_NEXT; case 'p': return RC_REALLY_PREVIOUS; case 'r': case KEY_HOME: return RC_RESTART; case 'f': case KEY_RIGHT: case 6: /* ^F */ if(ctl_cmdmode) { if(!mini_buff_forward(command_buffer)) beep(); continue; } *valp = play_mode->rate * u_prefix; return RC_FORWARD; case 'b': case KEY_LEFT: case 2: /* ^B */ if(ctl_cmdmode) { if(!mini_buff_backward(command_buffer)) beep(); continue; } *valp = play_mode->rate * u_prefix; return RC_BACK; case 's': return RC_TOGGLE_PAUSE; case 'l': display_key_helpmsg(); ctl_list_mode(NC_LIST_PLAY); continue; case ' ': case KEY_ENTER: case '\r': case '\n': if(ctl_cmdmode == NCURS_MODE_CMD_J) return ctl_cmd_J_enter(); if(ctl_cmdmode == NCURS_MODE_CMD_L) return ctl_cmd_L_enter(); if(ctl_cmdmode == NCURS_MODE_CMD_D) return ctl_cmd_D_enter(valp); if(ctl_cmdmode == NCURS_MODE_CMD_E) return ctl_cmd_E_enter(valp); if(ctl_cmdmode == NCURS_MODE_CMD_S) return ctl_cmd_S_enter(); if(ctl_cmdmode == NCURS_MODE_CMD_R) return ctl_cmd_R_enter(valp); if(ctl_cmdmode == NCURS_MODE_CMD_FSEARCH) { if(!ctl_cmd_forward_search()) beep(); continue; } if(ctl_ncurs_mode == NCURS_MODE_LIST) { /* ctl_list_mode(NC_LIST_SELECT); */ return RC_LOAD_FILE; } if (ctl_ncurs_mode == NCURS_MODE_TRACE && selected_channel != -1) { *valp = selected_channel; return RC_TOGGLE_MUTE; } continue; case '+': *valp = u_prefix; return RC_KEYUP; case '-': *valp = -u_prefix; return RC_KEYDOWN; case '>': *valp = u_prefix; return RC_SPEEDUP; case '<': *valp = u_prefix; return RC_SPEEDDOWN; case 'O': *valp = u_prefix; return RC_VOICEINCR; case 'o': *valp = u_prefix; return RC_VOICEDECR; case 'c': if(ctl_ncurs_mode == NCURS_MODE_TRACE) { move_select_channel(u_prefix); continue; } break; case 'j': if (ctl_ncurs_mode == NCURS_MODE_TRACE) move_select_channel(u_prefix); else if (ctl_ncurs_mode == NCURS_MODE_LIST) ctl_list_mode(NC_LIST_DOWN); continue; case 'C': if(ctl_ncurs_mode == NCURS_MODE_TRACE) { move_select_channel(-u_prefix); continue; } break; case 'k': if (ctl_ncurs_mode == NCURS_MODE_TRACE) move_select_channel(-u_prefix); else if (ctl_ncurs_mode == NCURS_MODE_LIST) ctl_list_mode(NC_LIST_UP); continue; case 'd': if(ctl_ncurs_mode == NCURS_MODE_TRACE && selected_channel != -1) { *valp = selected_channel; return RC_TOGGLE_DRUMCHAN; } break; case '.': if (ctl_ncurs_mode == NCURS_MODE_TRACE && selected_channel != -1) { *valp = selected_channel; return RC_SOLO_PLAY; } break; case 'g': return RC_TOGGLE_SNDSPEC; case 'G': return RC_TOGGLE_CTL_SPEANA; case 't': /* toggle trace */ if(ctl.trace_playing) trace_flush(); ctl.trace_playing = (ctl.trace_playing) ? 0 : 1; if(ctl_open(0, 0)) return RC_QUIT; /* Error */ ctl_total_time(CTL_STATUS_UPDATE); ctl_master_volume(CTL_STATUS_UPDATE); ctl_metronome(CTL_STATUS_UPDATE, CTL_STATUS_UPDATE); ctl_keysig(CTL_STATUS_UPDATE, CTL_STATUS_UPDATE); ctl_tempo(CTL_STATUS_UPDATE, CTL_STATUS_UPDATE); ctl_file_name(NULL); display_key_helpmsg(); if(ctl.trace_playing) { *valp = 0; return RC_SYNC_RESTART; } return RC_NONE; case 7: /* ^G */ case 27: /* cancel */ if(ctl_cmdmode) { mini_buff_clear(command_buffer); beep(); ctl_cmdmode = 0; ctl_cmd_dir_close(); } continue; case 1: /* ^A */ if(ctl_cmdmode) { while(mini_buff_backward(command_buffer)) ; } continue; case 4: /* ^D */ if(ctl_cmdmode) { if(!mini_buff_delc(command_buffer)) beep(); } continue; case 5: /* ^E */ if(ctl_cmdmode) { while(mini_buff_forward(command_buffer)) ; } continue; case 9: /* TAB: file completion */ if(ctl_cmdmode == NCURS_MODE_CMD_L || ctl_cmdmode == NCURS_MODE_CMD_S) { if(!mini_buff_completion(command_buffer)) { /* Completion failure */ beep(); ctl_cmd_L_dir(0); } if(command_buffer->cflag == 1) { ctl_mode_L_dispstart = 0; ctl_cmd_L_dir(0); } else if(command_buffer->cflag > 1) ctl_cmd_L_dir(1); } continue; case 11: /* ^K */ if(ctl_cmdmode) { while(mini_buff_delc(command_buffer)) ; } continue; case KEY_BACKSPACE: case 8: /* ^H */ case 127: /* del */ if(ctl_cmdmode) { if(mini_buff_backward(command_buffer)) mini_buff_delc(command_buffer); else beep(); } continue; case 21: /* ^U */ if(ctl_cmdmode) { while(mini_buff_backward(command_buffer)) mini_buff_delc(command_buffer); } continue; case'J': ctl_cmdmode = NCURS_MODE_CMD_J; mini_buff_set(command_buffer, dftwin, LINES - 1, "Jump: "); continue; case'L': ctl_cmdmode = NCURS_MODE_CMD_L; mini_buff_set(command_buffer, dftwin, LINES - 1, "MIDI File: "); if(*ctl_mode_L_lastenter == '\0' && current_MFnode != NULL) { char *p; strncpy(ctl_mode_L_lastenter, current_MFnode->file, COMMAND_BUFFER_SIZE - 1); ctl_mode_L_lastenter[COMMAND_BUFFER_SIZE - 1] = '\0'; if((p = strrchr(ctl_mode_L_lastenter, '#')) != NULL) i = p - ctl_mode_L_lastenter; else i = strlen(ctl_mode_L_lastenter); while(i > 0 && !IS_PATH_SEP(ctl_mode_L_lastenter[i - 1])) i--; ctl_mode_L_lastenter[i] = '\0'; } mini_buff_sets(command_buffer, ctl_mode_L_lastenter); ctl_mode_L_histc = NULL; continue; case 'D': ctl_cmdmode = NCURS_MODE_CMD_D; mini_buff_set(command_buffer, dftwin, LINES - 1, "DrumCh> "); continue; case 'E': ctl_cmdmode = NCURS_MODE_CMD_E; mini_buff_set(command_buffer, dftwin, LINES - 1, "ExtMode> "); continue; case 'S': ctl_cmdmode = NCURS_MODE_CMD_S; mini_buff_set(command_buffer, dftwin, LINES - 1, "SaveAs> "); if(*ctl_mode_L_lastenter == '\0' && current_MFnode != NULL) { int i; strncpy(ctl_mode_L_lastenter, current_MFnode->file, COMMAND_BUFFER_SIZE - 1); ctl_mode_L_lastenter[COMMAND_BUFFER_SIZE - 1] = '\0'; i = strlen(ctl_mode_L_lastenter); while(i > 0 && !IS_PATH_SEP(ctl_mode_L_lastenter[i - 1])) i--; ctl_mode_L_lastenter[i] = '\0'; } mini_buff_sets(command_buffer, ctl_mode_L_lastenter); continue; case 'R': { char currentRate[16]; ctl_cmdmode = NCURS_MODE_CMD_R; mini_buff_set(command_buffer, dftwin, LINES - 1, "Sample rate> "); sprintf(currentRate, "%d", (int)play_mode->rate); mini_buff_sets(command_buffer, currentRate); continue; } case '%': display_velocity_flag = !display_velocity_flag; continue; case '/': if(ctl_ncurs_mode == NCURS_MODE_LIST) { ctl_cmdmode = NCURS_MODE_CMD_FSEARCH; mini_buff_set(command_buffer, dftwin, LINES - 1, "/"); } if (ctl_ncurs_mode == NCURS_MODE_TRACE) return RC_MUTE_CLEAR; continue; case 12: /* ^L */ redraw_all(); continue; default: beep(); continue; } } #if SCREEN_BUGFIX re_init_screen(); #endif return RC_NONE; } #ifdef USE_PDCURSES static void vwprintw(WINDOW *w, char *fmt, va_list ap) { char *buff; MBlockList pool; init_mblock(&pool); buff = (char *)new_segment(&pool, MIN_MBLOCK_SIZE); vsnprintf(buff, MIN_MBLOCK_SIZE, fmt, ap); waddstr(w, buff); reuse_mblock(&pool); } #endif /* USE_PDCURSES */ static int cmsg(int type, int verbosity_level, char *fmt, ...) { va_list ap; if ((type==CMSG_TEXT || type==CMSG_INFO || type==CMSG_WARNING) && ctl.verbositynext) { q = q->next; len++; } if(pos < 0) /* head */ { q->next = file_list.MFnode_head; file_list.MFnode_head = mfp; } else { MFnode *p; p = MFnode_nth_cdr(file_list.MFnode_head, pos); if(p == NULL) file_list.MFnode_tail = file_list.MFnode_tail->next = mfp; else { q->next = p->next; p->next = mfp; } } file_list.number += len; ctl_list_table_init(); } static void ctl_list_table_init(void) { for(;;) { ctl_list_from[ctl_listmode_max]=LIST_TITLE_LINES*(ctl_listmode_max-1); ctl_list_select[ctl_listmode_max]=ctl_list_from[ctl_listmode_max]; ctl_list_to[ctl_listmode_max]=LIST_TITLE_LINES*ctl_listmode_max-1; if(ctl_list_to[ctl_listmode_max]>=file_list.number){ ctl_list_to[ctl_listmode_max]=file_list.number; break; } ctl_listmode_max++; } } static MFnode *make_new_MFnode_entry(char *file) { struct midi_file_info *infop; #ifdef MIDI_TITLE char *title = NULL; #endif if(!strcmp(file, "-")) infop = get_midi_file_info("-", 1); else { #ifdef MIDI_TITLE title = get_midi_title(file); #else if(check_midi_file(file) < 0) return NULL; #endif /* MIDI_TITLE */ infop = get_midi_file_info(file, 0); } if(!strcmp(file, "-") || (infop && infop->format >= 0)) { MFnode *mfp; mfp = (MFnode *)safe_malloc(sizeof(MFnode)); memset(mfp, 0, sizeof(MFnode)); #ifdef MIDI_TITLE mfp->title = title; #endif /* MIDI_TITLE */ mfp->file = safe_strdup(url_unexpand_home_dir(file)); mfp->infop = infop; return mfp; } cmsg(CMSG_WARNING, VERB_NORMAL, "%s: Not a midi file (Ignored)", url_unexpand_home_dir(file)); return NULL; } static void shuffle_list(void) { MFnode **nodeList; int i, j, n; n = file_list.number + 1; /* Move MFnode into nodeList */ nodeList = (MFnode **)new_segment(&tmpbuffer, n * sizeof(MFnode)); for(i = 0; i < n; i++) { nodeList[i] = file_list.MFnode_head; file_list.MFnode_head = file_list.MFnode_head->next; } /* Simple validate check */ if(file_list.MFnode_head != NULL) ctl.cmsg(CMSG_ERROR, VERB_NORMAL, "BUG: MFnode_head is corrupted"); /* Construct randamized chain */ file_list.MFnode_head = file_list.MFnode_tail = NULL; for(i = 0; i < n; i++) { MFnode *tmp; j = int_rand(n - i); if(file_list.MFnode_head == NULL) file_list.MFnode_head = file_list.MFnode_tail = nodeList[j]; else file_list.MFnode_tail = file_list.MFnode_tail->next = nodeList[j]; /* nodeList[j] is used. Swap out it */ tmp = nodeList[j]; nodeList[j] = nodeList[n - i - 1]; nodeList[n - i - 1] = tmp; } file_list.MFnode_tail->next = NULL; reuse_mblock(&tmpbuffer); } static void ctl_pass_playing_list(int number_of_files, char *list_of_files[]) { int i; int act_number_of_files; int stdin_check; listwin=newwin(LIST_TITLE_LINES,COLS,TITLE_LINE,0); stdin_check = 0; act_number_of_files=0; for(i=0;inext = mfp; act_number_of_files++; } } file_list.number=act_number_of_files-1; if (file_list.number<0) { cmsg(CMSG_FATAL, VERB_NORMAL, "No MIDI file to play!"); return; } ctl_listmode_max=1; ctl_list_table_init(); i=0; for (;;) { int rc; current_MFnode = MFnode_nth_cdr(file_list.MFnode_head, i); display_key_helpmsg(); switch((rc=play_midi_file(current_MFnode->file))) { case RC_REALLY_PREVIOUS: if (i>0) i--; else { if(ctl.flags & CTLF_LIST_LOOP) i = file_list.number; else { ctl_reset(); break; } sleep(1); } nc_playfile=i; ctl_list_mode(NC_LIST_NEW); break; default: /* An error or something */ case RC_TUNE_END: case RC_NEXT: if (i 9999) rate = 10000; if(last_rate != rate) { last_rate = rate; wmove(dftwin, VOICE_LINE + 1, 15); if(rate > 9999) wprintw(dftwin, " Audio queue: ****%% "); else wprintw(dftwin, " Audio queue: %4d%% ", rate); scr_modified_flag = 1; } } static void update_indicator(void) { double t; int i; char c; static int play_modeflag = 1; #if 0 play_modeflag = 1; display_play_system(play_system_mode); display_intonation(opt_pure_intonation); #else if(midi_trace.flush_flag) { play_modeflag = 1; return; } if(gslcd_displayed_flag) { t = get_current_calender_time(); if(t - gslcd_last_display_time > GS_LCD_CLEAR_TIME) { ctl_lcd_mark(GS_LCD_MARK_CLEAR, 0, 0); gslcd_displayed_flag = 0; } } if (play_modeflag) { display_play_system(play_system_mode); display_intonation(opt_pure_intonation); } else { display_play_system(-1); display_intonation(-1); } play_modeflag = !play_modeflag; #endif /* __W32__ */ t = get_current_calender_time(); if(indicator_mode != INDICATOR_DEFAULT) { if(indicator_last_update + LYRIC_OUT_THRESHOLD > t) return; reset_indicator(); } indicator_last_update = t; if(indicator_msgptr != NULL && *indicator_msgptr == '\0') indicator_msgptr = NULL; if(indicator_msgptr == NULL) { int i, prog, first_ch; first_ch = -1; prog = ChannelStatus[current_indicator_chan].prog; /* Find next message */ for(i = 0; i < MAX_CHANNELS; i++, current_indicator_chan = (current_indicator_chan + 1) % MAX_CHANNELS) { if(ChannelStatus[current_indicator_chan].is_drum || ChannelStatus[current_indicator_chan].comm == NULL || *ChannelStatus[current_indicator_chan].comm == '\0') continue; if(first_ch == -1 && ChannelStatus[current_indicator_chan].last_note_on > 0) first_ch = current_indicator_chan; if(ChannelStatus[current_indicator_chan].prog != prog && (ChannelStatus[current_indicator_chan].last_note_on + CHECK_NOTE_SLEEP_TIME > t)) break; } if(i == MAX_CHANNELS) { if(first_ch == -1) first_ch = 0; if(ChannelStatus[first_ch].comm == NULL || *ChannelStatus[first_ch].comm == '\0') return; current_indicator_chan = first_ch; } snprintf(current_indicator_message, indicator_width, "%03d:%s ", ChannelStatus[current_indicator_chan].prog, ChannelStatus[current_indicator_chan].comm); indicator_msgptr = current_indicator_message; } c = *indicator_msgptr++; for(i = 0; i < indicator_width - 2; i++) comment_indicator_buffer[i] = comment_indicator_buffer[i + 1]; comment_indicator_buffer[indicator_width - 2] = c; wmove(dftwin, HELP_LINE, 0); waddstr(dftwin, comment_indicator_buffer); scr_modified_flag = 1; N_ctl_refresh(); } static void indicator_chan_update(int ch) { ChannelStatus[ch].last_note_on = get_current_calender_time(); if(ChannelStatus[ch].comm == NULL) { if((ChannelStatus[ch].comm = default_instrument_name) == NULL) { if(ChannelStatus[ch].is_drum) ChannelStatus[ch].comm = ""; else ChannelStatus[ch].comm = ""; } } } static void display_lyric(char *lyric, int sep) { char *p; int len, idlen, sepoffset; static int crflag = 0; if(lyric == NULL) { indicator_last_update = get_current_calender_time(); crflag = 0; return; } if(indicator_mode != INDICATOR_LYRIC || crflag) { memset(comment_indicator_buffer, 0, indicator_width); N_ctl_clrtoeol(HELP_LINE); N_ctl_refresh(); indicator_mode = INDICATOR_LYRIC; crflag = 0; } if(*lyric == '\0') { indicator_last_update = get_current_calender_time(); return; } if(strchr(lyric, '\r') != NULL) { crflag = 1; if(lyric[0] == '\r' && lyric[1] == '\0') { indicator_last_update = get_current_calender_time(); return; } } idlen = strlen(comment_indicator_buffer); len = strlen(lyric); if(sep) { while(idlen > 0 && comment_indicator_buffer[idlen - 1] == ' ') comment_indicator_buffer[--idlen] = '\0'; while(len > 0 && lyric[len - 1] == ' ') len--; } if(len == 0) { indicator_last_update = get_current_calender_time(); reuse_mblock(&tmpbuffer); return; } sepoffset = (sep != 0); if(len >= indicator_width - 2) { memcpy(comment_indicator_buffer, lyric, indicator_width - 1); comment_indicator_buffer[indicator_width - 1] = '\0'; } else if(idlen == 0) { memcpy(comment_indicator_buffer, lyric, len); comment_indicator_buffer[len] = '\0'; } else if(len + idlen + 2 < indicator_width) { if(sep) comment_indicator_buffer[idlen] = sep; memcpy(comment_indicator_buffer + idlen + sepoffset, lyric, len); comment_indicator_buffer[idlen + sepoffset + len] = '\0'; } else { int spaces; p = comment_indicator_buffer; spaces = indicator_width - idlen - 2; while(spaces < len) { char *q; /* skip one word */ if((q = strchr(p, ' ')) == NULL) { p = NULL; break; } do q++; while(*q == ' '); spaces += (q - p); p = q; } if(p == NULL) { N_ctl_clrtoeol(HELP_LINE); memcpy(comment_indicator_buffer, lyric, len); comment_indicator_buffer[len] = '\0'; } else { int d, l, r, i, j; d = (p - comment_indicator_buffer); l = strlen(p); r = len - (indicator_width - 2 - l - d); j = d - r; for(i = 0; i < j; i++) comment_indicator_buffer[i] = ' '; for(i = 0; i < l; i++) comment_indicator_buffer[j + i] = comment_indicator_buffer[d + i]; if(sep) comment_indicator_buffer[j + i] = sep; memcpy(comment_indicator_buffer + j + i + sepoffset, lyric, len); comment_indicator_buffer[j + i + sepoffset + len] = '\0'; } } wmove(dftwin, HELP_LINE, 0); waddstr(dftwin, comment_indicator_buffer); N_ctl_refresh(); reuse_mblock(&tmpbuffer); indicator_last_update = get_current_calender_time(); } /* * MiniBuffer functions */ #include #include #ifndef S_ISDIR #define S_ISDIR(mode) (((mode)&0xF000) == 0x4000) #endif /* S_ISDIR */ /* Allocate new buffer */ static MiniBuffer *mini_buff_new(int size) { MiniBuffer *b; b = (MiniBuffer *)safe_malloc(sizeof(MiniBuffer) + size + 1); memset(b, 0, sizeof(MiniBuffer) + size + 1); b->buffer = (char *)b + sizeof(MiniBuffer); b->size = size; mini_buff_set(b, NULL, 0, NULL); return b; } /* Initialize buffer */ static void mini_buff_set(MiniBuffer *b, WINDOW *bufwin, int line, char *prompt) { int plen = 0; memset(b->buffer, 0, b->size); b->len = 0; b->cur = 0; b->bufwin = bufwin; b->cflag = 0; b->uflag = 0; reuse_mblock(&b->pool); b->files = NULL; b->lastcmpl = NULL; if(prompt) { plen = strlen(prompt); b->text = b->buffer + plen; b->maxlen = b->size - plen; memcpy(b->buffer, prompt, plen); } else { b->text = b->buffer; b->maxlen = b->size; } if(bufwin) { b->x = 0; b->y = line; getmaxyx(bufwin, b->h, b->w); N_ctl_clrtoeol(line); if(prompt) { waddstr(bufwin, prompt); b->x = plen; } wrefresh(b->bufwin); } } /* Clear buffer */ static void mini_buff_clear(MiniBuffer *b) { reuse_mblock(&b->pool); mini_buff_set(b, b->bufwin, b->y, NULL); } /* Refresh buffer window if modified */ static void mini_buff_refresh(MiniBuffer *b) { if(b->uflag && b->bufwin) { wmove(b->bufwin, b->y, b->x); wrefresh(b->bufwin); b->uflag = 0; } } static void mb_disp_line(MiniBuffer *b, int offset, int view_start) { int rlen; int tlen; if(b->bufwin == NULL) return; /* Note that: -prompt_length <= view_start <= b->maxlen */ wmove(b->bufwin, b->y, offset); wclrtoeol(b->bufwin); rlen = b->w - offset; tlen = b->len - view_start - offset; if(tlen < rlen) waddnstr(b->bufwin, b->text + view_start + offset, tlen); else { waddnstr(b->bufwin, b->text + view_start + offset, rlen - 1); waddch(b->bufwin, MINI_BUFF_MORE_C); } } /* Forward one character */ static int mini_buff_forward(MiniBuffer *b) { if(b->cur == b->len) return 0; b->cur++; b->x++; if(b->cur == b->len && b->x == b->w) { /* turn the line */ mb_disp_line(b, 0, b->cur - 1); b->x = 0; } else if(b->x == b->w - 1) { /* turn the line */ mb_disp_line(b, 0, b->cur); b->x = 0; } b->uflag = 1; return 1; } /* Forward one character */ static int mini_buff_backward(MiniBuffer *b) { if(b->cur == 0) return 0; b->cur--; b->x--; if(b->x < 0) { /* restore the prev line */ b->x = b->w - 2; mb_disp_line(b, 0, b->cur - b->x); } b->uflag = 1; return 1; } /* Insert a character */ static int mini_buff_insertc(MiniBuffer *b, int c) { if(b->cur == b->maxlen || c == 0) return 0; /* insert */ if(b->cur == b->len) { /* end of buffer */ b->text[b->cur] = c; b->cur++; b->len++; b->x++; if(b->x == b->w) { mb_disp_line(b, 0, b->cur - 1); b->x = 1; } else { if(b->bufwin) { wmove(b->bufwin, b->y, b->x - 1); waddch(b->bufwin, c); } } } else { /* not end of buffer */ int i; for(i = b->len; i > b->cur; i--) b->text[i] = b->text[i - 1]; b->text[i] = c; b->cur++; b->len++; b->x++; if(b->x == b->w - 1) { mb_disp_line(b, 0, b->cur); b->x = 0; } else { mb_disp_line(b, b->x - 1, b->cur - b->x); } } b->uflag = 1; return 1; } /* Insert a string */ static int mini_buff_inserts(MiniBuffer *b, char *s) { unsigned char *c = (unsigned char *)s; while(*c) if(!mini_buff_insertc(b, *c++)) return 0; return 1; } /* Delete a character */ static int mini_buff_delc(MiniBuffer *b) { int i, c; if(b->cur == b->len) return 0; c = (int)(unsigned char)b->text[b->cur]; for(i = b->cur; i < b->len - 1; i++) b->text[i] = b->text[i + 1]; b->len--; if(b->x > 0 || b->cur != b->len || b->cur == 0) mb_disp_line(b, b->x, b->cur - b->x); else { mb_disp_line(b, 0, b->cur - b->w + 1); b->x = b->w - 1; } b->uflag = 1; return c; } /* Get buffer string */ static char *mini_buff_gets(MiniBuffer *b) { b->text[b->len] = '\0'; return b->text; } /* Set buffer string */ static void mini_buff_sets(MiniBuffer *b, char *s) { while(mini_buff_backward(b)) ; while(mini_buff_delc(b)) ; mini_buff_inserts(b, s); } static int mini_buff_len(MiniBuffer *b) { return b->len; } static int is_directory(char *pathname) { struct stat stb; pathname = url_expand_home_dir(pathname); if(stat(pathname, &stb) < 0) return 0; return S_ISDIR(stb.st_mode); } static MFnode *MFnode_insert_node(MFnode *list, MFnode *node) { MFnode *cur, *prev; prev = NULL; for(cur = list; cur; prev = cur, cur = cur->next) if(strcmp(cur->file, node->file) >= 0) break; if(cur == list) { node->next = list; return node; } prev->next = node; node->next = cur; return list; } /* Completion as file name */ static int mini_buff_completion(MiniBuffer *b) { char *text, *dir, *file, *pr; URL url; char buff[BUFSIZ]; int dirlen, prefix; text = mini_buff_gets(b); if(b->lastcmpl != NULL && strcmp(b->lastcmpl, text) == 0) { /* same */ b->cflag++; return 1; } /* make new completion list */ /* fix the path */ pr = text; for(;;) { pr = pathsep_strchr(pr); if(pr == NULL) break; pr++; #ifdef TILD_SCHEME_ENABLE if(*pr == '~') break; #endif /* TILD_SCHEME_ENABLE */ if(IS_PATH_SEP(*pr)) { do pr++; while(IS_PATH_SEP(*pr)) ; pr--; break; } } if(pr != NULL) { int pos; pos = pr - text; /* goto pos */ while(b->cur < pos) mini_buff_forward(b); while(b->cur > pos) mini_buff_backward(b); /* del */ while(mini_buff_backward(b)) mini_buff_delc(b); } text = mini_buff_gets(b); reuse_mblock(&b->pool); b->lastcmpl = NULL; b->files = NULL; b->cflag = 0; /* split dir and file name */ if((file = pathsep_strrchr(text)) != NULL) { file++; dirlen = file - text; dir = (char *)new_segment(&b->pool, dirlen + 1); memcpy(dir, text, dirlen); dir[dirlen] = '\0'; } else { file = text; dir = ""; /* "" means current directory */ dirlen = 0; } /* open directory */ url = url_dir_open(dir); if(url == NULL) /* No completion */ { reuse_mblock(&b->pool); return 0; } /* scan and match each files */ prefix = -1; pr = NULL; while(url_gets(url, buff, sizeof(buff))) { char *path; MFnode *mfp; int i; if(!strcmp(buff, ".") || !strcmp(buff, "..") || (*buff == '.' && *file != '.')) continue; /* check prefix */ for(i = 0; file[i]; i++) if(file[i] != buff[i]) break; if(file[i] == '\0') /* matched */ { int flen; flen = strlen(buff); path = (char *)new_segment(&b->pool, dirlen + flen + 1); memcpy(path, dir, dirlen); memcpy(path + dirlen, buff, flen + 1); mfp = (MFnode *)new_segment(&b->pool, sizeof(MFnode)); mfp->file = path; b->files = MFnode_insert_node(b->files, mfp); if(prefix == -1) { prefix = flen; pr = path + dirlen; } else { int j; for(j = i; j < prefix && pr[j]; j++) if(pr[j] != buff[j]) break; prefix = j; } } } url_close(url); prefix -= strlen(file); if(b->files == NULL) { reuse_mblock(&b->pool); b->files = NULL; return 0; } /* go to end of buffer */ while(mini_buff_forward(b)) ; if(b->files->next == NULL) /* Sole completed */ { char *p; p = b->files->file + strlen(text); while(*p) mini_buff_insertc(b, *p++); if(is_directory(mini_buff_gets(b))) { /* Enter in the new directory. */ mini_buff_insertc(b, PATH_SEP); reuse_mblock(&b->pool); b->lastcmpl = NULL; b->files = NULL; } else b->lastcmpl = strdup_mblock(&b->pool, mini_buff_gets(b)); } else if(prefix > 0) /* partial completed */ { char *p; int i; p = b->files->file + strlen(text); for(i = 0; i < prefix; i++) mini_buff_insertc(b, p[i]); b->lastcmpl = strdup_mblock(&b->pool, mini_buff_gets(b)); } else { b->cflag++; b->lastcmpl = strdup_mblock(&b->pool, mini_buff_gets(b)); } return 1; } /* * interface__loader(); */ ControlMode *interface_n_loader(void) { return &ctl; } TiMidity++-2.13.2/interface/slang_c.c0100644004711200001440000005723410045351230016413 0ustar tamukiusers/* TiMidity++ -- MIDI to WAVE converter and player Copyright (C) 1999-2004 Masanao Izumo Copyright (C) 1995 Tuukka Toivonen 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA slang_c.c, Riccardo Facchetti (riccardo@cdc8g5.cdc.polimi.it) based on ncurses_ctl.c slang library is more efficient than ncurses one. 04/04/1995 - Initial, working version. 15/04/1995 - Works with no-trace playing too; not the best way, but it is the only way: slang 0.99.1 don't have a window management interface and I don't want write one for it! :) The problem is that I have set the no-scroll slang option so when there are too much messages, the last ones are not displayed at all. Tipically the last messages are warning for instruments not found so this is no real problem (I hope :) - Get the real size of screen we are running on TiMidity++ release: Masanao Izumo */ #ifdef HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ #include #include #include #include #include #include #ifndef NO_STRING_H #include #else #include #endif #ifdef HAVE_SLANG_SLANG_H #include #else #include #endif #include "timidity.h" #include "common.h" #include "instrum.h" #include "playmidi.h" #include "readmidi.h" #include "output.h" #include "controls.h" #include "miditrace.h" #include "timer.h" /* * For the set_color pairs (so called 'objects') * see the ctl_open() */ #define SLsmg_normal() SLsmg_set_color(20) #define SLsmg_bold() SLsmg_set_color(21) #define SLsmg_reverse() SLsmg_set_color(22) #define SCRMODE_OUT_THRESHOLD 10.0 #define CHECK_NOTE_SLEEP_TIME 5.0 #define INDICATOR_UPDATE_TIME 0.2 static struct { int prog; int disp_cnt; double last_note_on; char *comm; } instr_comment[MAX_CHANNELS]; enum indicator_mode_t { INDICATOR_DEFAULT, INDICATOR_LYRIC }; static int indicator_width = 78; static char *comment_indicator_buffer = NULL; static char *current_indicator_message = NULL; static char *indicator_msgptr = NULL; static int current_indicator_chan = 0; static int next_indicator_chan = -1; static double indicator_last_update; static int indicator_mode = INDICATOR_DEFAULT; static void update_indicator(void); static void reset_indicator(void); static void display_lyric(char *lyric, int sep); static void display_title(char *title); static void init_lyric(char *lang); #define LYRIC_WORD_NOSEP 0 #define LYRIC_WORD_SEP ' ' static void ctl_refresh(void); static void ctl_help_mode(void); static void ctl_total_time(int tt); static void ctl_master_volume(int mv); static void ctl_file_name(char *name); static void ctl_current_time(int secs, int v); static void ctl_note(int status, int ch, int note, int vel); static void ctl_program(int ch, int val); static void ctl_volume(int channel, int val); static void ctl_expression(int channel, int val); static void ctl_panning(int channel, int val); static void ctl_sustain(int channel, int val); static void ctl_pitch_bend(int channel, int val); static void ctl_reset(void); static int ctl_open(int using_stdin, int using_stdout); static void ctl_close(void); static int ctl_read(int32 *valp); static void ctl_lyric(int valp); static int cmsg(int type, int verbosity_level, char *fmt, ...); static void ctl_event(CtlEvent *e); /**********************************************/ /* export the interface functions */ #define ctl slang_control_mode ControlMode ctl= { "slang interface", 's', 1,0,0, 0, ctl_open, ctl_close, dumb_pass_playing_list, ctl_read, cmsg, ctl_event }; /***********************************************************************/ /* foreground/background checks disabled since switching to curses */ /* static int in_foreground=1; */ static int ctl_helpmode=0; static int lyric_row = 6; static int title_row = 6; static int msg_row = 0; static void _ctl_refresh(void) { SLsmg_gotorc(0,0); SLsmg_refresh(); } static void SLsmg_printfrc( int r, int c, char *fmt, ...) { char p[1000]; va_list ap; SLsmg_gotorc( r, c); va_start(ap, fmt); vsnprintf(p, sizeof(p), fmt, ap); va_end(ap); SLsmg_write_string (p); } static void ctl_head(void) { SLsmg_printfrc(0, 0, "TiMidity++ %s%s", (strcmp(timidity_version, "current")) ? "v" : "", timidity_version); SLsmg_printfrc(0,SLtt_Screen_Cols-45, "(C) 1995 Tuukka Toivonen "); SLsmg_printfrc(1,0, "Press 'h' for help with keys, or 'q' to quit."); } static void ctl_refresh(void) { if (ctl.trace_playing) _ctl_refresh(); } static void ctl_help_mode(void) { if (ctl_helpmode) { ctl_helpmode=0; /* * Clear the head zone and reprint head message. */ SLsmg_gotorc(0,0); SLsmg_erase_eol(); SLsmg_gotorc(1,0); SLsmg_erase_eol(); ctl_head(); _ctl_refresh(); } else { ctl_helpmode=1; SLsmg_reverse(); SLsmg_gotorc(0,0); SLsmg_erase_eol(); SLsmg_write_string( "V=Louder b=Skip back " "n=Next file r=Restart file"); SLsmg_gotorc(1,0); SLsmg_erase_eol(); SLsmg_write_string( "v=Softer f=Skip forward " "p=Previous file q=Quit program"); SLsmg_normal(); _ctl_refresh(); } } static void ctl_total_time(int tt) { int mins, secs=tt/play_mode->rate; mins=secs/60; secs-=mins*60; SLsmg_gotorc(4,6+6+3); SLsmg_bold(); SLsmg_printf("%3d:%02d", mins, secs); SLsmg_normal(); _ctl_refresh(); } static void ctl_master_volume(int mv) { SLsmg_gotorc(4,SLtt_Screen_Cols-5); SLsmg_bold(); SLsmg_printf("%03d %%", mv); SLsmg_normal(); _ctl_refresh(); } static void ctl_file_name(char *name) { SLsmg_gotorc(3,6); SLsmg_erase_eol(); SLsmg_bold(); SLsmg_write_string(name); SLsmg_normal(); _ctl_refresh(); } static void ctl_current_time(int secs, int v) { int mins; static int last_voices=-1,last_secs=-1; if(1/*last_secs!=secs*/) { last_secs=secs; mins=secs/60; secs-=mins*60; SLsmg_gotorc(4,6); SLsmg_bold(); SLsmg_printf("%3d:%02d", mins, secs); _ctl_refresh(); } if(!ctl.trace_playing||midi_trace.flush_flag) { SLsmg_normal(); return; } if(last_voices!=voices) { last_voices=voices; SLsmg_gotorc(4,48); SLsmg_printf("%2d", v); SLsmg_normal(); _ctl_refresh(); } } static void ctl_note(int status, int channel, int note, int velocity) { int xl; if(channel >= 16) return; if (!ctl.trace_playing) return; xl=note%(SLtt_Screen_Cols-24); SLsmg_gotorc(8+channel,xl+3); switch(status) { case VOICE_DIE: SLsmg_write_char(','); break; case VOICE_FREE: SLsmg_write_char('.'); break; case VOICE_ON: SLsmg_bold(); SLsmg_write_char('0'+(10*velocity)/128); SLsmg_normal(); break; case VOICE_OFF: case VOICE_SUSTAINED: SLsmg_write_char('0'+(10*velocity)/128); break; } } static void ctl_program(int ch, int val) { if(ch >= 16) return; if (!ctl.trace_playing) return; if(channel[ch].special_sample) val = channel[ch].special_sample; else val += progbase; SLsmg_gotorc(8+ch, SLtt_Screen_Cols-20); if (ISDRUMCHANNEL(ch)) { SLsmg_bold(); SLsmg_printf("%03d", val); SLsmg_normal(); } else SLsmg_printf("%03d", val); } static void ctl_volume(int ch, int val) { if(ch >= 16) return; if (!ctl.trace_playing) return; SLsmg_gotorc(8+ch, SLtt_Screen_Cols-16); SLsmg_printf("%3d", (val*100)/127); } static void ctl_expression(int ch, int val) { if(ch >= 16) return; if (!ctl.trace_playing) return; SLsmg_gotorc(8+ch, SLtt_Screen_Cols-12); SLsmg_printf("%3d", (val*100)/127); } static void ctl_panning(int ch, int val) { if(ch >= 16) return; if (!ctl.trace_playing) return; SLsmg_gotorc(8+ch, SLtt_Screen_Cols-8); if (val==NO_PANNING) SLsmg_write_string(" "); else if (val<5) SLsmg_write_string(" L "); else if (val>123) SLsmg_write_string(" R "); else if (val>60 && val<68) SLsmg_write_string(" C "); else { /* wprintw(dftwin, "%+02d", (100*(val-64))/64); */ val = (100*(val-64))/64; /* piss on curses */ if (val<0) { SLsmg_write_char('-'); val=-val; } else SLsmg_write_char('+'); SLsmg_printf("%02d", val); } } static void ctl_sustain(int ch, int val) { if(ch >= 16) return; if (!ctl.trace_playing) return; SLsmg_gotorc(8+ch, SLtt_Screen_Cols-4); if (val) SLsmg_write_char('S'); else SLsmg_write_char(' '); } static void ctl_pitch_bend(int ch, int val) { if(ch >= 16) return; if (!ctl.trace_playing) return; SLsmg_gotorc(8+ch, SLtt_Screen_Cols-2); if (val==-1) SLsmg_write_char('='); else if (val>0x2000) SLsmg_write_char('+'); else if (val<0x2000) SLsmg_write_char('-'); else SLsmg_write_char(' '); } static void ctl_reset(void) { int i,j; if (!ctl.trace_playing) return; for (i=0; i<16; i++) { SLsmg_gotorc(8+i, 3); for (j=0; j 0) ctl_pitch_bend(i, -1); else ctl_pitch_bend(i, channel[i].pitchbend); } _ctl_refresh(); } /***********************************************************************/ /*ARGSUSED*/ static int ctl_open(int using_stdin, int using_stdout) { #ifdef TIOCGWINSZ struct winsize size; #endif int i; int save_lines, save_cols; SLtt_get_terminfo(); /* * Save the terminfo values for lines and cols * then detect the real values. */ save_lines = SLtt_Screen_Rows; save_cols = SLtt_Screen_Cols; #ifdef TIOCGWINSZ if (!ioctl(0, TIOCGWINSZ, &size)) { SLtt_Screen_Cols=size.ws_col; SLtt_Screen_Rows=size.ws_row; } else #endif { SLtt_Screen_Cols=atoi(getenv("COLUMNS")); SLtt_Screen_Rows=atoi(getenv("LINES")); } if (!SLtt_Screen_Cols || !SLtt_Screen_Rows) { SLtt_Screen_Rows = save_lines; SLtt_Screen_Cols = save_cols; } SLang_init_tty(7, 0, 0); SLsmg_init_smg(); SLtt_set_color (20, "Normal", "lightgray", "black"); SLtt_set_color (21, "HighLight", "white", "black"); SLtt_set_color (22, "Reverse", "black", "white"); SLtt_Use_Ansi_Colors = 1; SLtt_Term_Cannot_Scroll = 1; ctl.opened=1; SLsmg_cls(); ctl_head(); SLsmg_printfrc(3,0, "File:"); if (ctl.trace_playing) { SLsmg_printfrc(4,0, "Time:"); SLsmg_gotorc(4,6+6+1); SLsmg_write_char('/'); SLsmg_gotorc(4,40); SLsmg_printf("Voices: / %d", voices); } else { SLsmg_printfrc(4,0, "Time:"); SLsmg_printfrc(4,13, "/"); } SLsmg_printfrc(4,SLtt_Screen_Cols-20, "Master volume:"); SLsmg_gotorc(5,0); for (i=0; irate; return RC_FORWARD; case 'b': *valp=play_mode->rate; return RC_BACK; case 's': return RC_TOGGLE_PAUSE; } return RC_NONE; } /*ARGSUSED*/ static void ctl_lyric(int lyricid) { char *lyric; lyric = event2string(lyricid); if(lyric != NULL) { if(*lyric == ME_KARAOKE_LYRIC) { if(lyric[1] == '/') { display_lyric("\n", LYRIC_WORD_NOSEP); display_lyric(lyric + 2, LYRIC_WORD_NOSEP); } else if(lyric[1] == '\\') { display_lyric("\r", LYRIC_WORD_NOSEP); display_lyric(lyric + 2, LYRIC_WORD_NOSEP); } else if(lyric[1] == '@' && lyric[2] == 'T') { if(ctl.trace_playing) { display_lyric("\n", LYRIC_WORD_NOSEP); display_lyric(lyric + 3, LYRIC_WORD_SEP); } else display_title(lyric + 3); } else if(lyric[1] == '@' && lyric[2] == 'L') { init_lyric(lyric + 3); } else display_lyric(lyric + 1, LYRIC_WORD_NOSEP); } else { if(*lyric == ME_CHORUS_TEXT || *lyric == ME_INSERT_TEXT) display_lyric("\r", LYRIC_WORD_SEP); display_lyric(lyric + 1, LYRIC_WORD_SEP); } } } static int cmsg(int type, int verbosity_level, char *fmt, ...) { va_list ap; char p[1000]; if ((type==CMSG_TEXT || type==CMSG_INFO || type==CMSG_WARNING) && ctl.verbosity t) return; save_chan = next_indicator_chan; reset_indicator(); next_indicator_chan = save_chan; } else { if(indicator_last_update + INDICATOR_UPDATE_TIME > t) return; } indicator_last_update = t; if(indicator_msgptr != NULL && *indicator_msgptr == '\0') indicator_msgptr = NULL; if(indicator_msgptr == NULL) { if(next_indicator_chan >= 0 && instr_comment[next_indicator_chan].comm != NULL && *instr_comment[next_indicator_chan].comm) { current_indicator_chan = next_indicator_chan; } else { int prog; prog = instr_comment[current_indicator_chan].prog; for(i = 0; i < MAX_CHANNELS; i++) { current_indicator_chan++; if(current_indicator_chan == MAX_CHANNELS) current_indicator_chan = 0; if(instr_comment[current_indicator_chan].comm != NULL && *instr_comment[current_indicator_chan].comm && instr_comment[current_indicator_chan].prog != prog && (instr_comment[current_indicator_chan].last_note_on + CHECK_NOTE_SLEEP_TIME > t || instr_comment[current_indicator_chan].disp_cnt == 0)) break; } if(i == MAX_CHANNELS) return; } next_indicator_chan = -1; if(instr_comment[current_indicator_chan].comm == NULL || *instr_comment[current_indicator_chan].comm == '\0') return; snprintf(current_indicator_message, indicator_width, "%03d:%s ", instr_comment[current_indicator_chan].prog, instr_comment[current_indicator_chan].comm); instr_comment[current_indicator_chan].disp_cnt++; indicator_msgptr = current_indicator_message; } c = *indicator_msgptr++; for(i = 0; i < indicator_width - 2; i++) comment_indicator_buffer[i] = comment_indicator_buffer[i + 1]; comment_indicator_buffer[indicator_width - 2] = c; SLsmg_printfrc(2,0,comment_indicator_buffer); ctl_refresh(); } static void display_lyric(char *lyric, int sep) { char *p; int len, idlen, sepoffset; static int crflag = 0; if(lyric == NULL) { indicator_last_update = get_current_calender_time(); crflag = 0; return; } if(indicator_mode != INDICATOR_LYRIC || crflag) { memset(comment_indicator_buffer, 0, indicator_width); SLsmg_gotorc(lyric_row,0); SLsmg_erase_eol(); ctl_refresh(); indicator_mode = INDICATOR_LYRIC; crflag = 0; } if(*lyric == '\0') { indicator_last_update = get_current_calender_time(); return; } else if(*lyric == '\n') { if(!ctl.trace_playing) { crflag = 1; lyric_row++; SLsmg_gotorc(0,lyric_row); return; } else lyric = " / "; } if(strchr(lyric, '\r') != NULL) { crflag = 1; if(!ctl.trace_playing) { int i; for(i = title_row+1; i <= lyric_row; i++) { SLsmg_gotorc(i,0); SLsmg_erase_eol(); } lyric_row = title_row+1; } if(lyric[0] == '\r' && lyric[1] == '\0') { indicator_last_update = get_current_calender_time(); return; } } idlen = strlen(comment_indicator_buffer); len = strlen(lyric); if(sep) { while(idlen > 0 && comment_indicator_buffer[idlen - 1] == ' ') comment_indicator_buffer[--idlen] = '\0'; while(len > 0 && lyric[len - 1] == ' ') len--; } if(len == 0) { /* update time stamp */ indicator_last_update = get_current_calender_time(); reuse_mblock(&tmpbuffer); return; } sepoffset = (sep != 0); if(len >= indicator_width - 2) { memcpy(comment_indicator_buffer, lyric, indicator_width - 1); comment_indicator_buffer[indicator_width - 1] = '\0'; } else if(idlen == 0) { memcpy(comment_indicator_buffer, lyric, len); comment_indicator_buffer[len] = '\0'; } else if(len + idlen + 2 < indicator_width) { if(sep) comment_indicator_buffer[idlen] = sep; memcpy(comment_indicator_buffer + idlen + sepoffset, lyric, len); comment_indicator_buffer[idlen + sepoffset + len] = '\0'; } else { int spaces; p = comment_indicator_buffer; spaces = indicator_width - idlen - 2; while(spaces < len) { char *q; /* skip one word */ if((q = strchr(p, ' ')) == NULL) { p = NULL; break; } do q++; while(*q == ' '); spaces += (q - p); p = q; } if(p == NULL) { SLsmg_gotorc(lyric_row,0); SLsmg_erase_eol(); memcpy(comment_indicator_buffer, lyric, len); comment_indicator_buffer[len] = '\0'; } else { int d, l, r, i, j; d = (p - comment_indicator_buffer); l = strlen(p); r = len - (indicator_width - 2 - l - d); j = d - r; for(i = 0; i < j; i++) comment_indicator_buffer[i] = ' '; for(i = 0; i < l; i++) comment_indicator_buffer[j + i] = comment_indicator_buffer[d + i]; if(sep) comment_indicator_buffer[j + i] = sep; memcpy(comment_indicator_buffer + j + i + sepoffset, lyric, len); comment_indicator_buffer[j + i + sepoffset + len] = '\0'; } } SLsmg_printfrc(lyric_row,0,"%s",comment_indicator_buffer); ctl_refresh(); reuse_mblock(&tmpbuffer); indicator_last_update = get_current_calender_time(); } static void display_title(char *title) { SLsmg_printfrc(title_row,0,"Title:"); SLsmg_bold(); SLsmg_printfrc(title_row++,7,"%s", title); SLsmg_normal(); lyric_row = title_row + 1; } static void init_lyric(char *lang) { int i; if(ctl.trace_playing) return; for(i=6;i<=SLtt_Screen_Rows;i++){ SLsmg_gotorc(i,0); SLsmg_erase_eol(); } } static void ctl_event(CtlEvent *e) { switch(e->type) { case CTLE_NOW_LOADING: ctl_file_name((char *)e->v1); break; case CTLE_LOADING_DONE: break; case CTLE_PLAY_START: ctl_total_time((int)e->v1); break; case CTLE_PLAY_END: break; case CTLE_TEMPO: break; case CTLE_METRONOME: /* update_indicator(); */ break; case CTLE_CURRENT_TIME: ctl_current_time((int)e->v1, (int)e->v2); break; case CTLE_NOTE: ctl_note((int)e->v1, (int)e->v2, (int)e->v3, (int)e->v4); break; case CTLE_MASTER_VOLUME: ctl_master_volume((int)e->v1); break; case CTLE_PROGRAM: ctl_program((int)e->v1, (int)e->v2); break; case CTLE_VOLUME: ctl_volume((int)e->v1, (int)e->v2); break; case CTLE_EXPRESSION: ctl_expression((int)e->v1, (int)e->v2); break; case CTLE_PANNING: ctl_panning((int)e->v1, (int)e->v2); break; case CTLE_SUSTAIN: ctl_sustain((int)e->v1, (int)e->v2); break; case CTLE_PITCH_BEND: ctl_pitch_bend((int)e->v1, (int)e->v2); break; case CTLE_MOD_WHEEL: ctl_pitch_bend((int)e->v1, e->v2 ? -1 : 0x2000); break; case CTLE_CHORUS_EFFECT: break; case CTLE_REVERB_EFFECT: break; case CTLE_LYRIC: ctl_lyric((int)e->v1); break; case CTLE_REFRESH: ctl_refresh(); break; case CTLE_RESET: ctl_reset(); break; } } /* * interface__loader(); */ ControlMode *interface_s_loader(void) { return &ctl; } TiMidity++-2.13.2/interface/motif.h0100644004711200001440000000461507421005040016122 0ustar tamukiusers/* TiMidity++ -- MIDI to WAVE converter and player Copyright (C) 1999-2002 Masanao Izumo Copyright (C) 1995 Tuukka Toivonen 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA motif.h: written by Vincent Pagel (pagel@loria.fr) 10/4/95 */ #ifndef ___MOTIF_H_ #define ___MOTIF_H_ /* * MESSAGE FROM KERNEL TO MOTIF */ #define ERROR_MESSAGE -1 #define REFRESH_MESSAGE 1 #define HELPMODE_MESSAGE 2 #define TOTALTIME_MESSAGE 3 #define MASTERVOL_MESSAGE 4 #define FILENAME_MESSAGE 5 #define CURTIME_MESSAGE 6 #define NOTE_MESSAGE 7 #define PROGRAM_MESSAGE 8 #define VOLUME_MESSAGE 9 #define EXPRESSION_MESSAGE 10 #define PANNING_MESSAGE 11 #define SUSTAIN_MESSAGE 12 #define PITCH_MESSAGE 13 #define RESET_MESSAGE 14 #define CLOSE_MESSAGE 15 #define CMSG_MESSAGE 16 #define FILE_LIST_MESSAGE 17 #define NEXT_FILE_MESSAGE 18 #define PREV_FILE_MESSAGE 19 #define TUNE_END_MESSAGE 20 #define LYRIC_MESSAGE 21 /* * MESSAGE ON THE PIPE FROM MOTIF TOWARD KERNEL */ #define MOTIF_CHANGE_VOLUME 1 #define MOTIF_CHANGE_LOCATOR 2 #define MOTIF_QUIT 3 #define MOTIF_PLAY_FILE 4 #define MOTIF_NEXT 5 #define MOTIF_PREV 6 #define MOTIF_RESTART 7 #define MOTIF_FWD 8 #define MOTIF_RWD 9 #define MOTIF_PAUSE 10 #define MOTIF_EXPAND 11 /* * CONSTANTS FOR MOTIF MENUS */ #define MENU_OPEN 1 #define MENU_QUIT 2 #define MENU_TOGGLE 3 #define DIALOG_CANCEL 1 #define DIALOG_OK 2 #define DIALOG_ALL 3 /* * Pipe function interfaces */ extern void m_pipe_int_write(int c); extern void m_pipe_int_read(int *c); extern void m_pipe_string_write(char *str); extern void m_pipe_string_read(char *str); extern void m_pipe_open(void); extern int m_pipe_read_ready(void); void Launch_Motif_Process(int pipe_number); #endif /* ___MOTIF_H_ */ TiMidity++-2.13.2/interface/motif_c.c0100644004711200001440000002237207421005040016417 0ustar tamukiusers/* TiMidity++ -- MIDI to WAVE converter and player Copyright (C) 1999-2002 Masanao Izumo Copyright (C) 1995 Tuukka Toivonen 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA motif_ctl.c: written by Vincent Pagel (pagel@loria.fr) 10/4/95 A motif interface for TIMIDITY : to prevent X redrawings from interfering with the audio computation, I don't use the XtAppAddWorkProc I create a pipe between the timidity process and a Motif interface process forked from the 1st one */ #ifdef HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ #include #include #include #include #ifndef NO_STRING_H #include #else #include #endif #include "timidity.h" #include "common.h" #include "instrum.h" #include "playmidi.h" #include "readmidi.h" #include "output.h" #include "controls.h" #include "motif.h" #include "miditrace.h" static void ctl_refresh(void); static void ctl_total_time(int tt); static void ctl_master_volume(int mv); static void ctl_file_name(char *name); static void ctl_current_time(int secs, int v); static void ctl_lyric(int lyricid); static int ctl_open(int using_stdin, int using_stdout); static void ctl_close(void); static int ctl_read(int32 *valp); static int cmsg(int type, int verbosity_level, char *fmt, ...); static void ctl_pass_playing_list(int number_of_files, char *list_of_files[]); static void ctl_event(CtlEvent *e); static int motif_ready = 0; /**********************************************/ /* export the interface functions */ #define ctl motif_control_mode ControlMode ctl= { "motif interface", 'm', 1,0,0, 0, ctl_open, ctl_close, ctl_pass_playing_list, ctl_read, cmsg, ctl_event }; /***********************************************************************/ /* Put controls on the pipe */ /***********************************************************************/ static int cmsg(int type, int verbosity_level, char *fmt, ...) { char local[255]; va_list ap; if ((type==CMSG_TEXT || type==CMSG_INFO || type==CMSG_WARNING) && ctl.verbosityrate; m_pipe_int_write(TOTALTIME_MESSAGE); m_pipe_int_write(secs); } static void ctl_master_volume(int mv) { m_pipe_int_write(MASTERVOL_MESSAGE); m_pipe_int_write(mv); } static void ctl_file_name(char *name) { m_pipe_int_write(FILENAME_MESSAGE); m_pipe_string_write(name); } static void ctl_current_time(int secs, int v) { m_pipe_int_write(CURTIME_MESSAGE); m_pipe_int_write(secs); m_pipe_int_write(v); } static void ctl_lyric(int lyricid) { char *lyric; static char lyric_buf[300]; lyric = event2string(lyricid); if(lyric != NULL) { if(lyric[0] == ME_KARAOKE_LYRIC) { if(!lyric[1]) return; if(lyric[1] == '/' || lyric[1] == '\\') { snprintf(lyric_buf, sizeof(lyric_buf), "\n%s", lyric + 2); m_pipe_int_write(LYRIC_MESSAGE); m_pipe_string_write(lyric_buf); } else if(lyric[1] == '@') { if(lyric[2] == 'L') snprintf(lyric_buf, sizeof(lyric_buf), "Language: %s\n", lyric + 3); else if(lyric[2] == 'T') snprintf(lyric_buf, sizeof(lyric_buf), "Title: %s\n", lyric + 3); else snprintf(lyric_buf, sizeof(lyric_buf), "%s\n", lyric + 1); m_pipe_int_write(LYRIC_MESSAGE); m_pipe_string_write(lyric_buf); } else { strncpy(lyric_buf, lyric + 1, sizeof(lyric_buf) - 1); m_pipe_int_write(LYRIC_MESSAGE); m_pipe_string_write(lyric_buf); } } else { strncpy(lyric_buf, lyric + 1, sizeof(lyric_buf) - 1); m_pipe_int_write(LYRIC_MESSAGE); m_pipe_string_write(lyric_buf); } } } static void ctl_event(CtlEvent *e) { switch(e->type) { case CTLE_NOW_LOADING: ctl_file_name((char *)e->v1); break; case CTLE_PLAY_START: ctl_total_time((int)e->v1); break; case CTLE_CURRENT_TIME: ctl_current_time((int)e->v1, (int)e->v2); break; case CTLE_MASTER_VOLUME: ctl_master_volume((int)e->v1); break; case CTLE_LYRIC: ctl_lyric((int)e->v1); break; case CTLE_REFRESH: ctl_refresh(); break; } } /***********************************************************************/ /* OPEN THE CONNECTION */ /***********************************************************************/ /*ARGSUSED*/ static int ctl_open(int using_stdin, int using_stdout) { ctl.opened=1; #if 0 ctl.trace_playing=1; /* Default mode with Motif interface */ #endif /* The child process won't come back from this call */ m_pipe_open(); return 0; } /* Tells the window to disapear */ static void ctl_close(void) { if (ctl.opened) { m_pipe_int_write(CLOSE_MESSAGE); ctl.opened=0; motif_ready = 0; } } /* * Read information coming from the window in a BLOCKING way */ static int ctl_blocking_read(int32 *valp) { int command; int new_volume; int new_secs; int i=0, nfiles; char buf[256][256]; char **ret, *files[256]; m_pipe_int_read(&command); for(;;) /* Loop after pause sleeping to treat other buttons! */ { switch(command) { case MOTIF_CHANGE_VOLUME: m_pipe_int_read(&new_volume); *valp= new_volume - amplification ; return RC_CHANGE_VOLUME; case MOTIF_CHANGE_LOCATOR: m_pipe_int_read(&new_secs); *valp= new_secs * play_mode->rate; return RC_JUMP; case MOTIF_QUIT: return RC_QUIT; case MOTIF_PLAY_FILE: return RC_LOAD_FILE; case MOTIF_NEXT: return RC_NEXT; case MOTIF_PREV: return RC_REALLY_PREVIOUS; case MOTIF_RESTART: return RC_RESTART; case MOTIF_FWD: *valp=play_mode->rate; return RC_FORWARD; case MOTIF_RWD: *valp=play_mode->rate; return RC_BACK; case MOTIF_EXPAND: m_pipe_int_read(&nfiles); for (i=0;i begin to play automatically */ m_pipe_int_write(NEXT_FILE_MESSAGE); command = ctl_blocking_read(&val); /* Main Loop */ for (;;) { if (command==RC_LOAD_FILE) { /* Read a LoadFile command */ m_pipe_string_read(file_to_play); command=play_midi_file(file_to_play); } else { if (command==RC_QUIT) return; switch(command) { case RC_ERROR: m_pipe_int_write(ERROR_MESSAGE); break; case RC_NONE: break; case RC_NEXT: m_pipe_int_write(NEXT_FILE_MESSAGE); break; case RC_REALLY_PREVIOUS: m_pipe_int_write(PREV_FILE_MESSAGE); break; case RC_TUNE_END: m_pipe_int_write(TUNE_END_MESSAGE); break; case RC_CHANGE_VOLUME: amplification += val; break; default: fprintf(stderr, "PANIC !!! OTHER COMMAND ERROR ?!?! %i" NLS, command); } command = ctl_blocking_read(&val); } } } /* * interface__loader(); */ ControlMode *interface_m_loader(void) { return &ctl; } TiMidity++-2.13.2/interface/motif_i.c0100644004711200001440000011267307421005040016431 0ustar tamukiusers/* TiMidity++ -- MIDI to WAVE converter and player Copyright (C) 1999-2002 Masanao Izumo Copyright (C) 1995 Tuukka Toivonen 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA motif_interface.c: written by Vincent Pagel (pagel@loria.fr) 10/4/95 Policy : I choose to make a separate process for a TIMIDITY motif interface for TIMIDITY (if the interface was in the same process X redrawings would interfere with the audio computation. Besides XtAppAddWorkProc mechanism is not easily controlable) The solution : I create a pipe between Timidity and the forked interface and use XtAppAddInput to watch the data arriving on the pipe. 10/4/95 - Initial working version with prev, next, and quit button and a text display 17/5/95 - Add timidity icon with filename displaying to play midi while I work without having that big blue window in the corner of my screen :) - Solve the problem of concurent scale value modification 21/5/95 - Add menus, file selection box 14/6/95 - Make the visible part of file list follow the selection */ #ifdef HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "timidity.h" #include "common.h" #include "instrum.h" #include "playmidi.h" #include "output.h" #include "controls.h" #include "motif.h" static XtAppContext context; static XmStringCharSet char_set=XmSTRING_DEFAULT_CHARSET; static Widget toplevel; static Widget text; static XmTextPosition wpr_position=0; static Widget mainForm; static Widget menu_bar, open_option, quit_option, auto_next_option; static Widget open_dialog , add_all_button; static Widget btnForm, backBtn,fwdBtn, restartBtn, pauseBtn, quitBtn, nextBtn, prevBtn; static Pixmap backPixmap, fwdPixmap, pausePixmap , restartPixmap, prevPixmap, nextPixmap, quitPixmap, timidityPixmap; static Widget countFrame, countForm, counterlbl, totlbl , count_headlbl; static int last_sec=0; static int max_sec=0; static Widget file_namelbl, file_headlbl; static Widget volume_scale , locator_scale ; static Boolean locator_scale_button= ButtonRelease; static Widget file_list; static int file_number_to_play; /* Number of the file we're playing in the list */ /* * CREATE PIXMAPS FOR THE BUTONS */ static void CreatePixmaps(Widget parent) { /* * * BITMAPS */ #include "motif_bitmaps/back.xbm" #include "motif_bitmaps/next.xbm" #include "motif_bitmaps/prev.xbm" #include "motif_bitmaps/restart.xbm" #include "motif_bitmaps/fwd.xbm" #include "motif_bitmaps/pause.xbm" #include "motif_bitmaps/quit.xbm" #include "motif_bitmaps/timidity.xbm" Display *disp; Drawable d; Pixel fg,bg; int ac; Arg al[20]; unsigned int depth=DefaultDepthOfScreen(XtScreen(toplevel)); ac = 0; XtSetArg(al[ac], XmNbackground, &bg); ac++; XtSetArg(al[ac], XmNforeground, &fg); ac++; XtGetValues(parent, al, ac); disp=XtDisplay(toplevel); d=RootWindowOfScreen(XtScreen(toplevel)); backPixmap = XCreatePixmapFromBitmapData(disp, d, back_bits, back_width, back_height, fg, bg,depth); fwdPixmap = XCreatePixmapFromBitmapData( disp, d, fwd_bits, fwd_width, fwd_height, fg, bg,depth); pausePixmap = XCreatePixmapFromBitmapData(disp, d, pause_bits, pause_width, pause_height, fg, bg,depth); restartPixmap = XCreatePixmapFromBitmapData(disp, d, restart_bits, restart_width, restart_height, fg, bg,depth); nextPixmap = XCreatePixmapFromBitmapData(disp, d, next_bits, next_width, next_height, fg, bg,depth); prevPixmap = XCreatePixmapFromBitmapData(disp, d, prev_bits, prev_width, prev_height, fg, bg,depth); quitPixmap = XCreatePixmapFromBitmapData(disp, d, quit_bits, quit_width, quit_height, fg, bg,depth); timidityPixmap = XCreatePixmapFromBitmapData(disp, d, timidity_bits, timidity_width, timidity_height, WhitePixelOfScreen(XtScreen(toplevel)), BlackPixelOfScreen(XtScreen(toplevel)),depth); } /************************************ * * * ALL THE INTERFACE'S CALLBACKS * * * ************************************/ /* * Generic buttons callbacks ( Transport Buttons ) */ /*ARGSUSED*/ static void GenericCB(Widget widget, int data, XtPointer call_data) { if(data != MOTIF_QUIT && data != MOTIF_NEXT && data != MOTIF_PREV) { Arg al[10]; int ac, nbfile; ac=0; XtSetArg(al[ac], XmNitemCount, &nbfile); ac++; XtGetValues(file_list, al, ac); if(file_number_to_play==0||file_number_to_play>nbfile) return; } m_pipe_int_write( data ); } /* * Generic scales callbacks : VOLUME and LOCATOR */ /*ARGSUSED*/ static void Generic_scaleCB(Widget widget, int data, XtPointer call_data) { XmScaleCallbackStruct *cbs = (XmScaleCallbackStruct *) call_data; if(data == MOTIF_CHANGE_LOCATOR) { Arg al[10]; int ac, nbfile; ac=0; XtSetArg(al[ac], XmNitemCount, &nbfile); ac++; XtGetValues(file_list, al, ac); if(file_number_to_play<=0||file_number_to_play>nbfile) { XmScaleSetValue(locator_scale,0); return; } } m_pipe_int_write( data ); m_pipe_int_write(cbs->value); } /* * Detect when a mouse button is pushed or released in a scale area to * avoid concurent scale value modification while holding it with the mouse */ /*ARGSUSED*/ static void Locator_btn(Widget w,XtPointer client_data,XEvent *event,Boolean *cont) { /* Type = ButtonPress or ButtonRelease */ locator_scale_button= event->xbutton.type; } /* * File List selection CALLBACK */ /*ARGSUSED*/ static void File_ListCB(Widget widget, int data, XtPointer call_data) { XmListCallbackStruct *cbs= (XmListCallbackStruct *) call_data; char *text; int nbvisible, first_visible ; Arg al[10]; int ac; /* First, check that the selected file is really visible in the list */ ac=0; XtSetArg(al[ac],XmNtopItemPosition,&first_visible); ac++; XtSetArg(al[ac],XmNvisibleItemCount,&nbvisible); ac++; XtGetValues(widget, al, ac); if ( ( first_visible > cbs->item_position) || ((first_visible+nbvisible) <= cbs->item_position)) XmListSetPos(widget, cbs->item_position); /* Tell the application to play the requested file */ XmStringGetLtoR(cbs->item,char_set,&text); m_pipe_int_write(MOTIF_PLAY_FILE); m_pipe_string_write(text); file_number_to_play=cbs->item_position; XtFree(text); } /* * Generic menu callback */ /*ARGSUSED*/ static void menuCB(Widget w,int client_data,XmAnyCallbackStruct *call_data) { switch (client_data) { case MENU_OPEN: { XtManageChild(open_dialog); } break; case MENU_QUIT : { m_pipe_int_write(MOTIF_QUIT); } break; case MENU_TOGGLE : { /* Toggle modified : for the moment , nothing to do ! */ /* if (XmToggleButtonGetState(w)) TRUE else FALSE */ } break; } } /* * File selection box callback */ /*ARGSUSED*/ static void openCB(Widget w,int client_data,XmFileSelectionBoxCallbackStruct *call_data) { if (client_data==DIALOG_CANCEL) { /* do nothing if cancel is selected. */ XtUnmanageChild(open_dialog); return; } else if (client_data==DIALOG_ALL) { /* Add all the listed files */ Arg al[10]; int ac; Widget the_list; int nbfile; XmStringTable files; char *text; int i; the_list=XmFileSelectionBoxGetChild(open_dialog,XmDIALOG_LIST); if (!XmIsList(the_list)) { fprintf(stderr, "PANIC: List are not what they used to be" NLS); exit(1); } ac=0; XtSetArg(al[ac], XmNitemCount, &nbfile); ac++; XtSetArg(al[ac], XmNitems, &files); ac++; XtGetValues(the_list, al, ac); m_pipe_int_write(MOTIF_EXPAND); m_pipe_int_write(nbfile); for (i=0;ivalue,char_set,&text); m_pipe_string_write(text); XtFree(text); XtUnmanageChild(open_dialog); } } /******************************************************** * * * Receive DATA sent by the application on the pipe * * * ********************************************************/ /*ARGSUSED*/ static void handle_input(client_data, source, id) XtPointer client_data; int *source; XtInputId *id; { int message; m_pipe_int_read(&message); switch (message) { case REFRESH_MESSAGE : { fprintf(stderr, "REFRESH MESSAGE IS OBSOLETE !!!" NLS); } break; case TOTALTIME_MESSAGE : { int tseconds; int minutes,seconds; char local_string[20]; Arg al[10]; int ac; m_pipe_int_read(&tseconds); seconds=tseconds; minutes=seconds/60; seconds-=minutes*60; sprintf(local_string,"/ %02d:%02d",minutes,seconds); ac=0; XtSetArg(al[ac], XmNlabelString, XmStringCreate(local_string, char_set)); ac++; XtSetValues(totlbl, al, ac); /* Readjust the time scale */ XmScaleSetValue(locator_scale,0); ac=0; XtSetArg(al[ac], XmNmaximum, tseconds); ac++; XtSetValues(locator_scale, al, ac); max_sec=tseconds; } break; case MASTERVOL_MESSAGE: { int volume; m_pipe_int_read(&volume); XmScaleSetValue(volume_scale,volume); } break; case FILENAME_MESSAGE : { char filename[255], separator[255]; Arg al[10]; char *pc; int ac, i; short nbcol; m_pipe_string_read(filename); /* Extract basename of the file */ pc=strrchr(filename,'/'); if (pc==NULL) pc=filename; else pc++; ac=0; XtSetArg(al[ac], XmNlabelString, XmStringCreate(pc, char_set)); ac++; XtSetValues(file_namelbl, al, ac); /* Change the icon */ ac=0; XtSetArg(al[ac], XmNiconName,pc); ac++; XtSetValues(toplevel,al,ac); /* Put a separator in the text Window */ ac=0; nbcol=10; XtSetArg(al[ac], XmNcolumns,&nbcol); ac++; XtGetValues(text,al,ac); for (i=0;inbfile) { file_number_to_play=nbfile+1; XmScaleSetValue(locator_scale,0); return; } XmListSelectPos(file_list,file_number_to_play,TRUE); } break; case CURTIME_MESSAGE : { int tseconds; int sec,seconds, minutes; int nbvoice; char local_string[20]; Arg al[10]; int ac; m_pipe_int_read(&tseconds); m_pipe_int_read(&nbvoice); sec=seconds=tseconds; /* To avoid blinking */ if (sec!=last_sec) { minutes=seconds/60; seconds-=minutes*60; sprintf(local_string,"%02d:%02d", minutes, seconds); ac=0; XtSetArg(al[ac], XmNlabelString, XmStringCreate(local_string, char_set)); ac++; XtSetValues(counterlbl, al, ac); } last_sec=sec; /* Readjust the time scale if not dragging the scale */ if ( (locator_scale_button==ButtonRelease) && (tsecondso:"); quit_option = make_menu_option("Exit", 'E', MENU_QUIT, menu); add_accelerator(quit_option, "meta+q", "Metaq:"); menu=make_menu("Options",'O',menu_bar); auto_next_option= make_menu_toggle("Auto Next", MENU_TOGGLE, menu); XmToggleButtonSetState( auto_next_option , True , False ); } static void create_dialog_boxes(void) { Arg al[10]; int ac; XmString add_all = XmStringCreateLocalized("ADD ALL"); /* create the file selection box used by MENU_OPEN */ ac=0; XtSetArg(al[ac],XmNmustMatch,True); ac++; XtSetArg(al[ac],XmNautoUnmanage,False); ac++; XtSetArg(al[ac],XmNdialogTitle, XmStringCreateLtoR("TIMIDITY: Open",char_set)); ac++; open_dialog=XmCreateFileSelectionDialog(toplevel,"open_dialog",al,ac); XtAddCallback(open_dialog, XmNokCallback, (XtCallbackProc) openCB, (XtPointer) DIALOG_OK); XtAddCallback(open_dialog, XmNcancelCallback, (XtCallbackProc) openCB, (XtPointer) DIALOG_CANCEL); XtUnmanageChild(XmFileSelectionBoxGetChild(open_dialog, XmDIALOG_HELP_BUTTON)); ac = 0; XtSetArg(al[ac], XmNleftOffset, 10); ac++; XtSetArg(al[ac], XmNrightOffset, 10); ac++; XtSetArg(al[ac], XmNtopOffset, 10); ac++; XtSetArg(al[ac], XmNbottomOffset, 10); ac++; XtSetArg(al[ac], XmNlabelString, add_all); ac++; add_all_button = XmCreatePushButton(open_dialog, "add_all",al, ac); XtManageChild(add_all_button); XtAddCallback(add_all_button, XmNactivateCallback, (XtCallbackProc) openCB, (XtPointer) DIALOG_ALL); } void Launch_Motif_Process(int pipe_number) { Arg al[20]; int ac; int argc=0; XtSetLanguageProc(NULL,NULL,NULL); /* By KINOSHITA, K. */ /* create the toplevel shell */ toplevel = XtAppInitialize(&context,"timidity",NULL,0,&argc,NULL, NULL,NULL,0); /*******************/ /* Main form */ /*******************/ ac=0; XtSetArg(al[ac],XmNtopAttachment,XmATTACH_FORM); ac++; XtSetArg(al[ac],XmNbottomAttachment,XmATTACH_FORM); ac++; XtSetArg(al[ac],XmNrightAttachment,XmATTACH_FORM); ac++; XtSetArg(al[ac],XmNleftAttachment,XmATTACH_FORM); ac++; mainForm=XmCreateForm(toplevel,"form",al,ac); XtManageChild(mainForm); CreatePixmaps(mainForm); /* create a menu bar and attach it to the form. */ ac=0; XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++; menu_bar=XmCreateMenuBar(mainForm,"menu_bar",al,ac); XtManageChild(menu_bar); create_dialog_boxes(); create_menus(menu_bar); /*******************/ /* Message window */ /*******************/ ac=0; XtSetArg(al[ac], XmNleftOffset, 10); ac++; XtSetArg(al[ac], XmNrightOffset, 10); ac++; XtSetArg(al[ac], XmNtopOffset, 10); ac++; XtSetArg(al[ac], XmNbottomOffset, 10); ac++; XtSetArg(al[ac],XmNtopAttachment,XmATTACH_WIDGET); ac++; XtSetArg(al[ac],XmNtopWidget, menu_bar); ac++; XtSetArg(al[ac],XmNrightAttachment,XmATTACH_FORM); ac++; XtSetArg(al[ac],XmNleftAttachment,XmATTACH_FORM); ac++; XtSetArg(al[ac],XmNeditMode,XmMULTI_LINE_EDIT); ac++; XtSetArg(al[ac],XmNrows,10); ac++; XtSetArg(al[ac],XmNcolumns,10); ac++; XtSetArg(al[ac],XmNeditable, False); ac++; XtSetArg(al[ac],XmNwordWrap, True); ac++; XtSetArg(al[ac],XmNvalue, "TIMIDIY RUNNING...\n"); ac++; wpr_position+= strlen("TIMIDIY RUNNING...\n"); text=XmCreateScrolledText(mainForm,"text",al,ac); XtManageChild(text); /********************/ /* File_name label */ /********************/ ac = 0; XtSetArg(al[ac], XmNleftOffset, 20); ac++; XtSetArg(al[ac], XmNrightOffset, 10); ac++; XtSetArg(al[ac], XmNtopOffset, 20); ac++; XtSetArg(al[ac], XmNbottomOffset, 20); ac++; XtSetArg(al[ac], XmNlabelType, XmSTRING); ac++; XtSetArg(al[ac], XmNtopAttachment, XmATTACH_WIDGET); ac++; XtSetArg(al[ac], XmNtopWidget, text); ac++; XtSetArg(al[ac], XmNleftAttachment,XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNtraversalOn, False); ac++; XtSetArg(al[ac], XmNhighlightThickness,0); ac++; XtSetArg(al[ac], XmNalignment,XmALIGNMENT_END); ac++; XtSetArg(al[ac], XmNlabelString, XmStringCreate("Playing:",char_set)); ac++; file_headlbl = XmCreateLabel(mainForm,"fileheadlbl",al,ac); XtManageChild(file_headlbl); ac = 0; XtSetArg(al[ac], XmNrightOffset, 10); ac++; XtSetArg(al[ac], XmNtopOffset, 20); ac++; XtSetArg(al[ac], XmNbottomOffset, 20); ac++; XtSetArg(al[ac], XmNlabelType, XmSTRING); ac++; XtSetArg(al[ac], XmNtopAttachment, XmATTACH_WIDGET); ac++; XtSetArg(al[ac], XmNtopWidget, text); ac++; XtSetArg(al[ac], XmNleftAttachment,XmATTACH_WIDGET); ac++; XtSetArg(al[ac], XmNleftWidget,file_headlbl); ac++; XtSetArg(al[ac], XmNtraversalOn, False); ac++; XtSetArg(al[ac], XmNhighlightThickness,0); ac++; XtSetArg(al[ac], XmNalignment,XmALIGNMENT_BEGINNING); ac++; XtSetArg(al[ac], XmNlabelString, XmStringCreate("NONE ",char_set)); ac++; file_namelbl = XmCreateLabel(mainForm,"filenameLbl",al,ac); XtManageChild(file_namelbl); /*****************************/ /* TIME LABELS IN A FORM */ /*****************************/ /* Counters frame */ ac=0; XtSetArg(al[ac], XmNtopOffset, 10); ac++; XtSetArg(al[ac], XmNbottomOffset, 10); ac++; XtSetArg(al[ac], XmNleftOffset, 10); ac++; XtSetArg(al[ac], XmNrightOffset, 10); ac++; XtSetArg(al[ac],XmNtopAttachment,XmATTACH_WIDGET); ac++; XtSetArg(al[ac],XmNtopWidget,text); ac++; XtSetArg(al[ac],XmNrightAttachment,XmATTACH_FORM); ac++; /* XtSetArg(al[ac],XmNleftAttachment,XmATTACH_WIDGET); ac++; XtSetArg(al[ac],XmNleftWidget,file_namelbl); ac++; */ XtSetArg(al[ac],XmNshadowType,XmSHADOW_OUT); ac++; countFrame=XmCreateFrame(mainForm,"countframe",al,ac); XtManageChild(countFrame); /* Counters form */ ac=0; XtSetArg(al[ac],XmNtopAttachment,XmATTACH_FORM); ac++; XtSetArg(al[ac],XmNbottomAttachment,XmATTACH_FORM); ac++; XtSetArg(al[ac],XmNrightAttachment,XmATTACH_FORM); ac++; XtSetArg(al[ac],XmNleftAttachment,XmATTACH_FORM); ac++; XtSetArg(al[ac],XmNleftAttachment,XmATTACH_FORM); ac++; countForm=XmCreateForm(countFrame,"countform",al,ac); XtManageChild(countForm); /* HEADER label */ ac = 0; XtSetArg(al[ac], XmNtopOffset, 10); ac++; XtSetArg(al[ac], XmNlabelType, XmSTRING); ac++; XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNleftAttachment,XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNrightAttachment,XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNtraversalOn, False); ac++; XtSetArg(al[ac], XmNhighlightThickness,0); ac++; XtSetArg(al[ac], XmNlabelString, XmStringCreate("Time:",char_set)); ac++; count_headlbl = XmCreateLabel(countForm,"countheadLbl",al,ac); XtManageChild(count_headlbl); /* current Time label */ ac = 0; XtSetArg(al[ac], XmNtopAttachment, XmATTACH_WIDGET); ac++; XtSetArg(al[ac], XmNtopWidget, count_headlbl); ac++; XtSetArg(al[ac], XmNleftAttachment,XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNbottomAttachment,XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNtraversalOn, False); ac++; XtSetArg(al[ac], XmNhighlightThickness,0); ac++; XtSetArg(al[ac], XmNalignment,XmALIGNMENT_END); ac++; XtSetArg(al[ac], XmNlabelString, XmStringCreate("00:00",char_set)); ac++; counterlbl = XmCreateLabel(countForm,"counterLbl",al,ac); XtManageChild(counterlbl); /* Total time label */ ac = 0; XtSetArg(al[ac], XmNtopAttachment, XmATTACH_WIDGET); ac++; XtSetArg(al[ac], XmNtopWidget, count_headlbl); ac++; XtSetArg(al[ac], XmNleftAttachment, XmATTACH_WIDGET); ac++; XtSetArg(al[ac], XmNleftWidget, counterlbl); ac++; XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNbottomAttachment,XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNtraversalOn, False); ac++; XtSetArg(al[ac], XmNhighlightThickness,0); ac++; XtSetArg(al[ac], XmNalignment,XmALIGNMENT_BEGINNING); ac++; XtSetArg(al[ac], XmNlabelString, XmStringCreate("/ 00:00",char_set)); ac++; totlbl = XmCreateLabel(countForm,"TotalTimeLbl",al,ac); XtManageChild(totlbl); /******************/ /* Locator Scale */ /******************/ { /* * We need to add an xevent manager for buton pressing since * locator_scale is a critical ressource that can be modified * by shared by the handle input function */ WidgetList WList; Cardinal Card; ac = 0; XtSetArg(al[ac], XmNleftOffset, 10); ac++; XtSetArg(al[ac], XmNrightOffset, 10); ac++; XtSetArg(al[ac], XmNtopOffset, 10); ac++; XtSetArg(al[ac], XmNbottomOffset, 10); ac++; XtSetArg(al[ac], XmNtopAttachment, XmATTACH_WIDGET); ac++; XtSetArg(al[ac], XmNtopWidget, countForm); ac++; XtSetArg(al[ac], XmNleftAttachment,XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNrightAttachment,XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNmaximum, 100); ac++; XtSetArg(al[ac], XmNminimum, 0); ac++; XtSetArg(al[ac], XmNshowValue, True); ac++; XtSetArg(al[ac], XmNdecimalPoints, 0); ac++; XtSetArg(al[ac], XmNorientation, XmHORIZONTAL); ac++; XtSetArg(al[ac], XmNtraversalOn, False); ac++; XtSetArg(al[ac], XmNhighlightThickness,0); ac++; locator_scale = XmCreateScale(mainForm,"locator",al,ac); XtManageChild(locator_scale); XtAddCallback(locator_scale,XmNvalueChangedCallback, (XtCallbackProc) Generic_scaleCB, (XtPointer) MOTIF_CHANGE_LOCATOR); /* Reach the scrollbar child in the scale */ ac = 0; XtSetArg(al[ac], XtNchildren, &WList); ac++; XtSetArg(al[ac], XtNnumChildren, &Card); ac++; XtGetValues(locator_scale,al,ac); if ((Card!=2)|| strcmp(XtName(WList[1]),"Scrollbar")) fprintf(stderr,"PANIC: Scale has be redefined.. may cause bugs\n"); XtAddEventHandler(WList[1],ButtonPressMask|ButtonReleaseMask, FALSE,Locator_btn,NULL); } /*****************************/ /* Control buttons in a form */ /*****************************/ /* create form for the row of control buttons */ ac = 0; XtSetArg(al[ac], XmNtopOffset, 10); ac++; XtSetArg(al[ac], XmNbottomOffset, 10); ac++; XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++; /* XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM); ac++; */ XtSetArg(al[ac],XmNtopAttachment,XmATTACH_WIDGET); ac++; XtSetArg(al[ac], XmNtopWidget, locator_scale); ac++; btnForm = XmCreateForm(mainForm,"btnForm", al, ac); XtManageChild(btnForm); /* Previous Button */ ac = 0; XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNleftOffset, 10); ac++; XtSetArg(al[ac], XmNshadowType, XmSHADOW_OUT); ac++; XtSetArg(al[ac], XmNshadowThickness, 2); ac++; XtSetArg(al[ac], XmNlabelType, XmPIXMAP); ac++; XtSetArg(al[ac], XmNlabelPixmap, prevPixmap); ac++; XtSetArg(al[ac], XmNhighlightThickness, 2); ac++; prevBtn = XmCreatePushButton(btnForm, "previous",al, ac); XtManageChild(prevBtn); XtAddCallback(prevBtn, XmNactivateCallback, (XtCallbackProc) GenericCB, (XtPointer) MOTIF_PREV); /* Backward Button */ ac = 0; XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNleftAttachment, XmATTACH_WIDGET); ac++; XtSetArg(al[ac], XmNleftWidget, prevBtn); ac++; XtSetArg(al[ac], XmNleftOffset, 2); ac++; XtSetArg(al[ac], XmNshadowType, XmSHADOW_OUT); ac++; XtSetArg(al[ac], XmNshadowThickness, 2); ac++; XtSetArg(al[ac], XmNlabelType, XmPIXMAP); ac++; XtSetArg(al[ac], XmNlabelPixmap, backPixmap); ac++; XtSetArg(al[ac], XmNhighlightThickness, 2); ac++; backBtn = XmCreatePushButton(btnForm, "backward",al, ac); XtManageChild(backBtn); XtAddCallback(backBtn, XmNactivateCallback, (XtCallbackProc) GenericCB, (XtPointer) MOTIF_RWD); /* Restart Button */ ac = 0; XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNleftAttachment, XmATTACH_WIDGET); ac++; XtSetArg(al[ac], XmNleftWidget, backBtn); ac++; XtSetArg(al[ac], XmNleftOffset, 2); ac++; XtSetArg(al[ac], XmNshadowType, XmSHADOW_OUT); ac++; XtSetArg(al[ac], XmNshadowThickness, 2); ac++; XtSetArg(al[ac], XmNlabelType, XmPIXMAP); ac++; XtSetArg(al[ac], XmNlabelPixmap, restartPixmap); ac++; XtSetArg(al[ac], XmNhighlightThickness, 2); ac++; restartBtn = XmCreatePushButton(btnForm,"restartBtn", al, ac); XtManageChild(restartBtn); XtAddCallback(restartBtn, XmNactivateCallback, (XtCallbackProc) GenericCB, (XtPointer) MOTIF_RESTART); /* Quit Button */ ac = 0; XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNleftAttachment, XmATTACH_WIDGET); ac++; XtSetArg(al[ac], XmNleftWidget, restartBtn); ac++; XtSetArg(al[ac], XmNleftOffset, 2); ac++; XtSetArg(al[ac], XmNshadowType, XmSHADOW_OUT); ac++; XtSetArg(al[ac], XmNshadowThickness, 2); ac++; XtSetArg(al[ac], XmNlabelType, XmPIXMAP); ac++; XtSetArg(al[ac], XmNlabelPixmap, quitPixmap); ac++; XtSetArg(al[ac], XmNhighlightThickness, 2); ac++; quitBtn = XmCreatePushButton(btnForm,"quitBtn", al, ac); XtManageChild(quitBtn); XtAddCallback(quitBtn, XmNactivateCallback, (XtCallbackProc) GenericCB, (XtPointer) MOTIF_QUIT); /* Pause Button */ ac = 0; XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNleftAttachment, XmATTACH_WIDGET); ac++; XtSetArg(al[ac], XmNleftWidget, quitBtn); ac++; XtSetArg(al[ac], XmNshadowType, XmSHADOW_OUT); ac++; XtSetArg(al[ac], XmNshadowThickness, 2); ac++; XtSetArg(al[ac], XmNlabelType, XmPIXMAP); ac++; XtSetArg(al[ac], XmNlabelPixmap, pausePixmap); ac++; XtSetArg(al[ac], XmNhighlightThickness, 2); ac++; pauseBtn = XmCreatePushButton(btnForm,"pauseBtn", al, ac); XtManageChild(pauseBtn); XtAddCallback(pauseBtn, XmNactivateCallback, (XtCallbackProc) GenericCB,(XtPointer) MOTIF_PAUSE); /* Forward Button */ ac = 0; XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNleftAttachment, XmATTACH_WIDGET); ac++; XtSetArg(al[ac], XmNleftWidget,pauseBtn); ac++; XtSetArg(al[ac], XmNshadowType, XmSHADOW_OUT); ac++; XtSetArg(al[ac], XmNshadowThickness, 2); ac++; XtSetArg(al[ac], XmNlabelType, XmPIXMAP); ac++; XtSetArg(al[ac], XmNlabelPixmap, fwdPixmap); ac++; XtSetArg(al[ac], XmNhighlightThickness, 2); ac++; fwdBtn = XmCreatePushButton(btnForm,"fwdBtn", al, ac); XtManageChild(fwdBtn); XtAddCallback(fwdBtn, XmNactivateCallback, (XtCallbackProc) GenericCB, (XtPointer) MOTIF_FWD); /* Next Button */ ac = 0; XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNleftAttachment, XmATTACH_WIDGET); ac++; XtSetArg(al[ac], XmNleftWidget, fwdBtn); ac++; XtSetArg(al[ac], XmNleftOffset, 2); ac++; XtSetArg(al[ac], XmNshadowType, XmSHADOW_OUT); ac++; XtSetArg(al[ac], XmNshadowThickness, 2); ac++; XtSetArg(al[ac], XmNlabelType, XmPIXMAP); ac++; XtSetArg(al[ac], XmNlabelPixmap, nextPixmap); ac++; XtSetArg(al[ac], XmNhighlightThickness, 2); ac++; nextBtn = XmCreatePushButton(btnForm,"nextBtn", al, ac); XtManageChild(nextBtn); XtAddCallback(nextBtn, XmNactivateCallback, (XtCallbackProc) GenericCB, (XtPointer) MOTIF_NEXT); /********************/ /* Volume scale */ /********************/ ac = 0; XtSetArg(al[ac], XmNleftOffset, 10); ac++; XtSetArg(al[ac], XmNrightOffset, 10); ac++; XtSetArg(al[ac], XmNtopOffset, 10); ac++; XtSetArg(al[ac], XmNbottomOffset, 10); ac++; XtSetArg(al[ac], XmNtopAttachment, XmATTACH_WIDGET); ac++; XtSetArg(al[ac], XmNtopWidget, btnForm); ac++; XtSetArg(al[ac], XmNleftAttachment,XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNbottomAttachment,XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNmaximum, MAX_AMPLIFICATION); ac++; XtSetArg(al[ac], XmNminimum, 0); ac++; XtSetArg(al[ac], XmNshowValue, True); ac++; XtSetArg(al[ac], XmNtraversalOn, False); ac++; XtSetArg(al[ac], XmNhighlightThickness,0); ac++; XtSetArg(al[ac], XmNtitleString, XmStringCreate("VOL",char_set)); ac++; volume_scale = XmCreateScale(mainForm,"volscale",al,ac); XtManageChild(volume_scale); XtAddCallback(volume_scale, XmNvalueChangedCallback, (XtCallbackProc) Generic_scaleCB, (XtPointer) MOTIF_CHANGE_VOLUME); /********************/ /* File list */ /********************/ ac = 0; XtSetArg(al[ac], XmNtopOffset, 10); ac++; XtSetArg(al[ac], XmNbottomOffset, 10); ac++; XtSetArg(al[ac], XmNleftOffset, 10); ac++; XtSetArg(al[ac], XmNrightOffset, 10); ac++; XtSetArg(al[ac], XmNtopAttachment, XmATTACH_WIDGET); ac++; XtSetArg(al[ac], XmNtopWidget, btnForm ); ac++; XtSetArg(al[ac], XmNleftAttachment,XmATTACH_WIDGET); ac++; XtSetArg(al[ac], XmNleftWidget, volume_scale); ac++; XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNbottomAttachment,XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNselectionPolicy ,XmSINGLE_SELECT); ac++; XtSetArg(al[ac], XmNscrollBarDisplayPolicy ,XmAS_NEEDED); ac++; XtSetArg(al[ac], XmNlistSizePolicy ,XmRESIZE_IF_POSSIBLE); ac++; XtSetArg(al[ac], XmNtraversalOn, False); ac++; XtSetArg(al[ac], XmNhighlightThickness,0); ac++; file_list = XmCreateScrolledList(mainForm,"File List",al,ac); XtManageChild(file_list); XtAddCallback(file_list, XmNsingleSelectionCallback, (XtCallbackProc) File_ListCB, NULL); /* * Last details on toplevel */ ac=0; /* XtSetArg(al[ac],XmNwidth,400); ac++; XtSetArg(al[ac],XmNheight,800); ac++; */ XtSetArg(al[ac], XmNtitle, "TiMidity"); ac++; XtSetArg(al[ac], XmNiconName, "NONE"); ac++; XtSetArg(al[ac], XmNiconPixmap, timidityPixmap); ac++; XtSetValues(toplevel,al,ac); /*******************************************************/ /* Plug the pipe ..... and heeere we go */ /*******************************************************/ XtAppAddInput(context,pipe_number, (XtPointer) XtInputReadMask,handle_input,NULL); XtRealizeWidget(toplevel); XtAppMainLoop(context); } TiMidity++-2.13.2/interface/motif_p.c0100644004711200001440000001163307421005040016432 0ustar tamukiusers/* TiMidity++ -- MIDI to WAVE converter and player Copyright (C) 1999-2002 Masanao Izumo Copyright (C) 1995 Tuukka Toivonen 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA motif_pipe.c: written by Vincent Pagel (pagel@loria.fr) 10/4/95 pipe communication between motif interface and sound generator */ #ifdef HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ #include #include #include #include #include #ifdef SOLARIS #include #endif #ifndef NO_STRING_H #include #else #include #endif #include #include #include "timidity.h" #include "controls.h" #include "motif.h" static int pipeAppli[2],pipeMotif[2]; /* Pipe for communication with MOTIF process */ static int fpip_in, fpip_out; /* in and out depends in which process we are */ static int pid; /* Pid for child process */ /* DATA VALIDITY CHECK */ #define INT_CODE 214 #define STRING_CODE 216 #define DEBUGPIPE /***********************************************************************/ /* PIPE COMUNICATION */ /***********************************************************************/ static void m_pipe_error(char *st) { fprintf(stderr,"CONNECTION PROBLEM WITH MOTIF PROCESS IN %s BECAUSE:%s" NLS, st, strerror(errno)); exit(1); } /***************************************** * INT * *****************************************/ void m_pipe_int_write(int c) { int len; int code=INT_CODE; #ifdef DEBUGPIPE len = write(fpip_out,&code,sizeof(code)); if (len!=sizeof(code)) m_pipe_error("PIPE_INT_WRITE"); #endif len = write(fpip_out,&c,sizeof(c)); if (len!=sizeof(int)) m_pipe_error("PIPE_INT_WRITE"); } void m_pipe_int_read(int *c) { int len; #ifdef DEBUGPIPE int code; len = read(fpip_in,&code,sizeof(code)); if (len!=sizeof(code)) m_pipe_error("PIPE_INT_READ"); if (code!=INT_CODE) fprintf(stderr,"BUG ALERT ON INT PIPE %i" NLS, code); #endif len = read(fpip_in,c, sizeof(int)); if (len!=sizeof(int)) m_pipe_error("PIPE_INT_READ"); } /***************************************** * STRINGS * *****************************************/ void m_pipe_string_write(char *str) { int len, slen; #ifdef DEBUGPIPE int code=STRING_CODE; len = write(fpip_out,&code,sizeof(code)); if (len!=sizeof(code)) m_pipe_error("PIPE_STRING_WRITE"); #endif slen=strlen(str); len = write(fpip_out,&slen,sizeof(slen)); if (len!=sizeof(slen)) m_pipe_error("PIPE_STRING_WRITE"); len = write(fpip_out,str,slen); if (len!=slen) m_pipe_error("PIPE_STRING_WRITE on string part"); } void m_pipe_string_read(char *str) { int len, slen; #ifdef DEBUGPIPE int code; len = read(fpip_in,&code,sizeof(code)); if (len!=sizeof(code)) m_pipe_error("PIPE_STRING_READ"); if (code!=STRING_CODE) fprintf(stderr,"BUG ALERT ON STRING PIPE %i" NLS, code); #endif len = read(fpip_in,&slen,sizeof(slen)); if (len!=sizeof(slen)) m_pipe_error("PIPE_STRING_READ"); len = read(fpip_in,str,slen); if (len!=slen) m_pipe_error("PIPE_STRING_READ on string part"); str[slen]='\0'; /* Append a terminal 0 */ } int m_pipe_read_ready(void) { fd_set fds; int cnt; struct timeval timeout; FD_ZERO(&fds); FD_SET(fpip_in, &fds); timeout.tv_sec = timeout.tv_usec = 0; if((cnt = select(fpip_in + 1, &fds, NULL, NULL, &timeout)) < 0) { perror("select"); return -1; } return cnt > 0 && FD_ISSET(fpip_in, &fds) != 0; } void m_pipe_open(void) { int res; res=pipe(pipeAppli); if (res!=0) m_pipe_error("PIPE_APPLI CREATION"); res=pipe(pipeMotif); if (res!=0) m_pipe_error("PIPE_MOTIF CREATION"); if ((pid=fork())==0) /*child*/ { close(pipeMotif[1]); close(pipeAppli[0]); fpip_in=pipeMotif[0]; fpip_out= pipeAppli[1]; Launch_Motif_Process(fpip_in); /* Won't come back from here */ fprintf(stderr,"WARNING: come back from MOTIF" NLS); exit(0); } close(pipeMotif[0]); close(pipeAppli[1]); fpip_in= pipeAppli[0]; fpip_out= pipeMotif[1]; } TiMidity++-2.13.2/interface/tk_c.c0100644004711200001440000006415210014435412015723 0ustar tamukiusers/* TiMidity++ -- MIDI to WAVE converter and player Copyright (C) 1999-2002 Masanao Izumo Copyright (C) 1995 Tuukka Toivonen 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*================================================================ * * The Tcl/Tk interface for Timidity * written by Takashi Iwai (iwai@dragon.mm.t.u-tokyo.ac.jp) * * Most of the following codes are derived from both motif_ctl.c * and motif_pipe.c. The communication between Tk program and * timidity is established by a pipe stream as in Motif interface. * On the contrast to motif, the stdin and stdout are assigned * as pipe i/o in Tk interface. * *================================================================*/ #ifdef HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ #include #include #include #include #ifndef NO_STRING_H #include #else #include #endif #include #include #include #include #include #include #include #include #include #include "timidity.h" #include "common.h" #include "instrum.h" #include "playmidi.h" #include "readmidi.h" #include "output.h" #include "controls.h" #include "miditrace.h" #include "aq.h" #ifndef TKPROGPATH #define TKPROGPATH PKGLIBDIR "/tkmidity.tcl" #endif /* TKPROGPATH */ static void ctl_refresh(void); static void ctl_total_time(int tt); static void ctl_master_volume(int mv); static void ctl_file_name(char *name); static void ctl_current_time(int secs, int v); static void ctl_program(int ch, int val); static void ctl_volume(int channel, int val); static void ctl_expression(int channel, int val); static void ctl_panning(int channel, int val); static void ctl_sustain(int channel, int val); static void ctl_pitch_bend(int channel, int val); static void ctl_lyric(int lyricid); static void ctl_reset(void); static int ctl_open(int using_stdin, int using_stdout); static void ctl_close(void); static int ctl_read(int32 *valp); static int cmsg(int type, int verbosity_level, char *fmt, ...); static void ctl_pass_playing_list(int number_of_files, char *list_of_files[]); static int ctl_blocking_read(int32 *valp); static void ctl_note(int status, int ch, int note, int vel); static void ctl_event(CtlEvent *e); static void k_pipe_printf(char *fmt, ...); static void k_pipe_puts(char *str); static int k_pipe_gets(char *str, int maxlen); static void k_pipe_open(void); static void k_pipe_error(char *st); static int k_pipe_read_ready(void); static int AppInit(Tcl_Interp *interp); static int ExitAll(ClientData clientData, Tcl_Interp *interp, int argc, char *argv[]); static int TraceCreate(ClientData clientData, Tcl_Interp *interp, int argc, char *argv[]); static int TraceUpdate(ClientData clientData, Tcl_Interp *interp, int argc, char *argv[]); static int TraceReset(ClientData clientData, Tcl_Interp *interp, int argc, char *argv[]); static void trace_volume(int ch, int val); static void trace_panning(int ch, int val); static void trace_prog_init(int ch); static void trace_prog(int ch, int val); static void trace_bank(int ch, int val); static void trace_sustain(int ch, int val); static void get_child(int sig); static void shm_alloc(void); static void shm_free(int sig); static void start_panel(void); #define MAX_TK_MIDI_CHANNELS 16 typedef struct { int reset_panel; int multi_part; int32 last_time, cur_time; char v_flags[MAX_TK_MIDI_CHANNELS]; int16 cnote[MAX_TK_MIDI_CHANNELS]; int16 cvel[MAX_TK_MIDI_CHANNELS]; int16 ctotal[MAX_TK_MIDI_CHANNELS]; char c_flags[MAX_TK_MIDI_CHANNELS]; Channel channel[MAX_TK_MIDI_CHANNELS]; int wait_reset; } PanelInfo; /**********************************************/ #define ctl tk_control_mode ControlMode ctl= { "Tcl/Tk interface", 'k', 1,0,0, 0, ctl_open, ctl_close, ctl_pass_playing_list, ctl_read, cmsg, ctl_event }; #define FLAG_NOTE_OFF 1 #define FLAG_NOTE_ON 2 #define FLAG_BANK 1 #define FLAG_PROG 2 #define FLAG_PAN 4 #define FLAG_SUST 8 static VOLATILE PanelInfo *Panel; static VOLATILE int child_killed = 0; static int shmid; /* shared memory id */ static int semid; /* semaphore id */ static int pipeAppli[2],pipePanel[2]; /* Pipe for communication with Tcl/Tk process */ static int fpip_in, fpip_out; /* in and out depends in which process we are */ static int child_pid; /* Pid for child process */ /***********************************************************************/ /* semaphore utilities */ /***********************************************************************/ static void semaphore_P(int sid) { struct sembuf sb; sb.sem_num = 0; sb.sem_op = -1; sb.sem_flg = 0; if(semop(sid, &sb, 1) == -1) perror("semop"); } static void semaphore_V(int sid) { struct sembuf sb; sb.sem_num = 0; sb.sem_op = 1; sb.sem_flg = 0; if(semop(sid, &sb, 1) == -1) perror("semop"); } /***********************************************************************/ /* Put controls on the pipe */ /***********************************************************************/ static int cmsg(int type, int verbosity_level, char *fmt, ...) { char local[2048]; #define TOO_LONG 2000 va_list ap; if ((type==CMSG_TEXT || type==CMSG_INFO || type==CMSG_WARNING) && ctl.verbosity TOO_LONG) fmt[TOO_LONG] = 0; if (!ctl.opened) { vfprintf(stderr, fmt, ap); fprintf(stderr, "\n"); } else if (type == CMSG_ERROR) { int32 val; vsnprintf(local, sizeof(local), fmt, ap); k_pipe_printf("CERR %d", type); k_pipe_puts(local); while (ctl_blocking_read(&val) != RC_NEXT) ; } else { vsnprintf(local, sizeof(local), fmt, ap); k_pipe_printf("CMSG %d", type); k_pipe_puts(local); } va_end(ap); return 0; } static void ctl_refresh(void) { } static void ctl_total_time(int tt) { int centisecs=tt/(play_mode->rate/100); k_pipe_printf("TIME %d", centisecs); ctl_current_time(0, 0); } static void ctl_master_volume(int mv) { k_pipe_printf("MVOL %d", mv); } static void ctl_file_name(char *name) { k_pipe_printf("FILE %s", name); } static void ctl_current_time(int secs, int v) { Panel->cur_time = secs; } static void ctl_channel_note(int ch, int note, int vel) { if (vel == 0) { if (note == Panel->cnote[ch]) Panel->v_flags[ch] = FLAG_NOTE_OFF; Panel->cvel[ch] = 0; } else if (vel > Panel->cvel[ch]) { Panel->cvel[ch] = vel; Panel->cnote[ch] = note; Panel->ctotal[ch] = vel * Panel->channel[ch].volume * Panel->channel[ch].expression / (127*127); Panel->v_flags[ch] = FLAG_NOTE_ON; } } static void ctl_note(int status, int ch, int note, int vel) { if (!ctl.trace_playing) return; if (ch < 0 || ch >= MAX_TK_MIDI_CHANNELS) return; if (status != VOICE_ON) vel = 0; semaphore_P(semid); ctl_channel_note(ch, note, vel); semaphore_V(semid); } static void ctl_program(int ch, int val) { if(ch >= MAX_TK_MIDI_CHANNELS) return; if (!ctl.trace_playing) return; if (ch < 0 || ch >= MAX_TK_MIDI_CHANNELS) return; if(channel[ch].special_sample) val = channel[ch].special_sample; else val += progbase; semaphore_P(semid); Panel->channel[ch].program = val; Panel->c_flags[ch] |= FLAG_PROG; semaphore_V(semid); } static void ctl_volume(int ch, int val) { if(ch >= MAX_TK_MIDI_CHANNELS) return; if (!ctl.trace_playing) return; semaphore_P(semid); Panel->channel[ch].volume = val; ctl_channel_note(ch, Panel->cnote[ch], Panel->cvel[ch]); semaphore_V(semid); } static void ctl_expression(int ch, int val) { if(ch >= MAX_TK_MIDI_CHANNELS) return; if (!ctl.trace_playing) return; semaphore_P(semid); Panel->channel[ch].expression = val; ctl_channel_note(ch, Panel->cnote[ch], Panel->cvel[ch]); semaphore_V(semid); } static void ctl_panning(int ch, int val) { if(ch >= MAX_TK_MIDI_CHANNELS) return; if (!ctl.trace_playing) return; semaphore_P(semid); Panel->channel[ch].panning = val; Panel->c_flags[ch] |= FLAG_PAN; semaphore_V(semid); } static void ctl_sustain(int ch, int val) { if(ch >= MAX_TK_MIDI_CHANNELS) return; if (!ctl.trace_playing) return; semaphore_P(semid); Panel->channel[ch].sustain = val; Panel->c_flags[ch] |= FLAG_SUST; semaphore_V(semid); } /*ARGSUSED*/ static void ctl_pitch_bend(int channel, int val) { /* if(ch >= MAX_TK_MIDI_CHANNELS) return; if (!ctl.trace_playing) return; semaphore_P(semid); Panel->channel[ch].pitch_bend = val; Panel->c_flags[ch] |= FLAG_BENDT; semaphore_V(semid); */ } static void ctl_lyric(int lyricid) { char *lyric; lyric = event2string(lyricid); if(lyric != NULL) { if(lyric[0] == ME_KARAOKE_LYRIC) { if(lyric[1] == '/' || lyric[1] == '\\') { k_pipe_printf("CMSG %d", CMSG_TEXT); k_pipe_puts(""); k_pipe_printf("LYRC %d", CMSG_TEXT); k_pipe_printf("%s", lyric + 2); } else if(lyric[1] == '@') { if(lyric[2] == 'L') { k_pipe_printf("CMSG %d", CMSG_TEXT); k_pipe_printf("Language: %s", lyric + 3); } else if(lyric[2] == 'T') { k_pipe_printf("CMSG %d", CMSG_TEXT); k_pipe_printf("Title: %s", lyric + 3); } else { k_pipe_printf("CMSG %d", CMSG_TEXT); k_pipe_printf("%s", lyric + 1); } } else { k_pipe_printf("LYRC %d", CMSG_TEXT); k_pipe_printf("%s", lyric + 1); } } else { k_pipe_printf("CMSG %d", CMSG_TEXT); k_pipe_printf("%s", lyric + 1); } } } static void ctl_reset(void) { int i; if (!ctl.trace_playing) { k_pipe_printf("RSET %d", ctl.trace_playing); return; } Panel->wait_reset = 1; k_pipe_printf("RSET %d", ctl.trace_playing); while(Panel->wait_reset) VOLATILE_TOUCH(Panel->wait_reset); if (!ctl.trace_playing) return; for (i = 0; i < MAX_TK_MIDI_CHANNELS; i++) { if(ISDRUMCHANNEL(i)) ctl_program(i, channel[i].bank); else ctl_program(i, channel[i].program); ctl_volume(i, channel[i].volume); ctl_expression(i, channel[i].expression); ctl_panning(i, channel[i].panning); ctl_sustain(i, channel[i].sustain); if(channel[i].pitchbend == 0x2000 && channel[i].mod.val > 0) ctl_pitch_bend(i, -1); else ctl_pitch_bend(i, channel[i].pitchbend); ctl_channel_note(i, Panel->cnote[i], 0); } } /***********************************************************************/ /* OPEN THE CONNECTION */ /***********************************************************************/ /*ARGSUSED*/ static int ctl_open(int using_stdin, int using_stdout) { shm_alloc(); k_pipe_open(); if (child_pid == 0) start_panel(); signal(SIGCHLD, get_child); signal(SIGTERM, shm_free); signal(SIGINT, shm_free); signal(SIGHUP, shm_free); ctl.opened=1; return 0; } /* Tells the window to disapear */ static void ctl_close(void) { if (ctl.opened) { kill(child_pid, SIGTERM); shm_free(100); ctl.opened=0; } } /* * Read information coming from the window in a BLOCKING way */ /* commands are: PREV, NEXT, QUIT, STOP, LOAD, JUMP, VOLM */ static int ctl_blocking_read(int32 *valp) { char buf[8192], *tok, *arg; int new_volume; int new_centiseconds; char *args[64], **files; int i=0, nfiles; k_pipe_gets(buf, sizeof(buf)-1); tok = strtok(buf, " "); for(;;)/* Loop after pause sleeping to treat other buttons! */ { switch (*tok) { case 'V': if ((arg = strtok(NULL, " ")) != NULL) { new_volume = atoi(arg); *valp= new_volume - amplification ; return RC_CHANGE_VOLUME; } return RC_NONE; case 'J': if ((arg = strtok(NULL, " ")) != NULL) { new_centiseconds = atoi(arg); *valp= new_centiseconds*(play_mode->rate / 100) ; return RC_JUMP; } return RC_NONE; case 'Q': return RC_QUIT; case 'L': return RC_LOAD_FILE; case 'N': return RC_NEXT; case 'P': /*return RC_REALLY_PREVIOUS;*/ return RC_PREVIOUS; case 'R': return RC_RESTART; case 'F': *valp=play_mode->rate; return RC_FORWARD; case 'B': *valp=play_mode->rate; return RC_BACK; case 'X': k_pipe_gets(buf, sizeof(buf)-1); args[i++] = strtok(buf, " "); while ((args[i++] = strtok(NULL, " ")) != NULL); nfiles = --i; files = expand_file_archives(args, &nfiles); k_pipe_printf("ALST %d", nfiles); for (i=0;i begin to play automatically */ /*k_pipe_puts("NEXT");*/ command = ctl_blocking_read(&val); /* Main Loop */ for (;;) { if (command==RC_LOAD_FILE) { /* Read a LoadFile command */ k_pipe_gets(local, sizeof(local)-1); command=play_midi_file(local); } else { if (command==RC_QUIT) { /* if really QUIT */ k_pipe_gets(local, sizeof(local)-1); if (*local == 'Z') return; /* only stop playing..*/ } if (command==RC_CHANGE_VOLUME) /* init volume */ amplification += val; switch(command) { case RC_ERROR: k_pipe_puts("ERRR"); break; case RC_NEXT: k_pipe_puts("NEXT"); break; case RC_REALLY_PREVIOUS: k_pipe_puts("PREV"); break; case RC_TUNE_END: k_pipe_puts("TEND"); break; case RC_RESTART: k_pipe_puts("RSTA"); break; } command = ctl_blocking_read(&val); } } } /* open pipe and fork child process */ static void k_pipe_open(void) { int res; res = pipe(pipeAppli); if (res!=0) k_pipe_error("PIPE_APPLI CREATION"); res = pipe(pipePanel); if (res!=0) k_pipe_error("PIPE_PANEL CREATION"); if ((child_pid = fork()) == 0) { /*child*/ close(pipePanel[1]); close(pipeAppli[0]); /* redirect to stdin/out */ dup2(pipePanel[0], fileno(stdin)); close(pipePanel[0]); dup2(pipeAppli[1], fileno(stdout)); close(pipeAppli[1]); } else { close(pipePanel[0]); close(pipeAppli[1]); fpip_in= pipeAppli[0]; fpip_out= pipePanel[1]; } } #if defined(sgi) #include #endif #if defined(SOLARIS) #include #endif static int k_pipe_read_ready(void) { #if defined(sgi) fd_set fds; int cnt; struct timeval timeout; FD_ZERO(&fds); FD_SET(fpip_in, &fds); timeout.tv_sec = timeout.tv_usec = 0; if((cnt = select(fpip_in + 1, &fds, NULL, NULL, &timeout)) < 0) { perror("select"); return -1; } return cnt > 0 && FD_ISSET(fpip_in, &fds) != 0; #else int num; if(ioctl(fpip_in,FIONREAD,&num) < 0) /* see how many chars in buffer. */ { perror("ioctl: FIONREAD"); return -1; } return num; #endif } /***********************************************************************/ /* PIPE COMUNICATION */ /***********************************************************************/ static void k_pipe_error(char *st) { fprintf(stderr,"CONNECTION PROBLEM WITH TCL/TK PROCESS IN %s BECAUSE:%s\n", st, strerror(errno)); exit(1); } static void k_pipe_printf(char *fmt, ...) { char buf[256]; va_list ap; va_start(ap, fmt); vsnprintf(buf, sizeof(buf), fmt, ap); k_pipe_puts(buf); } static int line_strlen(char *str) { int len; len = 0; while(*str && *str != '\r' && *str != '\n') { str++; len++; } return len; } static void k_pipe_puts(char *str) { int len; char lf = '\n'; len = line_strlen(str); write(fpip_out, str, len); write(fpip_out, &lf, 1); } int k_pipe_gets(char *str, int maxlen) { /* blocking reading */ char *p; int len; /* at least 5 letters (4+\n) command */ len = 0; for (p = str; len < maxlen - 1; p++) { read(fpip_in, p, 1); if (*p == '\n') break; len++; } *p = 0; return len; } /*---------------------------------------------------------------- * shared memory handling *----------------------------------------------------------------*/ /*ARGSUSED*/ static void get_child(int sig) { child_killed = 1; } static void shm_alloc(void) { shmid = shmget(IPC_PRIVATE, sizeof(PanelInfo), IPC_CREAT|0600); if (shmid < 0) { fprintf(stderr, "can't allocate shared memory\n"); exit(1); } semid = semget(IPC_PRIVATE, 1, IPC_CREAT|0600); if (semid < 0) { perror("semget"); shmctl(shmid, IPC_RMID,NULL); exit(1); } /* bin semaphore: only call once at first */ semaphore_V(semid); Panel = (PanelInfo *)shmat(shmid, 0, 0); Panel->reset_panel = 0; Panel->multi_part = 0; Panel->wait_reset = 0; } static void shm_free(int sig) { int status; #if defined(HAVE_UNION_SEMUN) union semun dmy; #else /* Solaris 2.x, BSDI, OSF/1, HPUX */ void *dmy; #endif kill(child_pid, SIGTERM); while(wait(&status) != child_pid) ; memset(&dmy, 0, sizeof(dmy)); /* Shut compiler warning up :-) */ semctl(semid, 0, IPC_RMID, dmy); shmctl(shmid, IPC_RMID, NULL); shmdt((char *)Panel); if (sig != 100) exit(0); } /*---------------------------------------------------------------- * start Tk window panel *----------------------------------------------------------------*/ static void start_panel(void) { char *argv[128]; int argc; argc = 0; argv[argc++] = "-f"; argv[argc++] = TKPROGPATH; if (ctl.trace_playing) { argv[argc++] = "-mode"; argv[argc++] = "trace"; } /* call Tk main routine */ Tk_Main(argc, argv, AppInit); exit(0); } /*---------------------------------------------------------------- * initialize Tcl application *----------------------------------------------------------------*/ static Tcl_Interp *my_interp; static int AppInit(Tcl_Interp *interp) { my_interp = interp; if (Tcl_Init(interp) == TCL_ERROR) { return TCL_ERROR; } if (Tk_Init(interp) == TCL_ERROR) { return TCL_ERROR; } Tcl_CreateCommand(interp, "TraceCreate", (Tcl_CmdProc*) TraceCreate, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); Tcl_CreateCommand(interp, "TraceUpdate", (Tcl_CmdProc*) TraceUpdate, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); Tcl_CreateCommand(interp, "TraceReset", (Tcl_CmdProc*) TraceReset, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); Tcl_CreateCommand(interp, "ExitAll", (Tcl_CmdProc*) ExitAll, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); Tcl_CreateCommand(interp, "TraceUpdate", (Tcl_CmdProc*) TraceUpdate, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); return TCL_OK; } /*ARGSUSED*/ static int ExitAll(ClientData clientData, Tcl_Interp *interp, int argc, char *argv[]) { /* window is killed; kill the parent process, too */ kill(getppid(), SIGTERM); for (;;) sleep(1000); return TCL_OK; } /* evaluate Tcl script */ static char *v_eval(char *fmt, ...) { char buf[256]; va_list ap; va_start(ap, fmt); vsnprintf(buf, sizeof(buf), fmt, ap); Tcl_Eval(my_interp, buf); va_end(ap); return my_interp->result; } static const char *v_get2(const char *v1, const char *v2) { return Tcl_GetVar2(my_interp, v1, v2, 0); } /*---------------------------------------------------------------- * update Tcl timer / trace window *----------------------------------------------------------------*/ #define FRAME_WIN ".body.trace" #define CANVAS_WIN FRAME_WIN ".c" #define BAR_WID 20 #define BAR_HGT 130 #define WIN_WID (BAR_WID * 16) #define WIN_HGT (BAR_HGT + 11 + 17) #define BAR_HALF_HGT (WIN_HGT / 2 - 11 - 17) /*ARGSUSED*/ static int TraceCreate(ClientData clientData, Tcl_Interp *interp, int argc, char *argv[]) { int i; v_eval("frame %s -bg black", FRAME_WIN); v_eval("canvas %s -width %d -height %d -bd 0 -bg black " "-highlightthickness 0", CANVAS_WIN, WIN_WID, WIN_HGT); v_eval("pack %s -side top -fill x", CANVAS_WIN); for (i = 0; i < 32; i++) { char *color; v_eval("%s create text 0 0 -anchor n -fill white -text 00 " "-tags prog%d", CANVAS_WIN, i); v_eval("%s create poly 0 0 0 0 0 0 -fill yellow -tags pos%d", CANVAS_WIN, i); color = (ISDRUMCHANNEL(i) || i == 25) ? "red" : "green"; v_eval("%s create rect 0 0 0 0 -fill %s -tags bar%d " "-outline \"\"", CANVAS_WIN, color, i); } v_eval("set Stat(TimerId) -1"); v_eval("TraceReset"); return TCL_OK; } static void trace_bank(int ch, int val) { v_eval("%s itemconfigure bar%d -fill %s", CANVAS_WIN, ch, (val == 128 ? "red" : "green")); } static void trace_prog(int ch, int val) { v_eval("%s itemconfigure prog%d -text %02X", CANVAS_WIN, ch, val); } static void trace_sustain(int ch, int val) { v_eval("%s itemconfigure prog%d -fill %s", CANVAS_WIN, ch, (val == 127 ? "green" : "white")); } static void trace_prog_init(int ch) { int item, yofs, bar, x, y; item = ch; yofs = 0; bar = Panel->multi_part ? BAR_HALF_HGT : BAR_HGT; if (ch >= 16) { ch -= 16; yofs = WIN_HGT / 2; if (!Panel->multi_part) yofs = -500; } x = ch * BAR_WID + BAR_WID/2; y = bar + 11 + yofs; v_eval("%s coords prog%d %d %d", CANVAS_WIN, item, x, y); } static void trace_volume(int ch, int val) { int item, bar, yofs, x1, y1, x2, y2; item = ch; yofs = 0; bar = Panel->multi_part ? BAR_HALF_HGT : BAR_HGT; if (ch >= 16) { yofs = WIN_HGT / 2; ch -= 16; if (!Panel->multi_part) yofs = -500; } x1 = ch * BAR_WID; y1 = bar - 1 + yofs; x2 = x1 + BAR_WID - 1; y2 = y1 - bar * val / 127; v_eval("%s coords bar%d %d %d %d %d", CANVAS_WIN, item, x1, y1, x2, y2); } static void trace_panning(int ch, int val) { int item, bar, yofs; int x, ap, bp; if (val < 0) { v_eval("%s coords pos%d -1 0 -1 0 -1 0", CANVAS_WIN, ch); return; } item = ch; yofs = 0; bar = Panel->multi_part ? BAR_HALF_HGT : BAR_HGT; if (ch >= 16) { yofs = WIN_HGT / 2; ch -= 16; if (!Panel->multi_part) yofs = -500; } x = BAR_WID * ch; ap = BAR_WID * val / 127; bp = BAR_WID - ap - 1; v_eval("%s coords pos%d %d %d %d %d %d %d", CANVAS_WIN, item, ap + x, bar + 5 + yofs, bp + x, bar + 1 + yofs, bp + x, bar + 9 + yofs); } /*ARGSUSED*/ static int TraceReset(ClientData clientData, Tcl_Interp *interp, int argc, char *argv[]) { int i; semaphore_P(semid); for (i = 0; i < 32; i++) { trace_volume(i, 0); trace_panning(i, -1); trace_prog_init(i); trace_prog(i, 0); trace_sustain(i, 0); Panel->ctotal[i] = 0; Panel->cvel[i] = 0; Panel->v_flags[i] = 0; Panel->c_flags[i] = 0; } semaphore_V(semid); Panel->wait_reset = 0; return TCL_OK; } #define DELTA_VEL 32 static void update_notes(void) { int i, imax; semaphore_P(semid); imax = Panel->multi_part ? 32 : 16; for (i = 0; i < imax; i++) { if (Panel->v_flags[i]) { if (Panel->v_flags[i] == FLAG_NOTE_OFF) { Panel->ctotal[i] -= DELTA_VEL; if (Panel->ctotal[i] <= 0) { Panel->ctotal[i] = 0; Panel->v_flags[i] = 0; } } else { Panel->v_flags[i] = 0; } trace_volume(i, Panel->ctotal[i]); } if (Panel->c_flags[i]) { if (Panel->c_flags[i] & FLAG_PAN) trace_panning(i, Panel->channel[i].panning); if (Panel->c_flags[i] & FLAG_BANK) trace_bank(i, Panel->channel[i].bank); if (Panel->c_flags[i] & FLAG_PROG) trace_prog(i, Panel->channel[i].program); if (Panel->c_flags[i] & FLAG_SUST) trace_sustain(i, Panel->channel[i].sustain); Panel->c_flags[i] = 0; } } semaphore_V(semid); } /*ARGSUSED*/ static int TraceUpdate(ClientData clientData, Tcl_Interp *interp, int argc, char *argv[]) { const char *playing = v_get2("Stat", "Playing"); if (playing && *playing != '0') { if (Panel->reset_panel) { v_eval("TraceReset"); Panel->reset_panel = 0; } if (Panel->last_time != Panel->cur_time) { v_eval("SetTime %d", Panel->cur_time); Panel->last_time = Panel->cur_time; } if (ctl.trace_playing) update_notes(); } v_eval("set Stat(TimerId) [after 50 TraceUpdate]"); return TCL_OK; } static void ctl_event(CtlEvent *e) { switch(e->type) { case CTLE_NOW_LOADING: ctl_file_name((char *)e->v1); break; case CTLE_LOADING_DONE: break; case CTLE_PLAY_START: ctl_total_time((int)e->v1); break; case CTLE_PLAY_END: break; case CTLE_TEMPO: break; case CTLE_METRONOME: break; case CTLE_CURRENT_TIME: ctl_current_time((int)e->v1, (int)e->v2); break; case CTLE_NOTE: ctl_note((int)e->v1, (int)e->v2, (int)e->v3, (int)e->v4); break; case CTLE_MASTER_VOLUME: ctl_master_volume((int)e->v1); break; case CTLE_PROGRAM: ctl_program((int)e->v1, (int)e->v2); break; case CTLE_VOLUME: ctl_volume((int)e->v1, (int)e->v2); break; case CTLE_EXPRESSION: ctl_expression((int)e->v1, (int)e->v2); break; case CTLE_PANNING: ctl_panning((int)e->v1, (int)e->v2); break; case CTLE_SUSTAIN: ctl_sustain((int)e->v1, (int)e->v2); break; case CTLE_PITCH_BEND: ctl_pitch_bend((int)e->v1, (int)e->v2); break; case CTLE_MOD_WHEEL: ctl_pitch_bend((int)e->v1, e->v2 ? -1 : 0x2000); break; case CTLE_CHORUS_EFFECT: break; case CTLE_REVERB_EFFECT: break; case CTLE_LYRIC: ctl_lyric((int)e->v1); break; case CTLE_REFRESH: ctl_refresh(); break; case CTLE_RESET: ctl_reset(); break; } } /* * interface__loader(); */ ControlMode *interface_k_loader(void) { return &ctl; } TiMidity++-2.13.2/interface/emacs_c.c0100644004711200001440000002761507421005040016376 0ustar tamukiusers/* TiMidity++ -- MIDI to WAVE converter and player Copyright (C) 1999-2002 Masanao Izumo Copyright (C) 1995 Tuukka Toivonen 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA emacs_c.c Emacs control mode - written by Masanao Izumo */ #ifdef HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ #include #include #include #include #include #ifndef NO_STRING_H #include #else #include #endif #include "timidity.h" #include "common.h" #include "output.h" #include "controls.h" #include "instrum.h" #include "playmidi.h" #include "miditrace.h" /* * miditrace functions * * ctl_current_time * ctl_note * ctl_program * ctl_volume * ctl_expression * ctl_panning * ctl_sustain * ctl_pitch_bend */ /* * commands: * LIST CMSG TIME MVOL DRUMS FILE CURT NOTE PROG VOL EXP PAN SUS PIT RESET */ static void ctl_refresh(void); static void ctl_total_time(int tt); static void ctl_master_volume(int mv); static void ctl_file_name(char *name); static void ctl_current_time(int ct, int nv); static void ctl_note(int status, int ch, int note, int vel); static void ctl_program(int ch, int val); static void ctl_volume(int channel, int val); static void ctl_expression(int channel, int val); static void ctl_panning(int channel, int val); static void ctl_sustain(int channel, int val); static void ctl_pitch_bend(int channel, int val); static void ctl_reset(void); static int ctl_open(int using_stdin, int using_stdout); static void ctl_close(void); static int ctl_read(int32 *valp); static int cmsg(int type, int verbosity_level, char *fmt, ...); static void ctl_pass_playing_list(int number_of_files, char *list_of_files[]); static void ctl_event(CtlEvent *e); static int read_ready(void); static int emacs_type = 0; /* 0:emacs, 1:mule, 2:?? Note that this variable not used yet. */ enum emacs_type_t { ETYPE_OF_EMACS, ETYPE_OF_MULE, ETYPE_OF_OTHER }; /**********************************/ /* export the interface functions */ #define ctl emacs_control_mode ControlMode ctl= { "Emacs interface (invoked from `M-x timidity')", 'e', 1, 0, 0, 0, ctl_open, ctl_close, ctl_pass_playing_list, ctl_read, cmsg, ctl_event }; static FILE *outfp; static void quote_string_out(char *str) { char *s; s = NULL; if(emacs_type == ETYPE_OF_MULE) { int len; len = SAFE_CONVERT_LENGTH(strlen(str)); s = (char *)new_segment(&tmpbuffer, len); code_convert(str, s, len, NULL, "EUC"); str = s; } while(*str) { if(*str == '\\' || *str == '\"') putc('\\', outfp); putc(*str, outfp); str++; } if(s != NULL) reuse_mblock(&tmpbuffer); } /*ARGSUSED*/ static int ctl_open(int using_stdin, int using_stdout) { if(using_stdout) outfp = stderr; else outfp = stdout; ctl.opened = 1; output_text_code = "NOCNV"; fprintf(outfp, "(timidity-VERSION \""); quote_string_out(timidity_version); fprintf(outfp, "\")\n"); ctl_refresh(); return 0; } static void ctl_close(void) { fflush(outfp); ctl.opened = 0; } static int ctl_read(int32 *valp) { char cmd[BUFSIZ]; int n; if(read_ready() <= 0) return RC_NONE; if(fgets(cmd, sizeof(cmd), stdin) == NULL) return RC_QUIT; /* Emacs may down */ n = atoi(cmd + 1); switch(cmd[0]) { case 'L': return RC_LOAD_FILE; case 'V': *valp = 10 * n; return RC_CHANGE_VOLUME; case 'v': *valp = -10 * n; return RC_CHANGE_VOLUME; case '1': case '2': case '3': *valp = cmd[0] - '2'; return RC_CHANGE_REV_EFFB; case '4': case '5': case '6': *valp = cmd[0] - '5'; return RC_CHANGE_REV_TIME; case 'Q': return RC_QUIT; case 'r': return RC_RESTART; case 'f': *valp = play_mode->rate * n; return RC_FORWARD; case 'b': *valp = play_mode->rate * n; return RC_BACK; case ' ': return RC_TOGGLE_PAUSE; case '+': *valp = n; return RC_KEYUP; case '-': *valp = -n; return RC_KEYDOWN; case '>': *valp = n; return RC_SPEEDUP; case '<': *valp = n; return RC_SPEEDDOWN; case 'O': *valp = n; return RC_VOICEINCR; case 'o': *valp = n; return RC_VOICEDECR; case 'd': *valp = n; return RC_TOGGLE_DRUMCHAN; case 'g': return RC_TOGGLE_SNDSPEC; } return RC_NONE; } static char *chomp(char *s) { int len = strlen(s); if(len < 2) { if(len == 0) return s; if(s[0] == '\n' || s[0] == '\r') s[0] = '\0'; return s; } if(s[len - 1] == '\n') s[--len] = '\0'; if(s[len - 1] == '\r') s[--len] = '\0'; return s; } static void ctl_pass_playing_list(int argc, char *argv[]) { int i; char cmd[BUFSIZ]; if(argc > 0) { if(!strcmp(argv[0], "emacs")) { emacs_type = ETYPE_OF_EMACS; argc--; argv++; } else if(!strcmp(argv[0], "mule")) { emacs_type = ETYPE_OF_MULE; argc--; argv++; } else emacs_type = ETYPE_OF_OTHER; } if(argc > 0 && !strcmp(argv[0], "debug")) { for(i = 1; i < argc; i++) play_midi_file(argv[i]); return; } /* Main Loop */ for(;;) { int rc; if(fgets(cmd, sizeof(cmd), stdin) == NULL) return; /* Emacs may down */ chomp(cmd); if(!strncmp(cmd, "PLAY", 4)) { rc = play_midi_file(cmd + 5); switch(rc) { case RC_TUNE_END: case RC_NEXT: fprintf(outfp, "(timidity-NEXT)\n"); ctl_refresh(); break; case RC_QUIT: return; } /* skipping others command */ } else if(!strncmp(cmd, "QUIT", 4)) return; else continue; /* skipping unknown command */ } /*NOTREACHED*/ } static int cmsg(int type, int verbosity_level, char *fmt, ...) { va_list ap; char buff[BUFSIZ]; if((type==CMSG_TEXT || type==CMSG_INFO || type==CMSG_WARNING) && ctl.verbosity < verbosity_level) return 0; va_start(ap, fmt); vsprintf(buff, fmt, ap); fprintf(outfp, "(timidity-CMSG %d \"", type); quote_string_out(buff); fprintf(outfp, "\")\n"); va_end(ap); ctl_refresh(); return 0; } static void ctl_refresh(void) { fflush(stdout); } static void ctl_total_time(int tt) { int secs; secs = tt/play_mode->rate; fprintf(outfp, "(timidity-TIME %d)\n", secs); ctl_refresh(); } static void ctl_master_volume(int mv) { fprintf(outfp, "(timidity-MVOL %d)\n", mv); ctl_refresh(); } static void ctl_file_name(char *name) { fprintf(outfp, "(timidity-FILE \""); quote_string_out(name); fprintf(outfp, "\")\n"); ctl_refresh(); } static void ctl_current_time(int secs, int v) { fprintf(outfp, "(timidity-CURT %d %d)\n", secs, v); ctl_refresh(); } static int status_number(int s) { switch(s) { case VOICE_FREE: return 0; case VOICE_ON: return 1; case VOICE_SUSTAINED: return 2; case VOICE_OFF: return 3; case VOICE_DIE: return 4; } /* dmy */ return 3; } static void ctl_note(int status, int ch, int note, int vel) { if(ch >= 16) return; if(midi_trace.flush_flag) return; fprintf(outfp, "(timidity-NOTE %d %d %d)\n", ch, note, status_number(status)); ctl_refresh(); } static void ctl_program(int ch, int val) { if(ch >= 16) return; if(midi_trace.flush_flag) return; if(channel[ch].special_sample) val = channel[ch].special_sample; else val += progbase; fprintf(outfp, "(timidity-PROG %d %d)\n", ch, val); ctl_refresh(); } static void ctl_volume(int ch, int val) { if(ch >= 16) return; if(midi_trace.flush_flag) return; fprintf(outfp, "(timidity-VOL %d %d)\n", ch, (val*100)/127); ctl_refresh(); } static void ctl_expression(int ch, int val) { if(ch >= 16) return; if(midi_trace.flush_flag) return; fprintf(outfp, "(timidity-EXP %d %d)\n", ch, (val*100)/127); ctl_refresh(); } static void ctl_panning(int ch, int val) { if(ch >= 16) return; if(midi_trace.flush_flag) return; fprintf(outfp, "(timidity-PAN %d %d)\n", ch, val); ctl_refresh(); } static void ctl_sustain(int ch, int val) { if(ch >= 16) return; if(midi_trace.flush_flag) return; fprintf(outfp, "(timidity-SUS %d %d)\n", ch, val); ctl_refresh(); } static void ctl_pitch_bend(int ch, int val) { if(ch >= 16) return; if(midi_trace.flush_flag) return; fprintf(outfp, "(timidity-PIT %d %d)\n", ch, val); ctl_refresh(); } static void ctl_reset(void) { int i; uint32 drums; /* Note that Emacs is 24 bit integer. */ drums = 0; for(i = 0; i < 16; i++) if(ISDRUMCHANNEL(i)) drums |= (1u << i); fprintf(outfp, "(timidity-DRUMS %lu)\n", (unsigned long)drums); fprintf(outfp, "(timidity-RESET)\n"); for(i = 0; i < 16; i++) { if(ISDRUMCHANNEL(i)) ctl_program(i, channel[i].bank); else ctl_program(i, channel[i].program); ctl_volume(i, channel[i].volume); ctl_expression(i, channel[i].expression); ctl_panning(i, channel[i].panning); ctl_sustain(i, channel[i].sustain); ctl_pitch_bend(i, channel[i].pitchbend); } ctl_refresh(); } #if defined(sgi) #include #include #endif #if defined(SOLARIS) || defined(__FreeBSD__) #include #include #endif static int read_ready(void) { #if defined(sgi) fd_set fds; int cnt; struct timeval timeout; int fd; fd = fileno(stdin); FD_ZERO(&fds); FD_SET(fd, &fds); timeout.tv_sec = timeout.tv_usec = 0; if((cnt = select(fd + 1, &fds, NULL, NULL, &timeout)) < 0) { fprintf(outfp, "(error \"select system call is failed\")\n"); ctl_refresh(); return -1; } return cnt > 0 && FD_ISSET(fd, &fds) != 0; #else int num; int fd; fd = fileno(stdin); if(ioctl(fd, FIONREAD, &num) < 0) /* see how many chars in buffer. */ { fprintf(outfp, "(error \"ioctl system call is failed\")\n"); ctl_refresh(); return -1; } return num; #endif } static void ctl_event(CtlEvent *e) { switch(e->type) { case CTLE_NOW_LOADING: ctl_file_name((char *)e->v1); break; case CTLE_LOADING_DONE: break; case CTLE_PLAY_START: ctl_total_time((int)e->v1); break; case CTLE_PLAY_END: break; case CTLE_TEMPO: break; case CTLE_METRONOME: break; case CTLE_CURRENT_TIME: ctl_current_time((int)e->v1, (int)e->v2); break; case CTLE_NOTE: ctl_note((int)e->v1, (int)e->v2, (int)e->v3, (int)e->v4); break; case CTLE_MASTER_VOLUME: ctl_master_volume((int)e->v1); break; case CTLE_PROGRAM: ctl_program((int)e->v1, (int)e->v2); break; case CTLE_VOLUME: ctl_volume((int)e->v1, (int)e->v2); break; case CTLE_EXPRESSION: ctl_expression((int)e->v1, (int)e->v2); break; case CTLE_PANNING: ctl_panning((int)e->v1, (int)e->v2); break; case CTLE_SUSTAIN: ctl_sustain((int)e->v1, (int)e->v2); break; case CTLE_PITCH_BEND: ctl_pitch_bend((int)e->v1, (int)e->v2); break; case CTLE_MOD_WHEEL: ctl_pitch_bend((int)e->v1, e->v2 ? -1 : 0x2000); break; case CTLE_CHORUS_EFFECT: break; case CTLE_REVERB_EFFECT: break; case CTLE_LYRIC: default_ctl_lyric((int)e->v1); break; case CTLE_REFRESH: ctl_refresh(); break; case CTLE_RESET: ctl_reset(); break; } } /* * interface__loader(); */ ControlMode *interface_e_loader(void) { return &ctl; } TiMidity++-2.13.2/interface/vt100.h0100644004711200001440000000253507421005040015655 0ustar tamukiusers/* TiMidity++ -- MIDI to WAVE converter and player Copyright (C) 1999-2002 Masanao Izumo Copyright (C) 1995 Tuukka Toivonen 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef ___VT100_H_ #define ___VT100_H_ #define VT100_COLS 80 #define VT100_ROWS 24 #define VT100_ATTR_UNDERLINE 000000400000 #define VT100_ATTR_REVERSE 000001000000 #define VT100_ATTR_BOLD 000010000000 /* vt100 utility functions */ extern void vt100_init_screen(void); extern void vt100_refresh(void); extern void vt100_clrtoeol(void); extern void vt100_move(int row, int col); extern void vt100_set_attr(int attr); extern void vt100_reset_attr(void); #endif /* ___VT100_H_ */ TiMidity++-2.13.2/interface/vt100.c0100644004711200001440000000504707421005040015651 0ustar tamukiusers/* TiMidity++ -- MIDI to WAVE converter and player Copyright (C) 1999-2002 Masanao Izumo Copyright (C) 1995 Tuukka Toivonen 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ #include #include "timidity.h" #include "vt100.h" /* #define NOT_FULLSCREEN */ /* d0|vt100|vt100-am|vt100am|Digital VT100:\ :cr=^M:nl=^J:bl=^G:ta=^I:\ :do=^J:co#80:li#24:cl=50\E[;H\E[2J:sf=2*\ED:\ :le=^H:bs:am:cm=5\E[%i%d;%dH:nd=2\E[C:up=2\E[A:\ :ce=3\E[K:cd=50\E[J:so=2\E[7m:se=2\E[m:us=2\E[4m:ue=2\E[m:\ :md=2\E[1m:mr=2\E[7m:mb=2\E[5m:me=2\E[m:is=\E[1;24r\E[24;1H:\ :ct=2\E[3g:st=2\EH:\ :rf=/usr/share/lib/tabset/vt100:\ :rs=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h:ks=\E[?1h:ke=\E[?1l:\ :ku=\EOA:kd=\EOB:kr=\EOC:kl=\EOD:kb=^H:\ :ho=\E[H:k1=\EOP:k2=\EOQ:k3=\EOR:k4=\EOS:pt:sr=2*\EM:vt#3:xn:\ :sc=\E7:rc=\E8:cs=\E[%i%d;%dr:\ :it#8:xo: */ #ifndef NOT_FULLSCREEN void vt100_init_screen(void) { vt100_reset_attr(); fputs("\033[H\033[J", stdout); } void vt100_refresh(void) { fputs("\033[H", stdout); fflush(stdout); } void vt100_clrtoeol(void) { fputs("\033[K", stdout); } void vt100_move(int row, int col) { fprintf(stdout, "\033[%02d;%02dH", row + 1, col + 1); } void vt100_set_attr(int attr) { switch(attr) { case VT100_ATTR_UNDERLINE: fputs("\033[4m", stdout); break; case VT100_ATTR_REVERSE: fputs("\033[7m", stdout); break; case VT100_ATTR_BOLD: fputs("\033[1m", stdout); break; } } void vt100_reset_attr(void) { fputs("\033[m", stdout); } #else void vt100_init_screen(void) { } void vt100_refresh(void) { fflush(stdout); } void vt100_clrtoeol(void) { } void vt100_move(int row, int col) { } void vt100_set_attr(int attr) { } void vt100_reset_attr(void) { } #endif TiMidity++-2.13.2/interface/vt100_c.c0100644004711200001440000006530410055547345016175 0ustar tamukiusers/* TiMidity++ -- MIDI to WAVE converter and player Copyright (C) 1999-2004 Masanao Izumo Copyright (C) 1995 Tuukka Toivonen 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA vt_100_c.c - written by Masanao Izumo */ #ifdef HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ #include #include #include #include #include #ifndef NO_STRING_H #include #else #include #endif #ifdef HAVE_UNISTD_H #include #endif /* HAVE_UNISTD_H */ #ifdef HAVE_SYS_TIME_H #include #endif /* HAVE_SYS_TIME_H */ #ifdef __W32__ #include #endif #include "timidity.h" #include "common.h" #include "instrum.h" #include "playmidi.h" #include "readmidi.h" #include "output.h" #include "controls.h" #include "miditrace.h" #include "vt100.h" #include "timer.h" #include "bitset.h" #include "aq.h" #define SCRMODE_OUT_THRESHOLD 10.0 #define CHECK_NOTE_SLEEP_TIME 5.0 #define INDICATOR_UPDATE_TIME 0.2 static struct { int prog; int disp_cnt; double last_note_on; char *comm; } instr_comment[MAX_CHANNELS]; enum indicator_mode_t { INDICATOR_DEFAULT, INDICATOR_LYRIC }; static int indicator_width = 78; static char *comment_indicator_buffer = NULL; static char *current_indicator_message = NULL; static char *indicator_msgptr = NULL; static int current_indicator_chan = 0; static int next_indicator_chan = -1; static double indicator_last_update; static int indicator_mode = INDICATOR_DEFAULT; static Bitset channel_program_flags[MAX_CHANNELS]; static void update_indicator(void); static void reset_indicator(void); static void indicator_chan_update(int ch); static void indicator_set_prog(int ch, int val, char *comm); static void display_lyric(char *lyric, int sep); static void display_title(char *title); static void init_lyric(char *lang); static char *vt100_getline(void); #define LYRIC_WORD_NOSEP 0 #define LYRIC_WORD_SEP ' ' static void ctl_refresh(void); static void ctl_total_time(int tt); static void ctl_master_volume(int mv); static void ctl_file_name(char *name); static void ctl_current_time(int ct, int nv); static const char note_name_char[12] = { 'c', 'C', 'd', 'D', 'e', 'f', 'F', 'g', 'G', 'a', 'A', 'b' }; static void ctl_note(int status, int ch, int note, int vel); static void ctl_program(int ch, int val, void *vp); static void ctl_volume(int channel, int val); static void ctl_expression(int channel, int val); static void ctl_panning(int channel, int val); static void ctl_sustain(int channel, int val); static void ctl_pitch_bend(int channel, int val); static void ctl_lyric(uint16 lyricid); static void ctl_reset(void); static int ctl_open(int using_stdin, int using_stdout); static void ctl_close(void); static int ctl_read(int32 *valp); static int cmsg(int type, int verbosity_level, char *fmt, ...); static void ctl_event(CtlEvent *e); /**********************************************/ /* export the interface functions */ #define ctl vt100_control_mode ControlMode ctl= { "vt100 interface", 'T', 1,0,0, 0, ctl_open, ctl_close, dumb_pass_playing_list, ctl_read, cmsg, ctl_event }; static int selected_channel = -1; static int lyric_row = 6; static int title_row = 6; static int msg_row = 6; static void ctl_refresh(void) { if(ctl.opened) vt100_refresh(); } static void ctl_total_time(int tt) { int mins, secs=tt/play_mode->rate; mins=secs/60; secs-=mins*60; vt100_move(4, 6+6+3); vt100_set_attr(VT100_ATTR_BOLD); printf("%3d:%02d ", mins, secs); vt100_reset_attr(); ctl_current_time(0, 0); } static void ctl_master_volume(int mv) { vt100_move(4, VT100_COLS-5); vt100_set_attr(VT100_ATTR_BOLD); printf("%03d %%", mv); vt100_reset_attr(); ctl_refresh(); } static void ctl_file_name(char *name) { int i; vt100_move(3, 6); vt100_clrtoeol(); vt100_set_attr(VT100_ATTR_BOLD); fputs(name, stdout); vt100_reset_attr(); if(ctl.trace_playing) { memset(instr_comment, 0, sizeof(instr_comment)); for(i = 0; i < MAX_CHANNELS; i++) instr_comment[i].disp_cnt = 1; indicator_msgptr = NULL; for(i = 0; i < indicator_width; i++) comment_indicator_buffer[i] = ' '; } ctl_refresh(); } static void ctl_current_time(int secs, int v) { int mins, bold_flag = 0; static int last_voices = -1, last_secs = -1; if(last_secs != secs) { last_secs=secs; mins=secs/60; secs-=mins*60; vt100_move(4, 6); vt100_set_attr(VT100_ATTR_BOLD); printf("%3d:%02d", mins, secs); bold_flag = 1; } if(!ctl.trace_playing || midi_trace.flush_flag) { if(bold_flag) vt100_reset_attr(); return; } vt100_move(4, 47); if(!bold_flag) vt100_set_attr(VT100_ATTR_BOLD); printf("%3d", v); vt100_reset_attr(); if(last_voices != voices) { last_voices = voices; vt100_move(4, 52); printf("%3d", voices); } } static void ctl_note(int status, int ch, int note, int vel) { int xl, n, c; unsigned int onoff, check, prev_check; Bitset *bitset; if(ch >= 16) return; if (!ctl.trace_playing || midi_trace.flush_flag) return; n = note_name_char[note % 12]; c = (VT100_COLS - 24) / 12 * 12; if(c <= 0) c = 1; xl=note % c; vt100_move(8 + ch, xl + 3); switch(status) { case VOICE_DIE: putc(',', stdout); onoff = 0; break; case VOICE_FREE: putc('.', stdout); onoff = 0; break; case VOICE_ON: vt100_set_attr(VT100_ATTR_REVERSE); putc(n, stdout); vt100_reset_attr(); indicator_chan_update(ch); onoff = 1; break; case VOICE_SUSTAINED: vt100_set_attr(VT100_ATTR_BOLD); putc(n, stdout); vt100_reset_attr(); onoff = 0; break; case VOICE_OFF: putc(n, stdout); onoff = 0; break; } bitset = channel_program_flags + ch; prev_check = has_bitset(bitset); if(prev_check == onoff) { /* Not change program mark */ onoff <<= (8 * sizeof(onoff) - 1); set_bitset(bitset, &onoff, note, 1); return; } onoff <<= (8 * sizeof(onoff) - 1); set_bitset(bitset, &onoff, note, 1); check = has_bitset(bitset); if(prev_check ^ check) { vt100_move(8 + ch, VT100_COLS - 21); if(check) { vt100_set_attr(VT100_ATTR_BOLD); putc('*', stdout); vt100_reset_attr(); } else { putc(' ', stdout); } } } static void ctl_program(int ch, int val, void *comm) { int pr; if(ch >= 16) return; if (!ctl.trace_playing || midi_trace.flush_flag) return; if(channel[ch].special_sample) pr = val = channel[ch].special_sample; else pr = val + progbase; vt100_move(8+ch, VT100_COLS-21); if (ISDRUMCHANNEL(ch)) { vt100_set_attr(VT100_ATTR_BOLD); printf(" %03d", pr); vt100_reset_attr(); } else printf(" %03d", pr); if(comm != NULL) indicator_set_prog(ch, val, (char *)comm); } static void ctl_volume(int ch, int val) { if(ch >= 16) return; if (!ctl.trace_playing || midi_trace.flush_flag) return; vt100_move(8 + ch, VT100_COLS - 16); printf("%3d", (val * 100) / 127); } static void ctl_expression(int ch, int val) { if(ch >= 16) return; if (!ctl.trace_playing || midi_trace.flush_flag) return; vt100_move(8 + ch, VT100_COLS - 12); printf("%3d", (val * 100) / 127); } static void ctl_panning(int ch, int val) { if(ch >= 16) return; if (!ctl.trace_playing || midi_trace.flush_flag) return; vt100_move(8 + ch, VT100_COLS - 8); if (val==NO_PANNING) fputs(" ", stdout); else if (val<5) fputs(" L ", stdout); else if (val>123) fputs(" R ", stdout); else if (val>60 && val<68) fputs(" C ", stdout); else { val = (100*(val-64))/64; /* piss on curses */ if (val<0) { putc('-', stdout); val=-val; } else putc('+', stdout); printf("%02d", val); } } static void ctl_sustain(int ch, int val) { if(ch >= 16) return; if (!ctl.trace_playing || midi_trace.flush_flag) return; vt100_move(8 + ch, VT100_COLS - 4); if (val) putc('S', stdout); else putc(' ', stdout); } static void ctl_pitch_bend(int ch, int val) { if(ch >= 16) return; if (!ctl.trace_playing || midi_trace.flush_flag) return; vt100_move(8+ch, VT100_COLS-2); if (val==-1) putc('=', stdout); else if (val>0x2000) putc('+', stdout); else if (val<0x2000) putc('-', stdout); else putc(' ', stdout); } /*ARGSUSED*/ static void ctl_lyric(uint16 lyricid) { char *lyric; lyric = event2string(lyricid); if(lyric != NULL) { /* EAW -- if not a true KAR lyric, ignore \r, treat \n as \r */ if (*lyric != ME_KARAOKE_LYRIC) { while (strchr(lyric, '\r')) { *(strchr(lyric, '\r')) = ' '; } while (strchr(lyric, '\n')) { *(strchr(lyric, '\n')) = '\r'; } } if(*lyric == ME_KARAOKE_LYRIC) { if(lyric[1] == '/') { display_lyric("\n", LYRIC_WORD_NOSEP); display_lyric(lyric + 2, LYRIC_WORD_NOSEP); } else if(lyric[1] == '\\') { display_lyric("\r", LYRIC_WORD_NOSEP); display_lyric(lyric + 2, LYRIC_WORD_NOSEP); } else if(lyric[1] == '@' && lyric[2] == 'T') { if(ctl.trace_playing) { display_lyric("\n", LYRIC_WORD_NOSEP); display_lyric(lyric + 3, LYRIC_WORD_SEP); } else display_title(lyric + 3); } else if(lyric[1] == '@' && lyric[2] == 'L') { init_lyric(lyric + 3); } else display_lyric(lyric + 1, LYRIC_WORD_NOSEP); } else { if(*lyric == ME_CHORUS_TEXT || *lyric == ME_INSERT_TEXT) display_lyric("\r", LYRIC_WORD_SEP); display_lyric(lyric + 1, LYRIC_WORD_SEP); } } } static void ctl_reset(void) { int i,j,c; char *title; if (!ctl.trace_playing) return; c = (VT100_COLS - 24) / 12 * 12; if(c <= 0) c = 1; for (i=0; i<16; i++) { vt100_move(8+i, 3); for (j=0; j 0) ctl_pitch_bend(i, -1); else ctl_pitch_bend(i, channel[i].pitchbend); clear_bitset(channel_program_flags + i, 0, 128); } reset_indicator(); display_lyric(NULL, LYRIC_WORD_NOSEP); if((title = get_midi_title(NULL)) != NULL) display_lyric(title, LYRIC_WORD_NOSEP); ctl_refresh(); } /***********************************************************************/ /*ARGSUSED*/ static int ctl_open(int using_stdin, int using_stdout) { int i; vt100_init_screen(); ctl.opened=1; vt100_move(0, 0); fprintf(stdout, "TiMidity++ %s%s" NLS, (strcmp(timidity_version, "current")) ? "v" : "", timidity_version); vt100_move(0, VT100_COLS-45); fputs("(C) 1995 Tuukka Toivonen ", stdout); vt100_move(1,0); fputs("vt100 Interface mode - Written by Masanao Izumo ", stdout); vt100_move(3,0); fputs("File:", stdout); vt100_move(4,0); if (ctl.trace_playing) { fputs("Time:", stdout); vt100_move(4,6+6+1); putc('/', stdout); vt100_move(4,40); printf("Voices: /%3d", voices); } else { fputs("Time:", stdout); vt100_move(4,6+6+1); putc('/', stdout); } vt100_move(4,VT100_COLS-20); fputs("Master volume:", stdout); vt100_move(5,0); for (i=0; i= 16) selected_channel -= 17; if(selected_channel != -1) { vt100_move(8 + selected_channel, 0); vt100_set_attr(VT100_ATTR_BOLD); printf("%02d", selected_channel + 1); vt100_reset_attr(); if(instr_comment[selected_channel].comm != NULL) { if(indicator_mode != INDICATOR_DEFAULT) reset_indicator(); next_indicator_chan = selected_channel; } } } static int ctl_read(int32 *valp) { char *cmd; if((cmd = vt100_getline()) == NULL) return RC_NONE; switch(cmd[0]) { case 'q': trace_flush(); return RC_QUIT; case 'V': *valp = 10 * char_count(cmd, cmd[0]); return RC_CHANGE_VOLUME; case 'v': *valp =- 10 * char_count(cmd, cmd[0]); return RC_CHANGE_VOLUME; #if 0 case '1': case '2': case '3': *valp=cmd[0] - '2'; return RC_CHANGE_REV_EFFB; case '4': case '5': case '6': *valp = cmd[0] - '5'; return RC_CHANGE_REV_TIME; #endif case 's': return RC_TOGGLE_PAUSE; case 'n': return RC_NEXT; case 'p': return RC_REALLY_PREVIOUS; case 'r': return RC_RESTART; case 'f': *valp=play_mode->rate * char_count(cmd, cmd[0]); return RC_FORWARD; case 'b': *valp=play_mode->rate * char_count(cmd, cmd[0]); return RC_BACK; case '+': *valp = char_count(cmd, cmd[0]); return RC_KEYUP; case '-': *valp = -char_count(cmd, cmd[0]); return RC_KEYDOWN; case '>': *valp = char_count(cmd, cmd[0]); return RC_SPEEDUP; case '<': *valp = char_count(cmd, cmd[0]); return RC_SPEEDDOWN; case 'O': *valp = char_count(cmd, cmd[0]); return RC_VOICEINCR; case 'o': *valp = char_count(cmd, cmd[0]); return RC_VOICEDECR; case 'c': *valp = char_count(cmd, cmd[0]); move_select_channel(*valp); break; case 'C': *valp = char_count(cmd, cmd[0]); move_select_channel(-*valp); break; case 'd': if(selected_channel != -1) { *valp = selected_channel; return RC_TOGGLE_DRUMCHAN; } break; case 'g': return RC_TOGGLE_SNDSPEC; } if(cmd[0] == '\033' && cmd[1] == '[') { switch(cmd[2]) { case 'A': *valp=10; return RC_CHANGE_VOLUME; case 'B': *valp=-10; return RC_CHANGE_VOLUME; case 'C': *valp=play_mode->rate; return RC_FORWARD; case 'D': *valp=play_mode->rate; return RC_BACK; } return RC_NONE; } return RC_NONE; } static int cmsg(int type, int verbosity_level, char *fmt, ...) { va_list ap; if ((type==CMSG_TEXT || type==CMSG_INFO || type==CMSG_WARNING) && ctl.verbosity 0 && FD_ISSET(0, &fds) != 0) { if(fgets(cmd, sizeof(cmd), stdin) == NULL) { rewind(stdin); return NULL; } return cmd; } return NULL; } #else /* Windows */ /* Define VT100_CBREAK_MODE if you want to emulate like ncurses mode */ /* #define VT100_CBREAK_MODE */ #include static char *vt100_getline(void) { static char cmd[VT100_COLS]; static int cmdlen = 0; int c; if(kbhit()) { c = getch(); if(c == 'q' || c == 3 || c == 4) return "q"; if(c == '\r') c = '\n'; #ifdef VT100_CBREAK_MODE cmd[0] = c; cmd[1] = '\0'; return cmd; #else if(cmdlen < sizeof(cmd) - 1) cmd[cmdlen++] = (char)c; if(c == '\n') { cmd[cmdlen] = '\0'; cmdlen = 0; return cmd; } #endif /* VT100_CBREAK_MODE */ } return NULL; } #endif /* Indicator */ static void reset_indicator(void) { int i; memset(comment_indicator_buffer, ' ', indicator_width - 1); comment_indicator_buffer[indicator_width - 1] = '\0'; next_indicator_chan = -1; indicator_last_update = get_current_calender_time(); indicator_mode = INDICATOR_DEFAULT; indicator_msgptr = NULL; for(i = 0; i < MAX_CHANNELS; i++) { instr_comment[i].last_note_on = 0.0; instr_comment[i].comm = channel_instrum_name(i); } } static void update_indicator(void) { double t; int i; char c; t = get_current_calender_time(); if(indicator_mode != INDICATOR_DEFAULT) { int save_chan; if(indicator_last_update + SCRMODE_OUT_THRESHOLD > t) return; save_chan = next_indicator_chan; reset_indicator(); next_indicator_chan = save_chan; } else { if(indicator_last_update + INDICATOR_UPDATE_TIME > t) return; } indicator_last_update = t; if(indicator_msgptr != NULL && *indicator_msgptr == '\0') indicator_msgptr = NULL; if(indicator_msgptr == NULL) { if(next_indicator_chan >= 0 && instr_comment[next_indicator_chan].comm != NULL && *instr_comment[next_indicator_chan].comm) { current_indicator_chan = next_indicator_chan; } else { int prog; prog = instr_comment[current_indicator_chan].prog; for(i = 0; i < MAX_CHANNELS; i++) { current_indicator_chan++; if(current_indicator_chan == MAX_CHANNELS) current_indicator_chan = 0; if(instr_comment[current_indicator_chan].comm != NULL && *instr_comment[current_indicator_chan].comm && instr_comment[current_indicator_chan].prog != prog && (instr_comment[current_indicator_chan].last_note_on + CHECK_NOTE_SLEEP_TIME > t || instr_comment[current_indicator_chan].disp_cnt == 0)) break; } if(i == MAX_CHANNELS) return; } next_indicator_chan = -1; if(instr_comment[current_indicator_chan].comm == NULL || *instr_comment[current_indicator_chan].comm == '\0') return; snprintf(current_indicator_message, indicator_width, "%03d:%s ", instr_comment[current_indicator_chan].prog, instr_comment[current_indicator_chan].comm); instr_comment[current_indicator_chan].disp_cnt++; indicator_msgptr = current_indicator_message; } c = *indicator_msgptr++; for(i = 0; i < indicator_width - 2; i++) comment_indicator_buffer[i] = comment_indicator_buffer[i + 1]; comment_indicator_buffer[indicator_width - 2] = c; vt100_move(msg_row, 0); fputs(comment_indicator_buffer, stdout); ctl_refresh(); } static void indicator_chan_update(int ch) { double t; t = get_current_calender_time(); if(next_indicator_chan == -1 && instr_comment[ch].last_note_on + CHECK_NOTE_SLEEP_TIME < t) next_indicator_chan = ch; instr_comment[ch].last_note_on = t; instr_comment[ch].disp_cnt = 0; if(instr_comment[ch].comm == NULL) { if((instr_comment[ch].comm = default_instrument_name) == NULL) { if(!ISDRUMCHANNEL(ch)) instr_comment[ch].comm = ""; else instr_comment[ch].comm = ""; } } } static void indicator_set_prog(int ch, int val, char *comm) { instr_comment[ch].comm = comm; instr_comment[ch].prog = val; instr_comment[ch].last_note_on = 0.0; } static void display_lyric(char *lyric, int sep) { char *p; int len, idlen, sepoffset; static int crflag = 0; if(lyric == NULL) { indicator_last_update = get_current_calender_time(); crflag = 0; return; } if(indicator_mode != INDICATOR_LYRIC || crflag) { memset(comment_indicator_buffer, 0, indicator_width); vt100_move(lyric_row, 0); vt100_clrtoeol(); ctl_refresh(); indicator_mode = INDICATOR_LYRIC; crflag = 0; } if(*lyric == '\0') { indicator_last_update = get_current_calender_time(); return; } else if(*lyric == '\n') { if(!ctl.trace_playing) { crflag = 1; lyric_row++; vt100_move(lyric_row, 0); return; } else lyric = " / "; } if(strchr(lyric, '\r') != NULL) { crflag = 1; if(!ctl.trace_playing) { int i; for(i = title_row+1; i <= lyric_row; i++) { vt100_move(i, 0); vt100_clrtoeol(); } lyric_row = title_row+1; } if(lyric[0] == '\r' && lyric[1] == '\0') { indicator_last_update = get_current_calender_time(); return; } } idlen = strlen(comment_indicator_buffer); len = strlen(lyric); if(sep) { while(idlen > 0 && comment_indicator_buffer[idlen - 1] == ' ') comment_indicator_buffer[--idlen] = '\0'; while(len > 0 && lyric[len - 1] == ' ') len--; } if(len == 0) { /* update time stamp */ indicator_last_update = get_current_calender_time(); reuse_mblock(&tmpbuffer); return; } sepoffset = (sep != 0); if(len >= indicator_width - 2) { memcpy(comment_indicator_buffer, lyric, indicator_width - 1); comment_indicator_buffer[indicator_width - 1] = '\0'; } else if(idlen == 0) { memcpy(comment_indicator_buffer, lyric, len); comment_indicator_buffer[len] = '\0'; } else if(len + idlen + 2 < indicator_width) { if(sep) comment_indicator_buffer[idlen] = sep; memcpy(comment_indicator_buffer + idlen + sepoffset, lyric, len); comment_indicator_buffer[idlen + sepoffset + len] = '\0'; } else { int spaces; p = comment_indicator_buffer; spaces = indicator_width - idlen - 2; while(spaces < len) { char *q; /* skip one word */ if((q = strchr(p, ' ')) == NULL) { p = NULL; break; } do q++; while(*q == ' '); spaces += (q - p); p = q; } if(p == NULL) { vt100_move(lyric_row, 0); vt100_clrtoeol(); memcpy(comment_indicator_buffer, lyric, len); comment_indicator_buffer[len] = '\0'; } else { int d, l, r, i, j; d = (p - comment_indicator_buffer); l = strlen(p); r = len - (indicator_width - 2 - l - d); j = d - r; for(i = 0; i < j; i++) comment_indicator_buffer[i] = ' '; for(i = 0; i < l; i++) comment_indicator_buffer[j + i] = comment_indicator_buffer[d + i]; if(sep) comment_indicator_buffer[j + i] = sep; memcpy(comment_indicator_buffer + j + i + sepoffset, lyric, len); comment_indicator_buffer[j + i + sepoffset + len] = '\0'; } } vt100_move(lyric_row, 0); fputs(comment_indicator_buffer, stdout); ctl_refresh(); reuse_mblock(&tmpbuffer); indicator_last_update = get_current_calender_time(); } static void display_title(char *title) { vt100_move(title_row, 0); printf("Title:"); vt100_move(title_row++, 7); vt100_set_attr(VT100_ATTR_BOLD); printf("%s", title); vt100_reset_attr(); lyric_row = title_row + 1; } static void init_lyric(char *lang) { int i; if(ctl.trace_playing) return; msg_row = 6; for(i = 6; i <= VT100_ROWS; i++) { vt100_move(i, 0); vt100_clrtoeol(); } } static void ctl_event(CtlEvent *e) { switch(e->type) { case CTLE_NOW_LOADING: ctl_file_name((char *)e->v1); break; case CTLE_LOADING_DONE: break; case CTLE_PLAY_START: ctl_total_time((int)e->v1); break; case CTLE_PLAY_END: break; case CTLE_TEMPO: break; case CTLE_METRONOME: update_indicator(); break; case CTLE_CURRENT_TIME: ctl_current_time((int)e->v1, (int)e->v2); break; case CTLE_NOTE: ctl_note((int)e->v1, (int)e->v2, (int)e->v3, (int)e->v4); break; case CTLE_MASTER_VOLUME: ctl_master_volume((int)e->v1); break; case CTLE_PROGRAM: ctl_program((int)e->v1, (int)e->v2, (char *)e->v3); break; case CTLE_VOLUME: ctl_volume((int)e->v1, (int)e->v2); break; case CTLE_EXPRESSION: ctl_expression((int)e->v1, (int)e->v2); break; case CTLE_PANNING: ctl_panning((int)e->v1, (int)e->v2); break; case CTLE_SUSTAIN: ctl_sustain((int)e->v1, (int)e->v2); break; case CTLE_PITCH_BEND: ctl_pitch_bend((int)e->v1, (int)e->v2); break; case CTLE_MOD_WHEEL: ctl_pitch_bend((int)e->v1, e->v2 ? -1 : 0x2000); break; case CTLE_CHORUS_EFFECT: break; case CTLE_REVERB_EFFECT: break; case CTLE_LYRIC: ctl_lyric((int)e->v1); break; case CTLE_REFRESH: ctl_refresh(); break; case CTLE_RESET: ctl_reset(); break; } } /* * interface__loader(); */ ControlMode *interface_T_loader(void) { return &ctl; } TiMidity++-2.13.2/interface/xaw.h0100644004711200001440000000576607520450060015621 0ustar tamukiusers/* TiMidity++ -- MIDI to WAVE converter and player Copyright (C) 1999-2002 Masanao Izumo Copyright (C) 1995 Tuukka Toivonen 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA xaw.h: written by Yoshishige Arai (ryo2@on.rim.or.jp) 12/8/98 */ #ifndef _XAW_H_ #define _XAW_H_ /* * XAW configurations */ #if HAVE_SYS_PARAM_H #include #endif /* Define to use libXaw3d */ /* #define XAW3D */ /* Define to use Japanese and so on */ #define I18N /* Define to use scrollable Text widget instead of Label widget */ /* #define WIDGET_IS_LABEL_WIDGET */ /*** Initial dot file name at home directory ***/ #define INITIAL_CONFIG ".xtimidity" /* * CONSTANTS FOR XAW MENUS */ #define MAXVOLUME MAX_AMPLIFICATION #define MAX_XAW_MIDI_CHANNELS 16 #define APP_CLASS "TiMidity" #define APP_NAME "timidity" #ifndef PATH_MAX #define PATH_MAX 512 #endif #define MAX_DIRECTORY_ENTRY BUFSIZ #define LF 0x0a #define SPACE 0x20 #define TAB 0x09 #define MODUL_N 0 #define PORTA_N 1 #define NRPNV_N 2 #define REVERB_N 3 #define CHPRESSURE_N 4 #define OVERLAPV_N 5 #define TXTMETA_N 6 #define MAX_OPTION_N 7 #define MODUL_BIT (1< Copyright (C) 1995 Tuukka Toivonen 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA xaw_c.c - XAW Interface from Tomokazu Harada Yoshishige Arai */ #ifdef HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ #include #include #include #include #ifndef NO_STRING_H #include #else #include #endif #ifdef HAVE_UNISTD_H #include #endif /* HAVE_UNISTD_H */ #include "timidity.h" #include "common.h" #include "instrum.h" #include "playmidi.h" #include "readmidi.h" #include "output.h" #include "controls.h" #include "miditrace.h" #include "timer.h" #include "xaw.h" static void ctl_current_time(int secs, int v); static void ctl_lyric(int lyricid); static int ctl_open(int using_stdin, int using_stdout); static void ctl_close(void); static int ctl_read(int32 *valp); static int cmsg(int type, int verbosity_level, char *fmt, ...); static void ctl_pass_playing_list(int number_of_files, char *list_of_files[]); static void ctl_event(CtlEvent *e); static void a_pipe_open(void); static int a_pipe_ready(void); static void ctl_master_volume(int); static void ctl_total_time(int); void a_pipe_write(char *); int a_pipe_read(char *,int); static void a_pipe_write_msg(char *msg); static void ctl_event(CtlEvent *e); static void ctl_refresh(void); static void ctl_total_time(int tt); static void ctl_note(int status, int ch, int note, int velocity); static void ctl_program(int ch, int val, void *vp); static void ctl_drumpart(int ch, int is_drum); static void ctl_volume(int ch, int val); static void ctl_expression(int ch, int val); static void ctl_panning(int ch, int val); static void ctl_sustain(int ch, int val); static void ctl_pitch_bend(int ch, int val); static void ctl_reset(void); static void update_indicator(void); static void set_otherinfo(int ch, int val, char c); static void xaw_add_midi_file(char *additional_path); static void xaw_delete_midi_file(int delete_num); static void xaw_output_flist(void); static int ctl_blocking_read(int32 *valp); static void shuffle(int n,int *a); static double indicator_last_update = 0; #define EXITFLG_QUIT 1 #define EXITFLG_AUTOQUIT 2 static int exitflag=0,randomflag=0,repeatflag=0,selectflag=0; static int xaw_ready=0; static int number_of_files; static char **list_of_files; static char **titles; static int *file_table; extern int amplitude; /**********************************************/ /* export the interface functions */ #define ctl xaw_control_mode ControlMode ctl= { "XAW interface", 'a', 1,0,0, 0, ctl_open, ctl_close, ctl_pass_playing_list, ctl_read, cmsg, ctl_event }; static char local_buf[300]; /***********************************************************************/ /* Put controls on the pipe */ /***********************************************************************/ #define CMSG_MESSAGE 16 static int cmsg(int type, int verbosity_level, char *fmt, ...) { va_list ap; char *buff; MBlockList pool; if ((type==CMSG_TEXT || type==CMSG_INFO || type==CMSG_WARNING) && ctl.verbosityrate; ctl_current_time(0, 0); sprintf(local_buf,"m%d",play_system_mode); a_pipe_write(local_buf); } static void ctl_master_volume(int mv) { sprintf(local_buf,"V %03d", mv); amplitude=atoi(local_buf+2); if (amplitude < 0) amplitude = 0; if (amplitude > MAXVOLUME) amplitude = MAXVOLUME; a_pipe_write(local_buf); } static void ctl_volume(int ch, int val) { if(!ctl.trace_playing) return; if(ch >= MAX_XAW_MIDI_CHANNELS) return; sprintf(local_buf, "PV%c%d", ch+'A', val); a_pipe_write(local_buf); } static void ctl_expression(int ch, int val) { if(!ctl.trace_playing) return; if(ch >= MAX_XAW_MIDI_CHANNELS) return; sprintf(local_buf, "PE%c%d", ch+'A', val); a_pipe_write(local_buf); } static void ctl_panning(int ch, int val) { if(!ctl.trace_playing) return; if(ch >= MAX_XAW_MIDI_CHANNELS) return; sprintf(local_buf, "PA%c%d", ch+'A', val); a_pipe_write(local_buf); } static void ctl_sustain(int ch, int val) { if(!ctl.trace_playing) return; if(ch >= MAX_XAW_MIDI_CHANNELS) return; sprintf(local_buf, "PS%c%d", ch+'A', val); a_pipe_write(local_buf); } static void ctl_pitch_bend(int ch, int val) { if(!ctl.trace_playing) return; if(ch >= MAX_XAW_MIDI_CHANNELS) return; sprintf(local_buf, "PB%c%d", ch+'A', val); a_pipe_write(local_buf); } static void ctl_lyric(int lyricid) { char *lyric; static int lyric_col = 0; static char lyric_buf[300]; lyric = event2string(lyricid); if(lyric != NULL) { if(lyric[0] == ME_KARAOKE_LYRIC) { if(lyric[1] == '/' || lyric[1] == '\\') { strncpy(lyric_buf, lyric + 2, sizeof(lyric_buf) - 1); a_pipe_write_msg(lyric_buf); lyric_col = strlen(lyric_buf); } else if(lyric[1] == '@') { if(lyric[2] == 'L') snprintf(lyric_buf, sizeof(lyric_buf), "Language: %s", lyric + 3); else if(lyric[2] == 'T') snprintf(lyric_buf, sizeof(lyric_buf), "Title: %s", lyric + 3); else strncpy(lyric_buf, lyric + 1, sizeof(lyric_buf) - 1); a_pipe_write_msg(lyric_buf); lyric_col = 0; } else { strncpy(lyric_buf + lyric_col, lyric + 1, sizeof(lyric_buf) - lyric_col - 1); a_pipe_write_msg(lyric_buf); lyric_col += strlen(lyric + 1); } } else { lyric_col = 0; a_pipe_write_msg(lyric + 1); } } } /*ARGSUSED*/ static int ctl_open(int using_stdin, int using_stdout) { ctl.opened=1; set_trace_loop_hook(update_indicator); /* The child process won't come back from this call */ a_pipe_open(); return 0; } static void ctl_close(void) { if (ctl.opened) { a_pipe_write("Q"); ctl.opened=0; xaw_ready=0; } } static void xaw_add_midi_file(char *additional_path) { char *files[1],**ret,**tmp; int i,nfiles,nfit; char *p; files[0] = additional_path; nfiles = 1; ret = expand_file_archives(files, &nfiles); if(ret == NULL) return; tmp = list_of_files; titles=(char **)safe_realloc(titles,(number_of_files+nfiles)*sizeof(char *)); list_of_files=(char **)safe_malloc((number_of_files+nfiles)*sizeof(char *)); for (i=0;i= 0) { p=strrchr(ret[i],'/'); if (p==NULL) p=ret[i]; else p++; titles[number_of_files+nfit]=(char *)safe_malloc(sizeof(char)*(strlen(p)+ 9)); list_of_files[number_of_files+nfit]=safe_strdup(ret[i]); sprintf(titles[number_of_files+nfit],"%d. %s",number_of_files+nfit+1,p); nfit++; } } if(nfit>0) { file_table=(int *)safe_realloc(file_table, (number_of_files+nfit)*sizeof(int)); for(i = number_of_files; i < number_of_files + nfit; i++) file_table[i] = i; number_of_files+=nfit; sprintf(local_buf, "X %d", nfit); a_pipe_write(local_buf); for (i=0;i0) number_of_files -= 1; } } static void xaw_output_flist(void) { int i; sprintf(local_buf, "s%d",number_of_files); a_pipe_write(local_buf); for(i=0;irate * 10); return RC_FORWARD; case 'b': *valp=(int32)(play_mode->rate * 10); return RC_BACK; case 'S' : return RC_QUIT; case 'N' : return RC_NEXT; case 'B' : return RC_REALLY_PREVIOUS; case 'R' : repeatflag=atoi(local_buf+2);return RC_NONE; case 'D' : randomflag=atoi(local_buf+2);return RC_QUIT; case 'd' : n=atoi(local_buf+2); xaw_delete_midi_file(atoi(local_buf+2)); return RC_QUIT; case 'A' : xaw_delete_midi_file(-1); return RC_QUIT; case 'C' : n=atoi(local_buf+2); opt_chorus_control = n; return RC_QUIT; case 'E' : n=atoi(local_buf+2); opt_modulation_wheel = n & MODUL_BIT; opt_portamento = n & PORTA_BIT; opt_nrpn_vibrato = n & NRPNV_BIT; opt_reverb_control = !!(n & REVERB_BIT); opt_channel_pressure = n & CHPRESSURE_BIT; opt_overlap_voice_allow = n & OVERLAPV_BIT; opt_trace_text_meta_event = n & TXTMETA_BIT; return RC_QUIT; case 'F' : case 'L' : selectflag=atoi(local_buf+2);return RC_QUIT; case 'T' : a_pipe_read(local_buf,sizeof(local_buf)); n=atoi(local_buf+2); *valp= n * play_mode->rate; return RC_JUMP; case 'V' : a_pipe_read(local_buf,sizeof(local_buf)); amplification=atoi(local_buf+2); *valp=(int32)0; return RC_CHANGE_VOLUME; case '+': a_pipe_read(local_buf,sizeof(local_buf)); *valp = (int32)1; return RC_KEYUP; case '-': a_pipe_read(local_buf,sizeof(local_buf)); *valp = (int32)-1; return RC_KEYDOWN; case '>': a_pipe_read(local_buf,sizeof(local_buf)); *valp = (int32)1; return RC_SPEEDUP; case '<': a_pipe_read(local_buf,sizeof(local_buf)); *valp = (int32)1; return RC_SPEEDDOWN; case 'o': a_pipe_read(local_buf,sizeof(local_buf)); *valp = (int32)1; return RC_VOICEINCR; case 'O': a_pipe_read(local_buf,sizeof(local_buf)); *valp = (int32)1; return RC_VOICEDECR; case 'X': a_pipe_read(local_buf,sizeof(local_buf)); xaw_add_midi_file(local_buf + 2); return RC_NONE; case 's': xaw_output_flist();return RC_NONE; case 'g': return RC_TOGGLE_SNDSPEC; case 'q' : exitflag ^= EXITFLG_AUTOQUIT;return RC_NONE; case 'Q' : default : exitflag |= EXITFLG_QUIT;return RC_QUIT; } } } static int ctl_read(int32 *valp) { if (a_pipe_ready()<=0) return RC_NONE; return ctl_blocking_read(valp); } static void shuffle(int n,int *a) { int i,j,tmp; for (i=0;i= 0) { p=strrchr(init_list_of_files[i],'/'); if (p==NULL) { p=safe_strdup(init_list_of_files[i]); } else p++; list_of_files[j]= safe_strdup(init_list_of_files[i]); titles[j]=(char *)safe_malloc(sizeof(char)*(strlen(p)+ 9)); sprintf(titles[j],"%d. %s",j+1,p); j++; number_of_files = j; } } titles=(char **)safe_realloc(titles,init_number_of_files*sizeof(char *)); list_of_files=(char **)safe_realloc(list_of_files,init_number_of_files*sizeof(char *)); /* Send title string */ sprintf(local_buf,"%d",number_of_files); a_pipe_write(local_buf); for (i=0;i0) current_no--; command=RC_LOAD_FILE; continue; } command=ctl_blocking_read(&val); } } } /* ------ Pipe handlers ----- */ static int pipe_in_fd,pipe_out_fd; extern void a_start_interface(int); static void a_pipe_open(void) { int cont_inter[2],inter_cont[2]; if (pipe(cont_inter)<0 || pipe(inter_cont)<0) exit(1); if (fork()==0) { close(cont_inter[1]); close(inter_cont[0]); pipe_in_fd=cont_inter[0]; pipe_out_fd=inter_cont[1]; a_start_interface(pipe_in_fd); } close(cont_inter[0]); close(inter_cont[1]); pipe_in_fd=inter_cont[0]; pipe_out_fd=cont_inter[1]; } void a_pipe_write(char *buf) { write(pipe_out_fd,buf,strlen(buf)); write(pipe_out_fd,"\n",1); } static int a_pipe_ready(void) { fd_set fds; static struct timeval tv; int cnt; FD_ZERO(&fds); FD_SET(pipe_in_fd,&fds); tv.tv_sec=0; tv.tv_usec=0; if((cnt=select(pipe_in_fd+1,&fds,NULL,NULL,&tv))<0) return -1; return cnt > 0 && FD_ISSET(pipe_in_fd, &fds) != 0; } int a_pipe_read(char *buf,int bufsize) { int i; bufsize--; for (i=0;i 0 && (i = read(pipe_in_fd, buf + j, n - j)) > 0) j += i; return j; } static void a_pipe_write_msg(char *msg) { int msglen; char buf[2 + sizeof(int)], *p, *q; /* strip '\r' */ p = q = msg; while(*q) { if(*q != '\r') *p++ = *q; q++; } *p = '\0'; msglen = strlen(msg) + 1; /* +1 for '\n' */ buf[0] = 'L'; buf[1] = '\n'; memcpy(buf + 2, &msglen, sizeof(int)); write(pipe_out_fd, buf, sizeof(buf)); write(pipe_out_fd, msg, msglen - 1); write(pipe_out_fd, "\n", 1); } static void ctl_note(int status, int ch, int note, int velocity) { char c; if(ch >= MAX_XAW_MIDI_CHANNELS) return; if(!ctl.trace_playing || midi_trace.flush_flag) return; c = '.'; switch(status) { case VOICE_ON: c = '*'; break; case VOICE_SUSTAINED: c = '&'; break; case VOICE_FREE: case VOICE_DIE: case VOICE_OFF: default: break; } snprintf(local_buf,sizeof(local_buf),"Y%c%c%03d%d",ch+'A',c,(unsigned char)note,velocity); a_pipe_write(local_buf); } static void ctl_program(int ch, int val, void *comm) { if(ch >= MAX_XAW_MIDI_CHANNELS) return; if(!ctl.trace_playing) return; if(!IS_CURRENT_MOD_FILE) val += progbase; sprintf(local_buf, "PP%c%d", ch+'A', val); a_pipe_write(local_buf); if (comm != NULL) { sprintf(local_buf, "I%c%s", ch+'A', (char *)comm); if (ISDRUMCHANNEL(ch)) sprintf(local_buf, "I%c%s", ch+'A', (!strlen((char *)comm))? "":(char *)comm); a_pipe_write(local_buf); } } static void ctl_drumpart(int ch, int is_drum) { if(ch >= MAX_XAW_MIDI_CHANNELS) return; if(!ctl.trace_playing) return; sprintf(local_buf, "i%c%c", ch+'A', is_drum+'A');; a_pipe_write(local_buf); } static void ctl_event(CtlEvent *e) { switch(e->type) { case CTLE_LOADING_DONE: break; case CTLE_CURRENT_TIME: ctl_current_time((int)e->v1, (int)e->v2); break; case CTLE_PLAY_START: ctl_total_time((int)e->v1); break; case CTLE_PLAY_END: break; case CTLE_TEMPO: break; case CTLE_METRONOME: break; case CTLE_NOTE: ctl_note((int)e->v1, (int)e->v2, (int)e->v3, (int)e->v4); break; case CTLE_PROGRAM: ctl_program((int)e->v1, (int)e->v2, (char *)e->v3); break; case CTLE_DRUMPART: ctl_drumpart((int)e->v1, (int)e->v2); break; case CTLE_VOLUME: ctl_volume((int)e->v1, (int)e->v2); break; case CTLE_EXPRESSION: ctl_expression((int)e->v1, (int)e->v2); break; case CTLE_PANNING: ctl_panning((int)e->v1, (int)e->v2); break; case CTLE_SUSTAIN: ctl_sustain((int)e->v1, (int)e->v2); break; case CTLE_PITCH_BEND: ctl_pitch_bend((int)e->v1, (int)e->v2); break; case CTLE_MOD_WHEEL: ctl_pitch_bend((int)e->v1, e->v2 ? -1 : 0x2000); break; case CTLE_CHORUS_EFFECT: set_otherinfo((int)e->v1, (int)e->v2, 'c'); break; case CTLE_REVERB_EFFECT: set_otherinfo((int)e->v1, (int)e->v2, 'r'); break; case CTLE_LYRIC: ctl_lyric((int)e->v1); break; case CTLE_MASTER_VOLUME: ctl_master_volume((int)e->v1); break; case CTLE_REFRESH: ctl_refresh(); break; case CTLE_RESET: ctl_reset(); break; } } static void ctl_refresh(void) { } static void set_otherinfo(int ch, int val, char c) { if(!ctl.trace_playing) return; if(ch >= MAX_XAW_MIDI_CHANNELS) return; sprintf(local_buf, "P%c%c%d", c, ch+'A', val); a_pipe_write(local_buf); } static void ctl_reset(void) { int i; if(!ctl.trace_playing) return; indicator_last_update = get_current_calender_time(); for (i=0; itone[channel[i].program].instrument == NULL) { b = 0; bank = tonebank[0]; } set_otherinfo(i, channel[i].bank, 'b'); if (opt_reverb_control) set_otherinfo(i, get_reverb_level(i), 'r'); if(opt_chorus_control) set_otherinfo(i, get_chorus_level(i), 'c'); } ctl_volume(i, channel[i].volume); ctl_expression(i, channel[i].expression); ctl_panning(i, channel[i].panning); ctl_sustain(i, channel[i].sustain); if(channel[i].pitchbend == 0x2000 && channel[i].mod.val > 0) ctl_pitch_bend(i, -1); else ctl_pitch_bend(i, channel[i].pitchbend); } sprintf(local_buf, "R"); a_pipe_write(local_buf); } static void update_indicator(void) { double t, diff; if(!ctl.trace_playing) return; t = get_current_calender_time(); diff = t - indicator_last_update; if(diff > XAW_UPDATE_TIME) { sprintf(local_buf, "U"); a_pipe_write(local_buf); indicator_last_update = t; } } /* * interface__loader(); */ ControlMode *interface_a_loader(void) { return &ctl; } TiMidity++-2.13.2/interface/xaw_i.c0100644004711200001440000040050110125651536016114 0ustar tamukiusers/* TiMidity++ -- MIDI to WAVE converter and player Copyright (C) 1999-2004 Masanao Izumo Copyright (C) 1995 Tuukka Toivonen 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA xaw_i.c - XAW Interface from Tomokazu Harada modified by Yoshishige Arai */ #ifdef HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ #include #include #include #ifdef HAVE_UNISTD_H #include #endif #ifndef NO_STRING_H #include #else #include #endif #include #include #include #include "xaw.h" #include #include #include #include #include #include #include #ifdef OFFIX #include #include #endif #include #include #include #include #include #include #include #include #include #include #include "check.xbm" #include "arrow.xbm" #include "on.xbm" #include "off.xbm" #include "timidity.h" #include "common.h" #include "instrum.h" #include "playmidi.h" #include "readmidi.h" #include "controls.h" #include "timer.h" #include "strtab.h" #ifndef S_ISDIR #define S_ISDIR(mode) (((mode)&0xF000) == 0x4000) #endif /* S_ISDIR */ #define TRACE_WIDTH 627 /* default height of trace_vport */ #define TRACEVPORT_WIDTH (TRACE_WIDTH+12) #define TRACE_WIDTH_SHORT 388 #define TRACEV_OFS 22 #define TRACE_FOOT 16 #define TRACEH_OFS 0 #define BAR_SPACE 20 #define BAR_HEIGHT 16 static int VOLUME_LABEL_WIDTH = 80; #define MAX_TRACE_HEIGHT 560 #if (MAX_XAW_MIDI_CHANNELS*BAR_SPACE+TRACE_FOOT+14 > MAX_TRACE_HEIGHT) #define TRACE_HEIGHT MAX_TRACE_HEIGHT #else #define TRACE_HEIGHT (MAX_XAW_MIDI_CHANNELS*BAR_SPACE+TRACE_FOOT+14) #endif #define VOICES_NUM_OFS 6 #define TTITLE_OFS 120 #define FILEVPORT_HEIGHT 336 #define FILEVPORT_WIDTH 272 #define BARSCALE2 0.31111 /* velocity scale (60-4)/180 */ #define BARSCALE3 0.28125 /* volume scale (40-4)/128 */ #define BARSCALE4 0.25 /* expression scale (36-4)/128 */ #define BARSCALE5 0.385827 /* expression scale (53-4)/128 */ static int currwidth = 2; static Dimension rotatewidth[] = {TRACE_WIDTH_SHORT, 592, TRACE_WIDTH+8}; typedef struct { int col; /* column number */ char **cap; /* caption strings array */ int *w; /* column width array */ int *ofs; /* column offset array */ } Tplane; static int plane = 0; #define TCOLUMN 9 #define T2COLUMN 10 static char *caption[TCOLUMN] = {"ch"," vel"," vol","expr","prog","pan","pit"," instrument", " keyboard"}; static char *caption2[T2COLUMN] = {"ch"," vel"," vol","expr","prog","pan","bnk","reverb","chorus", " keyboard"}; static int BARH_SPACE[TCOLUMN]= {22,60,40,36,36,36,30,106,304}; #define BARH_OFS0 (TRACEH_OFS) #define BARH_OFS1 (BARH_OFS0+22) #define BARH_OFS2 (BARH_OFS1+60) #define BARH_OFS3 (BARH_OFS2+40) #define BARH_OFS4 (BARH_OFS3+36) #define BARH_OFS5 (BARH_OFS4+36) #define BARH_OFS6 (BARH_OFS5+36) #define BARH_OFS7 (BARH_OFS6+30) #define BARH_OFS8 (BARH_OFS7+106) static int bar0ofs[] = {BARH_OFS0,BARH_OFS1,BARH_OFS2,BARH_OFS3, BARH_OFS4,BARH_OFS5,BARH_OFS6,BARH_OFS7,BARH_OFS8}; static int BARH2_SPACE[T2COLUMN]= {22,60,40,36,36,36,30,53,53,304}; #define BARH2_OFS0 (TRACEH_OFS) #define BARH2_OFS1 (BARH2_OFS0+22) #define BARH2_OFS2 (BARH2_OFS1+60) #define BARH2_OFS3 (BARH2_OFS2+40) #define BARH2_OFS4 (BARH2_OFS3+36) #define BARH2_OFS5 (BARH2_OFS4+36) #define BARH2_OFS6 (BARH2_OFS5+36) #define BARH2_OFS7 (BARH2_OFS6+30) #define BARH2_OFS8 (BARH2_OFS7+53) #define BARH2_OFS9 (BARH2_OFS8+53) static int bar1ofs[] = {BARH2_OFS0,BARH2_OFS1,BARH2_OFS2,BARH2_OFS3, BARH2_OFS4,BARH2_OFS5,BARH2_OFS6,BARH2_OFS7,BARH2_OFS8,BARH2_OFS9}; static Tplane pl[] = { {TCOLUMN, caption, BARH_SPACE, bar0ofs}, {T2COLUMN, caption2, BARH2_SPACE, bar1ofs}, }; #define CL_C 0 /* column 0 = channel */ #define CL_VE 1 /* column 1 = velocity */ #define CL_VO 2 /* column 2 = volume */ #define CL_EX 3 /* column 3 = expression */ #define CL_PR 4 /* column 4 = program */ #define CL_PA 5 /* column 5 = panning */ #define CL_PI 6 /* column 6 = pitch bend */ #define CL_IN 7 /* column 7 = instrument name */ #define CL_BA 6 /* column 6 = bank */ #define CL_RE 7 /* column 7 = reverb */ #define CL_CH 8 /* column 8 = chorus */ #define INST_NAME_SIZE 16 #define INIT_FLISTNUM MAX_DIRECTORY_ENTRY static char *inst_name[MAX_XAW_MIDI_CHANNELS]; static int disp_inst_name_len = 13; #define UNTITLED_STR "" typedef struct { int id; String name; Boolean trap; Boolean bmflag; Widget widget; } ButtonRec; typedef struct { int id; int bit; Widget widget; } OptionRec; typedef struct { char *dirname; char *basename; } DirPath; void a_print_text(Widget,char *); static void drawProg(int,int,int,int,Boolean),drawPan(int,int,Boolean), draw1Chan(int,int,char),drawVol(int,int),drawExp(int,int),drawPitch(int,int), drawInstname(int,char *),drawDrumPart(int,int),drawBank(int,int), drawReverb(int,int),drawChorus(int,int),drawVoices(void),drawTitle(char *), quitCB(),playCB(),pauseCB(),stopCB(),prevCB(),nextCB(), optionsCB(),optionspopupCB(),optionscloseCB(),chorusCB(),optionsdestroyCB(), flistpopupCB(),flistcloseCB(), forwardCB(),backCB(),repeatCB(),randomCB(),menuCB(),sndspecCB(), volsetCB(),volupdownCB(),tuneslideCB(),filemenuCB(), fselectCB(),fdeleteCB(),fdelallCB(),backspaceCB(),aboutCB(),aboutcloseCB(), #ifndef WIDGET_IS_LABEL_WIDGET deleteTextCB(), #endif toggleMark(),popupLoad(),popdownLoad(),volupdownAction(),tuneslideAction(), tunesetAction(),a_readconfig(),a_saveconfig(),filemenuAction(), setDirAction(),setDirList(), drawBar(),redrawTrace(Boolean),completeDir(),ctl_channel_note(), drawKeyboardAll(),draw1Note(),redrawAction(),redrawCaption(), exchgWidth(),toggletrace(), checkRightAndPopupSubmenu(),popdownSubmenuCB(),popdownSubmenu(),leaveSubmenu(), addOneFile(int,int,char *,Boolean), flistMove(),closeParent(),createOptions(),createFlist(); static char *expandDir(),*strmatch(); static int configcmp(); static void pauseAction(),soundkeyAction(),speedAction(),voiceAction(); static Boolean IsTracePlaying(),IsEffectiveFile(); extern void a_pipe_write(char *); extern int a_pipe_read(char *,int); extern int a_pipe_nread(char *buf, int n); static void initStatus(void); static void xaw_vendor_setup(void); static void safe_getcwd(char *cwd, int maxlen); static Widget title_mb,title_sm,time_l,popup_load,popup_load_f,load_d,load_t; static Widget load_vport,load_flist,cwd_l,load_info, lyric_t; static Dimension lyric_height, base_height, text_height; static GC gc,gcs,gct,gc_xcopy; static Pixel bgcolor,menubcolor,textcolor,textbgcolor,text2bgcolor,buttonbgcolor, buttoncolor,togglecolor,tracecolor,volcolor,expcolor,pancolor,capcolor,rimcolor, boxcolor,suscolor,playcolor,revcolor,chocolor; static Pixel black,white; static Pixel barcol[MAX_XAW_MIDI_CHANNELS]; static Widget toplevel,m_box,base_f,file_mb,file_sm,bsb, quit_b,play_b,pause_b,stop_b,prev_b,next_b,fwd_b,back_b, random_b,repeat_b,b_box,v_box,t_box,vol_l0,vol_l,vol_bar,tune_l0,tune_l,tune_bar, trace_vport,trace,pbox,popup_opt,popup_optbox,popup_oclose, popup_about,popup_abox,popup_aok,about_lbl[5], file_vport,file_list,popup_file,popup_fbox,flist_cmdbox, popup_fplay,popup_fdelete,popup_fdelall,popup_fclose, modul_b,porta_b,nrpnv_b,chpressure_b,txtmeta_b,overlapv_b,reverb_b,chorus_b, modul_l,porta_l,nrpnv_l,chpressure_l,txtmeta_l,overlapv_l,reverb_l,chorus_l, modul_bb,porta_bb,nrpnv_bb,chpressure_bb,txtmeta_bb,overlapv_bb,reverb_bb,chorus_bb; static Widget *psmenu = NULL; static char local_buf[300]; static char window_title[300], *w_title; int amplitude = DEFAULT_AMPLIFICATION; #ifndef XAW_BITMAP_DIR #define XAW_BITMAP_DIR PKGLIBDIR "/bitmaps" #endif /* XAW_BITMAP_DIR */ String bitmapdir = XAW_BITMAP_DIR; Boolean arrangetitle,savelist; static char **current_flist = NULL; static int voices = 0, last_voice = 0, voices_num_width; static int maxentry_on_a_menu = 0,submenu_n = 0; #define OPTIONS_WINDOW 1 #define FLIST_WINDOW 2 #define ABOUT_WINDOW 4 static int popup_shell_exist = 0; typedef struct { Boolean confirmexit; Boolean repeat; Boolean autostart; Boolean autoexit; Boolean hidetext; Boolean shuffle; Boolean disptrace; int amplitude; int extendopt; int chorusopt; } Config; #define FLAG_NOTE_OFF 1 #define FLAG_NOTE_ON 2 #define FLAG_BANK 1 #define FLAG_PROG 2 #define FLAG_PROG_ON 4 #define FLAG_PAN 8 #define FLAG_SUST 16 #define FLAG_BENDT 32 typedef struct { int reset_panel; int multi_part; char v_flags[MAX_XAW_MIDI_CHANNELS]; int16 cnote[MAX_XAW_MIDI_CHANNELS]; int16 cvel[MAX_XAW_MIDI_CHANNELS]; int16 ctotal[MAX_XAW_MIDI_CHANNELS]; int16 bank[MAX_XAW_MIDI_CHANNELS]; int16 reverb[MAX_XAW_MIDI_CHANNELS]; char c_flags[MAX_XAW_MIDI_CHANNELS]; Channel channel[MAX_XAW_MIDI_CHANNELS]; int is_drum[MAX_XAW_MIDI_CHANNELS]; } PanelInfo; /* Default configuration to execute Xaw interface */ /* (confirmexit repeat autostart autoexit hidetext shuffle disptrace amplitude) */ Config Cfg = { False, False, True, False, False, False, True, DEFAULT_AMPLIFICATION, DEFAULT_OPTIONS, DEFAULT_CHORUS }; static PanelInfo *Panel; typedef struct { int y; int l; } KeyL; typedef struct { KeyL k[3]; int xofs; Pixel col; } ThreeL; static ThreeL *keyG; #define KEY_NUM 111 #define MAXBITMAP 10 static char *bmfname[] = { "back.xbm","fwrd.xbm","next.xbm","pause.xbm","play.xbm","prev.xbm", "quit.xbm","stop.xbm","random.xbm","repeat.xbm",(char *)NULL }; static char *iconname = "timidity.xbm"; #define BM_BACK 0 #define BM_FWRD 1 #define BM_NEXT 2 #define BM_PAUSE 3 #define BM_PLAY 4 #define BM_PREV 5 #define BM_QUIT 6 #define BM_STOP 7 #define BM_RANDOM 8 #define BM_REPEAT 9 static char *dotfile = NULL; char *cfg_items[]= {"Tracing", "ConfirmExit", "Disp:file", "Disp:volume", "Disp:button", "RepeatPlay", "AutoStart", "Disp:text", "Disp:time", "Disp:trace", "CurVol", "ShufflePlay", "AutoExit", "CurFileMode", "ExtOptions", "ChorusOption","File"}; #define S_Tracing 0 #define S_ConfirmExit 1 #define S_DispFile 2 #define S_DispVolume 3 #define S_DispButton 4 #define S_RepeatPlay 5 #define S_AutoStart 6 #define S_DispText 7 #define S_DispTime 8 #define S_DispTrace 9 #define S_CurVol 10 #define S_ShufflePlay 11 #define S_AutoExit 12 #define S_CurFileMode 13 #define S_ExtOptions 14 #define S_ChorusOption 15 #define S_MidiFile 16 #define CFGITEMSNUMBER 17 #define COMMON_BGCOLOR "gray67" #define COMMANDBUTTON_COLOR "gray78" #define TEXTBG_COLOR "gray82" static Display *disp; static int screen; static Pixmap check_mark, arrow_mark, on_mark, off_mark, layer[2]; static int bm_height[MAXBITMAP], bm_width[MAXBITMAP], x_hot,y_hot, root_height, root_width; static Pixmap bm_Pixmap[MAXBITMAP]; static int max_files, init_options = 0, init_chorus = 0; static char basepath[PATH_MAX]; static String *dirlist = NULL, dirlist_top, *flist = NULL; static Dimension trace_width, trace_height, menu_width; static int total_time = 0, curr_time; static float thumbj; static XFontStruct *labelfont,*volumefont,*tracefont; #ifdef I18N static XFontSet ttitlefont; static XFontStruct *ttitlefont0; static char **ml; static XFontStruct **fs_list; #else static XFontStruct *ttitlefont; #define ttitlefont0 ttitlefont #endif static struct _app_resources { String bitmap_dir; Boolean arrange_title,save_list,gradient_bar; Dimension text_height,trace_width,trace_height,menu_width; Pixel common_fgcolor,common_bgcolor,menub_bgcolor,text_bgcolor,text2_bgcolor, toggle_fgcolor,button_fgcolor,button_bgcolor, velocity_color,drumvelocity_color,volume_color,expr_color,pan_color, trace_bgcolor,rim_color,box_color,caption_color,sus_color,white_key_color,black_key_color,play_color, rev_color,cho_color; XFontStruct *label_font,*volume_font,*trace_font; String more_text,file_text; #ifdef I18N XFontSet text_font, ttitle_font; #else XFontStruct *text_font, *ttitle_font; #endif } app_resources; static XtResource xaw_resources[] ={ #define offset(entry) XtOffset(struct _app_resources*, entry) {"bitmapDir", "BitmapDir", XtRString, sizeof(String), offset(bitmap_dir), XtRString, XAW_BITMAP_DIR }, {"arrangeTitle", "ArrangeTitle", XtRBoolean, sizeof(Boolean), offset(arrange_title), XtRImmediate, (XtPointer)False}, {"saveList", "SaveList", XtRBoolean, sizeof(Boolean), offset(save_list), XtRImmediate, (XtPointer)True}, {"gradientBar", "GradientBar", XtRBoolean, sizeof(Boolean), offset(gradient_bar), XtRImmediate, (XtPointer)False}, #ifdef WIDGET_IS_LABEL_WIDGET {"textLHeight", "TextLHeight", XtRShort, sizeof(short), offset(text_height), XtRImmediate, (XtPointer)30}, #else {"textHeight", "TextHeight", XtRShort, sizeof(short), offset(text_height), XtRImmediate, (XtPointer)120}, #endif {"traceWidth", "TraceWidth", XtRShort, sizeof(short), offset(trace_width), XtRImmediate, (XtPointer)TRACE_WIDTH}, {"traceHeight", "TraceHeight", XtRShort, sizeof(short), offset(trace_height), XtRImmediate, (XtPointer)TRACE_HEIGHT}, {"menuWidth", "MenuWidth", XtRShort, sizeof(Dimension), offset(menu_width), XtRImmediate, (XtPointer)200}, {"foreground", XtCForeground, XtRPixel, sizeof(Pixel), offset(common_fgcolor), XtRString, "black"}, {"background", XtCBackground, XtRPixel, sizeof(Pixel), offset(common_bgcolor), XtRString, COMMON_BGCOLOR}, {"menubutton", "MenuButtonBackground", XtRPixel, sizeof(Pixel), offset(menub_bgcolor), XtRString, "#CCFF33"}, {"textbackground", "TextBackground", XtRPixel, sizeof(Pixel), offset(text_bgcolor), XtRString, TEXTBG_COLOR}, {"text2background", "Text2Background", XtRPixel, sizeof(Pixel), offset(text2_bgcolor), XtRString, "gray80"}, {"toggleforeground", "ToggleForeground", XtRPixel, sizeof(Pixel), offset(toggle_fgcolor), XtRString, "MediumBlue"}, {"buttonforeground", "ButtonForeground", XtRPixel, sizeof(Pixel), offset(button_fgcolor), XtRString, "blue"}, {"buttonbackground", "ButtonBackground", XtRPixel, sizeof(Pixel), offset(button_bgcolor), XtRString, COMMANDBUTTON_COLOR}, {"velforeground", "VelForeground", XtRPixel, sizeof(Pixel), offset(velocity_color), XtRString, "orange"}, {"veldrumforeground", "VelDrumForeground", XtRPixel, sizeof(Pixel), offset(drumvelocity_color), XtRString, "red"}, {"volforeground", "VolForeground", XtRPixel, sizeof(Pixel), offset(volume_color), XtRString, "LightPink"}, {"expforeground", "ExpForeground", XtRPixel, sizeof(Pixel), offset(expr_color), XtRString, "aquamarine"}, {"panforeground", "PanForeground", XtRPixel, sizeof(Pixel), offset(pan_color), XtRString, "blue"}, {"tracebackground", "TraceBackground", XtRPixel, sizeof(Pixel), offset(trace_bgcolor), XtRString, "gray90"}, {"rimcolor", "RimColor", XtRPixel, sizeof(Pixel), offset(rim_color), XtRString, "gray20"}, {"boxcolor", "BoxColor", XtRPixel, sizeof(Pixel), offset(box_color), XtRString, "gray76"}, {"captioncolor", "CaptionColor", XtRPixel, sizeof(Pixel), offset(caption_color), XtRString, "DarkSlateGrey"}, {"sustainedkeycolor", "SustainedKeyColor", XtRPixel, sizeof(Pixel), offset(sus_color), XtRString, "red4"}, {"whitekeycolor", "WhiteKeyColor", XtRPixel, sizeof(Pixel), offset(white_key_color), XtRString, "white"}, {"blackkeycolor", "BlackKeyColor", XtRPixel, sizeof(Pixel), offset(black_key_color), XtRString, "black"}, {"playingkeycolor", "PlayingKeyColor", XtRPixel, sizeof(Pixel), offset(play_color), XtRString, "maroon1"}, {"reverbcolor", "ReverbColor", XtRPixel, sizeof(Pixel), offset(rev_color), XtRString, "PaleGoldenrod"}, {"choruscolor", "ChorusColor", XtRPixel, sizeof(Pixel), offset(cho_color), XtRString, "yellow"}, {"labelfont", "LabelFont", XtRFontStruct, sizeof(XFontStruct *), offset(label_font), XtRString, "-adobe-helvetica-bold-r-*-*-14-*-75-75-*-*-*-*"}, {"volumefont", "VolumeFont", XtRFontStruct, sizeof(XFontStruct *), offset(volume_font), XtRString, "-adobe-helvetica-bold-r-*-*-12-*-75-75-*-*-*-*"}, #ifdef I18N {"textfontset", "TextFontSet", XtRFontSet, sizeof(XFontSet), offset(text_font), XtRString, "-*-*-medium-r-normal--14-*-*-*-*-*-*-*"}, {"ttitlefont", "TtitleFont", XtRFontSet, sizeof(XFontSet), offset(ttitle_font), XtRString, "-*-fixed-medium-r-normal--14-*-*-*-*-*-*-*"}, #else {"textfont", XtCFont, XtRFontStruct, sizeof(XFontStruct *), offset(text_font), XtRString, "-*-fixed-medium-r-normal--14-*-*-*-*-*-*-*"}, {"ttitlefont", "Ttitlefont", XtRFontStruct, sizeof(XFontStruct *), offset(ttitle_font), XtRString, "-adobe-helvetica-bold-o-*-*-14-*-75-75-*-*-*-*"}, #endif {"tracefont", "TraceFont", XtRFontStruct, sizeof(XFontStruct *), offset(trace_font), XtRString, "7x14"}, {"labelfile", "LabelFile", XtRString, sizeof(String), offset(file_text), XtRString, "file..."}, #undef offset }; enum { ID_LOAD = 100, ID_SAVECONFIG, ID_HIDETXT, ID_HIDETRACE, ID_SHUFFLE, ID_REPEAT, ID_AUTOSTART, ID_AUTOQUIT, ID_LINE, ID_FILELIST, ID_OPTIONS, ID_LINE2, ID_ABOUT, ID_QUIT, }; #define IDS_SAVECONFIG "101" #define IDS_HIDETXT "102" #define IDS_HIDETRACE "103" #define IDS_SHUFFLE "104" #define IDS_REPEAT "105" #define IDS_AUTOSTART "106" #define IDS_AUTOQUIT "107" #define IDS_FILELIST "109" #define IDS_OPTIONS "110" #define IDS_ABOUT "112" static ButtonRec file_menu[] = { {ID_LOAD, "load", True, False}, {ID_SAVECONFIG, "saveconfig", True, False}, {ID_HIDETXT, "hidetext", True, False}, {ID_HIDETRACE, "hidetrace", True, False}, {ID_SHUFFLE, "shuffle", True, False}, {ID_REPEAT, "repeat", True, False}, {ID_AUTOSTART, "autostart", True, False}, {ID_AUTOQUIT, "autoquit", True, False}, {ID_LINE, "line", False, False}, {ID_FILELIST, "filelist", True, False}, {ID_OPTIONS, "modes", True, False}, {ID_LINE2, "line2", False, False}, {ID_ABOUT, "about", True, False}, {ID_QUIT, "quit", True, False}, }; static OptionRec option_num[] = { {MODUL_N, MODUL_BIT}, {PORTA_N, PORTA_BIT}, {NRPNV_N, NRPNV_BIT}, {REVERB_N, REVERB_BIT}, {CHPRESSURE_N, CHPRESSURE_BIT}, {OVERLAPV_N, OVERLAPV_BIT}, {TXTMETA_N, TXTMETA_BIT}, }; static void offPauseButton(void) { Boolean s; XtVaGetValues(pause_b,XtNstate,&s,NULL); if (s == True) { s=False; XtVaSetValues(pause_b,XtNstate,&s,NULL); a_pipe_write("U"); } } static void offPlayButton(void) { Boolean s; XtVaGetValues(play_b,XtNstate,&s,NULL); if (s == True) { s=False; XtVaSetValues(play_b,XtNstate,&s,NULL); a_pipe_write("T 0\n"); } } static Boolean IsTracePlaying(void) { Boolean s; if (!ctl->trace_playing) return False; XtVaGetValues(play_b,XtNstate,&s,NULL); return(s); } static Boolean IsEffectiveFile(char *file) { char *p2; struct stat st; if((p2 = strrchr(file,'#')) != NULL) *p2 = '\0'; if(stat(file, &st) != -1) if (st.st_mode & S_IFMT & (S_IFDIR|S_IFREG|S_IFLNK)) { if(p2) *p2 = '#'; return(True); } return(False); } static Boolean onPlayOffPause(void) { Boolean s; Boolean play_on; play_on = False; XtVaGetValues(play_b,XtNstate,&s,NULL); if (s == False) { s=True; XtVaSetValues(play_b,XtNstate,&s,NULL); play_on = True; } offPauseButton(); return(play_on); } /*ARGSUSED*/ static void chorusCB(Widget w,XtPointer id_data, XtPointer data) { Boolean s; char str[16]; stopCB(NULL,NULL,NULL); XtVaGetValues(w,XtNstate,&s,NULL); XtVaSetValues(w,XtNbitmap,(s)? on_mark:off_mark,NULL); if(!s) sprintf(str, "C 0"); else sprintf(str, "C %03d", (init_chorus)? init_chorus:1); a_pipe_write(str); } /*ARGSUSED*/ static void optionsCB(Widget w,XtPointer id_data, XtPointer data) { Boolean s; int i,flags; char str[16]; stopCB(NULL,NULL,NULL); XtVaGetValues(w,XtNstate,&s,NULL); XtVaSetValues(w,XtNbitmap,(s)? on_mark:off_mark,NULL); flags = 0; for(i=0; iFILEVPORT_HEIGHT)? h1:FILEVPORT_HEIGHT),NULL); } static void aboutCB(Widget w,XtPointer data,XtPointer dummy) { char s[12],*p; int i; static char *info[]= {"TiMidity++ %s%s - Xaw interface", "- MIDI to WAVE converter and player -", "by Masanao Izumo and Tomokazu Harada", "modified by Yoshishige Arai"," ",NULL}; if(!(popup_shell_exist & ABOUT_WINDOW)) { popup_about= XtVaCreatePopupShell("popup_about",transientShellWidgetClass, toplevel,NULL); popup_abox= XtVaCreateManagedWidget("popup_abox",boxWidgetClass,popup_about, XtNwidth,320,XtNheight,120, XtNorientation,XtorientVertical, XtNbackground,bgcolor,NULL); for(i=0,p=info[0]; p!=NULL; p=info[++i]) { snprintf(s,sizeof(s),"about_lbl%d",i); snprintf(local_buf, sizeof(local_buf), p, (strcmp(timidity_version, "current")) ? "version " : "", timidity_version); about_lbl[i]= XtVaCreateManagedWidget(s,labelWidgetClass,popup_abox, XtNlabel,local_buf,XtNfont,((i)? labelfont:labelfont), XtNforeground,textcolor, XtNbackground,bgcolor, XtNwidth,320,XtNresize,False, XtNborderWidth,0,NULL); } popup_aok= XtVaCreateManagedWidget("OK", commandWidgetClass,popup_abox, XtNwidth,320,XtNresize,False,NULL); XtAddCallback(popup_aok,XtNcallback,aboutcloseCB,NULL); XtSetKeyboardFocus(popup_about, popup_abox); popup_shell_exist |= ABOUT_WINDOW; } XtVaSetValues(popup_about,XtNx,root_width/2 -160,XtNy,root_height/2 -60,NULL); XtPopup(popup_about,(XtGrabKind)XtGrabNonexclusive); } static void aboutcloseCB(Widget w,XtPointer data,XtPointer dummy) { XtPopdown(popup_about); } static void flistcloseCB(Widget w,XtPointer data,XtPointer dummy) { XtPopdown(popup_file); } /*ARGSUSED*/ static void optionscloseCB(Widget w,XtPointer data,XtPointer dummy) { XtPopdown(popup_opt); } /*ARGSUSED*/ static void optionsdestroyCB(Widget w,XtPointer data,XtPointer dummy) { popup_shell_exist &= (! OPTIONS_WINDOW); } /*ARGSUSED*/ static void quitCB(Widget w,XtPointer data,XtPointer dummy) { a_pipe_write("Q"); } /*ARGSUSED*/ static void sndspecCB(Widget w,XtPointer data,XtPointer dummy) { #ifdef SUPPORT_SOUNDSPEC a_pipe_write("g"); #endif } /*ARGSUSED*/ static void playCB(Widget w,XtPointer data,XtPointer dummy) { if(!max_files) return; onPlayOffPause(); XtVaGetValues(title_mb,XtNlabel,&local_buf+2,NULL); a_pipe_write("P"); } /*ARGSUSED*/ static void pauseAction(Widget w,XEvent *e,String *v,Cardinal *n) { Boolean s; XtVaGetValues(play_b,XtNstate,&s,NULL); if (e->type == KeyPress && s == True) { XtVaGetValues(pause_b,XtNstate,&s,NULL); s ^= True; XtVaSetValues(pause_b,XtNstate,&s,NULL); a_pipe_write("U"); } } static void soundkeyAction(Widget w,XEvent *e,String *v,Cardinal *n) { a_pipe_write(*(int *)n == 0 ? "+\n":"-\n"); } static void speedAction(Widget w,XEvent *e,String *v,Cardinal *n) { a_pipe_write(*(int *)n == 0 ? ">\n":"<\n"); } static void voiceAction(Widget w,XEvent *e,String *v,Cardinal *n) { a_pipe_write(*(int *)n == 0 ? "O\n":"o\n"); } static void randomAction(Widget w,XEvent *e,String *v,Cardinal *n) { Boolean s; XtVaGetValues(random_b,XtNstate,&s,NULL); s ^= True; if(!s) XtVaSetValues(random_b,XtNstate,s,NULL); randomCB(NULL,&s,NULL); } static void repeatAction(Widget w,XEvent *e,String *v,Cardinal *n) { Boolean s; XtVaGetValues(repeat_b,XtNstate,&s,NULL); s ^= True; if(!s) XtVaSetValues(repeat_b,XtNstate,s,NULL); repeatCB(NULL,&s,NULL); } /*ARGSUSED*/ static void pauseCB() { Boolean s; XtVaGetValues(play_b,XtNstate,&s,NULL); if (s == True) { a_pipe_write("U"); } else { s = True; XtVaSetValues(pause_b,XtNstate,&s,NULL); } } /*ARGSUSED*/ static void stopCB(Widget w,XtPointer data,XtPointer dummy) { offPlayButton(); offPauseButton(); a_pipe_write("S"); initStatus(); window_title[0]='\0'; redrawTrace(False); } /*ARGSUSED*/ static void nextCB(Widget w,XtPointer data,XtPointer dummy) { onPlayOffPause(); a_pipe_write("N"); initStatus(); redrawTrace(True); } /*ARGSUSED*/ static void prevCB(Widget w,XtPointer data,XtPointer dummy) { onPlayOffPause(); a_pipe_write("B"); initStatus(); redrawTrace(True); } /*ARGSUSED*/ static void forwardCB(Widget w,XtPointer data,XtPointer dummy) { if (onPlayOffPause()) a_pipe_write("P"); a_pipe_write("f"); initStatus(); } /*ARGSUSED*/ static void backCB(Widget w,XtPointer data,XtPointer dummy) { if (onPlayOffPause()) a_pipe_write("P"); a_pipe_write("b"); initStatus(); } /*ARGSUSED*/ static void repeatCB(Widget w,XtPointer data,XtPointer dummy) { Boolean s; Boolean *set= (Boolean *)data; if (set != NULL && *set) { s = *set; XtVaSetValues(repeat_b,XtNstate,set,NULL); } else { XtVaGetValues(repeat_b,XtNstate,&s,NULL); } if (s == True) { a_pipe_write("R 1"); } else a_pipe_write("R 0"); toggleMark(file_menu[ID_REPEAT-100].widget, file_menu[ID_REPEAT-100].id); } /*ARGSUSED*/ static void randomCB(Widget w,XtPointer data,XtPointer dummy) { Boolean s; Boolean *set= (Boolean *)data; onPlayOffPause(); if (set != NULL && *set) { s = *set; XtVaSetValues(random_b,XtNstate,set,NULL); } else { XtVaGetValues(random_b,XtNstate,&s,NULL); } if (s == True) { onPlayOffPause(); a_pipe_write("D 1"); } else { offPlayButton(); offPauseButton(); a_pipe_write("D 2"); } toggleMark(file_menu[ID_SHUFFLE-100].widget, file_menu[ID_SHUFFLE-100].id); } static void menuCB(Widget w,XtPointer data,XtPointer dummy) { onPlayOffPause(); sprintf(local_buf,"L %d",((int)data)+1); a_pipe_write(local_buf); } static void setVolbar(int val) { char s[8]; float thumb; amplitude = (val > MAXVOLUME)? MAXVOLUME:val; sprintf(s, "%d", val); XtVaSetValues(vol_l, XtNlabel, s, NULL); sprintf(s, "V %03d\n", val); a_pipe_write(s); thumb = (float)val / (float)MAXVOLUME; sprintf(s, "%d", val); XtVaSetValues(vol_l, XtNlabel, s, NULL); if (sizeof(thumb) > sizeof(XtArgVal)) { XtVaSetValues(vol_bar, XtNtopOfThumb, &thumb, NULL); } else { XtArgVal *l_thumb = (XtArgVal *) &thumb; XtVaSetValues(vol_bar, XtNtopOfThumb,*l_thumb, NULL); } } static void volsetCB(Widget w,XtPointer data,XtPointer call_data) { float percent = *(float*)call_data; int val = (float)(MAXVOLUME * percent); if (amplitude == val) return; setVolbar(val); } static void volupdownCB(Widget w,XtPointer data,XtPointer diff) { int i = ((int)diff > 0)? (-10):10; i += amplitude; setVolbar(i); } static void volupdownAction(Widget w,XEvent *e,String *v,Cardinal *n) { int i = atoi(*v); i += amplitude; setVolbar(i); } #if 0 /* Not used */ static void tunesetCB(Widget w,XtPointer data,XtPointer call_data) { static int tmpval; char s[16]; float percent = *(float*)call_data; int value = (float)(total_time * percent); float thumb, l_thumb; if (tmpval == value) return; if (curr_time > total_time) curr_time = total_time; curr_time = tmpval = value; l_thumb = thumb = (float)curr_time / (float)total_time; snprintf(s,sizeof(s), "%2d:%02d", tmpval / 60, tmpval % 60); XtVaSetValues(tune_l0, XtNlabel, s, NULL); sprintf(s, "T %d\n", tmpval); a_pipe_write(s); } #endif static void tunesetAction(Widget w,XEvent *e,String *v,Cardinal *n) { static float tmpval; char s[16]; int value; float l_thumb; XtVaGetValues(tune_bar, XtNtopOfThumb, &l_thumb, NULL); if (tmpval == l_thumb) return; tmpval = l_thumb; value = (int)(l_thumb * total_time); snprintf(s,sizeof(s), "%2d:%02d", curr_time / 60, curr_time % 60); XtVaSetValues(tune_l0, XtNlabel, s, NULL); XtVaSetValues(tune_bar, XtNtopOfThumb, &l_thumb, NULL); sprintf(s, "T %d\n", value); a_pipe_write(s); } static void tuneslideCB(Widget w,XtPointer data,XtPointer diff) { char s[16]; sprintf(s, "T %d\n", curr_time+ (int)diff); a_pipe_write(s); } static void tuneslideAction(Widget w,XEvent *e,String *v,Cardinal *n) { char s[16]; float l_thumb; XtVaGetValues(tune_bar, XtNtopOfThumb, &l_thumb, NULL); sprintf(s, "T %d\n", (int)(total_time * l_thumb)); a_pipe_write(s); } /*ARGSUSED*/ static void resizeAction(Widget w,XEvent *e,String *v,Cardinal *n) { Dimension w1,w2,h1,h2; Position y1; int i,tmp,tmp2,tmp3; XtVaGetValues(toplevel,XtNwidth,&w1,XtNheight,&h1,NULL); w2 = w1 -8; if(w2>TRACEVPORT_WIDTH) w2 = TRACEVPORT_WIDTH; XtVaGetValues(lyric_t,XtNheight,&h2,NULL); XtResizeWidget(lyric_t,w2-2,h2,0); i= 0; tmp = 10; while (tmp > 0) { i++; tmp -= (int)(w2) / 36; } XtVaSetValues(lyric_t,XtNborderWidth,1,NULL); XtVaSetValues(b_box,XtNheight,i*40,NULL); XtResizeWidget(b_box,w2,i*40,0); if(ctl->trace_playing) { XtVaGetValues(trace_vport,XtNy,&y1,NULL); XtResizeWidget(trace_vport,w2,((h1-y1>TRACE_HEIGHT+12)? TRACE_HEIGHT+12:h1-y1),0); } XtVaGetValues(v_box,XtNheight,&h2,NULL); w2 = ((w1 < TRACE_WIDTH_SHORT)? w1:TRACE_WIDTH_SHORT); /* new v_box width */ tmp = XTextWidth(app_resources.volume_font,"Volume ",7)+8; /* vol_l width */ XtVaSetValues(vol_l0,XtNwidth,tmp,NULL); XtVaSetValues(v_box,XtNwidth,w2,NULL); tmp2 = w2 -tmp - XTextWidth(app_resources.volume_font,"000",3) -38; tmp3 = w2 -XTextWidth(app_resources.volume_font,"/ 99:59",7) - XTextWidth(app_resources.volume_font,"000",3) -45; XtResizeWidget(v_box,w2,h2,0); XtVaGetValues(vol_bar,XtNheight,&h2,NULL); XtVaSetValues(vol_bar,XtNwidth,tmp2,NULL); XtVaSetValues(tune_bar,XtNwidth,tmp3,NULL); XtResizeWidget(vol_bar,tmp2,h2,0); XtResizeWidget(tune_bar,tmp3,h2,0); XSync(disp, False); usleep(10000); } #ifndef WIDGET_IS_LABEL_WIDGET void a_print_text(Widget w, char *st) { XawTextPosition pos; XawTextBlock tb; st = strcat(st, "\n"); pos = XawTextGetInsertionPoint(w); tb.firstPos = 0; tb.length = strlen(st); tb.ptr = st; tb.format = FMT8BIT; XawTextReplace(w, pos, pos, &tb); XawTextSetInsertionPoint(w, pos + tb.length); } #else void a_print_text(Widget w, char *st) { XtVaSetValues(w,XtNlabel,st,NULL); } #endif /* !WIDGET_IS_LABEL_WIDGET */ /*ARGSUSED*/ static void popupLoad(Widget w,XtPointer client_data,XtPointer call_data) { #define DIALOG_HEIGHT 400 Position popup_x, popup_y, top_x, top_y; Dimension top_width; XtVaGetValues(toplevel, XtNx,&top_x,XtNy,&top_y,XtNwidth,&top_width,NULL); popup_x=top_x+ 20; popup_y=top_y+ 72; top_width += 100; if(popup_x+top_width > root_width) popup_x = root_width -top_width -20; if(popup_y+DIALOG_HEIGHT > root_height) popup_y = root_height -DIALOG_HEIGHT -20; XtVaSetValues(popup_load, XtNx,popup_x,XtNy,popup_y,XtNwidth,top_width, XtNheight,DIALOG_HEIGHT,NULL); XtRealizeWidget(popup_load); XtPopup(popup_load,(XtGrabKind)XtGrabNone); top_width -= 4; XtVaSetValues(load_vport,XtNwidth,top_width,NULL); XawTextSetInsertionPoint(load_t,(XawTextPosition)(strlen(basepath))); } static void popdownLoad(Widget w,XtPointer s,XtPointer data) { char *p, *p2; DirPath full; char local_buf[300],tmp[PATH_MAX]; #ifndef ORIGINAL int Aflag = 0; /* RAKK/HIOENS: adding All files in directory */ #endif /*RAKK/HIOENS*/ /* tricky way for both use of action and callback */ if (s != NULL && data == NULL){ if(*(char *)s == 'A') { snprintf(tmp,sizeof(tmp),"%s%c",basepath,'/'); p = tmp; #ifndef ORIGINAL Aflag = 1; #endif /*RAKK/HIOENS*/ } else { p = XawDialogGetValueString(load_d); } if (NULL != (p2 = expandDir(p, &full))) p = p2; if(IsEffectiveFile(p)) { #ifndef ORIGINAL if(Aflag == 1) strcat(p,"/"); #endif /*RAKK/HIOENS*/ snprintf(local_buf,sizeof(local_buf),"X %s\n",p); a_pipe_write(local_buf); } } XtPopdown(popup_load); } static void toggleMark(Widget w,int id) { file_menu[id-100].bmflag ^= True; XtVaSetValues(w,XtNleftBitmap, ((file_menu[id-100].bmflag)? check_mark:None),NULL); } static void filemenuAction(Widget w,XEvent *e,String *v,Cardinal *n) { int i; if(e == NULL) i= ID_HIDETXT; else i= atoi(*v); if(!(ctl->trace_playing) && i == ID_HIDETRACE) i= ID_HIDETXT; filemenuCB(file_menu[i-100].widget,&file_menu[i-100].id,NULL); } static void filemenuCB(Widget w,XtPointer id_data, XtPointer data) { int *id = (int *)id_data; Dimension w1,h1,w2,h2,tmp; switch (*id) { case ID_LOAD: popupLoad(w,NULL,NULL); break; case ID_AUTOSTART: toggleMark(w,*id); break; case ID_AUTOQUIT: toggleMark(w,*id); a_pipe_write("q"); break; case ID_HIDETRACE: if(ctl->trace_playing) { XtVaGetValues(toplevel,XtNheight,&h1,XtNwidth,&w1,NULL); if(XtIsManaged(trace_vport)) { tmp = trace_height + (XtIsManaged(lyric_t) ? 0:lyric_height); XtUnmanageChild(trace_vport); XtMakeResizeRequest(toplevel,w1,base_height-tmp,&w2,&h2); } else { XtManageChild(trace_vport); XtVaSetValues(trace_vport,XtNfromVert, (XtIsManaged(lyric_t) ? lyric_t:t_box),NULL); XtMakeResizeRequest(toplevel,w1,h1+trace_height,&w2,&h2); XtVaSetValues(trace_vport,XtNheight,trace_height,NULL); } toggleMark(w,*id); } break; case ID_HIDETXT: XtVaGetValues(toplevel,XtNheight,&h1,XtNwidth,&w1,NULL); if(XtIsManaged(lyric_t)) { if(ctl->trace_playing) { tmp = lyric_height + (XtIsManaged(trace_vport) ? 0:trace_height); } else { tmp = lyric_height; } XtUnmanageChild(lyric_t); if(ctl->trace_playing && XtIsManaged(trace_vport)) XtVaSetValues(trace_vport,XtNfromVert,t_box,NULL); XtMakeResizeRequest(toplevel,w1,base_height-tmp,&w2,&h2); } else { XtManageChild(lyric_t); if(ctl->trace_playing && XtIsManaged(trace_vport)) { XtVaSetValues(trace_vport,XtNfromVert,lyric_t,NULL); } XtVaSetValues(lyric_t,XtNheight,lyric_height,NULL); XtMakeResizeRequest(toplevel,w1,h1+lyric_height,&w2,&h2); } toggleMark(w,*id); break; case ID_SAVECONFIG: a_saveconfig(dotfile); break; case ID_SHUFFLE: randomAction(NULL,NULL,NULL,NULL); break; case ID_REPEAT: repeatAction(NULL,NULL,NULL,NULL); break; case ID_OPTIONS: optionspopupCB(w,NULL,NULL); break; case ID_FILELIST: flistpopupCB(w,NULL,NULL); break; case ID_ABOUT: aboutCB(w,NULL,NULL); break; case ID_QUIT: quitCB(w,NULL,NULL); break; } } #ifdef WIDGET_IS_LABEL_WIDGET static void a_print_msg(Widget w) { int i, msglen; a_pipe_nread((char *)&msglen, sizeof(int)); while(msglen > 0) { i = msglen; if(i > sizeof(local_buf)-1) i = sizeof(local_buf)-1; a_pipe_nread(local_buf, i); local_buf[i] = '\0'; XtVaSetValues(w,XtNlabel,local_buf,NULL); msglen -= i; } } #else static void a_print_msg(Widget w) { int i, msglen; XawTextPosition pos; XawTextBlock tb; tb.firstPos = 0; tb.ptr = local_buf; tb.format = FMT8BIT; pos = XawTextGetInsertionPoint(w); a_pipe_nread((char *)&msglen, sizeof(int)); while(msglen > 0) { i = msglen; if(i > sizeof(local_buf)) i = sizeof(local_buf); a_pipe_nread(local_buf, i); tb.length = i; XawTextReplace(w, pos, pos, &tb); pos += i; XawTextSetInsertionPoint(w, pos); msglen -= i; } } #endif /* WIDGET_IS_LABEL_WIDGET */ #define DELTA_VEL 32 static void ctl_channel_note(int ch, int note, int velocity) { if(!ctl->trace_playing) return; if (velocity == 0) { if (note == Panel->cnote[ch]) Panel->v_flags[ch] = FLAG_NOTE_OFF; Panel->cvel[ch] = 0; } else if (velocity > Panel->cvel[ch]) { Panel->cvel[ch] = velocity; Panel->cnote[ch] = note; Panel->ctotal[ch] = velocity * Panel->channel[ch].volume * Panel->channel[ch].expression / (127*127); Panel->v_flags[ch] = FLAG_NOTE_ON; } } /*ARGSUSED*/ static void handle_input(XtPointer data,int *source,XtInputId *id) { char s[16], c; int i=0, n, ch, note; float thumb; char **pp; a_pipe_read(local_buf,sizeof(local_buf)); switch (local_buf[0]) { case 't' : curr_time = n = atoi(local_buf+2); i= n % 60; n /= 60; sprintf(s, "%d:%02d", n,i); XtVaSetValues(tune_l0, XtNlabel, s, NULL); if (total_time >0) { thumbj = (float)curr_time / (float)total_time; if (sizeof(thumbj) > sizeof(XtArgVal)) { XtVaSetValues(tune_bar,XtNtopOfThumb,&thumbj,NULL); } else { XtArgVal *l_thumbj = (XtArgVal *) &thumbj; XtVaSetValues(tune_bar,XtNtopOfThumb,*l_thumbj,NULL); } } break; case 'T' : n= atoi(local_buf+2); if(n > 0) { total_time = n; snprintf(s,sizeof(s), "/%2d:%02d", n/60, n%60); XtVaSetValues(tune_l,XtNlabel,s,NULL); } break; case 'E' : { char *name; name=strrchr(local_buf+2,' '); n= atoi(local_buf+2); if(popup_shell_exist & FLIST_WINDOW) XawListHighlight(file_list, n-1); if(name==NULL) break; name++; XtVaSetValues(title_mb,XtNlabel,name,NULL); snprintf(window_title, sizeof(window_title), "%s : %s", APP_CLASS, local_buf+2); XtVaSetValues(toplevel,XtNtitle,window_title,NULL); *window_title = '\0'; } break; case 'e' : if (arrangetitle) { char *p= local_buf+2; if (!strcmp(p, "(null)")) p = UNTITLED_STR; snprintf(window_title, sizeof(window_title), "%s : %s", APP_CLASS, p); XtVaSetValues(toplevel,XtNtitle,window_title,NULL); } snprintf(window_title, sizeof(window_title), "%s", local_buf+2); break; case 'O' : offPlayButton();break; case 'L' : a_print_msg(lyric_t); break; case 'Q' : exit(0); case 'V': amplitude=atoi(local_buf+2); thumb = (float)amplitude / (float)MAXVOLUME; sprintf(s, "%d", amplitude); XtVaSetValues(vol_l, XtNlabel, s, NULL); if (sizeof(thumb) > sizeof(XtArgVal)) { XtVaSetValues(vol_bar, XtNtopOfThumb, &thumb, NULL); } else { XtArgVal *l_thumb = (XtArgVal *) &thumb; XtVaSetValues(vol_bar, XtNtopOfThumb,*l_thumb, NULL); } break; case 'v': c= *(local_buf+1); n= atoi(local_buf+2); if(c == 'L') voices = n; else last_voice = n; if(IsTracePlaying()) drawVoices(); break; case 'g': case '\0' : break; case 'X': n=max_files; max_files+=atoi(local_buf+2); for (i=n;iFILEVPORT_HEIGHT)? h:FILEVPORT_HEIGHT),NULL); } break; case 'Y': if(ctl->trace_playing) { ch= *(local_buf+1) - 'A'; c= *(local_buf+2); note= (*(local_buf+3)-'0')*100 + (*(local_buf+4)-'0')*10 + *(local_buf+5)-'0'; n= atoi(local_buf+6); if (c == '*' || c == '&') { Panel->c_flags[ch] |= FLAG_PROG_ON; } else { Panel->c_flags[ch] &= ~FLAG_PROG_ON; n= 0; } ctl_channel_note(ch, note, n); draw1Note(ch,note,c); draw1Chan(ch,Panel->ctotal[ch],c); } break; case 'I': if(IsTracePlaying()) { ch= *(local_buf+1) - 'A'; strncpy(inst_name[ch], (char *)&local_buf[2], INST_NAME_SIZE); drawInstname(ch, inst_name[ch]); } break; case 'i': if(IsTracePlaying()) { ch= *(local_buf+1) - 'A'; Panel->is_drum[ch]= *(local_buf+2) - 'A'; drawDrumPart(ch, Panel->is_drum[ch]); } break; case 'P': if(IsTracePlaying()) { c= *(local_buf+1); ch= *(local_buf+2)-'A'; n= atoi(local_buf+3); switch(c) { case 'A': /* panning */ Panel->channel[ch].panning = n; Panel->c_flags[ch] |= FLAG_PAN; drawPan(ch,n,True); break; case 'B': /* pitch_bend */ Panel->channel[ch].pitchbend = n; Panel->c_flags[ch] |= FLAG_BENDT; if (!plane) drawPitch(ch,n); break; case 'b': /* tonebank */ Panel->channel[ch].bank = n; if (plane) drawBank(ch,n); break; case 'r': /* reverb */ Panel->reverb[ch] = n; if (plane) drawReverb(ch,n); break; case 'c': /* chorus */ Panel->channel[ch].chorus_level = n; if (plane) drawChorus(ch,n); break; case 'S': /* sustain */ Panel->channel[ch].sustain = n; Panel->c_flags[ch] |= FLAG_SUST; break; case 'P': /* program */ Panel->channel[ch].program = n; Panel->c_flags[ch] |= FLAG_PROG; drawProg(ch,n,4,pl[plane].ofs[CL_PR],True); break; case 'E': /* expression */ Panel->channel[ch].expression = n; ctl_channel_note(ch, Panel->cnote[ch], Panel->cvel[ch]); drawExp(ch,n); break; case 'V': /* volume */ Panel->channel[ch].volume = n; ctl_channel_note(ch, Panel->cnote[ch], Panel->cvel[ch]); drawVol(ch,n); break; } } break; case 'R': redrawTrace(True); break; case 'U': /* update timer */ if(ctl->trace_playing) { static double last_time = 0; double d, t; Bool need_flush; double delta_time; t = get_current_calender_time(); d = t - last_time; if(d > 1) d = 1; delta_time = d / XAW_UPDATE_TIME; last_time = t; need_flush = False; for(i=0; iv_flags[i]) { if (Panel->v_flags[i] == FLAG_NOTE_OFF) { Panel->ctotal[i] -= DELTA_VEL * delta_time; if (Panel->ctotal[i] <= 0) { Panel->ctotal[i] = 0; Panel->v_flags[i] = 0; } draw1Chan(i,Panel->ctotal[i],'*'); need_flush = True; } else { Panel->v_flags[i] = 0; } } if(need_flush) XFlush(XtDisplay(trace)); } break; case 'm': n= atoi(local_buf+1); switch(n) { case GM_SYSTEM_MODE: sprintf(s,"%d:%02d / GM",total_time/60,total_time%60); break; case GS_SYSTEM_MODE: sprintf(s,"%d:%02d / GS",total_time/60,total_time%60); break; case XG_SYSTEM_MODE: sprintf(s,"%d:%02d / XG",total_time/60,total_time%60); break; default: sprintf(s,"%d:%02d",total_time/60,total_time%60); break; } XtVaSetValues(time_l,XtNlabel,s,NULL); break; case 's': n= atoi(local_buf+1); pp = current_flist; if(pp != NULL) { while(*pp != NULL) free(*pp++); free(current_flist); } current_flist = (char **)safe_malloc(sizeof(char *) * (n+1)); if ('\0' != *dotfile) { FILE *fp; if (savelist) { if (NULL != (fp=fopen(dotfile, "a+"))) { for(i=0; idirname = tmp; full->basename = NULL; strcpy(newfull, tmp); return newfull; } else if (*p != '~' && NULL == (tail = strrchr(path, '/'))) { p = tmp; strncpy(p, basepath, PATH_MAX - 1); full->dirname = p; while (*p++ != '\0') ; strncpy(p, path, PATH_MAX - (p - tmp) - 1); tmp[PATH_MAX-1] = '\0'; snprintf(newfull,sizeof(newfull),"%s/%s", basepath, path); full->basename = p; return newfull; } if (*p == '/') { strncpy(tmp, path, PATH_MAX - 1); } else { if (*p == '~') { struct passwd *pw; p++; if (*p == '/' || *p == '\0') { pw = getpwuid(getuid()); } else { char buf[80], *bp = buf; while (*p != '/' && *p != '\0') *bp++ = *p++; *bp = '\0'; pw = getpwnam(buf); } if (pw == NULL) { ctl->cmsg(CMSG_WARNING, VERB_NORMAL, "something wrong with getting path."); return NULL; } while (*p == '/') p++; snprintf(tmp, sizeof(tmp), "%s/%s", pw->pw_dir, p); } else { /* *p != '~' */ snprintf(tmp, sizeof(tmp), "%s/%s", basepath, path); } } p = canonicalize_path(tmp); tail = strrchr(p, '/'); *tail++ = '\0'; full->dirname = p; full->basename = tail; snprintf(newfull,sizeof(newfull),"%s/%s", p, tail); return newfull; } /*ARGSUSED*/ static void setDirAction(Widget w,XEvent *e,String *v,Cardinal *n) { char *p, *p2; struct stat st; DirPath full; XawListReturnStruct lrs; p = XawDialogGetValueString(load_d); if (NULL != (p2 = expandDir(p, &full))) p = p2; if(stat(p, &st) == -1) return; if(S_ISDIR(st.st_mode)) { strncpy(basepath,p,sizeof(basepath)-1); p = strrchr(basepath, '/'); if (*(p+1) == '\0') *p = '\0'; lrs.string = ""; if(dirlist != NULL) { free(dirlist_top); free(dirlist); dirlist = NULL; } setDirList(load_flist, cwd_l, &lrs); } } /* * sort algorithm for DirList: * - directories before files */ static int dirlist_cmp (const void *p1, const void *p2) { int i1, i2; char *s1, *s2; s1 = *((char **)p1); s2 = *((char **)p2); i1 = strlen (s1) - 1; i2 = strlen (s2) - 1; if (i1 >= 0 && i2 >= 0) { if (s1 [i1] == '/' && s2 [i2] != '/') return -1; if (s1 [i1] != '/' && s2 [i2] == '/') return 1; } return strcmp (s1, s2); } #ifndef ORIGINAL /* RAKK/HIOENS: Save a string on the heap. Addition for 'common.c' ? */ static char * strsav( char * str ) { char * tp = safe_malloc( strlen(str)+1 ); strcpy(tp, str); return tp; } #endif /* RAKK/HIOENS */ static void setDirList(Widget list, Widget label, XawListReturnStruct *lrs) { URL dirp; struct stat st; char currdir[PATH_MAX], filename[PATH_MAX]; int i, d_num, f_num; snprintf(currdir, sizeof(currdir)-1, "%s/%s", basepath, lrs->string); canonicalize_path(currdir); if(stat(currdir, &st) == -1) return; if(!S_ISDIR(st.st_mode)) { #ifdef ORIGINAL XtVaSetValues(load_d,XtNvalue,currdir,NULL); #else /* RAKK/HIOENS */ XtVaSetValues(load_d,XtNvalue,strsav(currdir),NULL); #endif /* ORIGINAL */ return; } if (NULL != (dirp=url_dir_open(currdir))) { char *fullpath; MBlockList pool; StringTable strtab; init_mblock(&pool); if(dirlist != NULL) { free(dirlist_top); free(dirlist); } init_string_table(&strtab); i = 0; d_num = 0; f_num = 0; while (url_gets(dirp, filename, sizeof(filename)) != NULL) { fullpath = (char *)new_segment(&pool,strlen(currdir) +strlen(filename) +2); sprintf(fullpath, "%s/%s", currdir, filename); if(stat(fullpath, &st) == -1) continue; if(filename[0] == '.' && filename[1] == '\0') continue; if (currdir[0] == '/' && currdir[1] == '\0' && filename[0] == '.' && filename[1] == '.' && filename[2] == '\0') continue; if(S_ISDIR(st.st_mode)) { strcat(filename, "/"); d_num++; } else { f_num++; } put_string_table(&strtab, filename, strlen(filename)); i++; } dirlist = (String *)make_string_array(&strtab); dirlist_top = (String)dirlist[0]; /* Marking for free() */ qsort (dirlist, i, sizeof (char *), dirlist_cmp); snprintf(local_buf, sizeof(local_buf), "%d Directories, %d Files", d_num, f_num); XawListChange(list,dirlist,0,0,True); } else strcpy(local_buf, "Can't read directry"); XtVaSetValues(load_info,XtNlabel,local_buf,NULL); #ifdef ORIGINAL XtVaSetValues(label,XtNlabel,currdir,NULL); #else /* RAKK/HIOENS */ XtVaSetValues(label,XtNlabel,strsav(currdir),NULL); #endif /* RAKK/HIOENS */ strcpy(basepath, currdir); if(currdir[strlen(currdir) - 1] != '/') strcat(currdir, "/"); #ifdef ORIGINAL XtVaSetValues(load_d,XtNvalue,currdir,NULL); #else /* RAKK/HIOENS */ XtVaSetValues(load_d,XtNvalue,strsav(currdir),NULL); #endif /* RAKK/HIOENS */ } static int Red_depth,Green_depth,Blue_depth; static int Red_sft,Green_sft,Blue_sft; static int bitcount( int d ) { int rt=0; while( (d & 0x01)==0x01 ){ d>>=1; rt++; } return(rt); } static int sftcount( int *mask ) { int rt=0; while( (*mask & 0x01)==0 ){ (*mask)>>=1; rt++; } return(rt); } static int getdisplayinfo() { XWindowAttributes xvi; XGetWindowAttributes( disp, XtWindow(trace), &xvi ); if( 16 <= xvi.depth ){ Red_depth=(xvi.visual)->red_mask; Green_depth=(xvi.visual)->green_mask; Blue_depth=(xvi.visual)->blue_mask; Red_sft=sftcount(&(Red_depth)); Green_sft=sftcount(&(Green_depth)); Blue_sft=sftcount(&(Blue_depth)); Red_depth=bitcount(Red_depth); Green_depth=bitcount(Green_depth); Blue_depth=bitcount(Blue_depth); } return(xvi.depth); } static void drawBar(int ch,int len, int xofs, int column, Pixel color) { static Pixel column1color0; static GC gradient_gc[T2COLUMN]; static Pixmap gradient_pixmap[T2COLUMN]; static int gradient_set[T2COLUMN]; static int depth,init=1; static XColor x_boxcolor; static XGCValues gv; int i; int col; XColor x_color; if( init ){ for(i=0;i>= 8; g >>= 8; b >>= 8; if(255>(8-Red_depth))<>(8-Green_depth))<>(8-Blue_depth))<0x3000) sprintf(s, ">>"); else if (val>0x2000) sprintf(s, ">"); else if (val>0x1000) sprintf(s, "<"); else sprintf(s, "<<"); } XDrawString(XtDisplay(trace), XtWindow(trace), gct, pl[plane].ofs[CL_PI]+4,TRACEV_OFS+BAR_SPACE*ch+16,s,strlen(s)); } } static void drawInstname(int ch, char *name) { int len; if(!ctl->trace_playing) return; if(plane!=0) return; XSetForeground(disp, gct, boxcolor); XFillRectangle(XtDisplay(trace),XtWindow(trace),gct, pl[plane].ofs[CL_IN]+2,TRACEV_OFS+BAR_SPACE*ch+2, pl[plane].w[CL_IN] -4,BAR_HEIGHT); XSetForeground(disp, gct, ((Panel->is_drum[ch])? capcolor:black)); len = strlen(name); XDrawString(XtDisplay(trace), XtWindow(trace), gct, pl[plane].ofs[CL_IN]+4,TRACEV_OFS+BAR_SPACE*ch+15, name,(len>disp_inst_name_len)? disp_inst_name_len:len); } static void drawDrumPart(int ch, int is_drum) { if(!ctl->trace_playing) return; if(plane!=0) return; if (is_drum) barcol[ch]=app_resources.drumvelocity_color; else barcol[ch]=app_resources.velocity_color; } static void draw1Note(int ch,int note,int flag) { int i, j; XSegment dot[3]; j = note -9; if (j<0) return; if (flag == '*') { XSetForeground(disp, gct, playcolor); } else if (flag == '&') { XSetForeground(disp, gct, ((keyG[j].col == black)? suscolor:barcol[0])); } else { XSetForeground(disp, gct, keyG[j].col); } for(i= 0; i<3; i++) { dot[i].x1 = keyG[j].xofs +i; dot[i].y1 = TRACEV_OFS+ keyG[j].k[i].y+ ch*BAR_SPACE; dot[i].x2 = dot[i].x1; dot[i].y2 = dot[i].y1 + keyG[j].k[i].l; } XDrawSegments(XtDisplay(trace),XtWindow(trace),gct,dot,3); } static void drawKeyboardAll(Display *disp,Drawable pix) { int i, j; XSegment dot[3]; XSetForeground(disp, gc, tracecolor); XFillRectangle(disp,pix,gc,0,0,BARH_OFS8,BAR_SPACE); XSetForeground(disp, gc, boxcolor); XFillRectangle(disp,pix,gc,BARH_OFS8,0,TRACE_WIDTH-BARH_OFS8+1,BAR_SPACE); for(i= 0; itrace_playing) { if (!strcmp(p, "(null)")) p = UNTITLED_STR; XSetForeground(disp, gcs, capcolor); #ifdef I18N XmbDrawString(XtDisplay(trace), XtWindow(trace),ttitlefont,gcs, VOICES_NUM_OFS+TTITLE_OFS, MAX_XAW_MIDI_CHANNELS*BAR_SPACE+TRACEV_OFS+ ttitlefont0->ascent +3, p,strlen(p)); #else XDrawString(XtDisplay(trace), XtWindow(trace),gcs, VOICES_NUM_OFS+TTITLE_OFS, MAX_XAW_MIDI_CHANNELS*BAR_SPACE+TRACEV_OFS+ ttitlefont->ascent +3, p,strlen(p)); #endif } } static void toggletrace(Widget w,XEvent *e,String *v,Cardinal *n) { if((e->xbutton.button == 1) || e->type == KeyPress) { plane ^= 1; redrawTrace(True); } } /*ARGSUSED*/ static void exchgWidth(Widget w,XEvent *e,String *v,Cardinal *n) { Dimension w1,h1,w2,h2; XtVaGetValues(toplevel,XtNheight,&h1,NULL); ++currwidth; currwidth %= 3; /* number of rotatewidth */ w1 = rotatewidth[currwidth]; XtMakeResizeRequest(toplevel,w1,h1,&w2,&h2); resizeAction(w,NULL,NULL,NULL); } /*ARGSUSED*/ static void redrawAction(Widget w,XEvent *e,String *v,Cardinal *n) { if(e->xexpose.count == 0) redrawTrace(True); } /*ARGSUSED*/ static Boolean cursor_is_in = False; static void redrawCaption(Widget w,XEvent *e,String *v,Cardinal *n) { char *p; int i; if(e->type == EnterNotify) { cursor_is_in = True; XSetForeground(disp, gct, capcolor); } else { cursor_is_in = False; XSetForeground(disp, gct, tracecolor); } XFillRectangle(disp,XtWindow(trace),gct, 0,0,TRACE_WIDTH,TRACEV_OFS); XSetBackground(disp, gct, (e->type == EnterNotify)? expcolor:tracecolor); XSetForeground(disp, gct, (e->type == EnterNotify)? tracecolor:capcolor); for(i=0; itrace_playing) return; if(!XtIsRealized(trace)) return; /* XtVaGetValues(trace,XtNheight,&h1,XtNwidth,&w1,NULL); */ /* XSetForeground(disp, gct, tracecolor); */ /* XFillRectangle(disp,XtWindow(trace),gct, 0,0,w1,h1); */ /* XSetForeground(disp, gct, boxcolor); */ /* XFillRectangle(disp,XtWindow(trace),gct, BARH_OFS8 -1,TRACEV_OFS, TRACE_WIDTH-BARH_OFS8+1, BAR_SPACE*MAX_XAW_MIDI_CHANNELS); */ for(i= 0; ictotal[i] != 0 && Panel->c_flags[i] & FLAG_PROG_ON) draw1Chan(i,Panel->ctotal[i],'*'); XSetForeground(disp, gct, pancolor); for(i=0; ic_flags[i] & FLAG_PAN) drawPan(i,Panel->channel[i].panning,False); } XSetForeground(disp, gct, black); for(i=0; ichannel[i].program,CL_PR,pl[plane].ofs[4],False); drawVol(i,Panel->channel[i].volume); drawExp(i,Panel->channel[i].expression); if (plane) { drawBank(i,Panel->channel[i].bank); drawReverb(i,Panel->reverb[i]); drawChorus(i,Panel->channel[i].chorus_level); } else { drawPitch(i,Panel->channel[i].pitchbend); drawInstname(i, inst_name[i]); } } } } static void initStatus(void) { int i; if(!ctl->trace_playing) return; for(i=0; ichannel[i].program= 0; Panel->channel[i].volume= 0; Panel->channel[i].sustain= 0; Panel->channel[i].expression= 0; Panel->channel[i].pitchbend= 0; Panel->channel[i].panning= -1; Panel->ctotal[i] = 0; Panel->cvel[i] = 0; Panel->bank[i] = 0; Panel->reverb[i] = 0; Panel->channel[i].chorus_level = 0; Panel->v_flags[i] = 0; Panel->c_flags[i] = 0; Panel->is_drum[i] = 0; *inst_name[i] = '\0'; } last_voice = 0; } /*ARGSUSED*/ static void completeDir(Widget w,XEvent *e, XtPointer data) { char *p; DirPath full; p = XawDialogGetValueString(load_d); if (!expandDir(p, &full)) ctl->cmsg(CMSG_WARNING,VERB_NORMAL,"something wrong with getting path."); if(full.basename != NULL) { int len, match = 0; char filename[PATH_MAX], matchstr[PATH_MAX],*path = "/"; char *fullpath; URL dirp; len = strlen(full.basename); if(strlen(full.dirname)) path = full.dirname; if (NULL != (dirp=url_dir_open(path))) { MBlockList pool; init_mblock(&pool); while (url_gets(dirp, filename, sizeof(filename)) != NULL) { if (!strncmp(full.basename, filename, len)) { struct stat st; fullpath = (char *)new_segment(&pool, strlen(full.dirname) + strlen(filename) + 2); sprintf(fullpath, "%s/%s", full.dirname, filename); if (stat(fullpath, &st) == -1) continue; if (!match) strncpy(matchstr, filename, PATH_MAX - 1); else strmatch(matchstr, filename); match++; if(S_ISDIR(st.st_mode) && (!strcmp(filename,full.basename))) { strncpy(matchstr, filename, PATH_MAX - 1); strncat(matchstr, "/", PATH_MAX - strlen(matchstr) - 1); match = 1; break; } } } if (match) { sprintf(filename, "%s/%s", full.dirname, matchstr); XtVaSetValues(load_d,XtNvalue,filename,NULL); } url_close(dirp); reuse_mblock(&pool); } } } static char **dotfile_flist; static int dot_nfile = 0; #define SSIZE 256 static void a_readconfig (Config *Cfg) { char s[SSIZE]; char *home, c = ' ', *p; FILE *fp; int i, k; if (NULL == (home=getenv("HOME"))) home=getenv("home"); if (home != NULL) { dotfile = (char *)XtMalloc(sizeof(char) * PATH_MAX); snprintf(dotfile, PATH_MAX, "%s/%s", home, INITIAL_CONFIG); if (NULL != (fp=fopen(dotfile, "r"))) { dotfile_flist = (char **)safe_malloc(sizeof(char *) * INIT_FLISTNUM); while (c != EOF) { p = s; for(i=0;;i++) { c = fgetc(fp); if (c == LF || c == EOF || i > SSIZE) break; *p++ = c; } *p = (char)NULL; if (0 != strncasecmp(s, "set ", 4)) continue; switch (configcmp(s+4, &k)) { case S_RepeatPlay: Cfg->repeat = (Boolean)k; break; case S_AutoStart: Cfg->autostart = (Boolean)k; break; case S_AutoExit: Cfg->autoexit = (Boolean)k; break; case S_DispText: Cfg->hidetext = (Boolean)(k ^ 1); break; case S_ShufflePlay: Cfg->shuffle = (Boolean)k; break; case S_DispTrace: Cfg->disptrace = (Boolean)k; break; case S_CurVol: Cfg->amplitude = (int)k; break; case S_ExtOptions: Cfg->extendopt = (int)k; break; case S_ChorusOption: Cfg->chorusopt = (int)k; break; case S_MidiFile: if(savelist) { p = s+k+4; if(dot_nfile < INIT_FLISTNUM) if(IsEffectiveFile(p)) { dotfile_flist[dot_nfile] = (char *)safe_malloc(sizeof(char)*(strlen(p) +1)); strcpy(dotfile_flist[dot_nfile],p); dotfile_flist[++dot_nfile] = NULL; } } break; } } fclose(fp); } } } static void a_saveconfig (char *file) { FILE *fp; Boolean s1, s2; int i,flags, cflag; if ('\0' != *file) { if (NULL != (fp=fopen(file, "w"))) { XtVaGetValues(repeat_b,XtNstate,&s1,NULL); XtVaGetValues(random_b,XtNstate,&s2,NULL); fprintf(fp,"set %s %d\n",cfg_items[S_ConfirmExit],(int)Cfg.confirmexit); fprintf(fp,"set %s %d\n",cfg_items[S_RepeatPlay],(int)s1); fprintf(fp,"set %s %d\n",cfg_items[S_AutoStart],(int)file_menu[ID_AUTOSTART-100].bmflag); fprintf(fp,"set %s %d\n",cfg_items[S_DispText],(int)(file_menu[ID_HIDETXT-100].bmflag ^ TRUE)); fprintf(fp,"set %s %d\n",cfg_items[S_ShufflePlay],(int)s2); fprintf(fp,"set %s %d\n",cfg_items[S_DispTrace],((int)file_menu[ID_HIDETRACE-100].bmflag ? 0:1)); fprintf(fp,"set %s %d\n",cfg_items[S_CurVol],amplitude); fprintf(fp,"set %s %d\n",cfg_items[S_AutoExit],(int)file_menu[ID_AUTOQUIT-100].bmflag); if(popup_shell_exist & OPTIONS_WINDOW) { flags = 0; cflag = 0; for(i=0; ix <= 0 || leave_event->y <= 0 || leave_event->y >= height) XtPopdown(w); } /*ARGSUSED*/ static void checkRightAndPopupSubmenu(Widget w, XEvent *e, String *v, Cardinal *n) { XLeaveWindowEvent *leave_ev = (XLeaveWindowEvent *)e; Dimension nheight,height,width; Position x,y; int i; if(!maxentry_on_a_menu) return; if(e == NULL) i= *(int *)n; else i= atoi(*v); if(w != title_sm) { if(leave_ev->x <= 0 || leave_ev->y < 0) { XtPopdown(w); return; } } else { if(leave_ev->x <= 0 || leave_ev->y <= 0) return; } if(psmenu[i] == NULL) return; XtVaGetValues(psmenu[i],XtNheight,&height,NULL); /* neighbor menu height */ XtVaGetValues((i>0)? psmenu[i-1]:title_sm, XtNwidth,&width,XtNheight,&nheight,XtNx,&x,XtNy,&y,NULL); if(leave_ev->x > 0 && leave_ev->y > nheight - 22) { XtVaSetValues(psmenu[i],XtNx,x+80,NULL); XtPopup(psmenu[i],XtGrabNone); XtVaGetValues(psmenu[i],XtNheight,&height,NULL); XtVaSetValues(psmenu[i],XtNy,y +((height)? nheight-height:0),NULL); } } /*ARGSUSED*/ static void popdownSubmenuCB(Widget w,XtPointer data,XtPointer dummy) { int i = (int)data; if (i < 0) i = submenu_n -1; while(i >= 0) XtPopdown(psmenu[i--]); } /*ARGSUSED*/ static void popdownSubmenu(Widget w, XEvent *e, String *v, Cardinal *n) { int i = atoi(*v); while(i >= 0) XtPopdown(psmenu[i--]); } /*ARGSUSED*/ static void closeParent(Widget w, XEvent *e, String *v, Cardinal *n) { XtPopdown(XtParent(w)); } /*ARGSUSED*/ static void flistMove(Widget w, XEvent *e, String *v, Cardinal *n) { int i = atoi(*v); XawListReturnStruct *lr; if(!max_files) return; lr= XawListShowCurrent(file_list); if(popup_shell_exist & FLIST_WINDOW) { if(lr != NULL && lr->list_index != XAW_LIST_NONE) { i += atoi(lr->string) -1; if(i<0) i= 0; if(i>=max_files) i= max_files -1; XawListHighlight(file_list, i); } else { XawListHighlight(file_list, (i>0)? max_files-1:0); } } } static int max_num = INIT_FLISTNUM; static void addFlist(char *fname, int current_n) { char *p; if(max_num < current_n+1) { max_num += 64; flist = (String *)safe_realloc(flist,(max_num+1)*sizeof(String)); } p = (char *)safe_malloc(sizeof(char) * (strlen(fname) +1)); flist[current_n]= strcpy(p, fname); flist[current_n+1]= NULL; } static void addOneFile(int max_files,int curr_num,char *fname,Boolean update_flist) { static Dimension tmpi; static int menu_height; static Widget tmpw; static int j; char sbuf[256]; if(curr_num == 0) { j = 0; tmpi = 0; menu_height = 0; tmpw = title_sm; } if(menu_height + tmpi*2 > root_height) { if(!maxentry_on_a_menu) { maxentry_on_a_menu = j = curr_num; XtAddCallback(title_sm,XtNpopdownCallback,popdownSubmenuCB,(XtPointer)(submenu_n -1)); } if(j >= maxentry_on_a_menu) { if (psmenu == NULL) psmenu = (Widget *)safe_malloc(sizeof(Widget) * ((int)(max_files / curr_num)+ 2)); else psmenu = (Widget *)safe_realloc((char *)psmenu, sizeof(Widget)*(submenu_n + 2)); sprintf(sbuf, "morebox%d", submenu_n); pbox=XtVaCreateManagedWidget(sbuf,smeBSBObjectClass,tmpw,XtNlabel," More...", XtNbackground,textbgcolor,XtNforeground,capcolor, XtNrightBitmap,arrow_mark, XtNfont,app_resources.label_font, NULL); snprintf(sbuf,sizeof(sbuf), ": unhighlight() checkRightAndPopupSubmenu(%d)",submenu_n); XtOverrideTranslations(tmpw, XtParseTranslationTable(sbuf)); sprintf(sbuf, "psmenu%d", submenu_n); psmenu[submenu_n] = XtVaCreatePopupShell(sbuf,simpleMenuWidgetClass,title_sm, XtNforeground,textcolor, XtNbackground,textbgcolor, XtNbackingStore,NotUseful,XtNsaveUnder,False, XtNwidth,menu_width, NULL); snprintf(sbuf,sizeof(sbuf), ": popdownSubmenu(%d) notify() unhighlight()\n\ : unhighlight()\n\ : leaveSubmenu(%d) unhighlight()",submenu_n,submenu_n); XtOverrideTranslations(psmenu[submenu_n],XtParseTranslationTable(sbuf)); tmpw = psmenu[submenu_n++]; psmenu[submenu_n] = NULL; j = 0; } } if(maxentry_on_a_menu) j++; bsb=XtVaCreateManagedWidget(fname,smeBSBObjectClass,tmpw,NULL); XtAddCallback(bsb,XtNcallback,menuCB,(XtPointer)curr_num); XtVaGetValues(bsb, XtNheight, &tmpi, NULL); if(!maxentry_on_a_menu) menu_height += tmpi; else psmenu[submenu_n] = NULL; if(update_flist) addFlist(fname, curr_num); } static void createOptions(void) { if(!(popup_shell_exist & OPTIONS_WINDOW)) { popup_opt= XtVaCreatePopupShell("popup_option",transientShellWidgetClass, toplevel,NULL); popup_optbox= XtVaCreateManagedWidget("popup_optbox",boxWidgetClass,popup_opt, XtNorientation,XtorientVertical, XtNwidth,220,XtNheight,280, XtNbackground,bgcolor,NULL); modul_bb=XtVaCreateManagedWidget("modul_box",boxWidgetClass,popup_optbox, XtNorientation,XtorientHorizontal, XtNforeground,boxcolor, XtNbackground,bgcolor, XtNborderWidth,0,NULL); modul_b=XtVaCreateManagedWidget("modul_button",toggleWidgetClass,modul_bb, XtNbitmap,off_mark, XtNforeground,togglecolor, XtNbackground,buttonbgcolor, NULL); modul_l=XtVaCreateManagedWidget("modul_lbl",labelWidgetClass,modul_bb, XtNforeground,textcolor, XtNbackground,bgcolor, XtNborderWidth,0,NULL); porta_bb=XtVaCreateManagedWidget("porta_box",boxWidgetClass,popup_optbox, XtNorientation,XtorientHorizontal, XtNforeground,boxcolor, XtNbackground,bgcolor, XtNborderWidth,0,NULL); porta_b=XtVaCreateManagedWidget("porta_button",toggleWidgetClass,porta_bb, XtNbitmap,off_mark,XtNfromVert,modul_b, XtNforeground,togglecolor, XtNbackground,buttonbgcolor, NULL); porta_l=XtVaCreateManagedWidget("porta_lbl",labelWidgetClass,porta_bb, XtNforeground,textcolor, XtNbackground,bgcolor, XtNborderWidth,0,NULL); nrpnv_bb=XtVaCreateManagedWidget("nrpnv_box",boxWidgetClass,popup_optbox, XtNorientation,XtorientHorizontal, XtNforeground,boxcolor, XtNbackground,bgcolor, XtNborderWidth,0,NULL); nrpnv_b=XtVaCreateManagedWidget("nrpnv_button",toggleWidgetClass,nrpnv_bb, XtNbitmap,off_mark,XtNfromVert,porta_b, XtNforeground,togglecolor, XtNbackground,buttonbgcolor, NULL); nrpnv_l=XtVaCreateManagedWidget("nrpnv_lbl",labelWidgetClass,nrpnv_bb, XtNforeground,textcolor, XtNbackground,bgcolor, XtNborderWidth,0,NULL); reverb_bb=XtVaCreateManagedWidget("reverb_box",boxWidgetClass,popup_optbox, XtNorientation,XtorientHorizontal, XtNforeground,boxcolor, XtNbackground,bgcolor, XtNborderWidth,0,NULL); reverb_b=XtVaCreateManagedWidget("reverb_button",toggleWidgetClass,reverb_bb, XtNbitmap,off_mark,XtNfromVert,nrpnv_b, XtNforeground,togglecolor, XtNbackground,buttonbgcolor, NULL); reverb_l=XtVaCreateManagedWidget("reverb_lbl",labelWidgetClass,reverb_bb, XtNforeground,textcolor, XtNbackground,bgcolor, XtNborderWidth,0,NULL); chorus_bb=XtVaCreateManagedWidget("chorus_box",boxWidgetClass,popup_optbox, XtNorientation,XtorientHorizontal, XtNforeground,boxcolor, XtNbackground,bgcolor, XtNborderWidth,0,NULL); chorus_b=XtVaCreateManagedWidget("chorus_button",toggleWidgetClass,chorus_bb, XtNbitmap,off_mark,XtNfromVert,reverb_b, XtNforeground,togglecolor, XtNbackground,buttonbgcolor, NULL); chorus_l=XtVaCreateManagedWidget("chorus_lbl",labelWidgetClass,chorus_bb, XtNforeground,textcolor, XtNbackground,bgcolor, XtNborderWidth,0,NULL); chpressure_bb=XtVaCreateManagedWidget("chpressure_box",boxWidgetClass,popup_optbox, XtNorientation,XtorientHorizontal,XtNfromVert,chorus_b, XtNforeground,boxcolor, XtNbackground,bgcolor, XtNborderWidth,0,NULL); chpressure_b=XtVaCreateManagedWidget("chpressure_button",toggleWidgetClass,chpressure_bb, XtNbitmap,off_mark,XtNfromVert,chorus_b, XtNforeground,togglecolor, XtNbackground,buttonbgcolor, NULL); chpressure_l=XtVaCreateManagedWidget("chpressure_lbl",labelWidgetClass,chpressure_bb, XtNforeground,textcolor, XtNbackground,bgcolor, XtNborderWidth,0,NULL); overlapv_bb=XtVaCreateManagedWidget("overlapvoice_box",boxWidgetClass,popup_optbox, XtNorientation,XtorientHorizontal,XtNfromVert,chpressure_b, XtNforeground,boxcolor, XtNbackground,bgcolor, XtNborderWidth,0,NULL); overlapv_b=XtVaCreateManagedWidget("overlapvoice_button",toggleWidgetClass,overlapv_bb, XtNbitmap,off_mark,XtNfromVert,chpressure_b, XtNforeground,togglecolor, XtNbackground,buttonbgcolor, NULL); overlapv_l=XtVaCreateManagedWidget("overlapv_lbl",labelWidgetClass,overlapv_bb, XtNforeground,textcolor, XtNbackground,bgcolor, XtNborderWidth,0,NULL); txtmeta_bb=XtVaCreateManagedWidget("txtmeta_box",boxWidgetClass,popup_optbox, XtNorientation,XtorientHorizontal,XtNfromVert,overlapv_b, XtNforeground,boxcolor, XtNbackground,bgcolor, XtNborderWidth,0,NULL); txtmeta_b=XtVaCreateManagedWidget("txtmeta_button",toggleWidgetClass,txtmeta_bb, XtNbitmap,off_mark,XtNfromVert,overlapv_b, XtNforeground,togglecolor, XtNbackground,buttonbgcolor, NULL); txtmeta_l=XtVaCreateManagedWidget("txtmeta_lbl",labelWidgetClass,txtmeta_bb, XtNforeground,textcolor, XtNbackground,bgcolor, XtNborderWidth,0,NULL); popup_oclose= XtVaCreateManagedWidget("closebutton", commandWidgetClass, popup_optbox, XtNfromVert,txtmeta_b, XtNwidth,80,XtNresize,False,NULL); XtAddCallback(popup_opt,XtNdestroyCallback,optionsdestroyCB,NULL); XtAddCallback(popup_oclose,XtNcallback,optionscloseCB,NULL); XtAddCallback(modul_b,XtNcallback,optionsCB,(XtPointer)&option_num[MODUL_N].id); XtAddCallback(porta_b,XtNcallback,optionsCB,(XtPointer)&option_num[PORTA_N].id); XtAddCallback(nrpnv_b,XtNcallback,optionsCB,(XtPointer)&option_num[NRPNV_N].id); XtAddCallback(reverb_b,XtNcallback,optionsCB,(XtPointer)&option_num[REVERB_N].id); XtAddCallback(chpressure_b,XtNcallback,optionsCB,(XtPointer)&option_num[CHPRESSURE_N].id); XtAddCallback(overlapv_b,XtNcallback,optionsCB,(XtPointer)&option_num[OVERLAPV_N].id); XtAddCallback(txtmeta_b,XtNcallback,optionsCB,(XtPointer)&option_num[TXTMETA_N].id); XtAddCallback(chorus_b,XtNcallback,chorusCB,NULL); option_num[MODUL_N].widget= modul_b; option_num[PORTA_N].widget= porta_b; option_num[NRPNV_N].widget= nrpnv_b; option_num[REVERB_N].widget= reverb_b; option_num[CHPRESSURE_N].widget= chpressure_b; option_num[OVERLAPV_N].widget= overlapv_b; option_num[TXTMETA_N].widget= txtmeta_b; XtSetKeyboardFocus(popup_opt, popup_optbox); if(init_options) { int i; for(i=0; ilist_index != XAW_LIST_NONE) { onPlayOffPause(); sprintf(local_buf,"L %d",atoi(lr->string)); a_pipe_write(local_buf); } } /*ARGSUSED*/ static void fdeleteCB(Widget w,XtPointer data,XtPointer call_data) { XawListReturnStruct *lr = XawListShowCurrent(file_list); int i,n; char *p; if(lr == NULL || lr->list_index == XAW_LIST_NONE) return; stopCB(w,NULL,NULL); if(max_files==1) { fdelallCB(w,NULL,NULL); return; } n = atoi(lr->string) -1; sprintf(local_buf,"d %d",n); a_pipe_write(local_buf); --max_files; free(flist[n]); for(i= n; iFILEVPORT_HEIGHT)? h:FILEVPORT_HEIGHT),NULL); if(n>=max_files) --n; XawListHighlight(file_list,n); } if(psmenu != NULL) free(psmenu); XtDestroyWidget(title_sm); psmenu = NULL; maxentry_on_a_menu = 0,submenu_n = 0; title_sm=XtVaCreatePopupShell("title_simplemenu",simpleMenuWidgetClass,title_mb, XtNforeground,textcolor, XtNbackground,textbgcolor, XtNbackingStore,NotUseful, XtNsaveUnder,False, NULL); for(i= 0; iFILEVPORT_HEIGHT)? h:FILEVPORT_HEIGHT),NULL); } if(psmenu != NULL) free(psmenu); XtDestroyWidget(title_sm); psmenu = NULL; maxentry_on_a_menu = 0,submenu_n = 0; title_sm=XtVaCreatePopupShell("title_simplemenu",simpleMenuWidgetClass,title_mb, XtNforeground,textcolor, XtNbackground,textbgcolor, XtNbackingStore,NotUseful, XtNsaveUnder,False, NULL); bsb=XtVaCreateManagedWidget("dummyfile",smeLineObjectClass,title_sm,NULL); snprintf(local_buf,sizeof(local_buf),"TiMidity++ %s",timidity_version); XtVaSetValues(title_mb,XtNlabel,local_buf,NULL); if(ctl->trace_playing) strcpy(window_title,"[ No Playing File ]"); #ifndef WIDGET_IS_LABEL_WIDGET deleteTextCB(w,NULL,NULL); #endif } /*ARGSUSED*/ static void backspaceCB(Widget w,XtPointer data,XtPointer call_data) { XawTextPosition begin,end,curr; XawTextBlock tb; XawTextGetSelectionPos(w, &begin, &end); curr = XawTextGetInsertionPoint(w); if(begin == end) return; tb.firstPos = 0; tb.ptr = "."; tb.format = FMT8BIT; tb.length = strlen(tb.ptr); XawTextReplace(w,begin,end,&tb); XawTextSetInsertionPoint(w,begin+1); } /*ARGSUSED*/ #ifndef WIDGET_IS_LABEL_WIDGET static void deleteTextCB(Widget w,XtPointer data,XtPointer call_data) { XtVaSetValues(lyric_t,XtNstring,(String)"<< TiMidity Messages >>",NULL); } #endif static void createFlist(void) { if(!(popup_shell_exist & FLIST_WINDOW)) { popup_file= XtVaCreatePopupShell("popup_file",transientShellWidgetClass, toplevel,NULL); popup_fbox= XtVaCreateManagedWidget("popup_fbox",boxWidgetClass,popup_file, XtNwidth,280,XtNheight,360, XtNorientation,XtorientVertical, XtNbackground,bgcolor,NULL); file_vport = XtVaCreateManagedWidget("file_vport",viewportWidgetClass,popup_fbox, XtNallowHoriz,True, XtNallowVert,True, XtNuseBottom,True, XtNwidth,FILEVPORT_WIDTH, XtNheight,FILEVPORT_HEIGHT, XtNbackground,textbgcolor,XtNborderWidth,1,NULL); file_list= XtVaCreateManagedWidget("filelist",listWidgetClass,file_vport, XtNverticalList,True, XtNforceColumns,True,XtNdefaultColumns,1, XtNbackground,textbgcolor,NULL); flist_cmdbox= XtVaCreateManagedWidget("flist_cmdbox",boxWidgetClass,popup_fbox, XtNorientation,XtorientHorizontal, XtNwidth,272,XtNheight,24, XtNborderWidth,0, XtNbackground,bgcolor,NULL); popup_fplay= XtVaCreateManagedWidget("fplaybutton", commandWidgetClass,flist_cmdbox, XtNfont,volumefont,XtNresize,False,NULL); popup_fdelete= XtVaCreateManagedWidget("fdeletebutton", commandWidgetClass,flist_cmdbox, XtNfont,volumefont,XtNresize,False,NULL); popup_fdelall= XtVaCreateManagedWidget("fdelallbutton", commandWidgetClass,flist_cmdbox, XtNfont,volumefont,XtNresize,False,NULL); popup_fclose= XtVaCreateManagedWidget("closebutton", commandWidgetClass,flist_cmdbox, XtNfont,volumefont,XtNresize,False,NULL); XtAddCallback(popup_fclose,XtNcallback,flistcloseCB,NULL); XtAddCallback(popup_fplay,XtNcallback,fselectCB,NULL); XtAddCallback(popup_fdelete,XtNcallback,fdeleteCB,NULL); XtAddCallback(popup_fdelall,XtNcallback,fdelallCB,NULL); XtSetKeyboardFocus(popup_file, popup_fbox); popup_shell_exist |= FLIST_WINDOW; XawListChange(file_list, flist, 0,0,True); } } void a_start_interface(int pipe_in) { static XtActionsRec actions[] ={ {"do-quit",(XtActionProc)quitCB}, {"fix-menu", (XtActionProc)filemenuCB}, {"do-menu", (XtActionProc)filemenuAction}, {"do-complete", (XtActionProc)completeDir}, {"do-chgdir", (XtActionProc)setDirAction}, {"draw-trace",(XtActionProc)redrawAction}, {"do-exchange",(XtActionProc)exchgWidth}, {"do-toggletrace",(XtActionProc)toggletrace}, {"do-revcaption",(XtActionProc)redrawCaption}, {"do-dialog-button",(XtActionProc)popdownLoad}, {"do-load",(XtActionProc)popupLoad}, {"do-play",(XtActionProc)playCB}, {"do-sndspec",(XtActionProc)sndspecCB}, {"do-pause",(XtActionProc)pauseAction}, {"do-stop",(XtActionProc)stopCB}, {"do-next",(XtActionProc)nextCB}, {"do-prev",(XtActionProc)prevCB}, {"do-forward",(XtActionProc)forwardCB}, {"do-back",(XtActionProc)backCB}, {"do-key",(XtActionProc)soundkeyAction}, {"do-speed",(XtActionProc)speedAction}, {"do-voice",(XtActionProc)voiceAction}, {"do-volset",(XtActionProc)volsetCB}, {"do-volupdown",(XtActionProc)volupdownAction}, {"do-tuneset",(XtActionProc)tunesetAction}, {"do-tuneslide",(XtActionProc)tuneslideAction}, {"do-resize",(XtActionProc)resizeAction}, {"checkRightAndPopupSubmenu",checkRightAndPopupSubmenu}, {"leaveSubmenu",leaveSubmenu}, {"popdownSubmenu",popdownSubmenu}, {"do-options",(XtActionProc)optionspopupCB}, {"do-filelist",(XtActionProc)flistpopupCB}, {"do-about",(XtActionProc)aboutCB}, {"do-closeparent",closeParent}, {"do-flistmove",flistMove}, {"do-fselect",(XtActionProc)fselectCB}, {"do-fdelete",(XtActionProc)fdeleteCB}, {"do-backspace",(XtActionProc)backspaceCB}, #ifndef WIDGET_IS_LABEL_WIDGET {"do-deltext",(XtActionProc)deleteTextCB}, #endif }; static String fallback_resources[]={ #ifdef I18N "*Command*international: True", "*file_simplemenu*international: True", "*Label*fontSet: -adobe-helvetica-bold-o-*-*-14-*-*-*-*-*-*-*", "*MenuButton*fontSet: -adobe-helvetica-bold-r-*-*-14-*-*-*-*-*-*-*", "*Command*fontSet: -adobe-helvetica-bold-r-*-*-12-*-*-*-*-*-*-*", "*List*fontSet: -adobe-helvetica-medium-r-*-*-12-*-*-*-*-*-*-*", "*Text*fontSet: -misc-fixed-medium-r-normal--14-*-*-*-*-*-*-*", "*Form*fontSet: -adobe-helvetica-medium-r-*-*-12-*-*-*-*-*-*-*", #else "*Label.font: -adobe-helvetica-bold-r-*-*-14-*-*-*-*-*-*-*", "*Text*font: -misc-fixed-medium-r-normal--14-*-*-*-*-*-*-*", #endif "*Text*background: " TEXTBG_COLOR "", "*Text*scrollbar*background: " TEXTBG_COLOR "", "*Scrollbar*background: " TEXTBG_COLOR "", "*Label.foreground: black", "*Label.background: #CCFF33", "*Command.background: " COMMANDBUTTON_COLOR "", "*Dialog.Command.background: " COMMANDBUTTON_COLOR "", "*Dialog.Text.background: " TEXTBG_COLOR "", "*fontSet: -*--14-*", "*load_dialog.label.background: " COMMON_BGCOLOR "", #ifdef I18N "*international: True", #else "*international: False", #endif "*Command.font: -adobe-helvetica-bold-r-*-*-12-*-*-*-*-*-*-*", "*Toggle.font: -adobe-helvetica-medium-o-*-*-12-*-*-*-*-*-*-*", "*MenuButton.translations:: highlight()\\n\ : reset()\\n\ Any: reset() fix-menu() PopupMenu()", "*menu_box.borderWidth: 0", "*button_box.borderWidth: 0", "*button_box.horizDistance: 4", "*file_menubutton.menuName: file_simplemenu", "*file_menubutton.width: 60", "*file_menubutton.height: 28", "*file_menubutton.horizDistance: 6", "*file_menubutton.vertDistance: 4", #ifdef I18N "*file_menubutton.file_simplemenu*fontSet: -*--14-*", "*title_menubutton.title_simplemenu*fontSet: -adobe-helvetica-medium-r-*-*-12-*-*-*-*-*-*-*", #else "*file_menubutton.file_simplemenu*font: -adobe-helvetica-medium-r-*-*-12-*-*-*-*-*-*-*", "*title_menubutton.title_simplemenu*font: -adobe-helvetica-medium-r-*-*-12-*-*-*-*-*-*-*", #endif "*title_menubutton*SmeBSB.font: -adobe-helvetica-medium-r-*-*-12-*-*-*-*-*-*-*", "*title_menubutton.menuName: title_simplemenu", "*popup_abox.OK.label: OK", "*title_menubutton.width: 210", "*title_menubutton.height: 28", "*title_menubutton.resize: false", "*title_menubutton.horizDistance: 6", "*title_menubutton.vertDistance: 4", "*title_menubutton.fromHoriz: file_menubutton", "*time_label.width: 92", "*time_label.height: 26", "*time_label.resize: false", "*time_label.fromHoriz: title_menubutton", "*time_label.horizDistance: 1", "*time_label.vertDistance: 4", "*time_label.label: time / mode", "*button_box.height: 40", "*play_button.width: 32", "*play_button.height: 32", "*play_button.horizDistance: 1", "*play_button.vertDistance: 9", "*pause_button.width: 32", "*pause_button.height: 32", "*pause_button.horizDistance: 1", "*pause_button.vertDistance: 1", "*stop_button.width: 32", "*stop_button.height: 32", "*stop_button.horizDistance: 1", "*stop_button.vertDistance: 1", "*prev_button.width: 32", "*prev_button.height: 32", "*prev_button.horizDistance: 1", "*prev_button.vertDistance: 1", "*back_button.width: 32", "*back_button.height: 32", "*back_button.horizDistance: 1", "*back_button.vertDistance: 1", "*fwd_button.width: 32", "*fwd_button.height: 32", "*fwd_button.horizDistance: 1", "*fwd_button.vertDistance: 1", "*next_button.width: 32", "*next_button.height: 32", "*next_button.horizDistance: 1", "*next_button.vertDistance: 1", "*quit_button.width: 32", "*quit_button.height: 32", "*quit_button.horizDistance: 1", "*quit_button.vertDistance: 1", "*random_button.width: 32", "*random_button.height: 32", "*random_button.horizDistance: 4", "*random_button.vertDistance: 1", "*repeat_button.width: 32", "*repeat_button.height: 32", "*repeat_button.horizDistance: 1", "*repeat_button.vertDistance: 1", "*lyric_text.fromVert: tune_box", "*lyric_text.borderWidth: 1" , "*lyric_text.vertDistance: 4", "*lyric_text.horizDistance: 6", #ifndef WIDGET_IS_LABEL_WIDGET "*lyric_text.height: 120", "*lyric_text.scrollVertical: WhenNeeded", "*lyric_text.translations: #override\\n\ : do-deltext()", #else "*lyric_text.height: 30", "*lyric_text.label: MessageWindow", "*lyric_text.resize: true", #endif #ifdef I18N "*popup_optbox*international: True", "*lyric_text.international: True", "*volume_box*fontSet: -adobe-helvetica-bold-r-*-*-12-*-*-*-*-*-*-*", "*tune_box*fontSet: -adobe-helvetica-bold-r-*-*-12-*-*-*-*-*-*-*", #else "*popup_optbox*international: False", "*lyric_text.international: False", "*volume_box*font: -adobe-helvetica-bold-r-*-*-12-*-*-*-*-*-*-*", "*tune_box*font: -adobe-helvetica-bold-r-*-*-12-*-*-*-*-*-*-*", #endif "*volume_label.vertDistance: 0", "*volume_box.vertDistance: 2", "*volume_box.borderWidth: 0", "*volume_label.borderWidth: 0", "*volume_bar.length: 330", "*tune_box.borderWidth: 0", "*tune_label.label: ----", "*tune_label.vertDistance: 0", "*tune_label.horizDistance: 0", "*tune_label0.horizDistance: 0", "*tune_box.vertDistance: 2", "*tune_bar.length: 330", "*popup_load.title: TiMidity ", "*popup_loadform.height: 400", "*popup_option.title: TiMidity ", "*popup_file.title: TiMidity ", "*popup_about.title: Information", "*load_dialog.label: File Name", "*load_dialog.borderWidth: 0", "*load_dialog.height: 132", "*trace.vertDistance: 2", "*trace.borderWidth: 1", "*trace_vport.borderWidth: 1", #ifdef I18N "*popup_loadform.load_dialog.label.fontSet: -*--14-*", "*popup_abox*fontSet: -adobe-helvetica-bold-o-*-*-14-*-*-*-*-*-*-*", #else "*popup_loadform.load_dialog.label.font: -adobe-helvetica-bold-r-*-*-14-*-*-*-*-*-*-*", "*popup_abox*font: -adobe-helvetica-bold-o-*-*-14-*-*-*-*-*-*-*", #endif "*cwd_label.font: -adobe-helvetica-medium-r-*-*-12-*-*-*-*-*-*-*", "*time_label*cwd_info.font: -adobe-helvetica-medium-r-*-*-12-*-*-*-*-*-*-*", "*time_label.font: -adobe-helvetica-bold-r-*-*-14-*-*-*-*-*-*-*", "*BitmapDir: " XAW_BITMAP_DIR "/", #ifdef XAW3D "*volume_bar.translations: #override\\n\ ~Ctrl Shift: do-volupdown(-50)\\n\ ~Ctrl Shift: do-volupdown(50)\\n\ Ctrl ~Shift: do-volupdown(-5)\\n\ Ctrl ~Shift: do-volupdown(5)\\n\ : MoveThumb()\\n\ : NotifyScroll(FullLength) EndScroll()", "*tune_bar.translations: #override\\n\ : do-tuneset()\\n\ : do-tuneslide()\\n\ : MoveThumb()\\n\ : NotifyScroll(FullLength) EndScroll()", #else "*volume_bar.translations: #override\\n\ ~Ctrl Shift: do-volupdown(-50)\\n\ ~Ctrl Shift: do-volupdown(50)\\n\ Ctrl ~Shift: do-volupdown(-5)\\n\ Ctrl ~Shift: do-volupdown(5)\\n\ : StartScroll(Forward) MoveThumb()\\n\ : StartScroll(Backward) MoveThumb()\\n\ : NotifyScroll(FullLength) EndScroll()", "*tune_bar.translations: #override\\n\ : do-tuneset()\\n\ : do-tuneslide()\\n\ : StartScroll(Forward) MoveThumb()\\n\ : StartScroll(Backward) MoveThumb()\\n\ : NotifyScroll(FullLength) EndScroll()", #endif "*file_simplemenu.load.label: Load (Meta-N)", "*file_simplemenu.saveconfig.label: Save Config (Meta-S)", "*file_simplemenu.hidetext.label: (Un)Hide Messages (Ctrl-M)", "*file_simplemenu.hidetrace.label: (Un)Hide Trace (Ctrl-T)", "*file_simplemenu.shuffle.label: Shuffle (Ctrl-S)", "*file_simplemenu.repeat.label: Repeat (Ctrl-R)", "*file_simplemenu.autostart.label: Auto Start", "*file_simplemenu.autoquit.label: Auto Exit", "*file_simplemenu.filelist.label: File List (Ctrl-F)", "*file_simplemenu.modes.label: Extend Modes (Ctrl-O)", "*file_simplemenu.about.label: About", "*file_simplemenu.quit.label: Quit (Meta-Q, Q)", "*load_dialog.OK.label: OK", "*load_dialog.add.label: Add ALL", "*load_dialog.cancel.label: Cancel", "*flist_cmdbox.fplaybutton.label: Play", "*flist_cmdbox.fdeletebutton.label: Delete", "*flist_cmdbox.fdelallbutton.label: Delete ALL", "*closebutton.label: Close", "*modul_box.modul_lbl.label: Modulation control", "*porta_box.porta_lbl.label: Portamento control", "*nrpnv_box.nrpnv_lbl.label: NRPN Vibration", "*reverb_box.reverb_lbl.label: Reverb control", "*chorus_box.chorus_lbl.label: Chorus control", "*chpressure_box.chpressure_lbl.label: Channel Pressure control", "*overlapvoice_box.overlapv_lbl.label: Allow Multiple Same Notes", "*txtmeta_box.txtmeta_lbl.label: Tracing All Text Meta Events", "*base_form.translations: #override\\n\ ~Ctrl Metan: do-load()\\n\ ~Ctrl Metas: do-menu(" IDS_SAVECONFIG ")\\n\ Ctrl r: do-menu(" IDS_REPEAT ")\\n\ Ctrl s: do-menu(" IDS_SHUFFLE ")\\n\ Ctrlt: do-menu(" IDS_HIDETRACE ")\\n\ Ctrlm: do-menu(" IDS_HIDETXT ")\\n\ ~Ctrlq: do-quit()\\n\ ~Ctrlr: do-play()\\n\ Return: do-play()\\n\ KP_Enter: do-play()\\n\ ~Ctrlg: do-sndspec()\\n\ ~Ctrlspace: do-pause()\\n\ ~Ctrls: do-stop()\\n\ p: do-prev()\\n\ Left: do-prev()\\n\ ~Metan: do-next()\\n\ Right: do-next()\\n\ ~Ctrlf: do-forward()\\n\ ~Ctrlb: do-back()\\n\ ~Ctrlplus: do-key()\\n\ ~Shift-: do-key(1)\\n\ KP_Add: do-key()\\n\ KP_Subtract: do-key(1)\\n\ ~Ctrlgreater: do-speed()\\n\ ~Ctrlless: do-speed(1)\\n\ ~Ctrl ~Shifto: do-voice()\\n\ ~Ctrl Shifto: do-voice(1)\\n\ Ctrlo: do-options()\\n\ Ctrlf: do-filelist()\\n\ l: do-filelist()\\n\ a: do-about()\\n\ ~Ctrl ~Shiftv: do-volupdown(-10)\\n\ ~Ctrl Shiftv: do-volupdown(10)\\n\ Down: do-volupdown(-10)\\n\ Up: do-volupdown(10)\\n\ ~Ctrlx: do-exchange()\\n\ ~Ctrlt: do-toggletrace()\\n\ : do-resize()", "*load_dialog.value.translations: #override\\n\ ~CtrlReturn: do-chgdir() end-of-line()\\n\ ~CtrlKP_Enter: do-chgdir() end-of-line()\\n\ ~Ctrl ~MetaTab: do-complete() end-of-line()\\n\ Ctrl ~Shiftg: do-dialog-button(1)\\n\ BackSpace: do-backspace() delete-previous-character()\\n\ Delete: do-backspace() delete-previous-character()\\n\ CtrlH: do-backspace() delete-previous-character()\\n\ Escape: do-dialog-button(1)", "*trace.translations: #override\\n\ : do-toggletrace()\\n\ : do-revcaption()\\n\ : do-revcaption()\\n\ : draw-trace()", "*time_label.translations: #override\\n\ : do-menu(" IDS_HIDETRACE ")\\n\ : do-exchange()", "*popup_optbox.translations: #override\\n\ ~Ctrlc: do-closeparent()\\n\ ~Ctrlq: do-quit()", "*popup_fbox.translations: #override\\n\ ~Ctrlc: do-closeparent()\\n\ Up: do-flistmove(-1)\\n\ p: do-flistmove(-1)\\n\ Prior: do-flistmove(-5)\\n\ Right: do-flistmove(-5)\\n\ ~Ctrlr: do-fselect()\\n\ Return: do-fselect()\\n\ KP_Enter: do-fselect()\\n\ Ctrlm: do-fselect()\\n\ space: do-pause()\\n\ s: do-stop()\\n\ Down: do-flistmove(1)\\n\ n: do-flistmove(1)\\n\ Next: do-flistmove(5)\\n\ Left: do-flistmove(5)\\n\ d: do-fdelete()\\n\ ~Shiftv: do-volupdown(-10)\\n\ Shiftv: do-volupdown(10)\\n\ ~Ctrlf: do-forward()\\n\ ~Ctrlb: do-back()\\n\ ~Ctrlq: do-quit()", "*popup_abox.translations: #override\\n\ ~Ctrlc: do-closeparent()\\n\ KP_Enter: do-closeparent()\\n\ Return: do-closeparent()", NULL, }; XtAppContext app_con; char cbuf[PATH_MAX]; Pixmap bmPixmap; int bmwidth, bmheight; int i, j, k, tmpi; int argc=1; float thumb, l_thumb, l_thumbj; char *argv=APP_NAME, *filetext; #ifdef I18N #define XtNfontDEF XtNfontSet XFontSet textfont; #else #define XtNfontDEF XtNfont XFontStruct *textfont; #endif XawListReturnStruct lrs; unsigned long gcmask; XGCValues gcval; #ifdef DEBUG_PRINT_RESOURCE char str[BUFSIZ], *p,*new; for(i=0; fallback_resources[i] != NULL; i++) { p = fallback_resources[i]; new= str; while(*p != NULL) { if(*p == 'n' && *(p-1) == '\\') { *new++ = 'n'; *new++ = '\\'; *new++ = '\n'; } else { *new++ = *p; } p++; } *new = '\0'; puts(str); } exit(0); #endif xaw_vendor_setup(); #ifdef I18N XtSetLanguageProc(NULL,NULL,NULL); #endif toplevel=XtVaAppInitialize(&app_con,APP_CLASS,NULL,ZERO,&argc,&argv, fallback_resources,NULL); XtGetApplicationResources(toplevel,(caddr_t)&app_resources,xaw_resources, XtNumber(xaw_resources),NULL,0); bitmapdir = app_resources.bitmap_dir; arrangetitle = app_resources.arrange_title; savelist = app_resources.save_list; text_height = (Dimension)app_resources.text_height; trace_width = (Dimension)app_resources.trace_width; trace_height = (Dimension)app_resources.trace_height; menu_width = (Dimension)app_resources.menu_width; labelfont = app_resources.label_font; volumefont = app_resources.volume_font; textfont = app_resources.text_font; tracefont = app_resources.trace_font; ttitlefont = app_resources.ttitle_font; a_readconfig(&Cfg); amplitude= (amplification == DEFAULT_AMPLIFICATION)? Cfg.amplitude:amplification; disp = XtDisplay(toplevel); screen = DefaultScreen(disp); root_height = DisplayHeight(disp, screen); root_width = DisplayWidth(disp, screen); check_mark = XCreateBitmapFromData(XtDisplay(toplevel), RootWindowOfScreen(XtScreen(toplevel)), (char *)check_bits, check_width, check_height); arrow_mark = XCreateBitmapFromData(XtDisplay(toplevel), RootWindowOfScreen(XtScreen(toplevel)), (char *)arrow_bits, (unsigned int)arrow_width,arrow_height); on_mark = XCreateBitmapFromData(XtDisplay(toplevel), RootWindowOfScreen(XtScreen(toplevel)), (char *)on_bits, (unsigned int)on_width,on_height); off_mark = XCreateBitmapFromData(XtDisplay(toplevel), RootWindowOfScreen(XtScreen(toplevel)), (char *)off_bits, (unsigned int)off_width,off_height); for(i= 0; i < MAXBITMAP; i++) { snprintf(cbuf,sizeof(cbuf),"%s/%s",bitmapdir,bmfname[i]); XReadBitmapFile(disp,RootWindow(disp,screen),cbuf,&bm_width[i],&bm_height[i], &bm_Pixmap[i],&x_hot,&y_hot); } safe_getcwd(basepath, sizeof(basepath)); #ifdef OFFIX DndInitialize(toplevel); DndRegisterOtherDrop(FileDropedHandler); DndRegisterIconDrop(FileDropedHandler); #endif XtAppAddActions(app_con, actions, XtNumber(actions)); bgcolor = app_resources.common_bgcolor; menubcolor = app_resources.menub_bgcolor; textcolor = app_resources.common_fgcolor; textbgcolor = app_resources.text_bgcolor; text2bgcolor = app_resources.text2_bgcolor; buttonbgcolor = app_resources.button_bgcolor; buttoncolor = app_resources.button_fgcolor; togglecolor = app_resources.toggle_fgcolor; if(ctl->trace_playing) { volcolor = app_resources.volume_color; expcolor = app_resources.expr_color; pancolor = app_resources.pan_color; tracecolor = app_resources.trace_bgcolor; } if(ctl->trace_playing) { gcmask = GCForeground | GCBackground | GCFont; gcval.foreground = 1; gcval.background = 1; gcval.plane_mask = 1; #ifdef I18N XFontsOfFontSet(ttitlefont,&fs_list,&ml); ttitlefont0 = fs_list[0]; if (! ttitlefont0->fid) { ttitlefont0 = XLoadQueryFont(disp, ml[0]); if (! ttitlefont0) { fprintf(stderr, "can't load fonts %s\n", ml[0]); exit(1); } } gcval.font = ttitlefont0->fid; #else gcval.font = ttitlefont->fid; #endif gcs = XCreateGC(disp, RootWindow(disp, screen), gcmask, &gcval); } base_f=XtVaCreateManagedWidget("base_form",boxWidgetClass,toplevel, XtNbackground,bgcolor, XtNwidth,rotatewidth[currwidth], NULL); m_box=XtVaCreateManagedWidget("menu_box",boxWidgetClass,base_f, XtNorientation,XtorientHorizontal, XtNbackground,bgcolor, NULL); filetext = app_resources.file_text; file_mb=XtVaCreateManagedWidget("file_menubutton",menuButtonWidgetClass,m_box, XtNbackground,menubcolor, XtNfont,labelfont, XtNlabel,filetext, NULL); file_sm=XtVaCreatePopupShell("file_simplemenu",simpleMenuWidgetClass,file_mb, XtNforeground,textcolor, XtNbackground,textbgcolor,XtNresize,False, XtNbackingStore,NotUseful, XtNsaveUnder,False, XtNwidth,menu_width+100, NULL); snprintf(cbuf,sizeof(cbuf),"TiMidity++ %s",timidity_version); title_mb=XtVaCreateManagedWidget("title_menubutton",menuButtonWidgetClass,m_box, XtNbackground,menubcolor,XtNlabel,cbuf, XtNfont,labelfont, NULL); title_sm=XtVaCreatePopupShell("title_simplemenu",simpleMenuWidgetClass,title_mb, XtNforeground,textcolor, XtNbackground,textbgcolor, XtNbackingStore,NotUseful, XtNsaveUnder,False, NULL); time_l=XtVaCreateManagedWidget("time_label",commandWidgetClass,m_box, XtNfont,labelfont, XtNbackground,menubcolor,NULL); b_box=XtVaCreateManagedWidget("button_box",boxWidgetClass,base_f, XtNorientation,XtorientHorizontal, XtNwidth,rotatewidth[currwidth]-10, XtNbackground,bgcolor,XtNfromVert,m_box, NULL); v_box=XtVaCreateManagedWidget("volume_box",boxWidgetClass,base_f, XtNorientation,XtorientHorizontal, XtNwidth,TRACE_WIDTH_SHORT, XtNheight,36, XtNfromVert,b_box,XtNbackground,bgcolor, NULL); t_box=XtVaCreateManagedWidget("tune_box",boxWidgetClass,base_f, XtNorientation,XtorientHorizontal, XtNwidth,TRACE_WIDTH_SHORT, XtNheight,36, XtNfromVert,v_box,XtNbackground,bgcolor, NULL); i = XTextWidth(volumefont,"Volume ",7)+8; vol_l0=XtVaCreateManagedWidget("volume_label0",labelWidgetClass,v_box, XtNwidth,i, XtNresize,False, XtNfont,volumefont, XtNlabel, "Volume", XtNborderWidth,0, XtNforeground,textcolor, XtNbackground,bgcolor, NULL); VOLUME_LABEL_WIDTH = i+30; j = XTextWidth(volumefont,"000",3)+8; VOLUME_LABEL_WIDTH += j; vol_l=XtVaCreateManagedWidget("volume_label",labelWidgetClass,v_box, XtNwidth,j, XtNresize,False,XtNborderWidth,0, XtNfont,volumefont, XtNorientation, XtorientHorizontal, XtNforeground,textcolor, XtNbackground,bgcolor, NULL); vol_bar=XtVaCreateManagedWidget("volume_bar",scrollbarWidgetClass,v_box, XtNorientation, XtorientHorizontal, XtNwidth, TRACE_WIDTH_SHORT -VOLUME_LABEL_WIDTH, XtNbackground,textbgcolor, XtNfromVert,vol_l, XtNtopOfThumb,&l_thumb, NULL); i = XTextWidth(volumefont," 00:00",6); tune_l0=XtVaCreateManagedWidget("tune_label0",labelWidgetClass,t_box, XtNwidth,i, XtNresize,False, XtNlabel, " 0:00", XtNfont,volumefont, XtNfromVert,vol_l0,XtNborderWidth,0, XtNforeground,textcolor, XtNbackground,bgcolor, NULL); j = XTextWidth(volumefont,"/ 00:00",7); tune_l=XtVaCreateManagedWidget("tune_label",labelWidgetClass,t_box, XtNwidth,j, XtNresize,False, XtNfont,volumefont, XtNfromVert,vol_l,XtNborderWidth,0, XtNforeground,textcolor, XtNbackground,bgcolor, NULL); tune_bar=XtVaCreateManagedWidget("tune_bar",scrollbarWidgetClass,t_box, XtNwidth, TRACE_WIDTH_SHORT -i -j -30, XtNbackground,textbgcolor,XtNorientation, XtorientHorizontal, XtNfromVert,tune_l, XtNtopOfThumb,&l_thumbj, NULL); l_thumb = thumb = (float)amplitude / (float)MAXVOLUME; if (sizeof(thumb) > sizeof(XtArgVal)) { XtVaSetValues(vol_bar,XtNtopOfThumb,&thumb,NULL); } else { XtArgVal * l_thumb = (XtArgVal *) &thumb; XtVaSetValues(vol_bar,XtNtopOfThumb,*l_thumb,NULL); } play_b=XtVaCreateManagedWidget("play_button",toggleWidgetClass,b_box, XtNbitmap,bm_Pixmap[BM_PLAY], XtNforeground,buttoncolor, XtNbackground,buttonbgcolor, NULL); pause_b=XtVaCreateManagedWidget("pause_button",toggleWidgetClass,b_box, XtNbitmap,bm_Pixmap[BM_PAUSE], XtNfromHoriz, play_b, XtNforeground,togglecolor, XtNbackground,buttonbgcolor, NULL); stop_b=XtVaCreateManagedWidget("stop_button",commandWidgetClass,b_box, XtNbitmap,bm_Pixmap[BM_STOP], XtNforeground,buttoncolor, XtNbackground,buttonbgcolor, XtNfromHoriz,pause_b,NULL); prev_b=XtVaCreateManagedWidget("prev_button",commandWidgetClass,b_box, XtNbitmap,bm_Pixmap[BM_PREV], XtNforeground,buttoncolor, XtNbackground,buttonbgcolor, XtNfromHoriz,stop_b,NULL); back_b=XtVaCreateManagedWidget("back_button",commandWidgetClass,b_box, XtNbitmap,bm_Pixmap[BM_BACK], XtNforeground,buttoncolor, XtNbackground,buttonbgcolor, XtNfromHoriz,prev_b,NULL); fwd_b=XtVaCreateManagedWidget("fwd_button",commandWidgetClass,b_box, XtNbitmap,bm_Pixmap[BM_FWRD], XtNforeground,buttoncolor, XtNbackground,buttonbgcolor, XtNfromHoriz,back_b,NULL); next_b=XtVaCreateManagedWidget("next_button",commandWidgetClass,b_box, XtNbitmap,bm_Pixmap[BM_NEXT], XtNforeground,buttoncolor, XtNbackground,buttonbgcolor, XtNfromHoriz,fwd_b,NULL); quit_b=XtVaCreateManagedWidget("quit_button",commandWidgetClass,b_box, XtNbitmap,bm_Pixmap[BM_QUIT], XtNforeground,buttoncolor, XtNbackground,buttonbgcolor, XtNfromHoriz,next_b,NULL); random_b=XtVaCreateManagedWidget("random_button",toggleWidgetClass,b_box, XtNbitmap,bm_Pixmap[BM_RANDOM], XtNfromHoriz,quit_b, XtNforeground,togglecolor, XtNbackground,buttonbgcolor, NULL); repeat_b=XtVaCreateManagedWidget("repeat_button",toggleWidgetClass,b_box, XtNbitmap,bm_Pixmap[BM_REPEAT], XtNfromHoriz,random_b, XtNforeground,togglecolor, XtNbackground,buttonbgcolor, NULL); popup_load=XtVaCreatePopupShell("popup_load",transientShellWidgetClass,toplevel, NULL); popup_load_f= XtVaCreateManagedWidget("popup_loadform",formWidgetClass,popup_load, XtNbackground,bgcolor, NULL); load_d=XtVaCreateManagedWidget("load_dialog",dialogWidgetClass,popup_load_f, XtNbackground,bgcolor, XtNresizable,True, NULL); cwd_l = XtVaCreateManagedWidget("cwd_label",labelWidgetClass,popup_load_f, XtNlabel,basepath, XtNborderWidth,0, XtNfromVert,load_d, XtNwidth,250, XtNheight,20, XtNbackground,text2bgcolor, XtNresizable,False, NULL); load_vport = XtVaCreateManagedWidget("vport",viewportWidgetClass, popup_load_f, XtNfromVert,cwd_l, XtNallowHoriz,True, XtNallowVert,True, XtNbackground,textbgcolor, XtNuseBottom,True, XtNwidth,250, XtNheight,200, NULL); load_flist = XtVaCreateManagedWidget("files",listWidgetClass,load_vport, XtNverticalList,True, XtNforceColumns,False, XtNbackground,textbgcolor, XtNdefaultColumns,3, NULL); load_info = XtVaCreateManagedWidget("cwd_info",labelWidgetClass,popup_load_f, XtNborderWidth,0, XtNwidth,250, XtNheight,20, XtNresizable,False, XtNbackground,text2bgcolor, XtNfromVert,load_vport, NULL); XawDialogAddButton(load_d, "OK", popdownLoad,"Y"); XawDialogAddButton(load_d, "add", popdownLoad,"A"); XawDialogAddButton(load_d, "cancel", popdownLoad,NULL); #ifndef WIDGET_IS_LABEL_WIDGET lyric_t=XtVaCreateManagedWidget("lyric_text",asciiTextWidgetClass,base_f, XtNwrap,XawtextWrapWord, XtNeditType,XawtextAppend, XtNwidth, rotatewidth[currwidth]-10, #else lyric_t=XtVaCreateManagedWidget("lyric_text",labelWidgetClass,base_f, XtNresize,False, XtNforeground,textcolor, XtNbackground,menubcolor, XtNwidth,rotatewidth[currwidth]-10, #endif XtNfontDEF,textfont, XtNheight,text_height, XtNfromVert,t_box, NULL); if(ctl->trace_playing) { trace_vport = XtVaCreateManagedWidget("trace_vport",viewportWidgetClass, base_f, XtNallowHoriz,True, XtNallowVert,True, XtNuseBottom,True, XtNfromVert,lyric_t, XtNbackground,tracecolor, #ifdef WIDGET_IS_LABEL_WIDGET XtNuseRight,True, #endif XtNwidth,trace_width, XtNheight,trace_height+12, NULL); trace = XtVaCreateManagedWidget("trace",widgetClass,trace_vport, XtNwidth,trace_width, XtNbackground,tracecolor, XtNheight,BAR_SPACE*MAX_XAW_MIDI_CHANNELS+TRACEV_OFS, NULL); } XtAddCallback(quit_b,XtNcallback,quitCB,NULL); XtAddCallback(play_b,XtNcallback,playCB,NULL); XtAddCallback(pause_b,XtNcallback,pauseCB,NULL); XtAddCallback(stop_b,XtNcallback,stopCB,NULL); XtAddCallback(prev_b,XtNcallback,prevCB,NULL); XtAddCallback(next_b,XtNcallback,nextCB,NULL); XtAddCallback(fwd_b,XtNcallback,forwardCB,NULL); XtAddCallback(back_b,XtNcallback,backCB,NULL); XtAddCallback(random_b,XtNcallback,randomCB,NULL); XtAddCallback(repeat_b,XtNcallback,repeatCB,NULL); XtAddCallback(vol_bar,XtNjumpProc,volsetCB,NULL); XtAddCallback(vol_bar,XtNscrollProc,volupdownCB,NULL); XtAppAddInput(app_con,pipe_in,(XtPointer)XtInputReadMask,handle_input,NULL); XtAddCallback(load_flist,XtNcallback,(XtCallbackProc)setDirList,cwd_l); XtAddCallback(time_l,XtNcallback,(XtCallbackProc)filemenuAction,NULL); XtRealizeWidget(toplevel); dirlist = NULL; lrs.string = ""; setDirList(load_flist, cwd_l, &lrs); XtSetKeyboardFocus(base_f, base_f); XtSetKeyboardFocus(lyric_t, base_f); if(ctl->trace_playing) XtSetKeyboardFocus(trace, base_f); XtSetKeyboardFocus(popup_load_f, load_d); load_t = XtNameToWidget(load_d,"value"); XtOverrideTranslations(toplevel, XtParseTranslationTable("WM_PROTOCOLS: do-quit()")); snprintf(cbuf,sizeof(cbuf),"%s/%s",bitmapdir,iconname); XReadBitmapFile(disp,RootWindow(disp,screen),cbuf, &bmwidth,&bmheight,&bmPixmap,&x_hot,&y_hot); XtVaSetValues(toplevel,XtNiconPixmap,bmPixmap,NULL); strcpy(window_title,APP_CLASS); w_title = strncat(window_title," : ",3); w_title += sizeof(APP_CLASS)+ 2; XtVaGetValues(toplevel,XtNheight,&base_height,NULL); XtVaGetValues(lyric_t,XtNheight,&lyric_height,NULL); a_print_text(lyric_t,strcpy(local_buf,"<< TiMidity Messages >>")); a_pipe_write("READY"); if(ctl->trace_playing) { XGCValues gv; gv.fill_style = FillTiled; gv.fill_rule = WindingRule; Panel = (PanelInfo *)safe_malloc(sizeof(PanelInfo)); gc_xcopy = XCreateGC(disp,RootWindow(disp, screen),GCFillStyle|GCFillRule,&gv); gct = XCreateGC(disp, RootWindow(disp, screen), 0, NULL); gc = XCreateGC(disp, RootWindow(disp, screen), 0, NULL); for(i=0; iis_drum[i]=1; barcol[i]=app_resources.drumvelocity_color; } else { barcol[i]=app_resources.velocity_color; } inst_name[i] = (char *)safe_malloc(sizeof(char) * INST_NAME_SIZE); } rimcolor = app_resources.rim_color; boxcolor = app_resources.box_color; capcolor = app_resources.caption_color; black = app_resources.black_key_color; white = app_resources.white_key_color; suscolor = app_resources.sus_color; playcolor = app_resources.play_color; revcolor = app_resources.rev_color; chocolor = app_resources.cho_color; XSetFont(disp, gct, tracefont->fid); keyG = (ThreeL *)safe_malloc(sizeof(ThreeL) * KEY_NUM); for(i=0, j= BARH_OFS8+1; itrace_playing || !Cfg.disptrace) { Dimension w2,h2,h; XtVaSetValues(lyric_t,XtNwidth,rotatewidth[0] -12,NULL); XtVaGetValues(toplevel,XtNheight,&h,NULL); XtMakeResizeRequest(toplevel,rotatewidth[0],h,&w2,&h2); } if (!ctl->trace_playing) XtVaSetValues(file_menu[ID_HIDETRACE-100].widget,XtNsensitive,False,NULL); /* Please sleep here to make widgets arrange by Form Widget, * otherwise the widget geometry is broken. * Strange!! */ if(Cfg.hidetext || !Cfg.disptrace) { XSync(disp, False); usleep(10000); } sprintf(cbuf,"%d",amplitude); XtVaSetValues(vol_l,XtNlabel,cbuf,NULL); sprintf(local_buf,"V %d\n",amplitude); a_pipe_write(local_buf); if (init_options == DEFAULT_OPTIONS) init_options=Cfg.extendopt; if (init_chorus == DEFAULT_CHORUS) init_chorus=Cfg.chorusopt; sprintf(local_buf,"E %03d",init_options); a_pipe_write(local_buf); sprintf(local_buf,"C %03d",init_chorus); a_pipe_write(local_buf); if(Cfg.autostart) filemenuCB(file_menu[ID_AUTOSTART-100].widget, &file_menu[ID_AUTOSTART-100].id,NULL); if(Cfg.autoexit) { filemenuCB(file_menu[ID_AUTOQUIT-100].widget, &file_menu[ID_AUTOQUIT-100].id,NULL); } if(Cfg.hidetext) filemenuCB(file_menu[ID_HIDETXT-100].widget, &file_menu[ID_HIDETXT-100].id,NULL); if(!Cfg.disptrace) filemenuCB(file_menu[ID_HIDETRACE-100].widget, &file_menu[ID_HIDETRACE-100].id,NULL); if(Cfg.repeat) repeatCB(NULL,&Cfg.repeat,NULL); if(Cfg.shuffle) randomCB(NULL,&Cfg.shuffle,NULL); if(Cfg.autostart) { if(max_files==0) prevCB(NULL,NULL,NULL); else playCB(NULL,NULL,NULL); } else stopCB(NULL,NULL,NULL); if(ctl->trace_playing) initStatus(); XtAppMainLoop(app_con); } static void safe_getcwd(char *cwd, int maxlen) { #ifndef STDC_HEADERS if(!getwd(cwd)) #else if(!getcwd(cwd, maxlen)) #endif { ctl->cmsg(CMSG_WARNING, VERB_NORMAL, "Warning: Can't get current working directory"); strcpy(cwd, "."); } } #include "interface.h" #if defined(IA_MOTIF) /* * Switch -lXm's vendorShellWidgetClass to -lXaw's vendorShellWidgetClass */ #define vendorShellClassRec xaw_vendorShellClassRec #define vendorShellWidgetClass xaw_vendorShellWidgetClass #include "xaw_redef.c" #undef vendorShellClassRec #undef vendorShellWidgetClass extern WidgetClass vendorShellWidgetClass; extern VendorShellClassRec vendorShellClassRec; static void xaw_vendor_setup(void) { memcpy(&vendorShellClassRec, &xaw_vendorShellClassRec, sizeof(VendorShellClassRec)); vendorShellWidgetClass = (WidgetClass)&xaw_vendorShellWidgetClass; } #else static void xaw_vendor_setup(void) { } #endif TiMidity++-2.13.2/interface/xaw_redef.c0100644004711200001440000006076707421005040016755 0ustar tamukiusers/* Masanao Izumo : * * There is problem if both -lXm and -lXaw are linked. * This source code to re-define XAW vendorShell. * To change motif vendorShell to XAW vendorShell in runtime. * * #define vendorShellClassRec xaw_vendorShellClassRec * #define vendorShellWidgetClass xaw_vendorShellWidgetClass * #include "xaw_redef.c" * #undef vendorShellClassRec * #undef vendorShellWidgetClass * extern WidgetClass vendorShellWidgetClass; * extern VendorShellClassRec vendorShellClassRec; * static void xaw_vendor_setup(void) * { * memcpy(&vendorShellClassRec, &xaw_vendorShellClassRec, * sizeof(VendorShellClassRec)); * vendorShellWidgetClass = (WidgetClass)&xaw_vendorShellWidgetClass; * } */ /* $XConsortium: Vendor.c,v 1.27 94/04/17 20:13:25 kaleb Exp $ */ /*********************************************************** Copyright (c) 1987, 1988, 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 CONNECTION 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 dealings in this Software without prior written authorization from the X Consortium. Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, 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. ******************************************************************/ /* * This is a copy of Xt/Vendor.c with an additional ClassInitialize * procedure to register Xmu resource type converters, and all the * monkey business associated with input methods... * */ /* Make sure all wm properties can make it out of the resource manager */ #include #include #include #include #include #include #include #include #ifdef HAVE_XMUREGISTEREXTERNALAGENT #ifdef HAVE_X11_XMU_EXTAGENT_H #include #else /* There is no ExtAgent.h in openwin package, but XmuRegisterExternalAgent * is surely defined in libXmu on Solaris 7. */ extern void XmuRegisterExternalAgent( #if NeedFunctionPrototypes Widget /* w */, XtPointer /* data */, XEvent* /* event */, Boolean* /* cont */ #endif ); #endif /* HAVE_X11_XMU_EXTAGENT_H */ #endif /* HAVE_XMUREGISTEREXTERNALAGENT */ /* The following two headers are for the input method. */ /* $XConsortium: VendorEP.h,v 1.2 94/04/17 20:13:25 kaleb Exp $ */ /* * Copyright 1991 by OMRON Corporation * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of OMRON not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. OMRON makes no representations about the * suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * OMRON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL * OMRON BE LIABLE FOR ANY SPECIAL, 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 TORTUOUS ACTION, * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. * * Author: Seiji Kuwari OMRON Corporation * kuwa@omron.co.jp * kuwa%omron.co.jp@uunet.uu.net */ /* 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 CONNECTION 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 dealings in this Software without prior written authorization from the X Consortium. */ #ifndef _VendorEP_h #define _VendorEP_h /* $XConsortium: XawImP.h,v 1.4 95/06/06 20:50:30 kaleb Exp $ */ /* * Copyright 1991 by OMRON Corporation * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of OMRON not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. OMRON makes no representations about the * suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * OMRON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL * OMRON BE LIABLE FOR ANY SPECIAL, 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 TORTUOUS ACTION, * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. * * Author: Seiji Kuwari OMRON Corporation * kuwa@omron.co.jp * kuwa%omron.co.jp@uunet.uu.net */ /* 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 CONNECTION 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 dealings in this Software without prior written authorization from the X Consortium. */ #ifndef _XawImP_h #define _XawImP_h #define XtNinputMethod "inputMethod" #define XtCInputMethod "InputMethod" #define XtNpreeditType "preeditType" #define XtCPreeditType "PreeditType" #define XtNopenIm "openIm" #define XtCOpenIm "OpenIm" #define XtNsharedIc "sharedIc" #define XtCSharedIc "SharedIc" #include #define CIICFocus (1 << 0) #define CIFontSet (1 << 1) #define CIFg (1 << 2) #define CIBg (1 << 3) #define CIBgPixmap (1 << 4) #define CICursorP (1 << 5) #define CILineS (1 << 6) typedef struct _XawImPart { XIM xim; XrmResourceList resources; Cardinal num_resources; Boolean open_im; Boolean initialized; Dimension area_height; String input_method; String preedit_type; } XawImPart; typedef struct _XawIcTablePart { Widget widget; XIC xic; XIMStyle input_style; unsigned long flg; unsigned long prev_flg; Boolean ic_focused; XFontSet font_set; Pixel foreground; Pixel background; Pixmap bg_pixmap; XawTextPosition cursor_position; unsigned long line_spacing; Boolean openic_error; struct _XawIcTablePart *next; } XawIcTablePart, *XawIcTableList; typedef struct _XawIcPart { XIMStyle input_style; Boolean shared_ic; XawIcTableList shared_ic_table; XawIcTableList current_ic_table; XawIcTableList ic_table; } XawIcPart; typedef struct _contextDataRec { Widget parent; Widget ve; } contextDataRec; typedef struct _contextErrDataRec { Widget widget; XIM xim; } contextErrDataRec; void _XawImResizeVendorShell( #if NeedFunctionPrototypes Widget /* w */ #endif ); Dimension _XawImGetShellHeight( #if NeedFunctionPrototypes Widget /* w */ #endif ); void _XawImRealize( #if NeedFunctionPrototypes Widget /* w */ #endif ); void _XawImInitialize( #if NeedFunctionPrototypes Widget, /* w */ Widget /* ext */ #endif ); void _XawImReconnect( #if NeedFunctionPrototypes Widget /* w */ #endif ); void _XawImRegister( #if NeedFunctionPrototypes Widget /* w */ #endif ); void _XawImUnregister( #if NeedFunctionPrototypes Widget /* w */ #endif ); void _XawImSetValues( #if NeedFunctionPrototypes Widget, /* w */ ArgList, /* args */ Cardinal /* num_args */ #endif ); /* DON'T USE THIS FUNCTION -- it's going away in the next release */ void _XawImVASetValues( #if NeedVarargsPrototypes Widget, /* w */ ... #endif ); void _XawImSetFocusValues( #if NeedFunctionPrototypes Widget, /* w */ ArgList, /* args */ Cardinal /* num_args */ #endif ); /* DON'T USE THIS FUNCTION -- it's going away in the next release */ void _XawImVASetFocusValues( #if NeedVarargsPrototypes Widget, /* w */ ... #endif ); void _XawImUnsetFocus( #if NeedFunctionPrototypes Widget /* w */ #endif ); int _XawImWcLookupString( #if NeedFunctionPrototypes Widget, /* w */ XKeyPressedEvent*, /* event */ wchar_t*, /* buffer_return */ int, /* bytes_buffer */ KeySym*, /* keysym_return */ Status* /* status return */ #endif ); int _XawImGetImAreaHeight( #if NeedFunctionPrototypes Widget /* w */ #endif ); void _XawImCallVendorShellExtResize( #if NeedFunctionPrototypes Widget /* w */ #endif ); void _XawImDestroy( #if NeedFunctionPrototypes Widget, /* w */ Widget /* ext */ #endif ); #endif /* _XawImP_h */ typedef struct { XtPointer extension; } XawVendorShellExtClassPart; typedef struct _VendorShellExtClassRec { ObjectClassPart object_class; XawVendorShellExtClassPart vendor_shell_ext_class; } XawVendorShellExtClassRec; typedef struct { Widget parent; XawImPart im; XawIcPart ic; } XawVendorShellExtPart; typedef struct XawVendorShellExtRec { ObjectPart object; XawVendorShellExtPart vendor_ext; } XawVendorShellExtRec, *XawVendorShellExtWidget; #endif /* _VendorEP_h */ static XtResource resources[] = { {XtNinput, XtCInput, XtRBool, sizeof(Bool), XtOffsetOf(VendorShellRec, wm.wm_hints.input), XtRImmediate, (XtPointer)True} }; /*************************************************************************** * * Vendor shell class record * ***************************************************************************/ static void XawVendorShellClassInitialize(); static void XawVendorShellClassPartInit(); static void XawVendorShellInitialize(); static Boolean XawVendorShellSetValues(); static void Realize(), ChangeManaged(); static XtGeometryResult GeometryManager(); void XawVendorShellExtResize(); static CompositeClassExtensionRec vendorCompositeExt = { /* next_extension */ NULL, /* record_type */ NULLQUARK, /* version */ XtCompositeExtensionVersion, /* record_size */ sizeof (CompositeClassExtensionRec), /* accepts_objects */ TRUE, /* allows_change_managed_set */ FALSE }; #define SuperClass (&wmShellClassRec) externaldef(vendorshellclassrec) VendorShellClassRec vendorShellClassRec = { { /* superclass */ (WidgetClass)SuperClass, /* class_name */ "VendorShell", /* size */ sizeof(VendorShellRec), /* class_initialize */ XawVendorShellClassInitialize, /* class_part_init */ XawVendorShellClassPartInit, /* Class init'ed ? */ FALSE, /* initialize */ XawVendorShellInitialize, /* initialize_hook */ NULL, /* realize */ Realize, /* actions */ NULL, /* num_actions */ 0, /* resources */ resources, /* resource_count */ XtNumber(resources), /* xrm_class */ NULLQUARK, /* compress_motion */ FALSE, /* compress_exposure */ TRUE, /* compress_enterleave*/ FALSE, /* visible_interest */ FALSE, /* destroy */ NULL, /* resize */ XawVendorShellExtResize, /* expose */ NULL, /* set_values */ XawVendorShellSetValues, /* set_values_hook */ NULL, /* set_values_almost */ XtInheritSetValuesAlmost, /* get_values_hook */ NULL, /* accept_focus */ NULL, /* intrinsics version */ XtVersion, /* callback offsets */ NULL, /* tm_table */ NULL, /* query_geometry */ NULL, /* display_accelerator*/ NULL, /* extension */ NULL },{ /* geometry_manager */ GeometryManager, /* change_managed */ ChangeManaged, /* insert_child */ XtInheritInsertChild, /* delete_child */ XtInheritDeleteChild, /* extension */ (XtPointer) &vendorCompositeExt },{ /* extension */ NULL },{ /* extension */ NULL },{ /* extension */ NULL } }; externaldef(vendorshellwidgetclass) WidgetClass vendorShellWidgetClass = (WidgetClass) (&vendorShellClassRec); /*************************************************************************** * * The following section is for the Vendor shell Extension class record * ***************************************************************************/ static XtResource ext_resources[] = { {XtNinputMethod, XtCInputMethod, XtRString, sizeof(String), XtOffsetOf(XawVendorShellExtRec, vendor_ext.im.input_method), XtRString, (XtPointer)NULL}, {XtNpreeditType, XtCPreeditType, XtRString, sizeof(String), XtOffsetOf(XawVendorShellExtRec, vendor_ext.im.preedit_type), XtRString, (XtPointer)"OverTheSpot,OffTheSpot,Root"}, {XtNopenIm, XtCOpenIm, XtRBoolean, sizeof(Boolean), XtOffsetOf(XawVendorShellExtRec, vendor_ext.im.open_im), XtRImmediate, (XtPointer)TRUE}, {XtNsharedIc, XtCSharedIc, XtRBoolean, sizeof(Boolean), XtOffsetOf(XawVendorShellExtRec, vendor_ext.ic.shared_ic), XtRImmediate, (XtPointer)FALSE} }; static void XawVendorShellExtClassInitialize(); static void XawVendorShellExtInitialize(); static void XawVendorShellExtDestroy(); static Boolean XawVendorShellExtSetValues(); externaldef(vendorshellextclassrec) XawVendorShellExtClassRec xawvendorShellExtClassRec = { { /* superclass */ (WidgetClass)&objectClassRec, /* class_name */ "VendorShellExt", /* size */ sizeof(XawVendorShellExtRec), /* class_initialize */ XawVendorShellExtClassInitialize, /* class_part_initialize*/ NULL, /* Class init'ed ? */ FALSE, /* initialize */ XawVendorShellExtInitialize, /* initialize_hook */ NULL, /* pad */ NULL, /* pad */ NULL, /* pad */ 0, /* resources */ ext_resources, /* resource_count */ XtNumber(ext_resources), /* xrm_class */ NULLQUARK, /* pad */ FALSE, /* pad */ FALSE, /* pad */ FALSE, /* pad */ FALSE, /* destroy */ XawVendorShellExtDestroy, /* pad */ NULL, /* pad */ NULL, /* set_values */ XawVendorShellExtSetValues, /* set_values_hook */ NULL, /* pad */ NULL, /* get_values_hook */ NULL, /* pad */ NULL, /* version */ XtVersion, /* callback_offsets */ NULL, /* pad */ NULL, /* pad */ NULL, /* pad */ NULL, /* extension */ NULL },{ /* extension */ NULL } }; externaldef(xawvendorshellwidgetclass) WidgetClass xawvendorShellExtWidgetClass = (WidgetClass) (&xawvendorShellExtClassRec); /*ARGSUSED*/ static Boolean XawCvtCompoundTextToString(dpy, args, num_args, fromVal, toVal, cvt_data) Display *dpy; XrmValuePtr args; Cardinal *num_args; XrmValue *fromVal; XrmValue *toVal; XtPointer *cvt_data; { XTextProperty prop; char **list; int count; static char *mbs = NULL; int len; prop.value = (unsigned char *)fromVal->addr; prop.encoding = XA_COMPOUND_TEXT(dpy); prop.format = 8; prop.nitems = fromVal->size; if(XmbTextPropertyToTextList(dpy, &prop, &list, &count) < Success) { XtAppWarningMsg(XtDisplayToApplicationContext(dpy), "converter", "XmbTextPropertyToTextList", "XawError", "conversion from CT to MB failed.", NULL, 0); return False; } len = strlen(*list); toVal->size = len; mbs = XtRealloc(mbs, len + 1); /* keep buffer because no one call free :( */ strcpy(mbs, *list); XFreeStringList(list); toVal->addr = (XtPointer)mbs; return True; } static void XawVendorShellClassInitialize() { static XtConvertArgRec screenConvertArg[] = { {XtWidgetBaseOffset, (XtPointer) XtOffsetOf(WidgetRec, core.screen), sizeof(Screen *)} }; XtAddConverter(XtRString, XtRCursor, XmuCvtStringToCursor, screenConvertArg, XtNumber(screenConvertArg)); XtAddConverter(XtRString, XtRBitmap, XmuCvtStringToBitmap, screenConvertArg, XtNumber(screenConvertArg)); XtSetTypeConverter("CompoundText", XtRString, XawCvtCompoundTextToString, NULL, 0, XtCacheNone, NULL); } static void XawVendorShellClassPartInit(class) WidgetClass class; { CompositeClassExtension ext; VendorShellWidgetClass vsclass = (VendorShellWidgetClass) class; if ((ext = (CompositeClassExtension) XtGetClassExtension (class, XtOffsetOf(CompositeClassRec, composite_class.extension), NULLQUARK, 1L, (Cardinal) 0)) == NULL) { ext = (CompositeClassExtension) XtNew (CompositeClassExtensionRec); if (ext != NULL) { ext->next_extension = vsclass->composite_class.extension; ext->record_type = NULLQUARK; ext->version = XtCompositeExtensionVersion; ext->record_size = sizeof (CompositeClassExtensionRec); ext->accepts_objects = TRUE; ext->allows_change_managed_set = FALSE; vsclass->composite_class.extension = (XtPointer) ext; } } } #ifdef __osf__ /* stupid OSF/1 shared libraries have the wrong semantics */ /* symbols do not get resolved external to the shared library */ void _XawFixupVendorShell() { transientShellWidgetClass->core_class.superclass = (WidgetClass) &vendorShellClassRec; topLevelShellWidgetClass->core_class.superclass = (WidgetClass) &vendorShellClassRec; } #endif /* ARGSUSED */ static void XawVendorShellInitialize(req, new, args, num_args) Widget req, new; ArgList args; Cardinal *num_args; { XtAddEventHandler(new, (EventMask) 0, TRUE, _XEditResCheckMessages, NULL); #ifdef HAVE_XMUREGISTEREXTERNALAGENT XtAddEventHandler(new, (EventMask) 0, TRUE, XmuRegisterExternalAgent, NULL); #endif /* HAVE_XMUREGISTEREXTERNALAGENT */ XtCreateWidget("shellext", xawvendorShellExtWidgetClass, new, args, *num_args); } /* ARGSUSED */ static Boolean XawVendorShellSetValues(old, ref, new) Widget old, ref, new; { return FALSE; } static void Realize(wid, vmask, attr) Widget wid; Mask *vmask; XSetWindowAttributes *attr; { WidgetClass super = wmShellWidgetClass; /* Make my superclass do all the dirty work */ (*super->core_class.realize) (wid, vmask, attr); _XawImRealize(wid); } static void XawVendorShellExtClassInitialize() { } /* ARGSUSED */ static void XawVendorShellExtInitialize(req, new) Widget req, new; { _XawImInitialize(new->core.parent, new); } /* ARGSUSED */ static void XawVendorShellExtDestroy( w ) Widget w; { _XawImDestroy( w->core.parent, w ); } /* ARGSUSED */ static Boolean XawVendorShellExtSetValues(old, ref, new) Widget old, ref, new; { return FALSE; } void XawVendorShellExtResize( w ) Widget w; { ShellWidget sw = (ShellWidget) w; Widget childwid; int i; int core_height; _XawImResizeVendorShell( w ); core_height = _XawImGetShellHeight( w ); for( i = 0; i < sw->composite.num_children; i++ ) { if( XtIsManaged( sw->composite.children[ i ] ) ) { childwid = sw->composite.children[ i ]; XtResizeWidget( childwid, sw->core.width, core_height, childwid->core.border_width ); } } } /*ARGSUSED*/ static XtGeometryResult GeometryManager( wid, request, reply ) Widget wid; XtWidgetGeometry *request; XtWidgetGeometry *reply; { ShellWidget shell = (ShellWidget)(wid->core.parent); XtWidgetGeometry my_request; if(shell->shell.allow_shell_resize == FALSE && XtIsRealized(wid)) return(XtGeometryNo); if (request->request_mode & (CWX | CWY)) return(XtGeometryNo); /* %%% worry about XtCWQueryOnly */ my_request.request_mode = 0; if (request->request_mode & CWWidth) { my_request.width = request->width; my_request.request_mode |= CWWidth; } if (request->request_mode & CWHeight) { my_request.height = request->height + _XawImGetImAreaHeight( wid ); my_request.request_mode |= CWHeight; } if (request->request_mode & CWBorderWidth) { my_request.border_width = request->border_width; my_request.request_mode |= CWBorderWidth; } if (XtMakeGeometryRequest((Widget)shell, &my_request, NULL) == XtGeometryYes) { /* assert: if (request->request_mode & CWWidth) then * shell->core.width == request->width * assert: if (request->request_mode & CWHeight) then * shell->core.height == request->height * * so, whatever the WM sized us to (if the Shell requested * only one of the two) is now the correct child size */ wid->core.width = shell->core.width; wid->core.height = shell->core.height; if (request->request_mode & CWBorderWidth) { wid->core.x = wid->core.y = -request->border_width; } _XawImCallVendorShellExtResize(wid); return XtGeometryYes; } else return XtGeometryNo; } static void ChangeManaged(wid) Widget wid; { ShellWidget w = (ShellWidget) wid; Widget* childP; int i; (*SuperClass->composite_class.change_managed)(wid); for (i = w->composite.num_children, childP = w->composite.children; i; i--, childP++) { if (XtIsManaged(*childP)) { XtSetKeyboardFocus(wid, *childP); break; } } } TiMidity++-2.13.2/interface/xskin.h0100644004711200001440000002142507515607440016156 0ustar tamukiusers/* TiMidity++ -- MIDI to WAVE converter and player Copyright (C) 1999-2002 Masanao Izumo Copyright (C) 1995 Tuukka Toivonen 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA xskin.h Oct.03.1998 Daisuke Nagano */ #ifdef HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ #include #include #ifndef __MACOS__ #include #include #include #include #endif /* __MACOS__ */ #ifndef NO_STRING_H #include #else /* NO_STRING_H */ #include #endif /* NO_STRING_H */ #ifdef HAVE_SYS_SOCKET_H #include #endif #ifndef __MACOS__ #include #include #include #include #endif /* __MACOS__ */ #define XSKIN_WINDOW_NAME "Timidity" #define XSKIN_RES_CLASS "timidity" #define XSKIN_RES_NAME "Timidity" extern Pixmap xskin_loadBMP( Display *, Window, char *, int *, int * ); extern int xskin_loadviscolor( Display *, Window, char * ); /* text */ extern void ts_puttext( int, int, char * ); /* numbers */ extern void ts_putnum( int, int, int ); /* cbuttons */ extern void ts_prev(int); extern void ts_play(int); extern void ts_pause(int); extern void ts_stop(int); extern void ts_next(int); extern void ts_eject(int); /* titlebar */ extern void ts_titlebar(int); extern void ts_exitbutton(int); extern void ts_menubutton(int); extern void ts_iconbutton(int); extern void ts_minibutton(int); /* monoster */ extern void ts_mono(int); extern void ts_stereo(int); /* shufrep */ extern void ts_shuf(int); extern void ts_rep(int); extern void ts_equ(int); extern void ts_plist(int); /* posbar */ extern int ts_pos(int,int); /* volume */ extern int ts_volume(int,int); extern int ts_pan(int,int); /* spectrum analizer */ extern void ts_spectrum( int, unsigned char * ); /* positions */ #define OFF 0 #define ON 1 #define ONOFF 2 #define OFFON 3 #define skin_width 275 #define skin_height 116 #define TS_PREV 0 #define TS_PLAY 1 #define TS_PAUSE 2 #define TS_STOP 3 #define TS_NEXT 4 #define TS_EJECT 5 #define TS_TITLEBAR 6 #define TS_EXITBUTTON 7 #define TS_MENUBUTTON 8 #define TS_ICONBUTTON 9 #define TS_MINIBUTTON 10 #define TS_MONO 11 #define TS_STEREO 12 #define TS_SHUFON 13 #define TS_SHUFOFF 14 #define TS_REPON 15 #define TS_REPOFF 16 #define TS_EQUON 17 #define TS_EQUOFF 18 #define TS_PLISTON 19 #define TS_PLISTOFF 20 #define TS_POS 21 #define TS_VOLUME 22 #define TS_PAN 23 #define TS_SPECTRUM 24 /* text */ #define TEXT_W 5 #define TEXT_H 6 #define BITRATE_X 111 #define BITRATE_Y 43 #define SAMPLE_X 156 #define SAMPLE_Y 43 #define MESSAGE_X 112 #define MESSAGE_Y 27 /* numbers */ #define NUM_W 9 #define NUM_H 13 #define MIN_H_X 48 #define MIN_H_Y 26 #define MIN_L_X 60 #define MIN_L_Y 26 #define SEC_H_X 78 #define SEC_H_Y 26 #define SEC_L_X 90 #define SEC_L_Y 26 /* cbuttons */ #define PREV_SX(f) 0 #define PREV_SY(f) f==OFF?0:18 #define PREV_DX 16 #define PREV_DY 88 #define PREV_W 23 #define PREV_H 18 #define PLAY_SX(f) 23 #define PLAY_SY(f) f==OFF?0:18 #define PLAY_DX 39 #define PLAY_DY 88 #define PLAY_W 23 #define PLAY_H 18 #define PAUSE_SX(f) 46 #define PAUSE_SY(f) f==OFF?0:18 #define PAUSE_DX 62 #define PAUSE_DY 88 #define PAUSE_W 23 #define PAUSE_H 18 #define STOP_SX(f) 69 #define STOP_SY(f) f==OFF?0:18 #define STOP_DX 85 #define STOP_DY 88 #define STOP_W 23 #define STOP_H 18 #define NEXT_SX(f) 92 #define NEXT_SY(f) f==OFF?0:18 #define NEXT_DX 108 #define NEXT_DY 88 #define NEXT_W 22 #define NEXT_H 18 #define EJECT_SX(f) 114 #define EJECT_SY(f) f==OFF?0:16 #define EJECT_DX 136 #define EJECT_DY 89 #define EJECT_W 23 #define EJECT_H 16 /* titlebar */ #define TITLEBAR_SX(f) 27 #define TITLEBAR_SY(f) f==OFF?15:0 #define TITLEBAR_DX 0 #define TITLEBAR_DY 0 #define TITLEBAR_W 275 #define TITLEBAR_H 14 #define EXITBUTTON_SX(f) 18 #define EXITBUTTON_SY(f) f==OFF?0:9 #define EXITBUTTON_DX 264 #define EXITBUTTON_DY 3 #define EXITBUTTON_W 9 #define EXITBUTTON_H 9 #define MENUBUTTON_SX(f) 0 #define MENUBUTTON_SY(f) f==OFF?0:9 #define MENUBUTTON_DX 6 #define MENUBUTTON_DY 3 #define MENUBUTTON_W 9 #define MENUBUTTON_H 9 #define ICONBUTTON_SX(f) 9 #define ICONBUTTON_SY(f) f==OFF?0:9 #define ICONBUTTON_DX 244 #define ICONBUTTON_DY 3 #define ICONBUTTON_W 9 #define ICONBUTTON_H 9 #define MINIBUTTON_SX(f) f==OFF?0:9 #define MINIBUTTON_SY(f) 18 #define MINIBUTTON_DX 254 #define MINIBUTTON_DY 3 #define MINIBUTTON_W 9 #define MINIBUTTON_H 9 /* monoster */ #define MONO_SX(f) 29 #define MONO_SY(f) f==OFF?12:0 #define MONO_DX 212 #define MONO_DY 41 #define MONO_W 29 #define MONO_H 12 #define STEREO_SX(f) 0 #define STEREO_SY(f) f==OFF?12:0 #define STEREO_DX 239 #define STEREO_DY 41 #define STEREO_W 29 #define STEREO_H 12 /* playpause */ #define PSTATE_STOP 0 #define PSTATE_PAUSE 1 #define PSTATE_PLAY 2 #define PSTATE1_SX(f) (f==PSTATE_STOP?18:(f==PSTATE_PAUSE?9:0)) #define PSTATE1_SY(f) 0 #define PSTATE1_DX 26 #define PSTATE1_DY 28 #define PSTATE1_W 9 #define PSTATE1_H 9 #define PSTATE2_SX(f) (f==PSTATE_STOP?39:(f==PSTATE_PAUSE?36:27)) #define PSTATE2_SY(f) 0 #define PSTATE2_DX 24 #define PSTATE2_DY 28 #define PSTATE2_W 3 #define PSTATE2_H 9 /* shufrep */ #define SHUF_SX(f) 28 #define SHUF_SY(f) f==OFF?0:(f==ON?30:(f==ONOFF?45:15)) #define SHUF_DX 164 #define SHUF_DY 89 #define SHUF_W 47 #define SHUF_H 15 #define REP_SX(f) 0 #define REP_SY(f) f==OFF?0:(f==ON?30:(f==ONOFF?45:15)) #define REP_DX 210 #define REP_DY 89 #define REP_W 28 #define REP_H 15 #define EQU_SX(f) f==OFF?0:(f==ON?0:(f==ONOFF?46:46)) #define EQU_SY(f) f==OFF?73:(f==ON?61:(f==ONOFF?61:73)) #define EQU_DX 219 #define EQU_DY 58 #define EQU_W 23 #define EQU_H 12 #define PLIST_SX(f) f==OFF?23:(f==ON?23:(f==ONOFF?69:69)) #define PLIST_SY(f) f==OFF?73:(f==ON?61:(f==ONOFF?61:73)) #define PLIST_DX 242 #define PLIST_DY 58 #define PLIST_W 23 #define PLIST_H 12 /* posbar */ #define BAR_SX 0 #define BAR_SY 0 #define BAR_W 248 #define BAR_H 10 #define BAR_DX 16 #define BAR_DY 72 #define POS_SX(f) f==OFF?248:278 #define POS_SY(f) 0 #define POS_W 29 #define POS_H 10 #define POS_MIN_DX 16 #define POS_MAX_DX 235 #define POS_DY 72 /* volume */ #define VOLUME_SX 0 #define VOLUME_SY 0 #define VOLUME_W 68 #define VOLUME_H 15 #define VOLUME_DX 107 #define VOLUME_DY 57 #define VOL_SX(f) f==OFF?15:0 #define VOL_SY(f) 421 #define VOL_W 15 #define VOL_H 12 #define VOL_MIN_DX 107 #define VOL_MAX_DX 160 #define VOL_DY 57 #define PANPOT_SX 9 #define PANPOT_SY 0 #define PANPOT_W 37 #define PANPOT_H 15 #define PANPOT_DX 177 #define PANPOT_DY 57 #define PAN_SX(f) f==OFF?15:0 #define PAN_SY(f) 421 #define PAN_W 15 #define PAN_H 12 #define PAN_MIN_DX 178 #define PAN_MAX_DX 199 #define PAN_DY 57 /* spectrum analizer */ #define SPE_SX 24 #define SPE_SY 43 #define SPE_W 76 #define SPE_H 16 TiMidity++-2.13.2/interface/xskin_c.c0100644004711200001440000003212007421005040016425 0ustar tamukiusers/* TiMidity++ -- MIDI to WAVE converter and player Copyright (C) 1999-2002 Masanao Izumo Copyright (C) 1995 Tuukka Toivonen 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA xskin interface by Daisuke nagano */ #ifdef HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ #include #include #include #include #include #ifndef NO_STRING_H #include #else #include #endif #ifdef HAVE_UNISTD_H #include #endif /* HAVE_UNISTD_H */ #include "timidity.h" #include "common.h" #include "instrum.h" #include "playmidi.h" #include "readmidi.h" #include "output.h" #include "controls.h" #include "miditrace.h" #include "xskin.h" #define MSGWINDOW static void ctl_total_time(int tt); static void ctl_master_volume(int mv); static void ctl_current_time(int secs, int v); static void ctl_lyric(int lyricid); static int ctl_open(int using_stdin, int using_stdout); static void ctl_close(void); static int ctl_read(int32 *valp); static int cmsg(int type, int verbosity_level, char *fmt, ...); static void ctl_pass_playing_list(int number_of_files, char *list_of_files[]); static void ctl_event(CtlEvent *e); static void ctl_speana_data(double *val, int size); static void initialize_exp_hz_table( void ); static void xskin_pipe_open(void); void xskin_pipe_write(char *); static int xskin_pipe_ready(void); int xskin_pipe_read(char *,int); static int isspeanaenabled; static unsigned char *speana_buf; static double exp_hz_table[SPE_W+1]; static int xskin_ready = 0; #define FFTSIZE 1024 /* same as "soudspec.c" */ #define NCOLOR 64 /* same as "soudspec.c" */ #define DEFAULT_ZOOM (44100.0/1024.0*4.0) /* tekito---- */ #define CTL_LAST_STATUS -1 /**********************************************/ /* export the interface functions */ #define ctl xskin_control_mode ControlMode ctl= { "skin interface", 'i', 1,0,0, 0, ctl_open, ctl_close, ctl_pass_playing_list, ctl_read, cmsg, ctl_event }; static char local_buf[300]; static int pipe_in_fd,pipe_out_fd=-1; /***********************************************************************/ /* Put controls on the pipe */ /***********************************************************************/ static int cmsg(int type, int verbosity_level, char *fmt, ...) { va_list ap; if ((type==CMSG_TEXT || type==CMSG_INFO || type==CMSG_WARNING) && ctl.verbosityrate; min = sec/60; sec-= min*60; if ( tt!=previous_total_time ) { previous_total_time=tt; sprintf(local_buf,"A %d",min*60+sec); xskin_pipe_write(local_buf); } return; } /*ARGSUSED*/ static void ctl_master_volume(int mv) { static int lastvol = CTL_LAST_STATUS; if ( mv != lastvol ) { if ( mv == CTL_LAST_STATUS ) mv = lastvol; else lastvol = mv; sprintf( local_buf, "V %d", mv ); xskin_pipe_write(local_buf); } return; } static void ctl_current_time(int sec, int v) { static int previous_sec=-1; if (sec!=previous_sec) { previous_sec=sec; sprintf(local_buf,"T %02d:%02d",sec/60,sec%60); xskin_pipe_write(local_buf); } } static void ctl_lyric(int lyricid) { char *lyric; static int lyric_col = 2; static char lyric_buf[300]; lyric = event2string(lyricid); if(lyric != NULL) { if(lyric[0] == ME_KARAOKE_LYRIC) { if(lyric[1] == '/' || lyric[1] == '\\') { lyric_buf[0] = 'L'; lyric_buf[1] = ' '; snprintf(lyric_buf + 2, sizeof (lyric_buf) - 2, "%s", lyric + 2); xskin_pipe_write(lyric_buf); lyric_col = strlen(lyric + 2) + 2; } else if(lyric[1] == '@') { lyric_buf[0] = 'L'; lyric_buf[1] = ' '; if(lyric[2] == 'L') snprintf(lyric_buf + 2, sizeof (lyric_buf) - 2, "Language: %s", lyric + 3); else if(lyric[2] == 'T') snprintf(lyric_buf + 2, sizeof (lyric_buf) - 2, "Title: %s", lyric + 3); else snprintf(lyric_buf + 2, sizeof (lyric_buf) - 2, "%s", lyric + 1); xskin_pipe_write(lyric_buf); } else { lyric_buf[0] = 'L'; lyric_buf[1] = ' '; snprintf(lyric_buf + lyric_col, sizeof (lyric_buf) - lyric_col, "%s", lyric + 1); xskin_pipe_write(lyric_buf); lyric_col += strlen(lyric + 1); } } else { if(lyric[0] == ME_CHORUS_TEXT || lyric[0] == ME_INSERT_TEXT) lyric_col = 0; snprintf(lyric_buf + lyric_col, sizeof (lyric_buf) - lyric_col, "%s", lyric + 1); xskin_pipe_write(lyric_buf); } } } static void ctl_speana_data(double *val, int size) { /* 0 <= val[n] <= (AMP*NCOLOR) */ /* AMP and NCOLOR are defined in soundspec.c */ /* By default, AMP*NCOLOR = 1.0*64 */ /* size = FFTSIZE/2 = 512 */ /* FFTSIZE is also defined in soundspec.c */ /* val[n] is the value of FFTed audio data */ #ifdef SUPPORT_SOUNDSPEC int i; int tx,x; double px; double s,a; int n; if ( isspeanaenabled ) { px=0.0; speana_buf[0] = (unsigned char)val[0]; for ( i=1 ; i=NCOLOR ) s=NCOLOR-1; speana_buf[i] = (unsigned char)(256*s/NCOLOR); px=tx; } speana_buf[SPE_W-1] = val[FFTSIZE/2-1]; xskin_pipe_write( "W" ); } #endif /* SUPPORT_SOUNDSPEC */ return; } /*ARGSUSED*/ static int ctl_open(int using_stdin, int using_stdout) { ctl.opened=1; initialize_exp_hz_table(); /* The child process won't come back from this call */ xskin_pipe_open(); return 0; } static void ctl_close(void) { if (ctl.opened) { xskin_pipe_write("Q"); ctl.opened=0; pipe_out_fd=-1; xskin_ready = 0; } } static int exitflag=0,randomflag=0,repeatflag=0,selectflag=0; /*ARGSUSED*/ static int ctl_blocking_read(int32 *valp /* Now, valp is not used */ ) { xskin_pipe_read(local_buf,sizeof(local_buf)); for (;;) { switch (local_buf[0]) { case 'P' : return RC_LOAD_FILE; case 'U' : return RC_TOGGLE_PAUSE; case 'S' : return RC_QUIT; case 'N' : return RC_NEXT; case 'B' : return RC_REALLY_PREVIOUS; case 'R' : repeatflag=atoi(local_buf+2);return RC_NONE; case 'D' : randomflag=atoi(local_buf+2);return RC_QUIT; case 'L' : selectflag=atoi(local_buf+2);return RC_QUIT; case 'V' : *valp =atoi(local_buf+2);return RC_CHANGE_VOLUME; #ifdef SUPPORT_SOUNDSPEC case 'W' : return RC_TOGGLE_CTL_SPEANA; #endif case 'Q' : default : exitflag=1;return RC_QUIT; } } } static int ctl_read(int32 *valp) { if (xskin_pipe_ready()<=0) return RC_NONE; return ctl_blocking_read(valp); } static void shuffle(int n,int *a) { int i,j,tmp; for (i=0;i0) current_no--; command=RC_LOAD_FILE; continue; } command=ctl_blocking_read(&val); } } } /* ------ Pipe handlers ----- */ extern void xskin_start_interface(int); static void xskin_pipe_open(void) { int cont_inter[2],inter_cont[2]; if (pipe(cont_inter)<0 || pipe(inter_cont)<0) exit(1); if (fork()==0) { close(cont_inter[1]); close(inter_cont[0]); pipe_in_fd=cont_inter[0]; pipe_out_fd=inter_cont[1]; xskin_start_interface(pipe_in_fd); } close(cont_inter[0]); close(inter_cont[1]); pipe_in_fd=inter_cont[0]; pipe_out_fd=cont_inter[1]; } void xskin_pipe_write(char *buf) { write(pipe_out_fd,buf,strlen(buf)); write(pipe_out_fd,"\n",1); } static int xskin_pipe_ready(void) { fd_set fds; static struct timeval tv; int cnt; FD_ZERO(&fds); FD_SET(pipe_in_fd,&fds); tv.tv_sec=0; tv.tv_usec=0; if((cnt=select(pipe_in_fd+1,&fds,NULL,NULL,&tv))<0) return -1; return cnt > 0 && FD_ISSET(pipe_in_fd, &fds) != 0; } int xskin_pipe_read(char *buf,int bufsize) { int i; bufsize--; for (i=0;itype) { case CTLE_PLAY_START: ctl_total_time((int)e->v1); break; case CTLE_CURRENT_TIME: ctl_current_time((int)e->v1, (int)e->v2); break; case CTLE_MASTER_VOLUME: ctl_master_volume((int)e->v1); break; case CTLE_LYRIC: ctl_lyric((int)e->v1); break; #ifdef SUPPORT_SOUNDSPEC case CTLE_SPEANA: ctl_speana_data((double *)e->v1, (int)e->v2); break; #endif /* SUPPORT_SOUNDSPEC */ } } /* * interface__loader(); */ ControlMode *interface_i_loader(void) { return &ctl; } static void initialize_exp_hz_table( void ) { int i; double r, x, w; w = (double)play_mode->rate * 0.5 / DEFAULT_ZOOM; r = exp(log(w) * (1.0/SPE_W)); w = (FFTSIZE/2.0) / (w - 1.0); for(i = 0, x = 1.0; i <= SPE_W; i++, x *= r) exp_hz_table[i] = (x - 1.0) * w; } TiMidity++-2.13.2/interface/xskin_i.c0100644004711200001440000006343710125651536016466 0ustar tamukiusers/* TiMidity++ -- MIDI to WAVE converter and player Copyright (C) 1999-2002 Masanao Izumo Copyright (C) 1995 Tuukka Toivonen 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA xskin_i.c Oct.06.1998 Daisuke Nagano */ #include "xskin.h" #include "timidity.h" #include "common.h" #include "instrum.h" #include "playmidi.h" #include "output.h" #include "controls.h" #include "miditrace.h" extern void xskin_pipe_write(char *); extern int xskin_pipe_read(char *,int); /* text positions */ static int text_posx[] = { /* ! "" # $ % & ' ( ) * + , - . / */ 30, 17, 26, 30, 29, 26, 25, 16, 13, 14, 4, 19, 10, 15, 10, 21, /* 0 1 2 3 4 5 6 7 8 9 : ; < = > ? */ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 12, 12, 30, 28, 30, 3, 27, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 22, 20, 23, 24, 18 }; static int text_posy[] = { 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1 }; static char local_buf[300]; static int load_skins( void ); static void xskin_jobs( int ); static void repaint( void ); static void install_sighandler( void ); static void signal_vector( int ); static void delete_shm( void ); static int fshuf,frep,fequ,fpll; static int fplay,fpause; static int fremain; static int play_val, vol_val; static char last_text[1024]; static int last_current_time; static int total_time; static int shmid; static unsigned char *speana_buf; Visual *xskin_vis; unsigned int xskin_depth; Display *xskin_d; Window xskin_r,xskin_w; GC xskin_gc; Pixmap xskin_back,xskin_titlebar,xskin_playpaus,xskin_numbers,xskin_cbuttons; Pixmap xskin_monoster,xskin_posbar,xskin_shufrep,xskin_text,xskin_volume; /* text */ void ts_puttext( int x0, int y0, char *message ) { int i,l; int c; int x,px,py; if ( x0 == MESSAGE_X ) { px=text_posx[0]*TEXT_W; py=text_posy[0]*TEXT_H; for ( i=0 ; i<31 ; i++ ) { x = x0+i*TEXT_W; XCopyArea( xskin_d, xskin_text, xskin_w, xskin_gc, px, py, TEXT_W, TEXT_H, x, y0 ); } } else if ( x0 == BITRATE_X ) { XCopyArea( xskin_d, xskin_back, xskin_w, xskin_gc, 111, 43, 15, 6, 111, 43 ); } else if ( x0 == SAMPLE_X ) { XCopyArea( xskin_d, xskin_back, xskin_w, xskin_gc, 156, 43, 10, 6, 156, 43 ); } l = strlen( message ); if ( l<=0 ) return; for ( i=0 ; i='a') && (c<='z') ) c = c-'a'+'A'; if ( c<' ' ) c = '.'; if ( c>'_' ) c = '.'; c-=' '; if ( c>=64 ) c=0; px = text_posx[c]*TEXT_W; py = text_posy[c]*TEXT_H; x = x0+i*TEXT_W; if (( x0 == MESSAGE_X && i<31 ) || ( x0 == BITRATE_X && i<3 ) || ( x0 == SAMPLE_X && i<2 )) { XCopyArea( xskin_d, xskin_text, xskin_w, xskin_gc, px, py, TEXT_W, TEXT_H, x, y0 ); } } XSync( xskin_d, True ); /* discards any events in the queue */ if ( x0 == MESSAGE_X ) strncpy( last_text, message, sizeof(last_text) ); return; } /* numbers */ void ts_putnum( int x, int y, int val ) { int x0,y0; if ( (val>9) || (val<0 ) ) return; x0=val*9; y0=0; XCopyArea( xskin_d, xskin_numbers, xskin_w, xskin_gc, x0, y0, NUM_W, NUM_H, x, y ); return ; } /* cbuttons */ void ts_prev( int i ) { XCopyArea( xskin_d, xskin_cbuttons, xskin_w, xskin_gc, PREV_SX(i), PREV_SY(i), PREV_W, PREV_H, PREV_DX, PREV_DY ); return; } void ts_play( int i ) { XCopyArea( xskin_d, xskin_cbuttons, xskin_w, xskin_gc, PLAY_SX(i), PLAY_SY(i), PLAY_W, PLAY_H, PLAY_DX, PLAY_DY ); return; } void ts_pause( int i ) { XCopyArea( xskin_d, xskin_cbuttons, xskin_w, xskin_gc, PAUSE_SX(i), PAUSE_SY(i), PAUSE_W, PAUSE_H, PAUSE_DX, PAUSE_DY); return; } void ts_stop ( int i ) { XCopyArea( xskin_d, xskin_cbuttons, xskin_w, xskin_gc, STOP_SX(i), STOP_SY(i), STOP_W, STOP_H, STOP_DX, STOP_DY ); return; } void ts_next( int i ) { XCopyArea( xskin_d, xskin_cbuttons, xskin_w, xskin_gc, NEXT_SX(i), NEXT_SY(i), NEXT_W, NEXT_H, NEXT_DX, NEXT_DY ); return; } void ts_eject( int i ) { XCopyArea( xskin_d, xskin_cbuttons, xskin_w, xskin_gc, EJECT_SX(i), EJECT_SY(i), EJECT_W, EJECT_H, EJECT_DX, EJECT_DY ); return; } /* titlebar */ void ts_titlebar( int i ) { XCopyArea( xskin_d, xskin_titlebar, xskin_w, xskin_gc, TITLEBAR_SX(i), TITLEBAR_SY(i), TITLEBAR_W, TITLEBAR_H, TITLEBAR_DX, TITLEBAR_DY ); return; } void ts_exitbutton( int i ) { XCopyArea( xskin_d, xskin_titlebar, xskin_w, xskin_gc, EXITBUTTON_SX(i), EXITBUTTON_SY(i), EXITBUTTON_W, EXITBUTTON_H, EXITBUTTON_DX, EXITBUTTON_DY ); return; } void ts_menubutton( int i ) { XCopyArea( xskin_d, xskin_titlebar, xskin_w, xskin_gc, MENUBUTTON_SX(i), MENUBUTTON_SY(i), MENUBUTTON_W, MENUBUTTON_H, MENUBUTTON_DX, MENUBUTTON_DY ); return; } void ts_iconbutton( int i ) { XCopyArea( xskin_d, xskin_titlebar, xskin_w, xskin_gc, ICONBUTTON_SX(i), ICONBUTTON_SY(i), ICONBUTTON_W, ICONBUTTON_H, ICONBUTTON_DX, ICONBUTTON_DY ); return; } void ts_minibutton( int i ) { XCopyArea( xskin_d, xskin_titlebar, xskin_w, xskin_gc, MINIBUTTON_SX(i), MINIBUTTON_SY(i), MINIBUTTON_W, MINIBUTTON_H, MINIBUTTON_DX, MINIBUTTON_DY ); return; } /* monoster */ void ts_mono( int i ) { XCopyArea( xskin_d, xskin_monoster, xskin_w, xskin_gc, MONO_SX(i), MONO_SY(i), MONO_W, MONO_H, MONO_DX, MONO_DY ); return; } void ts_stereo( int i ) { XCopyArea( xskin_d, xskin_monoster, xskin_w, xskin_gc, STEREO_SX(i), STEREO_SY(i), STEREO_W, STEREO_H, STEREO_DX, STEREO_DY ); return; } /* playpaus */ void ts_pstate( int i ) { XCopyArea( xskin_d, xskin_playpaus, xskin_w, xskin_gc, PSTATE1_SX(i), PSTATE1_SY(i), PSTATE1_W, PSTATE1_H, PSTATE1_DX, PSTATE1_DY ); XCopyArea( xskin_d, xskin_playpaus, xskin_w, xskin_gc, PSTATE2_SX(i), PSTATE2_SY(i), PSTATE2_W, PSTATE2_H, PSTATE2_DX, PSTATE2_DY ); return; } /* shufrep */ void ts_shuf( int i ) { XCopyArea( xskin_d, xskin_shufrep, xskin_w, xskin_gc, SHUF_SX(i), SHUF_SY(i), SHUF_W, SHUF_H, SHUF_DX, SHUF_DY ); return; } void ts_rep( int i ) { XCopyArea( xskin_d, xskin_shufrep, xskin_w, xskin_gc, REP_SX(i), REP_SY(i), REP_W, REP_H, REP_DX, REP_DY ); return; } void ts_equ( int i ) { XCopyArea( xskin_d, xskin_shufrep, xskin_w, xskin_gc, EQU_SX(i), EQU_SY(i), EQU_W, EQU_H, EQU_DX, EQU_DY ); return; } void ts_plist( int i ) { XCopyArea( xskin_d, xskin_shufrep, xskin_w, xskin_gc, PLIST_SX(i), PLIST_SY(i), PLIST_W, PLIST_H, PLIST_DX, PLIST_DY ); return; } /* posbar */ int ts_pos( int i, int j ) { int x,y; int p; if ( j<0 ) p=-j; else { if (jPOS_MAX_DX) j=POS_MAX_DX; p = 100*(j-POS_MIN_DX)/(POS_MAX_DX-POS_MIN_DX); } x = POS_MIN_DX + (POS_MAX_DX-POS_MIN_DX)*p/100; y = POS_DY; XCopyArea( xskin_d, xskin_posbar, xskin_w, xskin_gc, BAR_SX, BAR_SY, BAR_W, BAR_H, BAR_DX, BAR_DY ); XCopyArea( xskin_d, xskin_posbar, xskin_w, xskin_gc, POS_SX(i), POS_SY(i), POS_W, POS_H, x, y ); return p; } int ts_volume( int i, int j ) { int x,y; int t,p; if ( j<0 ) p=-j; else { if (jVOL_MAX_DX) j=VOL_MAX_DX; p = 100*(j-VOL_MIN_DX)/(VOL_MAX_DX-VOL_MIN_DX); } x = VOL_MIN_DX + (VOL_MAX_DX-VOL_MIN_DX)*p/100; y = VOL_DY; t=27*(int)p/100; XCopyArea( xskin_d, xskin_volume, xskin_w, xskin_gc, VOLUME_SX, t*VOLUME_H, VOLUME_W, VOLUME_H-2, VOLUME_DX, VOLUME_DY ); XCopyArea( xskin_d, xskin_volume, xskin_w, xskin_gc, VOL_SX(i), VOL_SY(i), VOL_W, VOL_H, x, y ); return p; } int ts_pan( int i, int j ) { int x,y; int t,p; if ( j<0 ) p=-j; else { if (jPAN_MAX_DX) j=PAN_MAX_DX; p = 100*(j-PAN_MIN_DX)/(PAN_MAX_DX-PAN_MIN_DX); } x = PAN_MIN_DX + (PAN_MAX_DX-PAN_MIN_DX)*p/100; y = PAN_DY; t=27*((p>50)?((float)p-50)/50:(50-(float)p)/50); if ( t<2 ) t=0; XCopyArea( xskin_d, xskin_volume, xskin_w, xskin_gc, PANPOT_SX, t*PANPOT_H, PANPOT_W, PANPOT_H-2, PANPOT_DX, PANPOT_DY ); XCopyArea( xskin_d, xskin_volume, xskin_w, xskin_gc, PAN_SX(i), PAN_SY(i), PAN_W, PAN_H, x, y ); return p; } static void pauseOn() { if(!fpause) { fpause = 1; xskin_pipe_write("U"); } } static void pauseOff() { if(fpause) { fpause = 0; xskin_pipe_write("U"); } } /* main loop */ #define ISIN(x,y,x0,y0,w,h) ( (x>=x0)&&(x=y0)&&(y=x0)&&(x=y0)&&(yencoding & PE_MONO)==0 ) { ts_mono(OFF); ts_stereo(ON); } else { ts_mono(ON); ts_stereo(OFF); } ts_pan(OFF,-50); ts_puttext( BITRATE_X, BITRATE_Y, "---" ); /* bit-rate */ sprintf( tmp, "%d", (int)play_mode->rate/1000 ); ts_puttext( SAMPLE_X, SAMPLE_Y, tmp ); /* sample-rate */ /* volatile values */ if ( fshuf==0 ) ts_shuf(OFF); else ts_shuf(ON); if ( frep==0 ) ts_rep(OFF); else ts_rep(ON); if ( fequ==0 ) ts_equ(OFF); else ts_equ(ON); if ( fpll==0 ) ts_plist(OFF); else ts_plist(ON); if ( fplay==1 ) { if ( fpause==0 ) ts_pstate( PSTATE_PLAY ); else ts_pstate( PSTATE_PAUSE ); } else ts_pstate( PSTATE_STOP ); ts_volume( OFF, -vol_val ); ts_pos( OFF, -play_val ); ts_puttext( MESSAGE_X, MESSAGE_Y, last_text ); if ( fremain==0 ) { sec=last_current_time; } else { sec=total_time-last_current_time; } min =sec/60; sec-=min*60; ts_putnum( MIN_H_X, MIN_H_Y, min/10 ); ts_putnum( MIN_L_X, MIN_L_Y, min%10 ); ts_putnum( SEC_H_X, SEC_H_Y, sec/10 ); ts_putnum( SEC_L_X, SEC_L_Y, sec%10 ); XFlush(xskin_d); return; } /* signal handler calls are ported from xmasl and thanks to takawata@shidahara1.planet.kobe-u.ac.jp */ void delete_shm( void ) { if ( speana_buf != NULL ) { shmdt( (char *)speana_buf ); shmctl( shmid, IPC_RMID, 0 ); } return; } static const int signals[]={SIGHUP,SIGINT,SIGQUIT,SIGILL,SIGABRT,SIGFPE, SIGBUS,SIGSEGV,SIGPIPE,SIGALRM,SIGTERM,0}; void install_sighandler( void ) { int i; for ( i=0 ; signals[i]!=0 ; i++ ) { signal( signals[i], signal_vector ); } } void signal_vector( int sig ) { delete_shm(); XUnmapWindow( xskin_d, xskin_w ); XFlush(xskin_d); XDestroyWindow( xskin_d, xskin_w ); XCloseDisplay( xskin_d ); exit (0); } TiMidity++-2.13.2/interface/xskin_loadBMP.c0100644004711200001440000002762707421005040017501 0ustar tamukiusers/* TiMidity++ -- MIDI to WAVE converter and player Copyright (C) 1999-2002 Masanao Izumo Copyright (C) 1995 Tuukka Toivonen 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA tskin_loadBMP.c Sep.23.1998 Daisuke Nagano */ #ifdef HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ #include #include #include #include #include "timidity.h" #include "common.h" #include "instrum.h" #include "playmidi.h" #include "controls.h" #include "output.h" #include "arc.h" typedef struct { int size; int offbits; int hsize; int w; int h; int bitcounts; int sizeimage; int ncolors; int compress; } BMPHeader; static int ugetc( struct timidity_file * ); static BMPHeader *loadBMPHeader( struct timidity_file * ); static Bool loadBMPColors( Display *, BMPHeader *, struct timidity_file * ); static int GetColor( Display *, int, int, int ); static int Get2bytes( struct timidity_file * ); static int Get4bytes( struct timidity_file * ); static int Draw4bit( Display *, Pixmap, GC, BMPHeader *, struct timidity_file * ); static int Draw8bit( Display *, Pixmap, GC, BMPHeader *, struct timidity_file * ); static int Draw24bit( Display *, Pixmap, GC, BMPHeader *, struct timidity_file * ); static int DrawCompressed4bit( Display *, Pixmap, GC, BMPHeader *, struct timidity_file * ); static int DrawCompressed8bit( Display *, Pixmap, GC, BMPHeader *, struct timidity_file * ); static int highbit( unsigned long ul ); extern unsigned int xskin_depth; extern Visual *xskin_vis; static Colormap cmap; static int color_palletes[256]; static int sc; long rshift,gshift,bshift; static int cols[8][8][8]; static int iscolorinited=0; int xskin_getcolor( Display *d, int r, int g, int b ) { int r0,g0,b0; sc = DefaultScreen( d ); cmap = DefaultColormap( d, sc ); rshift = 15-highbit(xskin_vis->red_mask); gshift = 15-highbit(xskin_vis->green_mask); bshift = 15-highbit(xskin_vis->blue_mask); if ( iscolorinited==0 ) { iscolorinited=1; for ( r0=0 ; r0<8 ; r0++ ) { for ( g0=0 ; g0<8 ; g0++ ) { for ( b0=0 ; b0<8 ; b0++ ) { cols[r0][g0][b0]=-1; } } } } return GetColor( d, r, g, b ); } Pixmap xskin_loadBMP( Display *d, Window w, char *filename, int *width, int *height ) { Pixmap ret=0; BMPHeader *bmp; struct timidity_file *fp; GC gc; if ( width!=NULL ) *width=-1; if ( height!=NULL ) *height=-1; sc = DefaultScreen( d ); gc = DefaultGC( d, sc ); cmap = DefaultColormap( d, sc ); rshift = 15-highbit(xskin_vis->red_mask); gshift = 15-highbit(xskin_vis->green_mask); bshift = 15-highbit(xskin_vis->blue_mask); fp = open_file( filename, 1, OF_SILENT ); if ( fp == NULL ) return ret; if ( fp->url->url_tell == NULL ) { fp->url = url_buff_open( fp->url, 1 ); } bmp = loadBMPHeader( fp ); if ( bmp==NULL ) goto finish1; if ( !loadBMPColors( d, bmp, fp ) ) goto finish1; ret = XCreatePixmap( d, w, bmp->w, bmp->h, xskin_depth ); XSetForeground( d, gc, 0 ); XFillRectangle( d, ret, gc, 0, 0, bmp->w, bmp->h ); XSetForeground( d, gc, WhitePixel( d, sc )); switch( bmp->bitcounts ) { case 4: if ( bmp->compress == 0 ) Draw4bit( d, ret, gc, bmp, fp ); else if ( bmp->compress == 2 ) DrawCompressed4bit( d, ret, gc, bmp, fp ); break; case 8: if ( bmp->compress == 0 ) Draw8bit( d, ret, gc, bmp, fp ); else if ( bmp->compress == 1 ) DrawCompressed8bit( d, ret, gc, bmp, fp ); break; case 24: Draw24bit( d, ret, gc, bmp, fp ); break; default: break; } if ( width!=NULL ) *width = bmp->w; if ( height!=NULL ) *height = bmp->h; finish1: close_file( fp ); return ret; } BMPHeader *loadBMPHeader( struct timidity_file *fp ) { static BMPHeader h; int i; /* file header */ if ( (ugetc(fp) != 'B') || (ugetc(fp) != 'M') ) return NULL; h.size = Get4bytes( fp ); /* size */ if ( h.size < 0 ) return NULL; i = Get2bytes( fp ); /* reserved 1 */ i = Get2bytes( fp ); /* reserved 2 */ h.offbits = Get4bytes( fp ); /* offbits */ if ( h.offbits < 0 ) return NULL; /* information header */ h.hsize = Get4bytes( fp ); /* header size */ if ( h.hsize < 0 ) return NULL; if ( h.hsize == 40 ) { h.w = Get4bytes( fp ); /* width */ h.h = Get4bytes( fp ); /* height */ } else { h.w = Get2bytes( fp ); /* width */ h.h = Get2bytes( fp ); /* height */ } if ( h.h < 0 ) return NULL; i = Get2bytes( fp ); /* planes */ if ( i != 1 ) return NULL; h.bitcounts = Get2bytes(fp); /* bit-counts */ if ( h.bitcounts != 4 && h.bitcounts != 8 && h.bitcounts != 24 ) return NULL; if ( h.hsize==40 || h.hsize==64 ) { i = Get4bytes( fp ); /* compress */ h.compress = i; h.ncolors = ( h.offbits - h.hsize - 14 ) / 4; /* colors */ } else { h.ncolors = 0; h.compress=0; } return &h; } Bool loadBMPColors( Display *d, BMPHeader *h, struct timidity_file *fp ) { int i; int r,g,b; if ( iscolorinited==0 ) { iscolorinited=1; for ( r=0 ; r<8 ; r++ ) { for ( g=0 ; g<8 ; g++ ) { for ( b=0 ; b<8 ; b++ ) { cols[r][g][b]=-1; } } } } tf_seek( fp, h->hsize+14, SEEK_SET ); if ( h->ncolors == 0 ) return True; if ( h->hsize==40 || h->hsize==64 ) { for ( i=0 ; incolors ; i++ ) { b = ugetc(fp)*256; g = ugetc(fp)*256; r = ugetc(fp)*256; if ( ugetc(fp)==EOF ) return False; color_palletes[i] = GetColor( d, r, g, b ); } } else { for ( i=0 ; incolors ; i++ ) { b = ugetc(fp)*256; g = ugetc(fp)*256; r = ugetc(fp)*256; if ( r==EOF ) return False; color_palletes[i] = GetColor( d, r, g, b ); } } return True; } int GetColor( Display *d, int r, int g, int b ) { int ret; XColor C; int r2,g2,b2; switch ( xskin_vis->class ) { case TrueColor: case StaticColor: case StaticGray: if (rshift<0) r = r << (-rshift); else r = r >> rshift; if (gshift<0) g = g << (-gshift); else g = g >> gshift; if (bshift<0) b = b << (-bshift); else b = b >> bshift; r = r & xskin_vis->red_mask; g = g & xskin_vis->green_mask; b = b & xskin_vis->blue_mask; ret = r | g | b; break; default: r2=(r>>13)&7; g2=(g>>13)&7; b2=(b>>13)&7; if ( cols[r2][g2][b2] == -1 ) { C.red = r; C.green = g; C.blue = b; if ( XAllocColor( d, cmap, &C )==0 ) C.pixel=0; cols[r2][g2][b2] = C.pixel; } ret = cols[r2][g2][b2]; break; } return ret; } int Get4bytes( struct timidity_file *fp ) { int ret; int i; if ( (i=ugetc(fp))==EOF ) return -1; ret = i; if ( (i=ugetc(fp))==EOF ) return -1; ret += i*256; if ( (i=ugetc(fp))==EOF ) return -1; ret += i*256*256; if ( (i=ugetc(fp))==EOF ) return -1; ret += i*256*256*256; return ret; } int Get2bytes( struct timidity_file *fp ) { int ret; int i; if ( (i=ugetc(fp))==EOF ) return -1; ret = i; if ( (i=ugetc(fp))==EOF ) return -1; ret += i*256; return ret; } int highbit( unsigned long ul ) { /* int i; int b; for ( i=31 ; i>=0 ; i-- ) { b=1<=0; i--, ul<<=1); return i; } int Draw4bit( Display *d, Pixmap p, GC gc, BMPHeader *bmp, struct timidity_file *fp ) { int x,y; int col,col1,col2; int pad; for ( y=bmp->h ; y>0 ; --y ) { pad = ((bmp->w+7)/8)*8; for ( x=0 ; x>4)&0x0f; col2=col&0x0f; if ( col1 >= bmp->ncolors ) col1=0; if ( col2 >= bmp->ncolors ) col2=0; if ( xw-1 ) { XSetForeground( d, gc, color_palletes[col1] ); XDrawPoint( d, p, gc, x, y-1 ); XSetForeground( d, gc, color_palletes[col2] ); XDrawPoint( d, p, gc, x+1, y-1 ); } } } return 0; } int Draw8bit( Display *d, Pixmap p, GC gc, BMPHeader *bmp, struct timidity_file *fp ) { int x,y; int col; int pad; for ( y=bmp->h ; y>0 ; --y ) { pad = ((bmp->w+3)/4)*4; for ( x=0 ; x= bmp->ncolors ) col=0; if ( xw ) { XSetForeground( d, gc, color_palletes[col] ); XDrawPoint( d, p, gc, x, y-1 ); } } } return 0; } int Draw24bit( Display *d, Pixmap p, GC gc, BMPHeader *bmp, struct timidity_file *fp ) { int x,y; int r,g,b; int pad; pad = (4-((bmp->w*3)%4))&0x03; for ( y=bmp->h ; y>0 ; --y ) { for ( x=0 ; xw ; x++ ) { b = ugetc(fp)*256; g = ugetc(fp)*256; r = ugetc(fp)*256; if ( r == EOF ) { y=0; break; } XSetForeground( d, gc, GetColor( d, r, g, b ) ); XDrawPoint( d, p, gc, x, y-1 ); } for ( x=0 ; xh; while (z) { a=ugetc(fp); b=ugetc(fp); if ( b==EOF ) break; if ( a!=0 ) { if ( b>=bmp->ncolors ) b=0; for ( i=0 ; iw ) { XSetForeground( d, gc, color_palletes[(b>>4)&0x0f] ); XDrawPoint( d, p, gc, x, y-1 ); x++; if ( i!=a-1 ) { XSetForeground( d, gc, color_palletes[b&0x0f] ); XDrawPoint( d, p, gc, x, y-1 ); x++; } } } } else { switch( b ) { case 0: x=0; y--; break; case 1: z=0; break; case 2: x+=ugetc(fp); i=ugetc(fp); if ( i==EOF ) z=0; else y-=i; break; default: for ( i=0 ; i>4)&0x0f; if ( j>=bmp->ncolors ) j=0; if (xw) { XSetForeground( d, gc, color_palletes[j] ); XDrawPoint( d, p, gc, x, y-1 ); x++; } j=a&0x0f; if ( j>=bmp->ncolors ) j=0; if (xw) { XSetForeground( d, gc, color_palletes[j] ); XDrawPoint( d, p, gc, x, y-1 ); x++; } } if (b%2==1) ugetc(fp); } break; } } return 0; } int DrawCompressed8bit( Display *d, Pixmap p, GC gc, BMPHeader *bmp, struct timidity_file *fp ) { int i; int a,b; int x,y; int z=1; x=0; y=bmp->h; while (z) { a=ugetc(fp); b=ugetc(fp); if ( b==EOF ) break; if ( a!=0 ) { if ( b>=bmp->ncolors ) b=0; for ( i=0 ; iw ) { XSetForeground( d, gc, color_palletes[b] ); XDrawPoint( d, p, gc, x, y-1 ); x++; } } } else { switch( b ) { case 0: x=0; y--; break; case 1: z=0; break; case 2: x+=ugetc(fp); i=ugetc(fp); if ( i==EOF ) z=0; else y-=i; break; default: for ( i=0 ; i=bmp->ncolors ) a=0; if (xw) { XSetForeground( d, gc, color_palletes[a] ); XDrawPoint( d, p, gc, x, y-1 ); x++; } } if (b%2==1) ugetc(fp); break; } } } return 0; } static int ugetc( struct timidity_file *fp ) { static unsigned char a[2]; int ret; if ( tf_read( a, 1, 1, fp ) != 1 ) ret=EOF; else ret = (int)a[0]; return ret; } TiMidity++-2.13.2/interface/xskin_spectrum.c0100644004711200001440000001375507421005040020062 0ustar tamukiusers/* TiMidity++ -- MIDI to WAVE converter and player Copyright (C) 1999-2002 Masanao Izumo Copyright (C) 1995 Tuukka Toivonen 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA xskin_spectrum.c Oct.08.1998 Daisuke Nagano */ #include "xskin.h" #include "timidity.h" #include "common.h" #include "instrum.h" #include "playmidi.h" #include "output.h" #include "controls.h" #include "miditrace.h" extern void xskin_pipe_write(char *); extern void xskin_pipe_read_direct(int32 *, int); extern int xskin_getcolor( Display *, int, int, int ); extern Display *xskin_d; extern Window xskin_w; extern GC xskin_gc; extern Pixmap xskin_back; extern unsigned int xskin_depth; extern Visual *xskin_vis; #ifdef SUPPORT_SOUNDSPEC static void xskin_spe_ana( unsigned char * ); static void xskin_wave( unsigned char * ); #endif /* SUPPORT_SOUNDSPEC */ static int foreground; static int background; static int spe_pixel[16]; static int wave_pixel[5]; static XImage *spe_line; static char *spe_background; int readrgb( Display *d, struct timidity_file *fp ) { char tmp[1024]; int r,g,b; if ( tf_gets( tmp, sizeof(tmp), fp ) == NULL) return -1; sscanf( tmp, "%d,%d,%d", &r, &g, &b ); return xskin_getcolor( d, r*256, g*256, b*256 ); } int xskin_loadviscolor( Display *d, Window w, char *filename ) { int i,j; int x,y; int sc; struct timidity_file *fp; static int r0[16] = { /* Default spectrum color (red) */ 0xcf3c, 0xb6da, 0xb6da, 0xc71b, 0xc71b, 0xefbe, 0xc71b, 0xbaea, 0xb6da, 0x28a2, 0x28a2, 0x28a2, 0x2081, 0x2081, 0x2081, 0x2081, }; static int g0[16] = { /* Default spectrum color (green) */ 0x0000, 0x69a6, 0x69a6, 0x79e7, 0x79e7, 0xa699, 0x9e79, 0xb6da, 0xb6da, 0xbaea, 0xbaea, 0xbaea, 0xa289, 0xa289, 0xa289, 0xa289 }; static int b0[16] = { /* Default spectrum color (blue) */ 0x0000, 0x0000, 0x0000, 0x0820, 0x0820, 0x0000, 0x30c2, 0x4103, 0x1040, 0x28a2, 0x28a2, 0x28a2, 0x2081, 0x2081, 0x2081, 0x2081 }; sc = DefaultScreen(d); if ( filename==NULL ) { /* Initialize */ spe_line = XCreateImage( d, xskin_vis, xskin_depth,ZPixmap, 0, NULL, SPE_W, SPE_H, 8, 0 ); spe_line->data = (char *)safe_malloc( spe_line->bytes_per_line* spe_line->height ); spe_background = (char *)safe_malloc( spe_line->bytes_per_line* spe_line->height ); foreground = xskin_getcolor( d, 0x4103, 0x4924, 0x4924 ); background = xskin_getcolor( d, 0, 0, 0 ); if ( background == 0 ) background = BlackPixel( d, sc ); if ( foreground == 0 ) foreground = BlackPixel( d, sc ); for ( i=0 ; i<16 ; i++ ) { spe_pixel[i] = xskin_getcolor( d, r0[i], g0[i], b0[i] ); if ( spe_pixel[i] == 0 ) spe_pixel[i] = spe_pixel[i-1]; } for ( i=0 ; i<5 ; i++ ) { wave_pixel[i] = WhitePixel( d, sc ); } } else { fp = open_file( filename, 1, OF_SILENT ); if ( fp == NULL ) return 0; if ( (i = readrgb(d,fp))<0 ) goto end; /* spe_ana : background */ background = i; if ( (i = readrgb(d,fp))<0 ) goto end; /* spe_ana : background */ foreground = i; for ( i=0 ; i<16 ; i++ ) { j = readrgb(d,fp); if ( j<0 ) goto end; spe_pixel[i] = j; } for ( i=0 ; i<5 ; i++ ) { j = readrgb(d,fp); if ( j<0 ) goto end; wave_pixel[i] = j; } end: close_file( fp ); } for ( y=0 ; ydata, spe_line->bytes_per_line * spe_line->height ); return 1; } void ts_spectrum( int mode, unsigned char *buf ) { static int last_mode; switch( mode ) { case -1: /* initialize */ if ( last_mode != -1 ) { XCopyArea( xskin_d, xskin_back, xskin_w, xskin_gc, SPE_SX, SPE_SY, SPE_W, SPE_H, SPE_SX, SPE_SY ); } break; case 0: /* blank */ if ( last_mode != 0 ) { XCopyArea( xskin_d, xskin_back, xskin_w, xskin_gc, SPE_SX, SPE_SY, SPE_W, SPE_H, SPE_SX, SPE_SY ); } break; #ifdef SUPPORT_SOUNDSPEC case 1: /* spectrum analizer */ xskin_spe_ana(buf); break; case 2: /* wave form */ xskin_wave(buf); break; #endif /* SUPPORT_SOUNDSPEC */ default: break; } last_mode=mode; return ; } #ifdef SUPPORT_SOUNDSPEC static void xskin_spe_ana( unsigned char *buf ) { int x,y,i; int yt; memcpy( spe_line->data, spe_background, spe_line->bytes_per_line * spe_line->height ); if ( buf != NULL ) { for ( x=0 ; x15 ) i=15; XPutPixel( spe_line, x, y, spe_pixel[i] ); } } } XPutImage( xskin_d, xskin_w, xskin_gc, spe_line, 0, 0, SPE_SX, SPE_SY, SPE_W, SPE_H ); return; } static void xskin_wave( unsigned char *buf ) { int x,y,c; memcpy( spe_line->data, spe_background, spe_line->bytes_per_line * spe_line->height ); if ( buf != NULL ) { for ( x=0 ; x=12 ) c=y-11; else c=0; XPutPixel( spe_line, x, y, wave_pixel[c] ); } } XPutImage( xskin_d, xskin_w, xskin_gc, spe_line, 0, 0, SPE_SX, SPE_SY, SPE_W, SPE_H ); return; } #endif /* SUPPORT_SOUNDSPEC */ TiMidity++-2.13.2/interface/wrdt_x.c0100644004711200001440000003261710125651536016325 0ustar tamukiusers/* TiMidity++ -- MIDI to WAVE converter and player Copyright (C) 1999-2002 Masanao Izumo Copyright (C) 1995 Tuukka Toivonen 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA wrdt_x.c - WRD Tracer for X Window Written by Takanori Watanabe */ #ifdef HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ #include #ifndef NO_STRING_H #include #else #include #endif #include #include #include "timidity.h" #include "common.h" #include "instrum.h" #include "playmidi.h" #include "readmidi.h" #include "controls.h" #include "wrd.h" #include "x_wrdwindow.h" #include "x_mag.h" #ifdef ENABLE_SHERRY #include "x_sherry.h" #endif /* ENABLE_SHERRY */ static int wrdt_open(char *dummy); static void wrdt_apply(int cmd, int wrd_argc, int wrd_argv[]); static void wrdt_update_events(void); static int wrdt_start(int wrd_mode); static void wrdt_end(void); static void wrdt_close(void); static int current_wrd_mode = WRD_TRACE_NOTHING; static char *save_open_flag; #define wrdt x_wrdt_mode WRDTracer wrdt = { "X WRD tracer", 'x', 0, wrdt_open, wrdt_apply, #ifdef ENABLE_SHERRY x_sry_wrdt_apply, #else NULL, #endif wrdt_update_events, wrdt_start, wrdt_end, wrdt_close }; static int inkey_flag; #define LINEBUF 1024 static char line_buf[LINEBUF]; static int wrdt_open(char *arg) { save_open_flag = arg; wrdt.opened = 1; return 0; } static void wrdt_update_events(void) { if(current_wrd_mode == WRD_TRACE_MIMPI) WinEvent(); #ifdef ENABLE_SHERRY else if(current_wrd_mode == WRD_TRACE_SHERRY) x_sry_event(); #endif } static int wrdt_start(int mode) { int last_mode = current_wrd_mode; current_wrd_mode = mode; switch(mode) { case WRD_TRACE_NOTHING: switch(last_mode) { case WRD_TRACE_MIMPI: CloseWRDWindow(); break; case WRD_TRACE_SHERRY: #ifdef ENABLE_SHERRY CloseSryWindow(); #endif /* ENABLE_SHERRY */ break; } break; case WRD_TRACE_MIMPI: #ifdef ENABLE_SHERRY if(last_mode == WRD_TRACE_SHERRY) CloseSryWindow(); #endif /* ENABLE_SHERRY */ if(OpenWRDWindow(save_open_flag) == -1) { current_wrd_mode = WRD_TRACE_NOTHING; return -1; /* Error */ } break; case WRD_TRACE_SHERRY: if(last_mode == WRD_TRACE_MIMPI) CloseWRDWindow(); #ifdef ENABLE_SHERRY if(OpenSryWindow(save_open_flag) == -1) { current_wrd_mode = WRD_TRACE_NOTHING; return -1; /* Error */ } #endif /* ENABLE_SHERRY */ break; } return 0; } static void wrdt_end(void) { inkey_flag = 0; mag_deletetab(); x_VRel(); } static void wrdt_close(void) { if(wrdt.opened) { EndWin(); #ifdef ENABLE_SHERRY x_sry_close(); #endif /* ENABLE_SHERRY */ wrdt.opened = 0; inkey_flag = 0; } } static char *wrd_event2string(int id) { char *name; name = event2string(id); if(name != NULL) return name + 1; return ""; } static void load_default_graphics(char *fn) { MBlockList pool; char *file, *p; int is_caseUpper; magdata *m; init_mblock(&pool); file = (char *)new_segment(&pool, strlen(fn) + 5); strcpy(file, fn); if((p = strrchr(file, '.')) == NULL) goto done; is_caseUpper = ('A' <= p[1] && p[1] <= 'Z'); /* try load default MAG file */ strcpy(p + 1, is_caseUpper ? "MAG" : "mag"); if((m = mag_create(file)) != NULL) { x_Mag(m, WRD_NOARG, WRD_NOARG, 0, 0); goto done; } /* try load default PHO file */ strcpy(p + 1, is_caseUpper ? "PHO" : "pho"); x_PLoad(file); done: reuse_mblock(&pool); } static void wrdt_apply(int cmd, int wrd_argc, int wrd_args[]) { char *p; char *text; int i, len; static int txtclr_preserve=0; if(cmd == WRD_MAGPRELOAD){ /* Load MAG file */ magdata *m; char *p = wrd_event2string(wrd_args[0]); ctl->cmsg(CMSG_INFO, VERB_NOISY, "Loading magfile: [%s]", p); m = mag_create(p); if(m == NULL) ctl->cmsg(CMSG_WARNING, VERB_NOISY, "Can't load magfile: %s", p); else { ctl->cmsg(CMSG_INFO, VERB_DEBUG, "MAG %s: [%d,%d,%d,%d]", p, m->xorig, m->xend, m->yorig, m->yend); } return; } if(cmd == WRD_PHOPRELOAD){ /* Load PHO file - Not implemented */ return; } #if 0 if(inkey_flag) fprintf(file_out,"* "); #endif switch(cmd) { case WRD_LYRIC: p = wrd_event2string(wrd_args[0]); len = strlen(p); text = (char *)new_segment(&tmpbuffer, SAFE_CONVERT_LENGTH(len)); /*This must be not good thing,but as far as I know no wrd file written in EUC-JP code can be found,And Hankaku kana required for layout of charactor and ASCII art.*/ code_convert(p, text, SAFE_CONVERT_LENGTH(len), "SJIS", "JISK"); AddLine(text,0); reuse_mblock(&tmpbuffer); break; case WRD_NL: /* Newline */ AddLine("\n",0); break; case WRD_COLOR: txtclr_preserve=wrd_args[0]; /*This length is at most 20 ; this is much lesser than LINEBUF*/ snprintf(line_buf,LINEBUF,"\033[%dm", txtclr_preserve); AddLine(line_buf,0); break; case WRD_END: /* Never call */ break; case WRD_ESC: AddLine("\033[",0); AddLine(wrd_event2string(wrd_args[0]),0); break; case WRD_EXEC: /*I don't spawn another program*/ ctl->cmsg(CMSG_INFO, VERB_DEBUG, "@EXEC(%s)", wrd_event2string(wrd_args[0])); break; case WRD_FADE: ctl->cmsg(CMSG_INFO, VERB_DEBUG, "@FADE(%d,%d,%d)", wrd_args[0], wrd_args[1], wrd_args[2]); x_Fade(wrd_args,wrd_argc-1,-1,-1); break; case WRD_FADESTEP: #if 0 ctl->cmsg(CMSG_INFO, VERB_DEBUG, "@FADESTEP(%d/%d)", wrd_args[0], wrd_args[1]); #endif x_Fade(NULL,0,wrd_args[0],wrd_args[1]); break; case WRD_GCIRCLE: ctl->cmsg(CMSG_INFO, VERB_DEBUG, "@GCIRCLE(%d,%d,%d,%d,%d,%d)", wrd_args[0], wrd_args[1], wrd_args[2], wrd_args[3], wrd_args[4], wrd_args[5]); x_GCircle(wrd_args,wrd_argc-1); break; case WRD_GCLS: x_Gcls(wrd_args[0]); break; case WRD_GINIT: ctl->cmsg(CMSG_INFO, VERB_DEBUG, "@GINIT()"); break; case WRD_GLINE: ctl->cmsg(CMSG_INFO, VERB_DEBUG, "@GLINE(%d,%d,%d,%d,%d,%d,%d)", wrd_args[0], wrd_args[1], wrd_args[2], wrd_args[3], wrd_args[4], wrd_args[5], wrd_args[6]); /*GRPH_LINE_MODE=1*/ x_Gline(wrd_args,wrd_argc-1); break; case WRD_GMODE: ctl->cmsg(CMSG_INFO, VERB_DEBUG, "@GMODE(%d)", wrd_args[0]); x_GMode(wrd_args[0]); break; case WRD_GMOVE: ctl->cmsg(CMSG_INFO, VERB_DEBUG, "@GMOVE(%d,%d,%d,%d,%d,%d,%d,%d,%d)", wrd_args[0], wrd_args[1], wrd_args[2], wrd_args[3], wrd_args[4], wrd_args[5], wrd_args[6], wrd_args[7], wrd_args[8]); wrd_args[0] &= ~0x7; wrd_args[4] &= ~0x7; wrd_args[2] |= 0x7; x_GMove(wrd_args[0], wrd_args[1], wrd_args[2], wrd_args[3], wrd_args[4],wrd_args[5], wrd_args[6], wrd_args[7], wrd_args[8]); break; case WRD_GON: ctl->cmsg(CMSG_INFO, VERB_DEBUG, "@GON(%d)", wrd_args[0]); x_Gon(wrd_args[0]); break; case WRD_GSCREEN: ctl->cmsg(CMSG_INFO, VERB_DEBUG, "@GSCREEN(%d,%d)", wrd_args[0], wrd_args[1]); x_Gscreen(wrd_args[0],wrd_args[1]); break; case WRD_INKEY: inkey_flag = 1; ctl->cmsg(CMSG_INFO, VERB_DEBUG, "@INKEY - begin"); break; case WRD_OUTKEY: inkey_flag = 0; ctl->cmsg(CMSG_INFO, VERB_DEBUG, "@INKEY - end"); break; case WRD_LOCATE: /*Length is At most 40*/ snprintf(line_buf,LINEBUF,"\033[%d;%dH", wrd_args[1], wrd_args[0]); AddLine(line_buf,0); break; case WRD_LOOP: /* Never call */ break; case WRD_MAG: { magdata *m; p = (char *)new_segment(&tmpbuffer, MIN_MBLOCK_SIZE); snprintf(p, MIN_MBLOCK_SIZE-1, "@MAG(%s", wrd_event2string(wrd_args[0])); p[MIN_MBLOCK_SIZE-1] = '\0'; /* fail safe */ for(i = 1; i < 5; i++) { if(wrd_args[i] == WRD_NOARG) strncat(p, ",*", MIN_MBLOCK_SIZE - strlen(p) - 1); else { char q[CHAR_BIT*sizeof(int)]; snprintf(q, sizeof(q)-1, ",%d", wrd_args[i]); strncat(p, q, MIN_MBLOCK_SIZE - strlen(p) - 1); } } strncat(p, ")", MIN_MBLOCK_SIZE - strlen(p) - 1); ctl->cmsg(CMSG_INFO, VERB_VERBOSE, "%s", p); m=mag_search(wrd_event2string(wrd_args[0])); if(m!=NULL){ x_Mag(m,wrd_args[1],wrd_args[2],wrd_args[3],wrd_args[4]); } reuse_mblock(&tmpbuffer); break; } case WRD_MIDI: /* Never call */ break; case WRD_OFFSET: /* Never call */ break; case WRD_PAL: x_Pal(wrd_args,wrd_argc-1); break; case WRD_PALCHG: ctl->cmsg(CMSG_INFO, VERB_DEBUG, "@PALCHG(%s)", wrd_event2string(wrd_args[0])); break; case WRD_PALREV: ctl->cmsg(CMSG_INFO, VERB_DEBUG, "@PALREV(%d)", wrd_args[0]); x_Palrev(wrd_args[0]); break; case WRD_PATH: ctl->cmsg(CMSG_INFO, VERB_DEBUG, "@PATH(%s)", wrd_event2string(wrd_args[0])); wrd_add_path(wrd_event2string(wrd_args[0]), 0); break; case WRD_PLOAD: ctl->cmsg(CMSG_INFO, VERB_DEBUG, "@PLOAD(%s)", wrd_event2string(wrd_args[0])); x_PLoad(wrd_event2string(wrd_args[0])); break; case WRD_REM: p = wrd_event2string(wrd_args[0]); len = strlen(p); text = (char *)new_segment(&tmpbuffer, SAFE_CONVERT_LENGTH(len)); code_convert(p, text, SAFE_CONVERT_LENGTH(len), NULL, NULL); ctl->cmsg(CMSG_INFO, VERB_DEBUG, "@REM %s", text); reuse_mblock(&tmpbuffer); break; case WRD_REMARK: ctl->cmsg(CMSG_INFO, VERB_DEBUG, "@REMARK(%s)", wrd_event2string(wrd_args[0])); break; case WRD_REST: /* Never call */ break; case WRD_SCREEN: /* Not supported */ break; case WRD_SCROLL: ctl->cmsg(CMSG_INFO, VERB_DEBUG, "@SCROLL(%d,%d,%d,%d,%d,%d,%d)", wrd_args[0], wrd_args[1], wrd_args[2], wrd_args[3], wrd_args[4], wrd_args[5], wrd_args[6]); break; case WRD_STARTUP: ctl->cmsg(CMSG_INFO, VERB_DEBUG, "@STARTUP(%d)", wrd_args[0]); wrd_init_path(); inkey_flag = 0; x_Startup(wrd_args[0]); load_default_graphics(current_file_info->filename); break; case WRD_STOP: /* Never call */ break; case WRD_TCLS: ctl->cmsg(CMSG_INFO, VERB_DEBUG, "@TCLS(%d,%d,%d,%d,%d,%d)", wrd_args[0], wrd_args[1], wrd_args[2], wrd_args[3], wrd_args[4], wrd_args[5]); { char fillbuf[1024]; int xdiff; xdiff=wrd_args[2]-wrd_args[0]+1; if(xdiff>80) xdiff = 79-wrd_args[0]+1; if(xdiff<0||xdiff>80) break; fillbuf[0]=0x1b; fillbuf[1]='['; fillbuf[2]='s'; fillbuf[3]=0; AddLine(fillbuf,0); i=wrd_args[4]; /*This Length is no more than 1024*/ sprintf(fillbuf,"\033[%dm",i); AddLine(fillbuf,0); memset(fillbuf,wrd_args[5],xdiff);/*X2-X1*/ fillbuf[xdiff]=0; for(i=wrd_args[1];i<=wrd_args[3];i++){/*Y1 to Y2*/ snprintf(line_buf,LINEBUF,"\033[%d;%dH",i,wrd_args[0]); /*X1to....*/ AddLine(line_buf,0); AddLine(fillbuf,0); } fillbuf[0]=0x1b; fillbuf[1]='['; fillbuf[2]='u'; fillbuf[3]=0; AddLine(fillbuf,0); } break; case WRD_TON: ctl->cmsg(CMSG_INFO, VERB_DEBUG, "@TON(%d)", wrd_args[0]); x_Ton(wrd_args[0]); break; case WRD_WAIT: /* Never call */ break; case WRD_WMODE: /* Never call */ break; /* Ensyutsukun */ case WRD_eFONTM: print_ecmd("FONTM", wrd_args, 1); break; case WRD_eFONTP: print_ecmd("FONTP", wrd_args, 4); break; case WRD_eFONTR: print_ecmd("FONTR", wrd_args, 17); break; case WRD_eGSC: print_ecmd("GSC", wrd_args, 1); break; case WRD_eLINE: print_ecmd("LINE", wrd_args, 1); break; case WRD_ePAL: print_ecmd("PAL", wrd_args, 2); break; case WRD_eREGSAVE: print_ecmd("REGSAVE", wrd_args, 17); break; case WRD_eSCROLL: print_ecmd("SCROLL",wrd_args, 2); break; case WRD_eTEXTDOT: print_ecmd("TEXTDOT", wrd_args, 1); break; case WRD_eTMODE: print_ecmd("TMODE", wrd_args, 1); break; case WRD_eTSCRL: print_ecmd("TSCRL", wrd_args, 0); break; case WRD_eVCOPY: print_ecmd("VCOPY", wrd_args, 9); x_VCopy(wrd_args[0],wrd_args[1],wrd_args[2],wrd_args[3] ,wrd_args[4],wrd_args[5],wrd_args[6],wrd_args[7],wrd_args[8]); break; case WRD_eVSGET: print_ecmd("VSGET", wrd_args, 4); x_VSget(wrd_args,4); break; case WRD_eVSRES: print_ecmd("VSRES", wrd_args, 0); x_VRel(); break; case WRD_eXCOPY: if(wrd_argc < 9) break; x_XCopy(wrd_args[0],wrd_args[1],wrd_args[2],wrd_args[3],wrd_args[4], wrd_args[5],wrd_args[6],wrd_args[7],wrd_args[8], wrd_args + 9, wrd_argc - 9); break; /* Extensionals */ case WRD_START_SKIP: if(current_wrd_mode == WRD_TRACE_MIMPI) x_RedrawControl(0); #ifdef ENABLE_SHERRY else if(current_wrd_mode == WRD_TRACE_SHERRY) x_sry_redraw_ctl(0); #endif /* ENABLE_SHERRY */ break; case WRD_END_SKIP: if(current_wrd_mode == WRD_TRACE_MIMPI) x_RedrawControl(1); #ifdef ENABLE_SHERRY else if(current_wrd_mode == WRD_TRACE_SHERRY) x_sry_redraw_ctl(1); #endif /* ENABLE_SHERRY */ break; #ifdef ENABLE_SHERRY case WRD_SHERRY_UPDATE: x_sry_update(); break; #endif /* ENABLE_SHERRY */ } WinFlush(); } TiMidity++-2.13.2/interface/x_sherry.c0100644004711200001440000015112407514365344016663 0ustar tamukiusers/* TiMidity++ -- MIDI to WAVE converter and player Copyright (C) 1999-2002 Masanao Izumo Copyright (C) 1995 Tuukka Toivonen 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA x_sherry.c - Sherry WRD for X Window written by Masanao Izumo */ #ifdef HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ #ifdef ENABLE_SHERRY #include #include #ifndef NO_STRING_H #include #else #include #endif #include #include #include "timidity.h" #include "common.h" #include "controls.h" #include "wrd.h" #include "aq.h" #include "x_sherry.h" #ifndef XSHM_SUPPORT #if defined(HAVE_XSHMCREATEPIXMAP) && \ defined(HAVE_X11_EXTENSIONS_XSHM_H) && \ defined(HAVE_SYS_IPC_H) && \ defined(HAVE_SYS_SHM_H) #define XSHM_SUPPORT 1 #else #define XSHM_SUPPORT 0 #endif #endif /* XSHM_SUPPORT */ #if XSHM_SUPPORT #include #include #include #endif #define MAX_PLANES 8 #define MAX_COLORS (1<data[(scr)->width * (y) + (x)]) static unsigned long basePixel; /* base pixel */ static unsigned long planePixel[MAX_PLANES]; /* plane pixel */ static unsigned long palette2Pixel[MAX_COLORS]; static int currentPalette; static SherryPalette **virtualPalette; /* MAX_VIRTUAL_PALETTES, ۥѥå */ static SherryPaletteEntry realPalette[MAX_PALETTES]; static uint8 *pseudoImage = NULL; /* For TrueColor */ static int draw_ctl_flag = True; static int err_to_stop = 0; /* Image Pixmap */ static ImagePixmap *create_image_pixmap(int width, int height, int depth); static void clear_image_pixmap(ImagePixmap *ip, unsigned long pixel); static void free_image_pixmap(ImagePixmap *ip); #if XSHM_SUPPORT static ImagePixmap *create_shm_image_pixmap(int width, int height, int depth); #endif /* XSHM_SUPPORT */ static int isRealPaletteChanged, isRealScreenChanged; static int updateClipX1, updateClipY1, updateClipX2, updateClipY2; static int check_range(VirtualScreen *scr, int x1, int y1, int x2, int y2); static Window try_create_window(Display *disp, int width, int height, int want_class, int want_depth, Visual **newVisual, Colormap *newColormap) { Visual *defVisual; int defScreen; int defDepth; XSetWindowAttributes xswa; unsigned long xswamask; int numvis; defScreen = DefaultScreen(disp); defVisual = DefaultVisual(disp, defScreen); defDepth = DefaultDepth(disp, defScreen); if(want_class == -1) want_class = defVisual->class; if(want_depth == -1) want_depth = defDepth; if(defVisual->class == want_class && defDepth == want_depth) *newVisual = defVisual; else { XVisualInfo *vinfo, rvinfo; rvinfo.class = want_class; rvinfo.screen = defScreen; rvinfo.depth = want_depth; vinfo = XGetVisualInfo(disp, VisualClassMask | VisualScreenMask | VisualDepthMask, &rvinfo, &numvis); if(vinfo == NULL) return None; if(numvis == 0) { XFree((char *)vinfo); return None; } *newVisual = vinfo[0].visual; } *newColormap = XCreateColormap(disp, RootWindow(disp, defScreen), *newVisual, AllocNone); xswa.background_pixel = 0; xswa.border_pixel = 0; xswa.colormap = *newColormap; xswamask = CWBackPixel | CWBorderPixel | CWColormap; return XCreateWindow(disp, RootWindow(disp, defScreen), 0, 0, width, height, 0, want_depth, InputOutput, *newVisual, xswamask, &xswa); } /* Create real-screen for Sherry WRD Window * sutable theVisual, theColormap, theDepth, theClass is selected. */ static Window create_main_window(int want_class, int want_depth) { Window win; int i; struct { int want_class, want_depth; } target_visuals[] = { {TrueColor, 24}, {TrueColor, 32}, {TrueColor, 16}, {PseudoColor, 8}, {-1, -1}}; if(want_class != -1) { win = try_create_window(theDisplay, REAL_SCREEN_SIZE_X, REAL_SCREEN_SIZE_Y, want_class, want_depth, &theVisual, &theColormap); theClass = want_class; theDepth = want_depth; return win; } for(i = 0; target_visuals[i].want_class != -1; i++) if((win = try_create_window(theDisplay, REAL_SCREEN_SIZE_X, REAL_SCREEN_SIZE_Y, target_visuals[i].want_class, target_visuals[i].want_depth, &theVisual, &theColormap)) != None) { theClass = target_visuals[i].want_class; theDepth = target_visuals[i].want_depth; return win; } /* Use default visual */ if((win = try_create_window(theDisplay, REAL_SCREEN_SIZE_X, REAL_SCREEN_SIZE_Y, -1, -1, &theVisual, &theColormap)) != None) { theClass = theVisual->class; theDepth = DefaultDepth(theDisplay, theScreen); return win; } return None; } static GC createGC(Display *disp, Drawable draw) { XGCValues gv; gv.graphics_exposures = False; return XCreateGC(disp, draw, GCGraphicsExposures, &gv); } static int highbit(unsigned long ul) { int i; unsigned long hb; hb = 0x80000000UL; for(i = 31; ((ul & hb) == 0) && i >= 0; i--, ul<<=1) ; return i; } static inline unsigned long trueColorPixel(unsigned long r, /* 0..255 */ unsigned long g, /* 0..255 */ unsigned long b) /* 0..255 */ { static int rs, gs, bs; if(r == 0xffffffff) /* for initialize */ { rs = 15 - highbit(theVisual->red_mask); gs = 15 - highbit(theVisual->green_mask); bs = 15 - highbit(theVisual->blue_mask); return 0; } r *= 257; /* 0..65535 */ g *= 257; /* 0..65535 */ b *= 257; /* 0..65535 */ if(rs < 0) r <<= -rs; else r >>= rs; if(gs < 0) g <<= -gs; else g >>= gs; if(bs < 0) b <<= -bs; else b >>= bs; r &= theVisual->red_mask; g &= theVisual->green_mask; b &= theVisual->blue_mask; return r | g | b; } static Bool init_palette(void) { static int first_flag = 1; int i, j; XColor xcolors[MAX_COLORS]; if(first_flag) { first_flag = 0; if(theClass == TrueColor) { basePixel = 0; trueColorPixel(0xffffffff, 0, 0); return True; } if(!XAllocColorCells(theDisplay, theColormap, False, planePixel, MAX_PLANES, &basePixel, 1)) return False; } if(theClass == TrueColor) return True; for(i = 0; i < MAX_COLORS; i++) { palette2Pixel[i] = basePixel; for(j = 0; j < MAX_PLANES; j++) if((i & (1 << j)) != 0) palette2Pixel[i] |= planePixel[j]; } for(i = 0; i < MAX_COLORS; i++) { xcolors[i].pixel = palette2Pixel[i]; xcolors[i].red = 0; xcolors[i].green = 0; xcolors[i].blue = 0; xcolors[i].flags = DoRed | DoGreen | DoBlue; } XStoreColors(theDisplay, theColormap, xcolors, MAX_COLORS); return True; } static Bool init_font(void) { if((theFont8 = XLoadQueryFont(theDisplay, JISX0201)) == NULL) { ctl->cmsg(CMSG_ERROR, VERB_NORMAL, "%s: Can't load font", JISX0201); return False; } if((theFont16 = XLoadQueryFont(theDisplay, JISX0208)) == NULL) { ctl->cmsg(CMSG_ERROR, VERB_NORMAL, "%s: Can't load font", JISX0208); XFreeFont(theDisplay, theFont8); return False; } lbearing8 = theFont8->min_bounds.lbearing; ascent8 = theFont8->max_bounds.ascent; lbearing16 = theFont16->min_bounds.lbearing; ascent16 = theFont16->max_bounds.ascent; return True; } static void free_font(void) { XFreeFont(theDisplay, theFont8); XFreeFont(theDisplay, theFont16); } /* open */ /* return: * -1: error * 0: success * 1: already initialized */ static int x_sry_open(char *opts) { static Bool error_flag = False; int i; Bool try_pseudo; if(error_flag) { if(error_flag == -1) ctl->cmsg(CMSG_ERROR, VERB_NOISY, "Sherry WRD: Can't work because of error"); else if(error_flag == 1) /* Already initialized */ { XMapWindow(theDisplay, theWindow); clear_image_pixmap(theRealScreen, basePixel); XFlush(theDisplay); return 0; } return error_flag; } try_pseudo = 0; if(opts) { if(strchr(opts, 'p')) try_pseudo = 1; } if((theDisplay = XOpenDisplay(NULL)) == NULL) { ctl->cmsg(CMSG_ERROR, VERB_NORMAL, "Sherry WRD: Can't open display: %s", XDisplayName(NULL)); error_flag = -1; return -1; } if(!init_font()) { XCloseDisplay(theDisplay); theDisplay = NULL; error_flag = -1; return -1; } theScreen = DefaultScreen(theDisplay); if(try_pseudo) theWindow = create_main_window(PseudoColor, 8); else theWindow = create_main_window(-1, -1); if(theWindow == None) { ctl->cmsg(CMSG_ERROR, VERB_NORMAL, "Sherry WRD: Can't create Sherry WRD Window"); free_font(); XCloseDisplay(theDisplay); theDisplay = NULL; error_flag = -1; return -1; } XSelectInput(theDisplay, theWindow, ExposureMask); #if XSHM_SUPPORT theRealScreen = create_shm_image_pixmap(REAL_SCREEN_SIZE_X, REAL_SCREEN_SIZE_Y, theDepth); imageBitmap = create_shm_image_pixmap(IMAGEBITMAPLEN * CHAR_WIDTH1, CHAR_HEIGHT, theDepth); #else theRealScreen = create_image_pixmap(REAL_SCREEN_SIZE_X, REAL_SCREEN_SIZE_Y, theDepth); imageBitmap = create_image_pixmap(IMAGEBITMAPLEN * CHAR_WIDTH1, CHAR_HEIGHT, 1); #endif init_palette(); XSetWindowBackground(theDisplay, theWindow, basePixel); XSetForeground(theDisplay, imageBitmap->gc, 1); XSetBackground(theDisplay, imageBitmap->gc, 0); theGC = createGC(theDisplay, theWindow); virtualScreen = (VirtualScreen **)safe_malloc(MAX_VIRTUAL_SCREENS * sizeof(VirtualScreen *)); for(i = 0; i < MAX_VIRTUAL_SCREENS; i++) virtualScreen[i] = NULL; tmpScreen = NULL; virtualPalette = (SherryPalette **)safe_malloc(MAX_VIRTUAL_PALETTES * sizeof(SherryPalette *)); for(i = 0; i < MAX_VIRTUAL_PALETTES; i++) virtualPalette[i] = NULL; memset(realPalette, 0, sizeof(realPalette)); if(theClass == TrueColor) { pseudoImage = (uint8 *)safe_malloc(REAL_SCREEN_SIZE_X * REAL_SCREEN_SIZE_Y); memset(pseudoImage, 0, REAL_SCREEN_SIZE_X * REAL_SCREEN_SIZE_Y); } XMapWindow(theDisplay, theWindow); XFlush(theDisplay); error_flag = 1; return 0; } void CloseSryWindow(void) { XUnmapWindow(theDisplay, theWindow); XFlush(theDisplay); } int OpenSryWindow(char *opts) { return x_sry_open(opts); } void x_sry_close(void) { int i; if(theDisplay == NULL) return; free_image_pixmap(theRealScreen); free_image_pixmap(imageBitmap); for(i = 0; i < MAX_VIRTUAL_SCREENS; i++) if(virtualScreen[i] != NULL) { free_vscreen(virtualScreen[i]); virtualScreen[i] = NULL; } free(virtualScreen); if(tmpScreen != NULL) { free(tmpScreen); tmpScreen = NULL; } for(i = 0; i < MAX_VIRTUAL_PALETTES; i++) if(virtualPalette[i] != NULL) { free(virtualPalette[i]); virtualPalette[i] = NULL; } free(virtualPalette); if(pseudoImage) free(pseudoImage); XFreeFont(theDisplay, theFont8); XFreeFont(theDisplay, theFont16); XCloseDisplay(theDisplay); theDisplay = NULL; } static void sry_new_vpal(uint8 *data, int len) { int i, n; for(i = 0; i < len-1; i += 2) { n = SRY_GET_SHORT(data + i) & 0xffff; #ifdef SRY_DEBUG printf("NEW palette %d\n", n); #endif /* SRY_DEBUG */ if(virtualPalette[n] == NULL) virtualPalette[n] = (SherryPalette *)safe_malloc(sizeof(SherryPalette)); memset(virtualPalette[n], 0, sizeof(SherryPalette)); } } static void sry_free_vpal(uint8 *data, int len) { int i, n; for(i = 0; i < len-1; i += 2) { n = SRY_GET_SHORT(data + i) & 0xffff; if(virtualPalette[n] != NULL) { free(virtualPalette[n]); virtualPalette[n] = NULL; } } } static void sry_new_vram(uint8 *data, int len) { int i, n, width, height, c; for(i = 0; i < len-6; i += 7) { n = SRY_GET_SHORT(data + i) & 0xffff; width = SRY_GET_SHORT(data + i + 2) & 0xffff; height = SRY_GET_SHORT(data + i + 4) & 0xffff; c = data[6]; #ifdef SRY_DEBUG printf("sherry: new vram[%d] %dx%d (t=%d)\n", n, width, height, c); #endif /* SRY_DEBUG */ if(virtualScreen[n] != NULL) free_vscreen(virtualScreen[n]); virtualScreen[n] = alloc_vscreen(width, height, c); } } static void sry_free_vram(uint8 *data, int len) { int i, n; for(i = 0; i < len-1; i += 2) { n = SRY_GET_SHORT(data + i) & 0xffff; if(virtualScreen[n] != NULL) { free_vscreen(virtualScreen[n]); virtualScreen[n] = NULL; } } } static void sry_pal_set(uint8 *data, int len) { int pg, i, p; SherryPaletteEntry *entry; pg = SRY_GET_SHORT(data) & 0xffff; if(virtualPalette[pg] == NULL) { ctl->cmsg(CMSG_ERROR, VERB_NORMAL, "WRD Sherry: virtual palette %d is not allocated", pg); err_to_stop = 1; return; } entry = virtualPalette[pg]->entry; data += 2; len -= 2; #ifdef SRY_DEBUG printf("set palette color of %d (n=%d)\n", pg, len / 4); #endif /* SRY_DEBUG */ for(i = 0; i < len - 3; i += 4) { p = data[i]; entry[p].r = data[i + 1]; entry[p].g = data[i + 2]; entry[p].b = data[i + 3]; } } static void update_real_screen(int x, int y, int width, int height) { if(!draw_ctl_flag) return; #if XSHM_SUPPORT if(theRealScreen->shminfo.shmid != -1) { XShmPutImage(theDisplay, theWindow, theGC, theRealScreen->im, x, y, x, y, width, height, False); return; } #endif XPutImage(theDisplay, theWindow, theGC, theRealScreen->im, x, y, x, y, width, height); } static void updateScreen(int sx, int sy, int width, int height) { if(theClass == TrueColor) { XImage *im; int x, y, c; int units_per_line; unsigned long pixels[MAX_COLORS]; for(c = 0; c < MAX_COLORS; c++) pixels[c] = trueColorPixel(realPalette[c].r, realPalette[c].g, realPalette[c].b); im = theRealScreen->im; units_per_line = im->bytes_per_line / (im->bits_per_pixel / 8); switch(im->bits_per_pixel) { #if 1 case 8: for(y = 0; y < height; y++) for(x = 0; x < width; x++) { c = pseudoImage[(sy + y) * REAL_SCREEN_SIZE_X + sx + x]; im->data[(sy + y) * units_per_line + sx + x] = pixels[c]; } break; case 16: for(y = 0; y < height; y++) for(x = 0; x < width; x++) { c = pseudoImage[(sy + y) * REAL_SCREEN_SIZE_X + sx + x]; ((uint16 *)im->data)[(sy + y) * units_per_line + sx + x] = pixels[c]; } break; case 32: for(y = 0; y < height; y++) for(x = 0; x < width; x++) { c = pseudoImage[(sy + y) * REAL_SCREEN_SIZE_X + sx + x]; ((uint32 *)im->data)[(sy + y) * units_per_line + sx + x] = pixels[c]; } break; #endif default: /* Generic routine */ for(y = 0; y < height; y++) for(x = 0; x < width; x++) { c = pseudoImage[(sy + y) * REAL_SCREEN_SIZE_X + sx + x]; XPutPixel(theRealScreen->im, sx + x, sy + y, pixels[c]); } break; } } update_real_screen(sx, sy, width, height); isRealScreenChanged = 0; } static void updatePalette(void) { int i; XColor xc[256]; if(theClass != TrueColor) { for(i = 0; i < MAX_COLORS; i++) { xc[i].pixel = palette2Pixel[i]; xc[i].red = realPalette[i].r * 257; xc[i].green = realPalette[i].g * 257; xc[i].blue = realPalette[i].b * 257; xc[i].flags = DoRed | DoGreen | DoBlue; } XStoreColors(theDisplay, theColormap, xc, MAX_COLORS); } else /* True color */ { updateScreen(0, 0, REAL_SCREEN_SIZE_X, REAL_SCREEN_SIZE_Y); isRealScreenChanged = 0; } isRealPaletteChanged = 0; } static void sry_pal_v2r(uint8 *data) { int n; n = SRY_GET_SHORT(data) & 0xffff; #ifdef SRY_DEBUG printf("Transfer palette %d\n", n); #endif /* SRY_DEBUG */ if(virtualPalette[n] == NULL) { virtualPalette[n] = (SherryPalette *)safe_malloc(sizeof(SherryPalette)); memset(virtualPalette[n], 0, sizeof(SherryPalette)); } memcpy(realPalette, virtualPalette[n]->entry, sizeof(realPalette)); isRealPaletteChanged = 1; currentPalette = n; } static void png_read_func(png_structp png_ptr, char *buff, size_t n) { struct timidity_file *tf; tf = (struct timidity_file *)png_ptr->io_ptr; tf_read(buff, 1, n, tf); } #define PNG_BYTES_TO_CHECK 8 #define MAX_SCREEN_COLORS 256 static void sry_load_png(uint8 *data) { int i; int x, y; int screen, vpalette; png_structp pngPtr; png_infop infoPtr; png_infop endInfo; VirtualScreen *scr; SherryPaletteEntry *entry; char *filename; struct timidity_file *tf; char sig[PNG_BYTES_TO_CHECK]; png_uint_32 width, height; int bitDepth, colorType, interlaceType, compressionType, filterType; int numPalette; png_colorp palette; png_uint_16p hist; png_bytep *rowPointers; png_uint_32 rowbytes; png_bytep trans; int transParent; int numTrans; png_color_16p transValues; numPalette = -1; memset(&palette, 0, sizeof(palette)); hist = NULL; rowbytes = 0; rowPointers = NULL; trans = NULL; numTrans = 0; transValues = NULL; screen = SRY_GET_SHORT(data) & 0xffff; vpalette = SRY_GET_SHORT(data + 2) & 0xffff; filename = data + 4; #ifdef SRY_DEBUG printf("Load png: %s: scr=%d pal=%d\n", filename, screen, vpalette); #endif /* SRY_DEBUG */ if((tf = wrd_open_file(filename)) == NULL) { err_to_stop = 1; return; } if(tf_read(sig, 1, sizeof(sig), tf) != sizeof(sig)) { ctl->cmsg(CMSG_ERROR, VERB_NORMAL, "WRD Sherry: %s is too short to be png format.", filename); err_to_stop = 1; return; } if(png_sig_cmp(sig, 0, sizeof(sig))) { ctl->cmsg(CMSG_ERROR, VERB_NORMAL, "%s: Not a png file", filename); err_to_stop = 1; return; } pngPtr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); infoPtr = png_create_info_struct(pngPtr); endInfo = png_create_info_struct(pngPtr); png_set_read_fn(pngPtr, (void *)tf, (png_rw_ptr)png_read_func); png_set_sig_bytes(pngPtr, sizeof(sig)); png_read_info(pngPtr, infoPtr); /* get info */ png_get_IHDR(pngPtr, infoPtr, &width, &height, &bitDepth, &colorType, &interlaceType, &compressionType, &filterType); /* transformation */ /* contert to 256 palette */ if (colorType == PNG_COLOR_TYPE_GRAY && bitDepth < 8) png_set_expand(pngPtr); if(bitDepth == 16) png_set_strip_16(pngPtr); if(bitDepth < 8) png_set_packing(pngPtr); if(colorType == PNG_COLOR_TYPE_GRAY || colorType == PNG_COLOR_TYPE_GRAY_ALPHA) png_set_gray_to_rgb(pngPtr); #if 0 double screenGamma; const char* const gammaStr = getenv ("SCREEN_GAMMA"); if (gammaStr != NULL) { screenGamma = atof (gammaStr); } else { screenGamma = 2.2; /* screenGamms = 2.0; screenGamms = 1.7; screenGamms = 1.0; */ } if (png_get_gAMA (pngPtr, infoPtr, &gamma)) png_set_gamma (pngPtr, screenGamma, gamma); else png_set_gamma (pngPtr, screenGamma, 0.50); #endif if(png_get_valid(pngPtr, infoPtr, PNG_INFO_PLTE)) { png_get_PLTE(pngPtr, infoPtr, &palette, &numPalette); if(numPalette > MAX_SCREEN_COLORS) { if(png_get_valid(pngPtr, infoPtr, PNG_INFO_hIST)) png_get_hIST(pngPtr, infoPtr, &hist); png_set_dither(pngPtr, palette, numPalette, MAX_SCREEN_COLORS, hist, 1); } } else { /* XXX */ /* NOTE 6*7*6 = 252 */ /* 6*7*6 = 5*7*6 + 6*6 + 6 */ png_color stdColorCube[6*7*6]; png_byte r, g, b; for(r = 0; r < 6; r++) { for(g = 0; g < 7; g++) { for(b = 0; b < 6; b++) { png_byte index = r*7*6+g*6+b; stdColorCube[index].red = r; stdColorCube[index].green = g; stdColorCube[index].blue = b; } } } png_set_dither(pngPtr, stdColorCube, 6*7*6, MAX_SCREEN_COLORS, NULL, 1); /*???*/ png_set_PLTE(pngPtr, infoPtr, pngPtr->palette, pngPtr->num_palette); palette = pngPtr->palette; numPalette = pngPtr->num_palette; } if(png_get_valid(pngPtr, infoPtr, PNG_INFO_tRNS)) png_get_tRNS(pngPtr, infoPtr, &trans, &numTrans, &transValues); png_read_update_info(pngPtr, infoPtr); rowbytes = png_get_rowbytes(pngPtr, infoPtr); /* rowbytes == width */ rowPointers = (png_bytep *)safe_malloc(height * sizeof(png_bytep)); rowPointers[0] = (png_byte *)safe_malloc(rowbytes * height * sizeof(png_byte)); for(i = 1; i < height; i++) rowPointers[i] = rowPointers[0] + i * rowbytes; png_read_image(pngPtr, rowPointers); png_read_end(pngPtr, endInfo); if(trans == NULL || numTrans == 0) transParent = 0; else transParent = trans[0] & 0xff; scr = virtualScreen[screen]; if(scr != NULL && (scr->width != width || scr->height != height)) { free_vscreen(scr); scr = NULL; } if(scr == NULL) scr = virtualScreen[screen] = alloc_vscreen(width, height*2, transParent); else scr->transParent = transParent; if(virtualPalette[vpalette] == NULL) { virtualPalette[vpalette] = (SherryPalette *)safe_malloc(sizeof(SherryPalette)); memset(virtualPalette[vpalette], 0, sizeof(SherryPalette)); } entry = virtualPalette[vpalette]->entry; for(i = 0; i < numPalette; i++) { entry[i].r = palette[i].red; entry[i].g = palette[i].green; entry[i].b = palette[i].blue; } for(y = 0; y < height; y++) for(x = 0; x < width; x++) VSCREEN_PIXEL(scr, x, y) = rowPointers[y][x]; free(rowPointers[0]); free(rowPointers); png_destroy_read_struct(&pngPtr, &infoPtr, &endInfo); close_file(tf); #ifdef SRY_DEBUG printf("Load png ok: width=%d height=%d\n", width, height); #endif /* SRY_DEBUG */ } static void sry_trans_all(uint8 *data) { int screen, x, y; int sx, sy; VirtualScreen *scr; XImage *im; screen = SRY_GET_SHORT(data + 0) & 0xffff; sx = SRY_GET_SHORT(data + 2) & 0xffff; sy = SRY_GET_SHORT(data + 4) & 0xffff; im = theRealScreen->im; scr = virtualScreen[screen]; #ifdef SRY_DEBUG printf("Trans all: %d:(%d,%d)\n", screen, sx, sy); #endif /* SRY_DEBUG */ if(!check_range(scr, sx, sy, sx + REAL_SCREEN_SIZE_X - 1, sy + REAL_SCREEN_SIZE_Y - 1)) return; if(theClass != TrueColor) { for(y = 0; y < REAL_SCREEN_SIZE_Y; y++) for(x = 0; x < REAL_SCREEN_SIZE_X; x++) XPutPixel(im, x, y, VSCREEN_PIXEL(scr, sx + x, sy + y)); } else /* TrueColor */ { for(y = 0; y < REAL_SCREEN_SIZE_Y; y++) memcpy(pseudoImage + y * REAL_SCREEN_SIZE_X, scr->data + (sy + y) * scr->width + sx, REAL_SCREEN_SIZE_X); } isRealScreenChanged = 1; updateClipX1 = 0; updateClipY1 = 0; updateClipX2 = REAL_SCREEN_SIZE_X-1; updateClipY2 = REAL_SCREEN_SIZE_Y-1; } static void sry_trans_partial_real(uint8 *data) { int screen, sx, sy, tx, ty, w, h, x, y; int x2, y2; VirtualScreen *scr; XImage *im; screen = SRY_GET_SHORT(data + 0) & 0xffff; sx = SRY_GET_SHORT(data + 2) & 0xffff; sy = SRY_GET_SHORT(data + 4) & 0xffff; tx = SRY_GET_SHORT(data + 6) & 0xffff; ty = SRY_GET_SHORT(data + 8) & 0xffff; w = SRY_GET_SHORT(data +10) & 0xffff; h = SRY_GET_SHORT(data +12) & 0xffff; x2 = tx + w - 1; if(x2 >= REAL_SCREEN_SIZE_X) { x2 = REAL_SCREEN_SIZE_X - 1; w = x2 - tx + 1; } y2 = ty + h - 1; if(y2 >= REAL_SCREEN_SIZE_Y) { y2 = REAL_SCREEN_SIZE_Y - 1; h = y2 - ty + 1; } #ifdef SRY_DEBUG printf("Trans partial: %d:(%d,%d) (%d,%d) %dx%d\n", screen, sx, sy, tx, ty, w, h); #endif /* SRY_DEBUG */ im = theRealScreen->im; scr = virtualScreen[screen]; if(theClass != TrueColor) { for(y = 0; y < h; y++) for(x = 0; x < w; x++) XPutPixel(im, tx + x, ty + y, VSCREEN_PIXEL(scr, sx + x, sy + y)); } else { for(y = 0; y < h; y++) { memcpy(pseudoImage + (ty + y) * REAL_SCREEN_SIZE_X + tx, scr->data + (sy + y) * scr->width + sx, w); } } if(isRealScreenChanged) { /*???*/ x_sry_update(); } updateClipX1 = tx; updateClipY1 = ty; updateClipX2 = x2; updateClipY2 = y2; isRealScreenChanged = 1; } static VirtualScreen *get_tmp_screen(int width_require, int height_require) { if(tmpScreen == NULL) { if(width_require < REAL_SCREEN_SIZE_X) width_require = REAL_SCREEN_SIZE_X; if(height_require < REAL_SCREEN_SIZE_Y) height_require = REAL_SCREEN_SIZE_Y; return tmpScreen = alloc_vscreen(width_require, height_require, 0); } if(tmpScreen->width * tmpScreen->height >= width_require * height_require) { tmpScreen->width = width_require; tmpScreen->height = height_require; return tmpScreen; } if(tmpScreen) free_vscreen(tmpScreen); return tmpScreen = alloc_vscreen(width_require, height_require, 0); } static void normalize_rect(int *x1, int *y1, int *x2, int *y2) { int w, h, x0, y0; w = *x2 - *x1; if(w >= 0) x0 = *x1; else { w = -w; x0 = *x2; } h = *y2 - *y1; if(h >= 0) y0 = *y1; else { h = -h; y0 = *y2; } *x1 = x0; *y1 = y0; *x2 = x0 + w; *y2 = y0 + h; } static int check_range(VirtualScreen *scr, int x1, int y1, int x2, int y2) { if(x1 < 0 || y1 < 0 || x2 >= scr->width || y2 >= scr->height || x1 > x2 || y1 > y2) { ctl->cmsg(CMSG_ERROR, VERB_NORMAL, "Sherry WRD: Out of range: (%d,%d)-(%d,%d)" " > %dx%d, stop sherring", x1, y1, x2, y2, scr->width, scr->height); err_to_stop = 1; return 0; } return 1; } static VirtualScreen *virtual_screen(int scr) { if(virtualScreen[scr] == NULL) { ctl->cmsg(CMSG_ERROR, VERB_NORMAL, "Sherry WRD: screen %d is not allocated, stop sherring", scr); err_to_stop = 1; return NULL; } return virtualScreen[scr]; } static void copy_vscreen_area(VirtualScreen *src, VirtualScreen *dest, int src_x1, int src_y1, int src_x2, int src_y2, int dest_x, int dest_y, int mask, int trans) { int x, y, sw, dw; uint8 *source, *target; int ww, hh; sw = src->width; dw = dest->width; source = src->data; target = dest->data; ww = src_x2 - src_x1 + 1; hh = src_y2 - src_y1 + 1; if(mask == 0xff && !trans) { for(y = 0; y < hh; y++) { memcpy(target + (dest_y + y) * dw + dest_x, source + (src_y1 + y) * sw + src_x1, ww); } } else { int p, q, i; int skip_color; skip_color = trans? src->transParent : -1; for(y = 0; y < hh; y++) { for(x = 0; x < ww; x++) { p = source[(src_y1 + y) * sw + src_x1 + x]; if(p == skip_color) continue; i = (dest_y + y) * dw + dest_x + x; q = target[i]; target[i] = ROP3_CA0749(mask, p, q); } } } } static void sry_trans_partial(uint8 *data) { VirtualScreen *src, *dest; int from, to; int x1, y1, x2, y2, tx, ty; int mask, trans; from = SRY_GET_SHORT(data + 0) & 0xffff; to = SRY_GET_SHORT(data + 2) & 0xffff; mask = data[4]; trans = data[5]; x1 = SRY_GET_SHORT(data + 6) & 0xffff; y1 = SRY_GET_SHORT(data + 8) & 0xffff; x2 = SRY_GET_SHORT(data +10) & 0xffff; y2 = SRY_GET_SHORT(data +12) & 0xffff; tx = SRY_GET_SHORT(data +14) & 0xffff; ty = SRY_GET_SHORT(data +16) & 0xffff; if((src = virtual_screen(from)) == NULL) return; if((dest = virtual_screen(to)) == NULL) return; #ifdef SRY_DEBUG printf("Screen copy: %d:(%d,%d)-(%d,%d) -> %d:(%d,%d) mask=0x%02x trans=%d\n", from, x1, y1, x2, y2, to, tx, ty, mask, trans); #endif /* SRY_DEBUG */ normalize_rect(&x1, &y1, &x2, &y2); if(!check_range(src, x1, y1, x2, y2)) return; if(!check_range(dest, tx, ty, tx + x2 - x1, ty + y2 - y1)) return; if(src == dest) { VirtualScreen *tmp; tmp = get_tmp_screen(x2 + 1, y2 + 1); tmp->transParent = src->transParent; copy_vscreen_area(src, tmp, x1, y1, x2, y2, x1, y1, 0xff, 0); src = tmp; } copy_vscreen_area(src, dest, x1, y1, x2, y2, tx, ty, mask, trans); } static void sry_trans_partial_mask(uint8 *data) { int from, to; int planeMask, transparencyFlag; int x1, y1, x2, y2, toX, toY; int maskX, maskY; uint8 *maskData; VirtualScreen *src, *dest; int x, y, width, height; int mx, my; int bytesPerLine; int srcP, dstP; from = SRY_GET_SHORT(data + 0) & 0xffff; to = SRY_GET_SHORT(data + 2) & 0xffff; planeMask = data[4]; transparencyFlag = data[5]; x1 = SRY_GET_SHORT(data + 6) & 0xffff; y1 = SRY_GET_SHORT(data + 8) & 0xffff; x2 = SRY_GET_SHORT(data +10) & 0xffff; y2 = SRY_GET_SHORT(data +12) & 0xffff; toX = SRY_GET_SHORT(data +14) & 0xffff; toY = SRY_GET_SHORT(data +16) & 0xffff; maskX = data[18]; maskY = data[19]; maskData = data + 20; width = x2 - x1 + 1; height = y2 - y1 + 1; if((src = virtual_screen(from)) == NULL) return; if((dest = virtual_screen(to)) == NULL) return; normalize_rect(&x1, &y1, &x2, &y2); if(!check_range(src, x1, y1, x2, y2)) return; if(!check_range(dest, toX, toY, toX + x2 - x1, toY + y2 - y1)) return; if(src == dest) { VirtualScreen *tmp; tmp = get_tmp_screen(x2 + 1, y2 + 1); tmp->transParent = src->transParent; copy_vscreen_area(src, tmp, x1, y1, x2, y2, x1, y1, 0xff, 0); src = tmp; } bytesPerLine = maskX; bytesPerLine = ((bytesPerLine + 7) & ~7); /* round up to 8 */ bytesPerLine /= 8; my = y1 % maskY; for(y = 0; y < height; y++, my++) { if(my == maskY) my = 0; mx = x1 % maskX; for(x = 0; x < width; x++, mx++) { if(mx == maskX) mx = 0; if(maskData[my * bytesPerLine + mx / 8] & (0x80 >> (mx%8))) { srcP = VSCREEN_PIXEL(src, x1 + x, y1 + y); if(!transparencyFlag || srcP != src->transParent) { dstP = VSCREEN_PIXEL(dest, toX + x, toY + y); VSCREEN_PIXEL(dest, toX + x, toY + y) = ROP3_CA0749(planeMask, srcP, dstP); } } } } } static void sry_draw_box(uint8 *data) { int screen; int mask; int x1, y1, x2, y2, x, y; int color; VirtualScreen *v; screen = SRY_GET_SHORT(data + 0) & 0xffff; mask = data[2]; x1 = SRY_GET_SHORT(data + 3) & 0xffff; y1 = SRY_GET_SHORT(data + 5) & 0xffff; x2 = SRY_GET_SHORT(data + 7) & 0xffff; y2 = SRY_GET_SHORT(data + 9) & 0xffff; color = data[11]; #ifdef SRY_DEBUG printf("Box %d 0x%02x (%d,%d)-(%d,%d)\n", screen, mask, x1, y1, x2, y2); #endif /* SRY_DEBUG */ if((v = virtual_screen(screen)) == NULL) return; normalize_rect(&x1, &y1, &x2, &y2); if(!check_range(v, x1, y1, x2, y2)) return; if(mask == 0xff) { for(y = y1; y <= y2; y++) memset(v->data + v->width * y + x1, color, x2 - x1 + 1); } else { int p; for(y = y1; y <= y2; y++) for(x = x1; x <= x2; x++) { int i; i = v->width * y + x; p = v->data[i]; v->data[i] = ROP3_CA0749(mask, color, p); } } } static void vscreen_drawline(VirtualScreen* scr, int x1, int y1, int x2, int y2, int pixel, int mask) { int dx, dy, incr1, incr2, d, x, y, xend, yend, xdirflag, ydirflag, idx; if(scr == NULL) return; if(x1 < 0 || y1 < 0 || x2 >= scr->width || y2 >= scr->height) { ctl->cmsg(CMSG_ERROR, VERB_NORMAL, "Sherry WRD: Out of range: (%d,%d)-(%d,%d)" " > %dx%d, stop sherring", x1, y1, x2, y2, scr->width, scr->height); err_to_stop = 1; return; } dx = x2 - x1; if(dx < 0) dx = -dx; /* dx = |x2-x1| */ dy = y2 - y1; if(dy < 0) dy = -dy; /* dy = |y2-y1| */ if(dy <= dx) { d = 2 * dy - dx; incr1 = 2 * dy; incr2 = 2 * (dy - dx); if(x1 > x2) { x = x2; y = y2; ydirflag = -1; xend = x1; } else { x = x1; y = y1; ydirflag = 1; xend = x2; } idx = scr->width * y + x; scr->data[idx] = ROP3_CA0749(mask, pixel, scr->data[idx]); if((y2 - y1) * ydirflag > 0) { while(x < xend) { x++; if(d < 0) d += incr1; else { y++; d += incr2; } idx = scr->width * y + x; scr->data[idx] = ROP3_CA0749(mask, pixel, scr->data[idx]); } } else { while(x < xend) { x++; if(d < 0) d += incr1; else { y--; d += incr2; } idx = scr->width * y + x; scr->data[idx] = ROP3_CA0749(mask, pixel, scr->data[idx]); } } } else { d = 2 * dx - dy; incr1 = 2 * dx; incr2 = 2 * (dx - dy); if(y1 > y2) { y = y2; x = x2; yend = y1; xdirflag = -1; } else { y = y1; x = x1; yend = y2; xdirflag = 1; } idx = scr->width * y + x; scr->data[idx] = ROP3_CA0749(mask, pixel, scr->data[idx]); if((x2 - x1) * xdirflag > 0) { while(y < yend) { y++; if(d <0) d += incr1; else { x++; d += incr2; } idx = scr->width * y + x; scr->data[idx] = ROP3_CA0749(mask, pixel, scr->data[idx]); } } else { while(y < yend) { y++; if(d < 0) d += incr1; else { x--; d += incr2; } idx = scr->width * y + x; scr->data[idx] = ROP3_CA0749(mask, pixel, scr->data[idx]); } } } } static void sry_draw_vline(uint8 *data) { int screen = SRY_GET_SHORT(data + 0) & 0xffff; int mask = data[2]; int x1 = SRY_GET_SHORT(data + 3) & 0xffff; int y1 = SRY_GET_SHORT(data + 5) & 0xffff; int y2 = SRY_GET_SHORT(data + 7) & 0xffff; int color = data[9]; vscreen_drawline(virtual_screen(screen), x1, y1, x1, y2, color, mask); } static void sry_draw_hline(uint8 *data) { int screen = SRY_GET_SHORT(data + 0) & 0xffff; int mask = data[2]; int x1 = SRY_GET_SHORT(data + 3) & 0xffff; int x2 = SRY_GET_SHORT(data + 5) & 0xffff; int y1 = SRY_GET_SHORT(data + 7) & 0xffff; int color = data[9]; vscreen_drawline(virtual_screen(screen), x1, y1, x2, y1, color, mask); } static void sry_draw_line(uint8 *data) { int screen = SRY_GET_SHORT(data + 0) & 0xffff; int mask = data[2]; int x1 = SRY_GET_SHORT(data + 3) & 0xffff; int y1 = SRY_GET_SHORT(data + 5) & 0xffff; int x2 = SRY_GET_SHORT(data + 7) & 0xffff; int y2 = SRY_GET_SHORT(data + 9) & 0xffff; int color = data[11]; vscreen_drawline(virtual_screen(screen), x1, y1, x2, y2, color, mask); } static void sry_pal_merge(uint8 *data) { int Pal1, Pal2, PalResult; int Pal1in, Pal1bit, Pal1out; int Pal2in, Pal2bit, Pal2out; int Per1, Per2; int Pal1Mask, Pal2Mask, PalMask; int i; int i1, i2; SherryPaletteEntry *pal_in1, *pal_in2, *pal_res; Pal1 = SRY_GET_SHORT(data + 0) & 0xffff; Pal2 = SRY_GET_SHORT(data + 2) & 0xffff; PalResult = SRY_GET_SHORT(data + 4) & 0xffff; Pal1in = data[6]; Pal1bit = data[7]; Pal1out = data[8]; Pal2in = data[9]; Pal2bit = data[10]; Pal2out = data[11]; Per1 = data[12]; Per2 = data[13]; Pal1Mask = 0xff >> ( 8 - Pal1bit ); Pal1Mask <<= Pal1out; Pal2Mask = 0xff >> ( 8 - Pal2bit ); Pal2Mask <<= Pal2out; PalMask = Pal1Mask | Pal2Mask; #ifdef SRY_DEBUG printf("palette merge %d(%d%%) %d(%d%%) => %d (mask=0x%x)\n", Pal1, Per1, Pal2, Per2, PalResult, PalMask); #endif /* SRY_DEBUG */ if(virtualPalette[Pal1] == NULL) { ctl->cmsg(CMSG_ERROR, VERB_NORMAL, "Sherry WRD: palette %d is not allocated, stop sherring", Pal1); err_to_stop = 1; return; } if(virtualPalette[Pal2] == NULL) { ctl->cmsg(CMSG_ERROR, VERB_NORMAL, "Sherry WRD: palette %d is not allocated, stop sherring", Pal2); err_to_stop = 1; return; } if(virtualPalette[PalResult] == NULL) { ctl->cmsg(CMSG_ERROR, VERB_NORMAL, "Sherry WRD: palette %d is not allocated, stop sherring", PalResult); err_to_stop = 1; return; } pal_in1 = virtualPalette[Pal1]->entry; pal_in2 = virtualPalette[Pal2]->entry; pal_res = virtualPalette[PalResult]->entry; for(i = 0; i < MAX_COLORS; i++) { if((i & PalMask) == i) { int p; i1 = (i & Pal1Mask) >> Pal1in; i2 = (i & Pal2Mask) >> Pal2in; p = pal_in1[i1].r * Per1 / 100 + pal_in2[i2].r * Per2 / 100; if(p > 0xff) p = 0xff; pal_res[i].r = p; p = pal_in1[i1].g * Per1 / 100 + pal_in2[i2].g * Per2 / 100; if(p > 0xff) p = 0xff; pal_res[i].g = p; p = pal_in1[i1].b * Per1 / 100 + pal_in2[i2].b * Per2 / 100; if(p > 0xff) p = 0xff; pal_res[i].b = p; } } } static void sry_pal_copy(uint8 *data) { int pal1, pal2; pal1 = SRY_GET_SHORT(data + 0) & 0xffff; pal2 = SRY_GET_SHORT(data + 2) & 0xffff; #ifdef SRY_DEBUG printf("Copy palette %d->%d\n", pal1, pal2); #endif /* SRY_DEBUG */ if(virtualPalette[pal1] == NULL) { ctl->cmsg(CMSG_ERROR, VERB_NORMAL, "Sherry WRD: palette %d is not allocated, stop sherring", pal1); err_to_stop = 1; return; } if(virtualPalette[pal2] == NULL) virtualPalette[pal2] = (SherryPalette *)safe_malloc(sizeof(SherryPalette)); memcpy(virtualPalette[pal2], virtualPalette[pal1], sizeof(SherryPalette)); } static void sry_text(uint8 *data) { int screen, mask, mode, bg, fg, tx, ty; char *str; int len, advance; VirtualScreen *scr; screen = SRY_GET_SHORT(data + 0); mask = data[2]; mode = data[3]; fg = data[4]; bg = data[5]; tx = SRY_GET_SHORT(data + 6); ty = SRY_GET_SHORT(data + 8); str = (char *)data + 10; len = strlen(str); if(len == 0) return; #ifdef SRY_DEBUG printf("%d 0x%02x %d %d %d (%d,%d)\n%s\n", screen, mask, mode, fg, bg, tx, ty, str); #endif /* SRY_DEBUG */ if((scr = virtual_screen(screen)) == NULL) return; if(!check_range(scr, tx, ty, tx + CHAR_WIDTH1 * len - 1, ty + CHAR_HEIGHT - 1)) return; while((advance = bitmap_drawimage(imageBitmap, str, len)) > 0) { int width, bx, by, p; width = advance * CHAR_WIDTH1; for(by = 0; by < CHAR_HEIGHT; by++) { for(bx = 0; bx < width; bx++) { if(XGetPixel(imageBitmap->im, bx, by)) { if(mode & 1) { p = VSCREEN_PIXEL(scr, tx + bx, ty + by); VSCREEN_PIXEL(scr, tx + bx, ty + by) = ROP3_CA0749(mask, fg, p); } } else { if(mode & 2) { p = VSCREEN_PIXEL(scr, tx + bx, ty + by); VSCREEN_PIXEL(scr, tx + bx, ty + by) = ROP3_CA0749(mask, bg, p); } } } } str += advance; len -= advance; tx += advance * CHAR_WIDTH1; } } void x_sry_clear(void) { int i; if(theDisplay == NULL) return; isRealPaletteChanged = 0; isRealScreenChanged = 0; err_to_stop = 0; init_palette(); XSetWindowBackground(theDisplay, theWindow, basePixel); XClearWindow(theDisplay, theWindow); clear_image_pixmap(theRealScreen, basePixel); for(i = 0; i < MAX_VIRTUAL_SCREENS; i++) if(virtualScreen[i] != NULL) { free_vscreen(virtualScreen[i]); virtualScreen[i] = NULL; } if(tmpScreen) { free(tmpScreen); tmpScreen = NULL; } for(i = 0; i < MAX_VIRTUAL_PALETTES; i++) if(virtualPalette[i] != NULL) { free(virtualPalette[i]); virtualPalette[i] = NULL; } memset(realPalette, 0, sizeof(realPalette)); if(theClass == TrueColor) memset(pseudoImage, 0, REAL_SCREEN_SIZE_X * REAL_SCREEN_SIZE_Y); } #ifdef SRY_DEBUG static void print_command(uint8 *data, int len) { int i; printf("sherry:"); for(i = 0; i < len; i++) { printf(" 0x%02x", data[i]); if(i >= 28) { printf("..."); break; } } printf("\n"); fflush(stdout); } #endif /* SRY_DEBUG */ void x_sry_wrdt_apply(uint8 *data, int len) { int op, skip_bit; if(err_to_stop || theDisplay == NULL) return; #ifdef SRY_DEBUG print_command(data, len); #endif /* SRY_DEBUG */ op = *data++; len--; skip_bit = op & 0x80; if(skip_bit && aq_filled_ratio() < 0.2) return; op &= 0x7F; switch(op) { case 0x00: /* DataEnd */ break; case 0x01: ctl->cmsg(CMSG_INFO, VERB_DEBUG, "sherry start"); wrd_init_path(); x_sry_clear(); break; case 0x21: ctl->cmsg(CMSG_INFO, VERB_DEBUG, "new pal 0x21"); sry_new_vpal(data, len); break; case 0x22: ctl->cmsg(CMSG_INFO, VERB_DEBUG, "free pal 0x22"); sry_free_vpal(data, len); break; case 0x25: ctl->cmsg(CMSG_INFO, VERB_DEBUG, "new vram 0x25"); sry_new_vram(data, len); break; case 0x26: ctl->cmsg(CMSG_INFO, VERB_DEBUG, "free vram 0x26"); sry_free_vram(data, len); break; case 0x27: ctl->cmsg(CMSG_INFO, VERB_DEBUG, "load PNG 0x27"); sry_load_png(data); break; case 0x31: ctl->cmsg(CMSG_INFO, VERB_DEBUG, "palette trans 0x31 (%d)", SRY_GET_SHORT(data)); sry_pal_v2r(data); break; case 0x35: ctl->cmsg(CMSG_INFO, VERB_DEBUG, "image copy 0x35 (%d)", SRY_GET_SHORT(data)); sry_trans_all(data); break; case 0x36: ctl->cmsg(CMSG_INFO, VERB_DEBUG, "image copy 0x36 (%d)", SRY_GET_SHORT(data)); sry_trans_partial_real(data); break; case 0x41: ctl->cmsg(CMSG_INFO, VERB_DEBUG, "set pal 0x41"); sry_pal_set(data, len); break; case 0x42: ctl->cmsg(CMSG_INFO, VERB_DEBUG, "pal merge 0x42"); sry_pal_merge(data); break; case 0x43: ctl->cmsg(CMSG_INFO, VERB_DEBUG, "pal copy 0x43"); sry_pal_copy(data); break; case 0x51: ctl->cmsg(CMSG_INFO, VERB_DEBUG, "text 0x51"); sry_text(data); break; case 0x52: ctl->cmsg(CMSG_INFO, VERB_DEBUG, "draw box 0x52"); sry_draw_box(data); break; case 0x53: ctl->cmsg(CMSG_INFO, VERB_DEBUG, "draw line 0x53"); sry_draw_vline(data); break; case 0x54: ctl->cmsg(CMSG_INFO, VERB_DEBUG, "draw line 0x54"); sry_draw_hline(data); break; case 0x55: ctl->cmsg(CMSG_INFO, VERB_DEBUG, "draw line 0x55"); sry_draw_line(data); break; case 0x61: ctl->cmsg(CMSG_INFO, VERB_DEBUG, "image copy 0x61"); sry_trans_partial(data); break; case 0x62: ctl->cmsg(CMSG_INFO, VERB_DEBUG, "image copy 0x62"); sry_trans_partial_mask(data); break; case 0x10: case 0x11: case 0x12: case 0x13: case 0x14: case 0x15: case 0x16: case 0x17: case 0x18: case 0x19: case 0x1a: case 0x1b: case 0x1c: case 0x1d: case 0x1e: case 0x1f: case 0x20: case 0x71: case 0x72: case 0x7f: ctl->cmsg(CMSG_WARNING, VERB_DEBUG, "Sherry WRD 0x%x: not supported, ignore", op); break; default: ctl->cmsg(CMSG_ERROR, VERB_NORMAL, "Sherry WRD 0x%x: not defined, stop sherring", op); err_to_stop = 1; break; } } void x_sry_redraw_ctl(int flag) { draw_ctl_flag = flag; if(draw_ctl_flag) update_real_screen(0, 0, REAL_SCREEN_SIZE_X, REAL_SCREEN_SIZE_Y); } void x_sry_update(void) { if(err_to_stop) return; #ifdef SRY_DEBUG puts("Update pallete & screen"); #endif /* SRY_DEBUG */ if(!isRealPaletteChanged && !isRealScreenChanged) return; if(isRealPaletteChanged) updatePalette(); if(isRealScreenChanged) updateScreen(updateClipX1, updateClipY1, updateClipX2 - updateClipX1 + 1, updateClipY2 - updateClipY1 + 1); XSync(theDisplay, False); } /**** ImagePixmap interfaces ****/ static ImagePixmap *create_image_pixmap(int width, int height, int depth) { ImagePixmap *ip; ip = (ImagePixmap *)safe_malloc(sizeof(ImagePixmap)); ip->pm = XCreatePixmap(theDisplay, theWindow, width, height, depth); ip->im = XGetImage(theDisplay, ip->pm, 0, 0, width, height, AllPlanes, ZPixmap); ip->gc = createGC(theDisplay, ip->pm); ip->depth = depth; #if XSHM_SUPPORT ip->shminfo.shmid = -1; #endif return ip; } #if XSHM_SUPPORT static int shm_error; static int my_err_handler(Display* dpy, XErrorEvent* e) { shm_error = e->error_code; ctl->cmsg(CMSG_WARNING, VERB_VERBOSE, "Warning: X Sherry Warning: Can't create SHM Pixmap. error-code=%d", shm_error); return shm_error; } static ImagePixmap *create_shm_image_pixmap(int width, int height, int depth) { XErrorHandler origh; ImagePixmap *ip; int shm_depth; shm_depth = depth; ip = (ImagePixmap *)safe_malloc(sizeof(ImagePixmap)); shm_error = 0; origh = XSetErrorHandler(my_err_handler); /* There is no need to initialize XShmSegmentInfo structure * before the call to XShmCreateImage. */ ip->im = XShmCreateImage(theDisplay, theVisual, shm_depth, ZPixmap, NULL, &ip->shminfo, width, height); if(ip->im == NULL) { if(shm_error == 0) shm_error = -1; goto done; } /* The next step is to create the shared memory segment. * The return value of shmat() should be stored both * the XImage structure and the shminfo structure. */ ip->shminfo.shmid = shmget(IPC_PRIVATE, ip->im->bytes_per_line * ip->im->height, IPC_CREAT | 0777); if(ip->shminfo.shmid == -1) { ctl->cmsg(CMSG_WARNING, VERB_VERBOSE, "X Sherry Warning: Can't create SHM Pixmap.\n" "shmget: %s", strerror(errno)); XDestroyImage(ip->im); ip->im = NULL; shm_error = -1; goto done; } ip->shminfo.shmaddr = ip->im->data = (char *)shmat(ip->shminfo.shmid, NULL, 0); if(ip->shminfo.shmaddr == (void *)-1) { ctl->cmsg(CMSG_WARNING, VERB_VERBOSE, "X Sherry Warning: Can't create SHM Pixmap.\n" "shmget: %s", strerror(errno)); shmctl(ip->shminfo.shmid, IPC_RMID, NULL); XDestroyImage(ip->im); ip->im = NULL; shm_error = -1; goto done; } /* If readOnly is True, XShmGetImage calls will fail. */ ip->shminfo.readOnly = False; /* Tell the server to attach to your shared memory segment. */ if(XShmAttach(theDisplay, &ip->shminfo) == 0) { if(shm_error == 0) { ctl->cmsg(CMSG_WARNING, VERB_VERBOSE, "X Sherry Warning: Can't create SHM Pixmap.\n" "Can't attach to the shared memory segment."); shm_error = -1; } shmdt(ip->shminfo.shmaddr); shmctl(ip->shminfo.shmid, IPC_RMID, NULL); XDestroyImage(ip->im); ip->im = NULL; goto done; } XSync(theDisplay, False); /* Wait until ready. */ ip->pm = XShmCreatePixmap(theDisplay, theWindow, ip->im->data, &ip->shminfo, width, height, shm_depth); if(ip->pm == None) { if(shm_error == 0) { ctl->cmsg(CMSG_WARNING, VERB_VERBOSE, "X Sherry Warning: Can't create SHM Pixmap.\n" "XShmCreatePixmap() is failed"); shm_error = -1; } shmdt(ip->shminfo.shmaddr); shmctl(ip->shminfo.shmid, IPC_RMID, NULL); XDestroyImage(ip->im); ip->im = NULL; goto done; } done: XSetErrorHandler(origh); if(ip->im != NULL) { ip->gc = createGC(theDisplay, ip->pm); ip->depth = shm_depth; } else { free(ip); ip = create_image_pixmap(width, height, depth); } return ip; } #endif static void clear_image_pixmap(ImagePixmap *ip, unsigned long pixel) { int x, y, w, h; w = ip->im->width; h = ip->im->height; XSetForeground(theDisplay, ip->gc, pixel); XFillRectangle(theDisplay, ip->pm, ip->gc, 0, 0, ip->im->width, ip->im->height); #if XSHM_SUPPORT if(ip->shminfo.shmid != -1) return; #endif /* XSHM_SUPPORT */ for(y = 0; y < h; y++) for(x = 0; x < w; x++){ XPutPixel(ip->im, x, y, pixel); } } static void free_image_pixmap(ImagePixmap *ip) { XFreePixmap(theDisplay, ip->pm); #if XSHM_SUPPORT if(ip->shminfo.shmid != -1) { /* To destory a shard memory XImage, you should call XShmDetach() * first. */ XShmDetach(theDisplay, &ip->shminfo); /* Unmap shared memory segment */ shmdt(ip->shminfo.shmaddr); /* Remove a shared memory ID from the system */ shmctl(ip->shminfo.shmid, IPC_RMID, NULL); } #endif /* XSHM_SUPPORT */ XDestroyImage(ip->im); free(ip); } #define IS_MULTI_BYTE(c) (((c)&0x80) && \ ((0x1 <= ((c)&0x7F) && ((c)&0x7F) <= 0x1f) || \ (0x60 <= ((c)&0x7F) && ((c)&0x7F) <= 0x7c))) /* bitmap_drawimage() Draws string into image * It returns number of bytes drawn */ static int bitmap_drawimage(ImagePixmap *ip, char *sjis_str, int nbytes) { int write_len; int sjis_c1, sjis_c2; int x, width, height; x = write_len = 0; while(*sjis_str && write_len < IMAGEBITMAPLEN) { sjis_c1 = *sjis_str & 0xff; sjis_str++; if(IS_MULTI_BYTE(sjis_c1)) { int e1, e2; XChar2b b; if(write_len+1 == IMAGEBITMAPLEN) break; sjis_c2 = *sjis_str & 0xff; if(sjis_c2 == 0) break; sjis_str++; /* SJIS to EUC */ if(sjis_c2 >= 0x9f) { if(sjis_c1 >= 0xe0) e1 = sjis_c1 * 2 - 0xe0; else e1 = sjis_c1 * 2 - 0x60; e2 = sjis_c2 + 2; } else { if(sjis_c1 >= 0xe0) e1 = sjis_c1 * 2 - 0xe1; else e1 = sjis_c1 * 2 - 0x61; if(sjis_c2 >= 0x7f) e2 = sjis_c2 + 0x60; else e2 = sjis_c2 + 0x61; } b.byte1 = e1 & 0x7f; b.byte2 = e2 & 0x7f; XSetFont(theDisplay, ip->gc, theFont16->fid); XDrawImageString16(theDisplay, ip->pm, ip->gc, x - lbearing16, ascent16, &b, 1); x += CHAR_WIDTH2; write_len += 2; } else { char c = sjis_c1; XSetFont(theDisplay, ip->gc, theFont8->fid); XDrawImageString(theDisplay, ip->pm, ip->gc, x - lbearing8, ascent8, &c, 1); x += CHAR_WIDTH1; write_len++; } } if(write_len == 0) return 0; /* Terminate repeating call */ #if XSHM_SUPPORT if(ip->shminfo.shmid != -1) { XSync(theDisplay, 0); /* Wait until ready */ return write_len; } #endif /* XSHM_SUPPORT */ /* XSHM is not supported. * Now, re-allocate XImage structure from the pixmap. */ width = ip->im->width; height = ip->im->height; XDestroyImage(ip->im); ip->im = XGetImage(theDisplay, ip->pm, 0, 0, width, height, AllPlanes, ZPixmap); return write_len; } /**** VirtualScreen intarfaces ****/ static VirtualScreen *alloc_vscreen(int width, int height, int transParent) { VirtualScreen *scr; int size = width * height; /* Shared the allocated memory for data and the structure */ scr = (VirtualScreen *)safe_malloc(sizeof(VirtualScreen) + size); scr->width = width; scr->height = height; scr->transParent = transParent; memset(scr->data, transParent, size); return scr; } static void free_vscreen(VirtualScreen *scr) { free(scr); } void x_sry_event(void) { if(QLength(theDisplay) == 0) XSync(theDisplay, False); while(QLength(theDisplay) > 0) { XEvent e; XNextEvent(theDisplay, &e); switch(e.type) { case Expose: update_real_screen(e.xexpose.x, e.xexpose.y, e.xexpose.width, e.xexpose.height); break; } if(QLength(theDisplay) == 0) XSync(theDisplay, False); } } #endif /* ENABLE_SHERRY */ TiMidity++-2.13.2/interface/x_sherry.h0100644004711200001440000000227207421005040016644 0ustar tamukiusers/* TiMidity++ -- MIDI to WAVE converter and player Copyright (C) 1999-2002 Masanao Izumo Copyright (C) 1995 Tuukka Toivonen 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef ___X_SRY_H_ #define ___X_SRY_H_ extern void x_sry_wrdt_apply(uint8 *data, int len); extern void CloseSryWindow(void); extern int OpenSryWindow(char *opts); extern void x_sry_redraw_ctl(int); extern void x_sry_close(void); extern void x_sry_update(void); extern void x_sry_event(void); #endif /* ___X_SRY_H_ */ TiMidity++-2.13.2/interface/x_wrdwindow.c0100644004711200001440000014760310014435412017361 0ustar tamukiusers/* TiMidity++ -- MIDI to WAVE converter and player Copyright (C) 1999-2002 Masanao Izumo Copyright (C) 1995 Tuukka Toivonen 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA x_wrdwindow.c - MIMPI WRD for X Window written by Takanori Watanabe. - Modified by Masanao Izumo. */ /* * PC98 Screen Emulator * By Takanori Watanabe. */ #ifdef HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ #include #include #include #include #include #include "timidity.h" #include "common.h" #include "x_mag.h" #include "x_wrdwindow.h" #include "VTparse.h" #include "wrd.h" #include "controls.h" #include "aq.h" #ifndef XSHM_SUPPORT #if defined(HAVE_XSHMCREATEPIXMAP) && \ defined(HAVE_X11_EXTENSIONS_XSHM_H) && \ defined(HAVE_SYS_IPC_H) && \ defined(HAVE_SYS_SHM_H) #define XSHM_SUPPORT 1 #else #define XSHM_SUPPORT 0 #endif #endif /* XSHM_SUPPORT */ #if XSHM_SUPPORT #include #include #include #endif #define SIZEX WRD_GSCR_WIDTH #define SIZEY WRD_GSCR_HEIGHT #define MBCS 1 #define DEFAULT -1 #define JISX0201 "-*-fixed-*-r-normal--16-*-*-*-*-*-jisx0201.1976-*" #define JISX0208 "-*-fixed-*-r-normal--16-*-*-*-*-*-jisx0208.1983-*" #define TXTCOLORS 8 #define LINES WRD_TSCR_HEIGHT #define COLS WRD_TSCR_WIDTH #define TAB_SET 8 #define CSIZEX ((SIZEX)/(COLS)) #define CSIZEY ((SIZEY)/(LINES)) #define min(a,b) ((a) <= (b) ? (a) : (b)) #define max(a,b) ((a) >= (b) ? (a) : (b)) typedef struct{ long attr;/*if attr<0 this attr is invalid*/ #define CATTR_LPART (1) #define CATTR_16FONT (1<<1) #define CATTR_COLORED (1<<2) #define CATTR_BGCOLORED (1<<3) #define CATTR_TXTCOL_MASK_SHIFT 4 #define CATTR_TXTCOL_MASK (7< offscr ----> Window * In TrueColor, it is needed to convert PseudoColor to TrueColor, here. */ /* For PC98 screen emulation. * Many text escape sequences are supported. */ Linbuf **scrnbuf; int curline; int curcol; long curattr; #define NUMPLANE 4 #define NUMPXL 16 #define MAXPAL 20 XColor txtcolor[TXTCOLORS],curcoltab[NUMPXL], gcolor[MAXPAL][NUMPXL],gcolorbase[NUMPXL]; unsigned long basepix, pmask[NUMPLANE], gscreen_plane_mask; int ton; int gon; int gmode; #define TON_NOSHOW 0 Colormap cmap; #define COLOR_BG 0 #define COLOR_DEFAULT 7 int redrawflag; }mywin; static struct VGVRAM{ Pixmap *vpix; int num; }vgvram; const static char *TXTCOLORNAME[8]={ WRD_TEXT_COLOR0, WRD_TEXT_COLOR1, WRD_TEXT_COLOR2, WRD_TEXT_COLOR3, WRD_TEXT_COLOR4, WRD_TEXT_COLOR5, WRD_TEXT_COLOR6, WRD_TEXT_COLOR7 }; const static int colval12[16]={ 0x000,0xf00,0x0f0,0xff0,0x00f,0xf0f,0x0ff,0xfff, 0x444,0xc44,0x4c4,0xcc4,0x44c,0xc4c,0x4cc,0xccc }; static char *image_buffer; /* Used for @MAG or @PLOAD */ Visual *theVisual; int theScreen, theDepth; int bytes_per_image_pixel; static int Parse(int); static void Redraw(int,int,int,int); static int RedrawText(Drawable,int,int,int,int); /* Redraw only text */ static void RedrawInject(int x,int y,int width,int height,int flag); /**** ImagePixmap interfaces ****/ static ImagePixmap *create_shm_image_pixmap(int width, int height); static void free_image_pixmap(ImagePixmap *ip); /* for truecolor */ static Bool truecolor; static ImagePixmap *shm_screen; /* for TrueColor conversion */ static unsigned long truecolor_palette[NUMPXL]; static int shm_format; /*12bit color value to color member of XColor structure */ static void col12toXColor(int val,XColor *set) { set->red=((val>>8)&0xf)*0x1111; set->green=((val>>4)&0xf)*0x1111; set->blue=(0xf&val)*0x1111; } static int highbit(unsigned long ul) { int i; unsigned long hb; hb = 0x80000000UL; for(i = 31; ((ul & hb) == 0) && i >= 0; i--, ul<<=1) ; return i; } static unsigned long trueColorPixel(unsigned long r, /* 0..255 */ unsigned long g, /* 0..255 */ unsigned long b) /* 0..255 */ { static int rs, gs, bs; if(r == 0xffffffff) /* for initialize */ { rs = 15 - highbit(theVisual->red_mask); gs = 15 - highbit(theVisual->green_mask); bs = 15 - highbit(theVisual->blue_mask); return 0; } r *= 257; /* 0..65535 */ g *= 257; /* 0..65535 */ b *= 257; /* 0..65535 */ if(rs < 0) r <<= -rs; else r >>= rs; if(gs < 0) g <<= -gs; else g >>= gs; if(bs < 0) b <<= -bs; else b >>= bs; r &= theVisual->red_mask; g &= theVisual->green_mask; b &= theVisual->blue_mask; return r | g | b; } static void store_palette(void) { if(truecolor) { int i; for(i = 0; i < NUMPXL; i++) truecolor_palette[i] = trueColorPixel(mywin.curcoltab[i].red / 257, mywin.curcoltab[i].green / 257, mywin.curcoltab[i].blue / 257); Redraw(0, 0, SIZEX, SIZEY); } else XStoreColors(mywin.d, mywin.cmap, mywin.curcoltab, NUMPXL); } static int InitColor(Colormap cmap, Bool allocate) { int i,j; XColor dummy; if(allocate) { for(i=0;i>1; } col12toXColor(colval12[i],&mywin.curcoltab[i]); mywin.curcoltab[i].pixel=pvalue; mywin.curcoltab[i].flags=DoRed|DoGreen|DoBlue; } if(!truecolor) XStoreColors(mywin.d, mywin.cmap, mywin.curcoltab, NUMPXL); else { int i; for(i = 0; i < NUMPXL; i++) truecolor_palette[i] = trueColorPixel(mywin.curcoltab[i].red / 257, mywin.curcoltab[i].green / 257, mywin.curcoltab[i].blue / 257); } for(i=0;icmsg(CMSG_INFO, VERB_VERBOSE, "Initialize WRD window"); /*Initialize Charactor buffer and attr */ mywin.curline=0; mywin.curcol=0; mywin.ton=1; mywin.gon=1; mywin.gmode=-1; mywin.curattr=0;/*Attribute Ground state*/ mywin.scrnbuf=(Linbuf **)calloc(LINES,sizeof(Linbuf *)); mywin.redrawflag=1; if((mywin.d=XOpenDisplay(NULL))==NULL){ ctl->cmsg(CMSG_ERROR,VERB_NORMAL,"WRD: Can't Open Display"); init_flag = -1; return -1; } if(strchr(opt, 'd')) { /* For debug */ fprintf(stderr,"Entering -Wx Debug mode\n"); XSynchronize(mywin.d, True); } theScreen = DefaultScreen(mywin.d); theDepth = DefaultDepth(mywin.d, theScreen); theVisual = DefaultVisual(mywin.d, theScreen); /* check truecolor */ if(theVisual->class == TrueColor || theVisual->class == StaticColor) truecolor=True; else truecolor=False; if((mywin.f8=XLoadQueryFont(mywin.d,JISX0201))==NULL){ ctl->cmsg(CMSG_ERROR,VERB_NORMAL,"%s: Can't load font",JISX0201); /* Can't load font JISX0201 */ XCloseDisplay(mywin.d); mywin.d=NULL; init_flag = -1; return -1; } if((mywin.f16=XLoadQueryFont(mywin.d,JISX0208))==NULL){ ctl->cmsg(CMSG_ERROR,VERB_NORMAL,"%s: Can't load font",JISX0208); XCloseDisplay(mywin.d); mywin.d=NULL; init_flag = -1; return -1; } mywin.w=XCreateSimpleWindow(mywin.d,DefaultRootWindow(mywin.d) ,0,0,SIZEX,SIZEY ,10, BlackPixel(mywin.d, theScreen), WhitePixel(mywin.d, theScreen)); mywin.cmap=DefaultColormap(mywin.d, theScreen); if(truecolor) { #if XSHM_SUPPORT shm_format = XShmPixmapFormat(mywin.d); if(shm_format == ZPixmap) shm_screen = create_shm_image_pixmap(SIZEX, SIZEY); else shm_screen = NULL; /* No-support other format */ if(!shm_screen) ctl->cmsg(CMSG_WARNING, VERB_VERBOSE, "X SHM Extention is off"); #else shm_screen = NULL; #endif } /*This block initialize Colormap*/ if(InitColor(mywin.cmap, True)!=0){ mywin.cmap=XCopyColormapAndFree(mywin.d,mywin.cmap); if(InitColor(mywin.cmap, True)!=0){ ctl->cmsg(CMSG_ERROR,VERB_NORMAL,"WRD: Can't initialize colormap"); XCloseDisplay(mywin.d); mywin.d=NULL; init_flag = -1; return -1; } XSetWindowColormap(mywin.d,mywin.w,mywin.cmap); } /*Tell Window manager not to allow resizing * And set Application name */ sh=XAllocSizeHints(); sh->flags=PMinSize|PMaxSize; sh->min_width=SIZEX; sh->min_height=SIZEY; sh->max_width=SIZEX; sh->max_height=SIZEY; XSetWMNormalHints(mywin.d,mywin.w,sh); XStoreName(mywin.d,mywin.w,"timidity"); XSetIconName(mywin.d,mywin.w,"TiMidity"); XFree(sh); /* Alloc background pixmap(Graphic plane)*/ for(i=0;ibits_per_pixel/8; XDestroyImage(im); } image_buffer=(char *)safe_malloc(SIZEX*SIZEY*bytes_per_image_pixel); init_flag = 1; return 0; } /*************************************************** Redraw Routine This redraw Text screen. Graphic Screen is treated as background bitmap ***************************************************/ static int DrawReverseString16(Display *disp,Drawable d,GC gc,int x,int y, XChar2b *string,int length) { int lbearing,ascent; lbearing=mywin.f16->min_bounds.lbearing; ascent=mywin.f16->max_bounds.ascent; XSetFont(disp,mywin.gcbmp,mywin.f16->fid); XDrawImageString16(disp,mywin.workbmp,mywin.gcbmp,-lbearing,ascent, string,length); XSetClipMask(disp,gc,mywin.workbmp); XSetClipOrigin(disp,gc,x+lbearing,y-ascent); XFillRectangle(disp,d,gc,x+lbearing,y-ascent,CSIZEX*length*2,CSIZEY); XSetClipMask(disp,gc,None); return 0; } static int DrawReverseString(Display *disp,Drawable d,GC gc,int x,int y, char *string,int length) { int lbearing,ascent; lbearing=mywin.f16->min_bounds.lbearing; ascent=mywin.f16->max_bounds.ascent; XSetFont(disp,mywin.gcbmp,mywin.f8->fid); XDrawImageString(disp,mywin.workbmp,mywin.gcbmp,-lbearing,ascent, string,length); XSetClipMask(disp,gc,mywin.workbmp); XSetClipOrigin(disp,gc,x+lbearing,y-ascent); XFillRectangle(disp,d,gc,x+lbearing,y-ascent,CSIZEX*length,CSIZEY); XSetClipMask(disp,gc,None); return 0; } static int RedrawText(Drawable drawable, int x,int y,int width,int height) { int i,yfrom,yto,xfrom,xto; int drawflag; xfrom=x/CSIZEX; xfrom=max(xfrom,0); xto=(x+width-1)/CSIZEX; xto=(xto 0 && (mywin.scrnbuf[i][jfrom-1].attr&CATTR_LPART)) jfrom--; if(jto < COLS-1 && (mywin.scrnbuf[i][jto].attr&CATTR_LPART)) jto++; pos=0; prevattr=CATTR_INVAL; s_x=e_x=jfrom*CSIZEX; for(j=jfrom;j<=jto+1;j++){ if(j==jto+1 || mywin.scrnbuf[i][j].c==0) { curattr=CATTR_INVAL; } else curattr=mywin.scrnbuf[i][j].attr; if((prevattr&~CATTR_LPART)!=(curattr&~CATTR_LPART)){ XFontStruct *f=NULL; int lbearing,ascent; int (*DrawStringFunc)(); DrawStringFunc=XDrawString; line[pos]=0; if(prevattr<0){ DrawStringFunc=NULL; }else if(prevattr&CATTR_16FONT){ f=mywin.f16; DrawStringFunc=XDrawString16; pos/=2; }else f=mywin.f8; if(DrawStringFunc!=NULL){ XSetFont(mywin.d,mywin.gc,f->fid); lbearing=f->min_bounds.lbearing; ascent=f->max_bounds.ascent; if(prevattr&CATTR_COLORED){ int tcol; tcol=(prevattr&CATTR_TXTCOL_MASK)>>CATTR_TXTCOL_MASK_SHIFT; XSetForeground(mywin.d,mywin.gc, mywin.txtcolor[tcol].pixel); }else if(prevattr&CATTR_BGCOLORED){ int tcol; tcol=(prevattr&CATTR_TXTCOL_MASK)>>CATTR_TXTCOL_MASK_SHIFT; DrawStringFunc=(DrawStringFunc==XDrawString)?(int(*)())DrawReverseString:(int(*)())DrawReverseString16; XSetForeground(mywin.d,mywin.gc, mywin.txtcolor[tcol].pixel); } (*DrawStringFunc)(mywin.d,drawable,mywin.gc, s_x-lbearing,i*CSIZEY+ascent,line,pos); drawflag=1; if((prevattr&CATTR_COLORED)||(prevattr&CATTR_BGCOLORED)) XSetForeground(mywin.d,mywin.gc,mywin.txtcolor[COLOR_DEFAULT].pixel); } prevattr=curattr; s_x=e_x; pos=0; } line[pos++]=mywin.scrnbuf[i][j].c; e_x+=CSIZEX; } } } return drawflag; } /* Copy disp_screen to offscr */ static void TransferArea(int sx, int sy, int width, int height) { if(!truecolor) XCopyArea(mywin.d, mywin.disp_screen, mywin.offscr, mywin.gc, sx, sy, width, height, sx, sy); else { XImage *im; int x, y, i, c; int units_per_line; int x0, y0; if(sx + width > SIZEX) width = SIZEX - sx; if(sy + height > SIZEY) height = SIZEY - sy; #if XSHM_SUPPORT if(shm_screen) { im = shm_screen->im; XCopyArea(mywin.d, mywin.disp_screen, shm_screen->pm, mywin.gc, sx, sy, width, height, 0, 0); XSync(mywin.d, 0); /* Wait until ready */ x0 = 0; y0 = 0; } else #endif /* XSHM_SUPPORT */ { im = XGetImage(mywin.d, mywin.disp_screen, sx, sy, width, height, AllPlanes, ZPixmap); x0 = 0; y0 = 0; } units_per_line = im->bytes_per_line / (im->bits_per_pixel / 8); /* Optimize 8, 16, 32 bit depth image */ switch(im->bits_per_pixel) { case 8: for(y = 0; y < height; y++) for(x = 0; x < width; x++) { i = (y0 + y) * units_per_line + x0 + x; c = im->data[i]; im->data[i] = truecolor_palette[c]; } break; case 16: for(y = 0; y < height; y++) for(x = 0; x < width; x++) { i = (y0 + y) * units_per_line + x0 + x; c = ((uint16 *)im->data)[i]; ((uint16 *)im->data)[i] = truecolor_palette[c]; } break; case 32: for(y = 0; y < height; y++) for(x = 0; x < width; x++) { i = (y0 + y) * units_per_line + x0 + x; c = ((uint32 *)im->data)[i]; ((uint32 *)im->data)[i] = truecolor_palette[c]; } break; default: for(y = 0; y < height; y++) for(x = 0; x < width; x++) { c = XGetPixel(im, x0 + x, y0 + y); XPutPixel(im, x0 + x, y0 + y, truecolor_palette[c]); } break; } #if XSHM_SUPPORT if(shm_screen) XCopyArea(mywin.d, shm_screen->pm, mywin.offscr, mywin.gc, x0, y0, width, height, sx, sy); else #endif { XPutImage(mywin.d, mywin.offscr, mywin.gc, im, x0, y0, sx, sy, width, height); XDestroyImage(im); } } } static void Redraw(int x, int y, int width, int height) { if(!mywin.redrawflag) return; if(mywin.gon) TransferArea(x, y, width, height); else { XSetForeground(mywin.d, mywin.gc, BlackPixel(mywin.d,DefaultScreen(mywin.d))); XFillRectangle(mywin.d, mywin.offscr, mywin.gc, x, y, width, height); } if(mywin.ton) RedrawText(mywin.offscr, x, y, width, height); XClearArea(mywin.d, mywin.w, x, y, width, height, False); } /******************************************************* * Utilities for VT Parser ********************************************************/ static void DelChar(int line,int col) { int rx1,ry1,rx2,ry2; rx1=(col)*CSIZEX; rx2=(col+1)*CSIZEX; ry1=(line)*CSIZEY; ry2=(line+1)*CSIZEY; if(mywin.scrnbuf[line][col].attr&CATTR_16FONT){ if(mywin.scrnbuf[line][col].attr&CATTR_LPART){ mywin.scrnbuf[line][col+1].c=0; mywin.scrnbuf[line][col+1].attr=0; rx2+=CSIZEX; } else{ mywin.scrnbuf[line][col-1].c=0; mywin.scrnbuf[line][col-1].attr=0; rx1-=CSIZEX; } } RedrawInject(rx1,ry1,rx2-rx1,ry2-ry1,False); mywin.scrnbuf[line][col].c=0; mywin.scrnbuf[line][col].attr=0; } static void ClearLine(int j) { free(mywin.scrnbuf[j]); mywin.scrnbuf[j]=NULL; RedrawInject(0,j*CSIZEY,SIZEX,CSIZEY,False); } static void ClearLeft(void) { memset(mywin.scrnbuf[mywin.curline],0,sizeof(Linbuf)*mywin.curcol); if(!(mywin.scrnbuf[mywin.curline][mywin.curcol+1].attr &(CATTR_LPART))){ mywin.scrnbuf[mywin.curline][mywin.curcol+1].attr=0; mywin.scrnbuf[mywin.curline][mywin.curcol+1].c=0; } RedrawInject(0,(mywin.curline)*CSIZEY,SIZEX,CSIZEY,False); } static void ClearRight(void) { /*Erase Right*/ memset(mywin.scrnbuf[mywin.curline]+mywin.curcol,0, sizeof(Linbuf)*(COLS-mywin.curcol)); if((mywin.scrnbuf[mywin.curline][mywin.curcol-1].attr &(CATTR_LPART))){ mywin.scrnbuf[mywin.curline][mywin.curcol-1].attr=0; mywin.scrnbuf[mywin.curline][mywin.curcol-1].c=0; } RedrawInject(0,(mywin.curline)*CSIZEY,SIZEX,CSIZEY,False); } static void RedrawInject(int x,int y,int width,int height,int flag){ static int xfrom,yfrom,xto,yto; int x2,y2; x2=x+width; y2=y+height; if(x==-1){ xfrom=yfrom=xto=yto=-1; return; } if(flag==False){ if(xfrom==-1){ xfrom=x; yfrom=y; xto=x2; yto=y2; } else{ xfrom=(xfromx2)?xto:x2; yto=(yto>y2)?yto:y2; } } else if(xfrom!=-1) Redraw(xfrom,yfrom,xto-xfrom,yto-yfrom); } /************************************************************ * Graphic Command Functions * * * **************************************************************/ void x_GMode(int mode) { int i; unsigned long mask; if(mode == -1) { /* Initialize plane mask */ mywin.gmode = -1; XSetPlaneMask(mywin.d,mywin.gcgr,AllPlanes); return; } mode&=15; mywin.gmode = mode; mode = (mode&8)|wrd_plane_remap[mode&7]; mask = mywin.basepix; for(i=0;i>1; } XSetPlaneMask(mywin.d,mywin.gcgr,mask); } void x_GMove(int xorig,int yorig,int xend,int yend,int xdist,int ydist, int srcp,int endp,int swflag) { int w, h; w=xend-xorig+1; h=yend-yorig+1; if((srcp<2)&&(endp<2)){ if(swflag==1){ XSetFunction(mywin.d,mywin.gcgr,GXxor); XCopyArea(mywin.d,mywin.screens[endp],mywin.screens[srcp],mywin.gcgr ,xdist,ydist,w,h,xorig,yorig); XCopyArea(mywin.d,mywin.screens[srcp],mywin.screens[endp],mywin.gcgr ,xorig,yorig,w,h,xdist,ydist); XCopyArea(mywin.d,mywin.screens[endp],mywin.screens[srcp],mywin.gcgr ,xdist,ydist,w,h,xorig,yorig); XSetFunction(mywin.d,mywin.gcgr,GXcopy); if(mywin.screens[srcp]==mywin.disp_screen) Redraw(xorig,yorig,w,h); } else XCopyArea(mywin.d,mywin.screens[srcp],mywin.screens[endp],mywin.gcgr ,xorig,yorig,w,h,xdist,ydist); if(mywin.screens[endp]==mywin.disp_screen) { Redraw(xdist,ydist,w,h); } } } void x_VSget(int *params,int nparam) { int numalloc,depth; depth=DefaultDepth(mywin.d,DefaultScreen(mywin.d)); if(vgvram.vpix!=NULL) x_VRel(); vgvram.vpix=safe_malloc(sizeof(Pixmap)*params[0]); for(numalloc=0;numalloc SIZEX || h <= 0 || h > SIZEY || ss < 0 || ss >= NUMVSCREEN || ts < 0 || ts >= NUMVSCREEN) return; simg = timg = NULL; x_GMode(-1); switch(method) { default: case 0: /* copy */ x_GMove(sx1, sy1, sx2, sy2, tx, ty, ss, ts, 0); break; case 1: /* copy except pallet No.0 */ simg = XGetImage(mywin.d, mywin.screens[ss], sx1, sy1, w, h, mywin.gscreen_plane_mask, ZPixmap); if(!simg) break; timg = XGetImage(mywin.d, mywin.screens[ts], tx, ty, w, h, mywin.gscreen_plane_mask, ZPixmap); if(!timg) break; for(y = 0; y < h; y++) for(x = 0; x < w; x++) { int pixel = XGetPixel(simg, x, y); if(pixel != mywin.curcoltab[0].pixel) XPutPixel(timg, x, y, pixel); } XPutImage(mywin.d, mywin.screens[ts], mywin.gcgr, timg, 0, 0, tx, ty, w, h); if(mywin.screens[ts] == mywin.disp_screen) Redraw(tx, ty, w, h); break; case 2: /* xor */ XSetFunction(mywin.d,mywin.gcgr,GXxor); x_GMove(sx1, sy1, sx2, sy2, tx, ty, ss, ts, 0); XSetFunction(mywin.d,mywin.gcgr,GXcopy); break; case 3: /* and */ XSetFunction(mywin.d,mywin.gcgr,GXand); x_GMove(sx1, sy1, sx2, sy2, tx, ty, ss, ts, 0); XSetFunction(mywin.d,mywin.gcgr,GXcopy); break; case 4: /* or */ XSetFunction(mywin.d,mywin.gcgr,GXor); x_GMove(sx1, sy1, sx2, sy2, tx, ty, ss, ts, 0); XSetFunction(mywin.d,mywin.gcgr,GXcopy); break; case 5: /* reverse x */ simg = XGetImage(mywin.d, mywin.screens[ss], sx1, sy1, w, h, mywin.gscreen_plane_mask, ZPixmap); if(!simg) break; for(y = 0; y < h; y++) { for(x = 0; x < w/2; x++) { int p1, p2; p1 = XGetPixel(simg, x, y); p2 = XGetPixel(simg, w-x-1, y); XPutPixel(simg, x, y, p2); XPutPixel(simg, w-x-1, y, p1); } } XPutImage(mywin.d, mywin.screens[ts], mywin.gcgr, simg, 0, 0, tx, ty, w, h); if(mywin.screens[ts] == mywin.disp_screen) Redraw(tx, ty, w, h); break; case 6: /* reverse y */ simg = XGetImage(mywin.d, mywin.screens[ss], sx1, sy1, w, h, mywin.gscreen_plane_mask, ZPixmap); if(!simg) break; for(y = 0; y < h/2; y++) { for(x = 0; x < w; x++) { int p1, p2; p1 = XGetPixel(simg, x, y); p2 = XGetPixel(simg, x, h-y-1); XPutPixel(simg, x, y, p2); XPutPixel(simg, x, h-y-1, p1); } } XPutImage(mywin.d, mywin.screens[ts], mywin.gcgr, simg, 0, 0, tx, ty, w, h); if(mywin.screens[ts] == mywin.disp_screen) Redraw(tx, ty, w, h); break; case 7: /* reverse x-y */ simg = XGetImage(mywin.d, mywin.screens[ss], sx1, sy1, w, h, mywin.gscreen_plane_mask, ZPixmap); if(!simg) break; for(i = 0; i < w*h/2; i++) { int p1, p2; p1 = simg->data[i]; p2 = simg->data[w*h-i-1]; simg->data[i] = p2; simg->data[w*h-i-1] = p1; } XPutImage(mywin.d, mywin.screens[ts], mywin.gcgr, simg, 0, 0, tx, ty, w, h); if(mywin.screens[ts] == mywin.disp_screen) Redraw(tx, ty, w, h); break; case 8: /* copy except pallet No.0 (type2) */ if(nopts < 2) break; simg = XGetImage(mywin.d, mywin.screens[ss], sx1, sy1, w, h, mywin.gscreen_plane_mask, ZPixmap); if(!simg) break; timg = XGetImage(mywin.d, mywin.screens[ts], opts[0], opts[1], w, h, mywin.gscreen_plane_mask, ZPixmap); if(!timg) break; for(y = 0; y < h; y++) for(x = 0; x < w; x++) { int pixel = XGetPixel(simg, x, y); if(pixel != mywin.curcoltab[0].pixel) XPutPixel(timg, x, y, pixel); } XPutImage(mywin.d, mywin.screens[ts], mywin.gcgr, timg, 0, 0, tx, ty, w, h); if(mywin.screens[ts] == mywin.disp_screen) Redraw(tx, ty, w, h); break; case 9: { /* Mask copy */ int m, opt5, c; if(nopts < 5) break; opt5 = opts[4]; simg = XGetImage(mywin.d, mywin.screens[ss], sx1, sy1, w, h, mywin.gscreen_plane_mask, ZPixmap); if(!simg) break; timg = XGetImage(mywin.d, mywin.screens[ts], tx, ty, w, h, mywin.gscreen_plane_mask, ZPixmap); if(!timg) break; for(y = 0; y < h; y++) { m = opts[y & 3] & 0xff; for(x = 0; x < w; x++) { if((1 << (x&7)) & m) { if(opt5 == 16) continue; c = mywin.curcoltab[opt5 & 0xf].pixel; } else c = XGetPixel(simg, x, y); XPutPixel(timg, x, y, c); } } XPutImage(mywin.d, mywin.screens[ts], mywin.gcgr, timg, 0, 0, tx, ty, w, h); if(mywin.screens[ts] == mywin.disp_screen) Redraw(tx, ty, w, h); } break; case 10: { /* line copy */ int cp, sk, i; if(nopts < 2) break; if((cp = opts[0]) < 0) break; if((sk = opts[1]) < 0) break; if(cp + sk == 0) break; simg = XGetImage(mywin.d, mywin.screens[ss], sx1, sy1, w, h, mywin.gscreen_plane_mask, ZPixmap); if(!simg) break; timg = XGetImage(mywin.d, mywin.screens[ts], tx, ty, w, h, mywin.gscreen_plane_mask, ZPixmap); if(!timg) break; y = 0; while(y < h) { for(i = 0; i < cp && y < h; i++, y++) { for(x = 0; x < w; x++) XPutPixel(timg, x, y, XGetPixel(simg, x, y)); } y += sk; } } if(mywin.screens[ts] == mywin.disp_screen) Redraw(tx, ty, w, h); break; case 11: { int etx, ety; while(tx < 0) tx += SIZEX; tx %= SIZEX; while(ty < 0) ty += SIZEY; ty %= SIZEY; etx = tx + w; ety = ty + h; XCopyArea(mywin.d,mywin.screens[ss],mywin.screens[ts],mywin.gcgr, sx1, sx2, w, h, tx, ty); if(etx > SIZEX) XCopyArea(mywin.d,mywin.screens[ss],mywin.screens[ts],mywin.gcgr, sx1 + (etx - SIZEX), sy1, w - (etx - SIZEX), h, 0, ty); if(ety > SIZEY) XCopyArea(mywin.d,mywin.screens[ss],mywin.screens[ts],mywin.gcgr, sx1, sy1 + (ety - SIZEY), w, h - (ety - SIZEY), tx, 0); if(etx > SIZEX && ety > SIZEY) { XCopyArea(mywin.d,mywin.screens[ss],mywin.screens[ts],mywin.gcgr, sx1 + (etx - SIZEX), sy1 + (ety - SIZEY), w - (etx - SIZEX), h - (ety - SIZEY), 0, 0); } if(mywin.screens[ts] == mywin.disp_screen) { if(etx < SIZEX && ety < SIZEY) Redraw(tx, ty, w, h); else Redraw(0, 0, SIZEX, SIZEY); } } break; case 12: { unsigned long psm, ptm; int plane_map[4] = {2, 0, 1, 3}; psm = mywin.pmask[plane_map[opts[0] & 3]] | mywin.basepix; ptm = mywin.pmask[plane_map[opts[1] & 3]] | mywin.basepix; simg = XGetImage(mywin.d, mywin.screens[ss], sx1, sy1, w, h, mywin.gscreen_plane_mask, ZPixmap); if(!simg) break; timg = XGetImage(mywin.d, mywin.screens[ts], tx, ty, w, h, mywin.gscreen_plane_mask, ZPixmap); if(!timg) break; for(y = 0; y < h; y++) for(x = 0; x < w; x++) { int p1, p2; p1 = XGetPixel(simg, x, y); p2 = XGetPixel(timg, x, y); if(p1 & psm) p2 |= ptm; else p2 &= ~ptm; XPutPixel(timg, x, y, p2); } if(mywin.screens[ts] == mywin.disp_screen) Redraw(tx, ty, w, h); } break; } if(simg != NULL) XDestroyImage(simg); if(timg != NULL) XDestroyImage(timg); x_GMode(gmode_save); } static void MyDestroyImage(XImage *img) { img->data = NULL; /* Don't free in XDestroyImage() */ XDestroyImage(img); } void x_PLoad(char *filename){ static XImage *image = NULL; if(image == NULL) { image=XCreateImage(mywin.d, DefaultVisual(mywin.d,DefaultScreen(mywin.d)), DefaultDepth(mywin.d,DefaultScreen(mywin.d)), ZPixmap,0,None,SIZEX,SIZEY,8,0); image->data = image_buffer; } memset(image->data, 0, SIZEX * SIZEY); if(!pho_load_pixel(image,mywin.curcoltab,filename)) return; XPutImage(mywin.d,mywin.active_screen,mywin.gc ,image,0,0,0,0,SIZEX,SIZEY); if(mywin.active_screen==mywin.disp_screen) Redraw(0,0,SIZEX,SIZEY); } void x_Mag(magdata *mag,int32 x,int32 y,int32 s,int32 p) { XImage *image; int pixsizex,pixsizey; if(mag==NULL){ ctl->cmsg(CMSG_INFO,VERB_VERBOSE,"mag ERROR!\n"); return; } x=(x==WRD_NOARG)?mag->xorig:x; y=(y==WRD_NOARG)?mag->yorig:y; p=(p==WRD_NOARG)?0:p; x=x+mag->xorig/8*8-mag->xorig; pixsizex=mag->xend-mag->xorig/8*8+1; pixsizey=mag->yend-mag->yorig+1; mag->pal[0]=17; x_Pal(mag->pal,16); if(mywin.active_screen==mywin.screens[0]){ /* Foreground screen */ mag->pal[0]=18; x_Pal(mag->pal,16); } else { /* Background screen */ mag->pal[0]=19; x_Pal(mag->pal,16); } if((p&1)==0){ mag->pal[0]=0; x_Pal(mag->pal,16); } if(p==2) return; image=XCreateImage(mywin.d, DefaultVisual(mywin.d,DefaultScreen(mywin.d)), DefaultDepth(mywin.d,DefaultScreen(mywin.d)), ZPixmap,0,None,pixsizex,pixsizey,8,0); image->data=image_buffer; memset(image->data, 0, pixsizex*pixsizey); mag_load_pixel(image,mywin.curcoltab,mag); XPutImage(mywin.d,mywin.active_screen,mywin.gc ,image,0,0,x,y,pixsizex,pixsizey); if(mywin.active_screen==mywin.disp_screen) Redraw(x,y,pixsizex,pixsizey); MyDestroyImage(image); } void x_Gcls(int mode) { int gmode_save; gmode_save = mywin.gmode; if(mode==0) mode=15; x_GMode(mode); XSetFunction(mywin.d,mywin.gcgr,GXclear); XFillRectangle(mywin.d,mywin.active_screen,mywin.gcgr,0,0,SIZEX,SIZEY); XSetFunction(mywin.d,mywin.gcgr,GXcopy); x_GMode(gmode_save); Redraw(0,0,SIZEX,SIZEY); } void x_Ton(int param) { mywin.ton=param; Redraw(0,0,SIZEX,SIZEY); } void x_Gon(int param) { mywin.gon=param; Redraw(0,0,SIZEX,SIZEY); } void x_RedrawControl(int flag) { mywin.redrawflag = flag; if(flag) { Redraw(0,0,SIZEX,SIZEY); store_palette(); } XFlush(mywin.d); } void x_Gline(int *params,int nparam) { int x, y, w, h; /* Update rectangle region */ unsigned long color; Pixmap screen; x = min(params[0], params[2]); y = min(params[1], params[3]); w = max(params[0], params[2]) - x + 1; h = max(params[1], params[3]) - y + 1; screen = mywin.active_screen; switch(params[5]) { default: case 0: if (truecolor) color = (unsigned long) params[4]; else color = mywin.curcoltab[params[4]].pixel; XSetForeground(mywin.d,mywin.gcgr,color); XDrawLine(mywin.d,screen,mywin.gcgr, params[0],params[1],params[2],params[3]); break; case 1: if (truecolor) color = (unsigned long) params[4]; else color = mywin.curcoltab[params[4]].pixel; XSetForeground(mywin.d,mywin.gcgr,color); XDrawRectangle(mywin.d,screen,mywin.gcgr,x,y,w-1,h-1); break; case 2: if (truecolor) color = (unsigned long) params[6]; else color = mywin.curcoltab[params[6]].pixel; XSetForeground(mywin.d,mywin.gcgr,color); XFillRectangle(mywin.d,screen,mywin.gcgr,x,y,w,h); break; } if(mywin.active_screen==mywin.disp_screen) Redraw(x,y,w,h); } void x_GCircle(int *params,int nparam) { int pad=0; int (*Linefunc)(); Linefunc=XDrawArc; if(nparam>=5){ switch(params[4]){ default: case 0: case 1: Linefunc=XDrawArc; if (truecolor) XSetForeground(mywin.d,mywin.gcgr,(unsigned long) params[3]); else XSetForeground(mywin.d,mywin.gcgr,mywin.curcoltab[params[3]].pixel); pad=-1; break; case 2: Linefunc=XFillArc; if (truecolor) XSetForeground(mywin.d,mywin.gcgr,(unsigned long) params[5]); else XSetForeground(mywin.d,mywin.gcgr,mywin.curcoltab[params[5]].pixel); break; } } if(nparam>=3){ int xcorner,ycorner,width,height,angle; xcorner=params[0]-params[2];/*x_center-radius*/ ycorner=params[1]-params[2];/*y_center-radius*/ width=height=params[2]*2;/*radius*2*/ angle=360*64; (*Linefunc)(mywin.d,mywin.active_screen,mywin.gcgr,xcorner,ycorner, width+pad,height+pad, 0,angle); if(mywin.active_screen==mywin.disp_screen) Redraw(xcorner,ycorner,width,height); } } #define FOREGROUND_PALLET 0 void x_Pal(int *param,int nparam){ int pallet; if(nparam==NUMPXL){ pallet=param[0]; nparam--; param++; } else pallet=FOREGROUND_PALLET; if(nparam==NUMPXL-1){ int i; for(i=0;i MAXPAL) return; for(i = 0; i < NUMPXL; i++){ mywin.gcolor[pallet][i].red ^= 0xffff; mywin.gcolor[pallet][i].green ^= 0xffff; mywin.gcolor[pallet][i].blue ^= 0xffff; } if(pallet == FOREGROUND_PALLET){ memcpy(mywin.curcoltab, mywin.gcolor[FOREGROUND_PALLET], sizeof(mywin.curcoltab)); if(mywin.redrawflag) store_palette(); } } void x_Gscreen(int active,int appear) { if(activepm, mywin.gcgr, 0, 0, SIZEX, SIZEY); } /*Graphic Definition*/ #define GRPH_LINE_MODE 1 #define GRPH_CIRCLE_MODE 2 #define GRPH_PAL_CHANGE 3 #define GRPH_FADE 4 #define GRPH_FADE_STEP 5 static void GrphCMD(int *params,int nparam) { switch(params[0]){ case GRPH_LINE_MODE: x_Gline(params+1,nparam-1); break; case GRPH_CIRCLE_MODE: x_GCircle(params+1,nparam-1); break; case GRPH_PAL_CHANGE: x_Pal(params+1,nparam-1); break; case GRPH_FADE: x_Fade(params+1,nparam-1,-1,-1); break; case GRPH_FADE_STEP: x_Fade(NULL,0,params[1],params[2]); break; } } /***************************************************** * VT parser * * ******************************************************/ #define MAXPARAM 20 static int Parse(int c) { static int *prstbl=groundtable; static char mbcs; static int params[MAXPARAM],nparam=0; static int hankaku=0; static int savcol,savline; static long savattr; if(c==-1) { prstbl=groundtable; mbcs=0; nparam=0; hankaku=0; savcol=savline=0; return 0; } if(mbcs&& prstbl !=mbcstable&& prstbl !=scstable&& prstbl !=scstable){ mbcs=0; } switch(prstbl[c]){ case CASE_IGNORE_STATE: prstbl=igntable; break; case CASE_IGNORE_ESC: prstbl=iestable; break; case CASE_ESC: prstbl=esctable; break; case CASE_ESC_IGNORE: prstbl=eigtable; break; case CASE_ESC_DIGIT: if(nparam 0) mywin.curcol--; #if 0 /* ^H maybe work backward character in MIMPI's screen */ DelChar(mywin.curline,mywin.curcol); mywin.scrnbuf[mywin.curline][mywin.curcol].c=0; mywin.scrnbuf[mywin.curline][mywin.curcol].attr=0; #endif break; case CASE_CSI_STATE: nparam=0; params[0]=DEFAULT; prstbl=csitable; break; case CASE_SCR_STATE: prstbl=scrtable; mbcs=0; break; case CASE_MBCS: hankaku=0; prstbl=mbcstable; mbcs=MBCS; break; case CASE_SCS_STATE: if(mbcs) prstbl=smbcstable; else prstbl=scstable; break; case CASE_GSETS: mywin.curattr=(mbcs)?(mywin.curattr|CATTR_16FONT): (mywin.curattr&~(CATTR_16FONT)); if(!mbcs){ hankaku=(c=='I')?1:0; } prstbl=groundtable; break; case CASE_DEC_STATE: prstbl =dectable; break; case CASE_SS2: case CASE_SS3: /*These are ignored because this will not accept SS2 SS3 charset*/ case CASE_GROUND_STATE: prstbl=groundtable; break; case CASE_CR: mywin.curcol=0; prstbl=groundtable; break; case CASE_IND: case CASE_VMOT: mywin.curline++; mywin.curcol=0; prstbl=groundtable; break; case CASE_CUP: mywin.curline=(params[0]<1)?0:params[0]-1; if(nparam>=1) mywin.curcol=(params[1]<1)?0:params[1]-1; else mywin.curcol=0; prstbl=groundtable; break; case CASE_PRINT: if(mywin.curcol==COLS){ mywin.curcol++; return 1; } if(mywin.curattr&CATTR_16FONT){ if(!(mywin.curattr&CATTR_LPART)&&(mywin.curcol==COLS-1)){ mywin.curcol+=2; return 1; } mywin.curattr^=CATTR_LPART; } else mywin.curattr&=~CATTR_LPART; DelChar(mywin.curline,mywin.curcol); if(hankaku==1) c|=0x80; mywin.scrnbuf[mywin.curline][mywin.curcol].attr=mywin.curattr; mywin.scrnbuf[mywin.curline][mywin.curcol].c=c; mywin.curcol++; break; case CASE_CUU: mywin.curline-=((params[0]<1)?1:params[0]); prstbl=groundtable; break; case CASE_CUD: mywin.curline+=((params[0]<1)?1:params[0]); prstbl=groundtable; break; case CASE_CUF: mywin.curcol+=((params[0]<1)?1:params[0]); prstbl=groundtable; break; case CASE_CUB: mywin.curcol-=((params[0]<1)?1:params[0]); prstbl=groundtable; break; case CASE_ED: switch(params[0]){ case DEFAULT: case 1: { int j; if(mywin.scrnbuf[mywin.curline]!=NULL) ClearLeft(); for(j=0;jcmsg(CMSG_INFO,VERB_VERBOSE,"NOT IMPREMENTED:%d\n",prstbl[c]); prstbl=groundtable; break; case CASE_BELL: case CASE_IGNORE: default: break; } return 0; } void AddLine(const unsigned char *str,int len) { Linbuf *ptr; int i,j; /*Initialize Redraw rectangle Manager*/ RedrawInject(-1,-1,-1,-1,False); /*Allocate LineBuffer*/ if(len==0) len=strlen(str); for(i=0;i0 Returned unput current value */ if(Parse(str[i])!=0){ i--; } /*Wrapping Proc*/ while(mywin.curcol>=COLS+1){ mywin.curcol-=COLS; mywin.curline++; } while(mywin.curcol<0){ mywin.curcol+=COLS; mywin.curline--; } /*Scroll Proc*/ mywin.curline=(mywin.curline<0)?0:mywin.curline; while(mywin.curline>=LINES){ mywin.curline--; free(mywin.scrnbuf[0]); mywin.scrnbuf[0]=NULL; for(j=1;jattr,a->c); } } fprintf(f,"\n"); } fclose(f); } #endif void WinEvent(void) { XEvent e; int rdx1, rdy1, rdx2, rdy2; rdx1 = rdy1 = rdx2 = rdy2 = -1; XSync(mywin.d, False); while(QLength(mywin.d)>0){ XNextEvent(mywin.d,&e); switch(e.type){ case ButtonPress: Redraw(0,0,SIZEX,SIZEY); rdx1=0; rdy1=0; rdx2=SIZEX; rdy2=SIZEY; if(e.xbutton.button==3){ #ifdef SCREENDEBUG DebugDump(); #endif } } } if(rdx1 != -1){ Redraw(rdx1, rdy1, rdx2 - rdx1, rdy2 - rdy1); XFlush(mywin.d); } } void EndWin(void) { if(mywin.d!=NULL) { if(truecolor && shm_screen) free_image_pixmap(shm_screen); XCloseDisplay(mywin.d); free(image_buffer); } mywin.d=NULL; } int OpenWRDWindow(char *opt) { if(InitWin(opt) == -1) { ctl->cmsg(CMSG_ERROR, VERB_NORMAL, "WRD: Can't open WRD window becase of error"); return -1; } XMapWindow(mywin.d, mywin.w); XSync(mywin.d, False); return 0; } void CloseWRDWindow(void) { if(mywin.d != NULL) { XUnmapWindow(mywin.d, mywin.w); XSync(mywin.d, False); } } static void free_image_pixmap(ImagePixmap *ip) { XFreePixmap(mywin.d, ip->pm); #if XSHM_SUPPORT if(ip->shminfo.shmid != -1) { /* To destroy a shard memory XImage, you should call XShmDetach() * first. */ XShmDetach(mywin.d, &ip->shminfo); /* Unmap shared memory segment */ shmdt(ip->shminfo.shmaddr); /* Remove a shared memory ID from the system */ shmctl(ip->shminfo.shmid, IPC_RMID, NULL); } #endif /* XSHM_SUPPORT */ if(ip->im != NULL) XDestroyImage(ip->im); free(ip); } #if XSHM_SUPPORT static int shm_error; static int my_err_handler(Display* dpy, XErrorEvent* e) { shm_error = e->error_code; ctl->cmsg(CMSG_WARNING, VERB_VERBOSE, "Warning: X WRD Warning: Can't create SHM Pixmap. error-code=%d", shm_error); return shm_error; } static ImagePixmap *create_shm_image_pixmap(int width, int height) { XErrorHandler origh; ImagePixmap *ip; int shm_depth; shm_depth = theDepth; ip = (ImagePixmap *)safe_malloc(sizeof(ImagePixmap)); shm_error = 0; origh = XSetErrorHandler(my_err_handler); /* There is no need to initialize XShmSegmentInfo structure * before the call to XShmCreateImage. */ ip->im = XShmCreateImage(mywin.d, theVisual, theDepth, ZPixmap, NULL, &ip->shminfo, width, height); if(ip->im == NULL) { if(shm_error == 0) shm_error = -1; goto done; } /* allocate n-depth Z image data structure */ ip->im->data = (char *)safe_malloc(ip->im->bytes_per_line * ip->im->height); /* The next step is to create the shared memory segment. * The return value of shmat() should be stored both * the XImage structure and the shminfo structure. */ ip->shminfo.shmid = shmget(IPC_PRIVATE, ip->im->bytes_per_line * ip->im->height, IPC_CREAT | 0777); if(ip->shminfo.shmid == -1) { ctl->cmsg(CMSG_WARNING, VERB_VERBOSE, "X Sherry Warning: Can't create SHM Pixmap.\n" "shmget: %s", strerror(errno)); XDestroyImage(ip->im); ip->im = NULL; shm_error = -1; goto done; } ip->shminfo.shmaddr = ip->im->data = (char *)shmat(ip->shminfo.shmid, NULL, 0); if(ip->shminfo.shmaddr == (void *)-1) { ctl->cmsg(CMSG_WARNING, VERB_VERBOSE, "X Sherry Warning: Can't create SHM Pixmap.\n" "shmget: %s", strerror(errno)); shmctl(ip->shminfo.shmid, IPC_RMID, NULL); XDestroyImage(ip->im); ip->im = NULL; shm_error = -1; goto done; } /* If readOnly is True, XShmGetImage calls will fail. */ ip->shminfo.readOnly = False; /* Tell the server to attach to your shared memory segment. */ if(XShmAttach(mywin.d, &ip->shminfo) == 0) { if(shm_error == 0) { ctl->cmsg(CMSG_WARNING, VERB_VERBOSE, "X Sherry Warning: Can't create SHM Pixmap.\n" "Can't attach to the shared memory segment."); shm_error = -1; } shmdt(ip->shminfo.shmaddr); shmctl(ip->shminfo.shmid, IPC_RMID, NULL); XDestroyImage(ip->im); ip->im = NULL; goto done; } XSync(mywin.d, False); /* Wait until ready. */ ip->pm = XShmCreatePixmap(mywin.d, mywin.w, ip->im->data, &ip->shminfo, width, height, shm_depth); if(ip->pm == None) { if(shm_error == 0) { ctl->cmsg(CMSG_WARNING, VERB_VERBOSE, "X Sherry Warning: Can't create SHM Pixmap.\n" "XShmCreatePixmap() is failed"); shm_error = -1; } shmdt(ip->shminfo.shmaddr); shmctl(ip->shminfo.shmid, IPC_RMID, NULL); XDestroyImage(ip->im); ip->im = NULL; goto done; } done: XSetErrorHandler(origh); if(ip->im == NULL) { free(ip); return NULL; } return ip; } #endif TiMidity++-2.13.2/interface/x_wrdwindow.h0100644004711200001440000000364507421005040017361 0ustar tamukiusers/* TiMidity++ -- MIDI to WAVE converter and player Copyright (C) 1999-2002 Masanao Izumo Copyright (C) 1995 Tuukka Toivonen 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _WINDOW_H_ #define _WINDOW_H_ #include "x_mag.h" extern void WinEvent(void); extern void EndWin(void); extern void WinFlush(void); extern void AddLine(const unsigned char *,int); extern int OpenWRDWindow(char *opt); extern void CloseWRDWindow(void); extern void x_RedrawControl(int flag); extern void x_Gcls(int); extern void x_Gline(int *,int); extern void x_GCircle(int *,int); extern void x_Pal(int *,int); extern void x_Palrev(int pallet); extern void x_Gscreen(int active,int appear); extern void x_Fade(int *,int,int,int); extern void x_Mag(magdata *,int32,int32,int32,int32); extern void x_PLoad(char *filename); extern void x_GMove(int,int,int,int,int,int,int,int,int); extern void x_GMode(int mode); extern void x_Ton(int param); extern void x_Gon(int param); extern void x_Startup(int version); extern void x_VSget(int *,int); extern void x_VRel(void); extern void x_VCopy(int,int,int,int,int,int,int,int,int); extern void x_XCopy(int sx1, int sy1, int sx2, int sy2, int tx, int ty, int ss, int ts, int method, int *opts, int npots); #endif TiMidity++-2.13.2/interface/VTPrsTbl.c0100644004711200001440000023524507421005040016464 0ustar tamukiusers/* * Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. * * All Rights Reserved * * Permission to use, copy, modify, and distribute this software and its * documentation for any purpose and without fee is hereby granted, * provided that the above copyright notice appear in all copies and that * both that copyright notice and this permission notice appear in * supporting documentation, and that the name of Digital Equipment * Corporation not be used in advertising or publicity pertaining to * distribution of the software without specific, written prior permission. * * * DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL * DIGITAL BE LIABLE FOR ANY SPECIAL, 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. */ /* *This file is a part of "kterm" and partially preprocessed and modified *to fit my purpose. * Takanori Watanabe */ #include "VTparse.h" #ifdef __STDC__ #define Const const #else #define Const /**/ #endif #define BUGGY_VTPARSE /* * Stupid Apollo C preprocessor can't handle long lines. So... To keep * it happy, we put each onto a seperate line.... Sigh... */ Const int groundtable[] = { /* NUL SOH STX ETX */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* EOT ENQ ACK BEL */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_BELL, /* BS HT NL VT */ CASE_BS, CASE_TAB, CASE_VMOT, CASE_VMOT, /* NP CR SO SI */ CASE_VMOT, CASE_CR, CASE_SO, CASE_SI, /* DLE DC1 DC2 DC3 */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* DC4 NAK SYN ETB */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* CAN EM SUB ESC */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_ESC, /* FS GS RS US */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* SP ! " # */ CASE_PRINT, CASE_PRINT, CASE_PRINT, CASE_PRINT, /* $ % & ' */ CASE_PRINT, CASE_PRINT, CASE_PRINT, CASE_PRINT, /* ( ) * + */ CASE_PRINT, CASE_PRINT, CASE_PRINT, CASE_PRINT, /* , - . / */ CASE_PRINT, CASE_PRINT, CASE_PRINT, CASE_PRINT, /* 0 1 2 3 */ CASE_PRINT, CASE_PRINT, CASE_PRINT, CASE_PRINT, /* 4 5 6 7 */ CASE_PRINT, CASE_PRINT, CASE_PRINT, CASE_PRINT, /* 8 9 : ; */ CASE_PRINT, CASE_PRINT, CASE_PRINT, CASE_PRINT, /* < = > ? */ CASE_PRINT, CASE_PRINT, CASE_PRINT, CASE_PRINT, /* @ A B C */ CASE_PRINT, CASE_PRINT, CASE_PRINT, CASE_PRINT, /* D E F G */ CASE_PRINT, CASE_PRINT, CASE_PRINT, CASE_PRINT, /* H I J K */ CASE_PRINT, CASE_PRINT, CASE_PRINT, CASE_PRINT, /* L M N O */ CASE_PRINT, CASE_PRINT, CASE_PRINT, CASE_PRINT, /* P Q R S */ CASE_PRINT, CASE_PRINT, CASE_PRINT, CASE_PRINT, /* T U V W */ CASE_PRINT, CASE_PRINT, CASE_PRINT, CASE_PRINT, /* X Y Z [ */ CASE_PRINT, CASE_PRINT, CASE_PRINT, CASE_PRINT, /* \ ] ^ _ */ CASE_PRINT, CASE_PRINT, CASE_PRINT, CASE_PRINT, /* ` a b c */ CASE_PRINT, CASE_PRINT, CASE_PRINT, CASE_PRINT, /* d e f g */ CASE_PRINT, CASE_PRINT, CASE_PRINT, CASE_PRINT, /* h i j k */ CASE_PRINT, CASE_PRINT, CASE_PRINT, CASE_PRINT, /* l m n o */ CASE_PRINT, CASE_PRINT, CASE_PRINT, CASE_PRINT, /* p q r s */ CASE_PRINT, CASE_PRINT, CASE_PRINT, CASE_PRINT, /* t u v w */ CASE_PRINT, CASE_PRINT, CASE_PRINT, CASE_PRINT, /* x y z { */ CASE_PRINT, CASE_PRINT, CASE_PRINT, CASE_PRINT, /* | } ~ DEL */ CASE_PRINT, CASE_PRINT, CASE_PRINT, CASE_PRINT, /* 0x80 0x81 0x82 0x83 */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* 0x84 0x85 0x86 0x87 */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* 0x88 0x89 0x8a 0x8b */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* 0x8c 0x8d 0x8e 0x8f */ CASE_IGNORE, CASE_IGNORE, CASE_SS2, CASE_SS3, /* 0x90 0x91 0x92 0x93 */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* 0x94 0x95 0x96 0x97 */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* 0x99 0x99 0x9a 0x9b */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_CSI_STATE, /* 0x9c 0x9d 0x9e 0x9f */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* nobreakspace exclamdown cent sterling */ CASE_PRINT, CASE_PRINT, CASE_PRINT, CASE_PRINT, /* currency yen brokenbar section */ CASE_PRINT, CASE_PRINT, CASE_PRINT, CASE_PRINT, /* diaeresis copyright ordfeminine guillemotleft */ CASE_PRINT, CASE_PRINT, CASE_PRINT, CASE_PRINT, /* notsign hyphen registered macron */ CASE_PRINT, CASE_PRINT, CASE_PRINT, CASE_PRINT, /* degree plusminus twosuperior threesuperior */ CASE_PRINT, CASE_PRINT, CASE_PRINT, CASE_PRINT, /* acute mu paragraph periodcentered */ CASE_PRINT, CASE_PRINT, CASE_PRINT, CASE_PRINT, /* cedilla onesuperior masculine guillemotright */ CASE_PRINT, CASE_PRINT, CASE_PRINT, CASE_PRINT, /* onequarter onehalf threequarters questiondown */ CASE_PRINT, CASE_PRINT, CASE_PRINT, CASE_PRINT, /* Agrave Aacute Acircumflex Atilde */ CASE_PRINT, CASE_PRINT, CASE_PRINT, CASE_PRINT, /* Adiaeresis Aring AE Ccedilla */ CASE_PRINT, CASE_PRINT, CASE_PRINT, CASE_PRINT, /* Egrave Eacute Ecircumflex Ediaeresis */ CASE_PRINT, CASE_PRINT, CASE_PRINT, CASE_PRINT, /* Igrave Iacute Icircumflex Idiaeresis */ CASE_PRINT, CASE_PRINT, CASE_PRINT, CASE_PRINT, /* Eth Ntilde Ograve Oacute */ CASE_PRINT, CASE_PRINT, CASE_PRINT, CASE_PRINT, /* Ocircumflex Otilde Odiaeresis multiply */ CASE_PRINT, CASE_PRINT, CASE_PRINT, CASE_PRINT, /* Ooblique Ugrave Uacute Ucircumflex */ CASE_PRINT, CASE_PRINT, CASE_PRINT, CASE_PRINT, /* Udiaeresis Yacute Thorn ssharp */ CASE_PRINT, CASE_PRINT, CASE_PRINT, CASE_PRINT, /* agrave aacute acircumflex atilde */ CASE_PRINT, CASE_PRINT, CASE_PRINT, CASE_PRINT, /* adiaeresis aring ae ccedilla */ CASE_PRINT, CASE_PRINT, CASE_PRINT, CASE_PRINT, /* egrave eacute ecircumflex ediaeresis */ CASE_PRINT, CASE_PRINT, CASE_PRINT, CASE_PRINT, /* igrave iacute icircumflex idiaeresis */ CASE_PRINT, CASE_PRINT, CASE_PRINT, CASE_PRINT, /* eth ntilde ograve oacute */ CASE_PRINT, CASE_PRINT, CASE_PRINT, CASE_PRINT, /* ocircumflex otilde odiaeresis division */ CASE_PRINT, CASE_PRINT, CASE_PRINT, CASE_PRINT, /* oslash ugrave uacute ucircumflex */ CASE_PRINT, CASE_PRINT, CASE_PRINT, CASE_PRINT, /* udiaeresis yacute thorn ydiaeresis */ CASE_PRINT, CASE_PRINT, CASE_PRINT, CASE_PRINT, }; Const int csitable[] = /* ESC [ */ { /* NUL SOH STX ETX */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* EOT ENQ ACK BEL */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_BELL, /* BS HT NL VT */ CASE_BS, CASE_TAB, CASE_VMOT, CASE_VMOT, /* NP CR SO SI */ CASE_VMOT, CASE_CR, CASE_SO, CASE_SI, /* DLE DC1 DC2 DC3 */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* DC4 NAK SYN ETB */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* CAN EM SUB ESC */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_ESC, /* FS GS RS US */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* SP ! " # */ #ifndef BUGGY_VTPARSE CASE_ESC_IGNORE, #else CASE_ESC_DIGIT, #endif CASE_ESC_IGNORE, CASE_ESC_IGNORE, CASE_ESC_IGNORE, /* $ % & ' */ CASE_ESC_IGNORE, CASE_ESC_IGNORE, CASE_ESC_IGNORE, CASE_ESC_IGNORE, /* ( ) * + */ CASE_ESC_IGNORE, CASE_ESC_IGNORE, CASE_ESC_IGNORE, CASE_ESC_IGNORE, /* , - . / */ CASE_ESC_IGNORE, CASE_ESC_IGNORE, CASE_ESC_IGNORE, CASE_ESC_IGNORE, /* 0 1 2 3 */ CASE_ESC_DIGIT, CASE_ESC_DIGIT, CASE_ESC_DIGIT, CASE_ESC_DIGIT, /* 4 5 6 7 */ CASE_ESC_DIGIT, CASE_ESC_DIGIT, CASE_ESC_DIGIT, CASE_ESC_DIGIT, /* 8 9 : ; */ CASE_ESC_DIGIT, CASE_ESC_DIGIT, CASE_IGNORE, CASE_ESC_SEMI, /* < = > ? */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_DEC_STATE, /* @ A B C */ CASE_ICH, CASE_CUU, CASE_CUD, CASE_CUF, /* D E F G */ CASE_CUB, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* H I J K */ CASE_CUP, CASE_GROUND_STATE, CASE_ED, CASE_EL, /* L M N O */ CASE_IL, CASE_DL, CASE_GROUND_STATE, CASE_GROUND_STATE, /* P Q R S */ CASE_DCH, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* T U V W */ CASE_TRACK_MOUSE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* X Y Z [ */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* \ ] ^ _ */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, #ifndef BUGGY_VTPARSE /* ` a b c */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_DA1, #else /* ` a b c */ CASE_GROUND_STATE, CASE_CUU, CASE_CUD, CASE_CUF, #endif /* d e f g */ #ifndef BUGGY_VTPARSE CASE_GROUND_STATE, #else CASE_CUB, #endif CASE_GROUND_STATE, CASE_CUP, CASE_TBC, /* h i j k */ CASE_SET, CASE_GROUND_STATE, #ifndef BUGGY_VTPARSE CASE_GROUND_STATE, #else CASE_ED, #endif CASE_GROUND_STATE, /* l m n o */ CASE_RST, CASE_SGR, CASE_CPR, CASE_GROUND_STATE, /* p q r s */ CASE_MY_GRAPHIC_CMD, CASE_GROUND_STATE, CASE_DECSTBM, CASE_DECSC, /* t u v w */ CASE_GROUND_STATE, CASE_DECRC, CASE_GROUND_STATE, CASE_GROUND_STATE, /* x y z { */ CASE_DECREQTPARM, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* | } ~ DEL */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* 0x80 0x81 0x82 0x83 */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* 0x84 0x85 0x86 0x87 */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* 0x88 0x89 0x8a 0x8b */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* 0x8c 0x8d 0x8e 0x8f */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* 0x90 0x91 0x92 0x93 */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* 0x94 0x95 0x96 0x97 */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* 0x99 0x99 0x9a 0x9b */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* 0x9c 0x9d 0x9e 0x9f */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* nobreakspace exclamdown cent sterling */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* currency yen brokenbar section */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* diaeresis copyright ordfeminine guillemotleft */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* notsign hyphen registered macron */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* degree plusminus twosuperior threesuperior */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* acute mu paragraph periodcentered */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* cedilla onesuperior masculine guillemotright */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* onequarter onehalf threequarters questiondown */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* Agrave Aacute Acircumflex Atilde */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* Adiaeresis Aring AE Ccedilla */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* Egrave Eacute Ecircumflex Ediaeresis */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* Igrave Iacute Icircumflex Idiaeresis */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* Eth Ntilde Ograve Oacute */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* Ocircumflex Otilde Odiaeresis multiply */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* Ooblique Ugrave Uacute Ucircumflex */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* Udiaeresis Yacute Thorn ssharp */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* agrave aacute acircumflex atilde */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* adiaeresis aring ae ccedilla */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* egrave eacute ecircumflex ediaeresis */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* igrave iacute icircumflex idiaeresis */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* eth ntilde ograve oacute */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* ocircumflex otilde odiaeresis division */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* oslash ugrave uacute ucircumflex */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* udiaeresis yacute thorn ydiaeresis */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, }; Const int dectable[] = /* ESC [ ? */ { /* NUL SOH STX ETX */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* EOT ENQ ACK BEL */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_BELL, /* BS HT NL VT */ CASE_BS, CASE_TAB, CASE_VMOT, CASE_VMOT, /* NP CR SO SI */ CASE_VMOT, CASE_CR, CASE_SO, CASE_SI, /* DLE DC1 DC2 DC3 */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* DC4 NAK SYN ETB */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* CAN EM SUB ESC */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_ESC, /* FS GS RS US */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* SP ! " # */ CASE_ESC_IGNORE, CASE_ESC_IGNORE, CASE_ESC_IGNORE, CASE_ESC_IGNORE, /* $ % & ' */ CASE_ESC_IGNORE, CASE_ESC_IGNORE, CASE_ESC_IGNORE, CASE_ESC_IGNORE, /* ( ) * + */ CASE_ESC_IGNORE, CASE_ESC_IGNORE, CASE_ESC_IGNORE, CASE_ESC_IGNORE, /* , - . / */ CASE_ESC_IGNORE, CASE_ESC_IGNORE, CASE_ESC_IGNORE, CASE_ESC_IGNORE, /* 0 1 2 3 */ CASE_ESC_DIGIT, CASE_ESC_DIGIT, CASE_ESC_DIGIT, CASE_ESC_DIGIT, /* 4 5 6 7 */ CASE_ESC_DIGIT, CASE_ESC_DIGIT, CASE_ESC_DIGIT, CASE_ESC_DIGIT, /* 8 9 : ; */ CASE_ESC_DIGIT, CASE_ESC_DIGIT, CASE_IGNORE, CASE_ESC_SEMI, /* < = > ? */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* @ A B C */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* D E F G */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* H I J K */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* L M N O */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* P Q R S */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* T U V W */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* X Y Z [ */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* \ ] ^ _ */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* ` a b c */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* d e f g */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* h i j k */ CASE_DECSET, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* l m n o */ CASE_DECRST, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* p q r s */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_XTERM_RESTORE, CASE_XTERM_SAVE, /* t u v w */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* x y z { */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* | } ~ DEL */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* 0x80 0x81 0x82 0x83 */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* 0x84 0x85 0x86 0x87 */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* 0x88 0x89 0x8a 0x8b */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* 0x8c 0x8d 0x8e 0x8f */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* 0x90 0x91 0x92 0x93 */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* 0x94 0x95 0x96 0x97 */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* 0x99 0x99 0x9a 0x9b */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* 0x9c 0x9d 0x9e 0x9f */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* nobreakspace exclamdown cent sterling */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* currency yen brokenbar section */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* diaeresis copyright ordfeminine guillemotleft */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* notsign hyphen registered macron */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* degree plusminus twosuperior threesuperior */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* acute mu paragraph periodcentered */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* cedilla onesuperior masculine guillemotright */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* onequarter onehalf threequarters questiondown */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* Agrave Aacute Acircumflex Atilde */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* Adiaeresis Aring AE Ccedilla */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* Egrave Eacute Ecircumflex Ediaeresis */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* Igrave Iacute Icircumflex Idiaeresis */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* Eth Ntilde Ograve Oacute */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* Ocircumflex Otilde Odiaeresis multiply */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* Ooblique Ugrave Uacute Ucircumflex */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* Udiaeresis Yacute Thorn ssharp */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* agrave aacute acircumflex atilde */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* adiaeresis aring ae ccedilla */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* egrave eacute ecircumflex ediaeresis */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* igrave iacute icircumflex idiaeresis */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* eth ntilde ograve oacute */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* ocircumflex otilde odiaeresis division */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* oslash ugrave uacute ucircumflex */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* udiaeresis yacute thorn ydiaeresis */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, }; Const int eigtable[] = /* CASE_ESC_IGNORE */ { /* NUL SOH STX ETX */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* EOT ENQ ACK BEL */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_BELL, /* BS HT NL VT */ CASE_BS, CASE_TAB, CASE_VMOT, CASE_VMOT, /* NP CR SO SI */ CASE_VMOT, CASE_CR, CASE_SO, CASE_SI, /* DLE DC1 DC2 DC3 */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* DC4 NAK SYN ETB */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* CAN EM SUB ESC */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_ESC, /* FS GS RS US */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* SP ! " # */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* $ % & ' */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* ( ) * + */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* , - . / */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* 0 1 2 3 */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* 4 5 6 7 */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* 8 9 : ; */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* < = > ? */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* @ A B C */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* D E F G */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* H I J K */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* L M N O */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* P Q R S */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* T U V W */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* X Y Z [ */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* \ ] ^ _ */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* ` a b c */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* d e f g */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* h i j k */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* l m n o */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* p q r s */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* t u v w */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* x y z { */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* | } ~ DEL */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* 0x80 0x81 0x82 0x83 */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* 0x84 0x85 0x86 0x87 */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* 0x88 0x89 0x8a 0x8b */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* 0x8c 0x8d 0x8e 0x8f */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* 0x90 0x91 0x92 0x93 */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* 0x94 0x95 0x96 0x97 */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* 0x99 0x99 0x9a 0x9b */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* 0x9c 0x9d 0x9e 0x9f */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* nobreakspace exclamdown cent sterling */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* currency yen brokenbar section */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* diaeresis copyright ordfeminine guillemotleft */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* notsign hyphen registered macron */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* degree plusminus twosuperior threesuperior */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* acute mu paragraph periodcentered */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* cedilla onesuperior masculine guillemotright */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* onequarter onehalf threequarters questiondown */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* Agrave Aacute Acircumflex Atilde */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* Adiaeresis Aring AE Ccedilla */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* Egrave Eacute Ecircumflex Ediaeresis */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* Igrave Iacute Icircumflex Idiaeresis */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* Eth Ntilde Ograve Oacute */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* Ocircumflex Otilde Odiaeresis multiply */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* Ooblique Ugrave Uacute Ucircumflex */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* Udiaeresis Yacute Thorn ssharp */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* agrave aacute acircumflex atilde */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* adiaeresis aring ae ccedilla */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* egrave eacute ecircumflex ediaeresis */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* igrave iacute icircumflex idiaeresis */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* eth ntilde ograve oacute */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* ocircumflex otilde odiaeresis division */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* oslash ugrave uacute ucircumflex */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* udiaeresis yacute thorn ydiaeresis */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, }; Const int esctable[] = /* ESC */ { /* NUL SOH STX ETX */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* EOT ENQ ACK BEL */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_BELL, /* BS HT NL VT */ CASE_BS, CASE_TAB, CASE_VMOT, CASE_VMOT, /* NP CR SO SI */ CASE_VMOT, CASE_CR, CASE_SO, CASE_SI, /* DLE DC1 DC2 DC3 */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* DC4 NAK SYN ETB */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* CAN EM SUB ESC */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_ESC, /* FS GS RS US */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* SP ! " # */ CASE_ESC_IGNORE, CASE_ESC_IGNORE, CASE_ESC_IGNORE, CASE_SCR_STATE, /* $ % & ' */ CASE_MBCS, CASE_ESC_IGNORE, CASE_ESC_IGNORE, CASE_ESC_IGNORE, /* ( ) * + */ CASE_SCS_STATE, CASE_SCS_STATE, CASE_SCS_STATE, CASE_SCS_STATE, /* , - . / */ CASE_SCS_STATE, /* not defined in ISO2022 but used in Mule */ CASE_SCS_STATE, CASE_SCS_STATE, CASE_SCS_STATE, /* 0 1 2 3 */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* 4 5 6 7 */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_DECSC, /* 8 9 : ; */ CASE_DECRC, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* < = > ? */ CASE_GROUND_STATE, CASE_DECKPAM, CASE_DECKPNM, CASE_GROUND_STATE, /* @ A B C */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* D E F G */ CASE_IND, CASE_NEL, CASE_HP_BUGGY_LL, CASE_GROUND_STATE, /* H I J K */ CASE_HTS, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* L M N O */ CASE_GROUND_STATE, CASE_RI, CASE_SS2, CASE_SS3, /* P Q R S */ CASE_IGNORE_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* T U V W */ CASE_XTERM_TITLE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* X Y Z [ */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_DECID, CASE_CSI_STATE, /* \ ] ^ _ */ CASE_GROUND_STATE, CASE_OSC, CASE_IGNORE_STATE, CASE_IGNORE_STATE, /* ` a b c */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_RIS, /* d e f g */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* h i j k */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* l m n o */ CASE_HP_MEM_LOCK, CASE_HP_MEM_UNLOCK, CASE_LS2, CASE_LS3, /* p q r s */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* t u v w */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* x y z { */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* | } ~ DEL */ CASE_LS3R, CASE_LS2R, CASE_LS1R, CASE_GROUND_STATE, /* 0x80 0x81 0x82 0x83 */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* 0x84 0x85 0x86 0x87 */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* 0x88 0x89 0x8a 0x8b */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* 0x8c 0x8d 0x8e 0x8f */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* 0x90 0x91 0x92 0x93 */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* 0x94 0x95 0x96 0x97 */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* 0x99 0x99 0x9a 0x9b */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* 0x9c 0x9d 0x9e 0x9f */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* nobreakspace exclamdown cent sterling */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* currency yen brokenbar section */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* diaeresis copyright ordfeminine guillemotleft */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* notsign hyphen registered macron */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* degree plusminus twosuperior threesuperior */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* acute mu paragraph periodcentered */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* cedilla onesuperior masculine guillemotright */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* onequarter onehalf threequarters questiondown */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* Agrave Aacute Acircumflex Atilde */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* Adiaeresis Aring AE Ccedilla */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* Egrave Eacute Ecircumflex Ediaeresis */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* Igrave Iacute Icircumflex Idiaeresis */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* Eth Ntilde Ograve Oacute */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* Ocircumflex Otilde Odiaeresis multiply */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* Ooblique Ugrave Uacute Ucircumflex */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* Udiaeresis Yacute Thorn ssharp */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* agrave aacute acircumflex atilde */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* adiaeresis aring ae ccedilla */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* egrave eacute ecircumflex ediaeresis */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* igrave iacute icircumflex idiaeresis */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* eth ntilde ograve oacute */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* ocircumflex otilde odiaeresis division */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* oslash ugrave uacute ucircumflex */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* udiaeresis yacute thorn ydiaeresis */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, }; Const int iestable[] = /* CASE_IGNORE_ESC */ { /* NUL SOH STX ETX */ CASE_IGNORE_STATE, CASE_IGNORE_STATE, CASE_IGNORE_STATE, CASE_IGNORE_STATE, /* EOT ENQ ACK BEL */ CASE_IGNORE_STATE, CASE_IGNORE_STATE, CASE_IGNORE_STATE, CASE_IGNORE_STATE, /* BS HT NL VT */ CASE_IGNORE_STATE, CASE_IGNORE_STATE, CASE_IGNORE_STATE, CASE_IGNORE_STATE, /* NP CR SO SI */ CASE_IGNORE_STATE, CASE_IGNORE_STATE, CASE_IGNORE_STATE, CASE_IGNORE_STATE, /* DLE DC1 DC2 DC3 */ CASE_IGNORE_STATE, CASE_IGNORE_STATE, CASE_IGNORE_STATE, CASE_IGNORE_STATE, /* DC4 NAK SYN ETB */ CASE_IGNORE_STATE, CASE_IGNORE_STATE, CASE_IGNORE_STATE, CASE_IGNORE_STATE, /* CAN EM SUB ESC */ CASE_IGNORE_STATE, CASE_IGNORE_STATE, CASE_IGNORE_STATE, CASE_IGNORE_STATE, /* FS GS RS US */ CASE_IGNORE_STATE, CASE_IGNORE_STATE, CASE_IGNORE_STATE, CASE_IGNORE_STATE, /* SP ! " # */ CASE_IGNORE_STATE, CASE_IGNORE_STATE, CASE_IGNORE_STATE, CASE_IGNORE_STATE, /* $ % & ' */ CASE_IGNORE_STATE, CASE_IGNORE_STATE, CASE_IGNORE_STATE, CASE_IGNORE_STATE, /* ( ) * + */ CASE_IGNORE_STATE, CASE_IGNORE_STATE, CASE_IGNORE_STATE, CASE_IGNORE_STATE, /* , - . / */ CASE_IGNORE_STATE, CASE_IGNORE_STATE, CASE_IGNORE_STATE, CASE_IGNORE_STATE, /* 0 1 2 3 */ CASE_IGNORE_STATE, CASE_IGNORE_STATE, CASE_IGNORE_STATE, CASE_IGNORE_STATE, /* 4 5 6 7 */ CASE_IGNORE_STATE, CASE_IGNORE_STATE, CASE_IGNORE_STATE, CASE_IGNORE_STATE, /* 8 9 : ; */ CASE_IGNORE_STATE, CASE_IGNORE_STATE, CASE_IGNORE_STATE, CASE_IGNORE_STATE, /* < = > ? */ CASE_IGNORE_STATE, CASE_IGNORE_STATE, CASE_IGNORE_STATE, CASE_IGNORE_STATE, /* @ A B C */ CASE_IGNORE_STATE, CASE_IGNORE_STATE, CASE_IGNORE_STATE, CASE_IGNORE_STATE, /* D E F G */ CASE_IGNORE_STATE, CASE_IGNORE_STATE, CASE_IGNORE_STATE, CASE_IGNORE_STATE, /* H I J K */ CASE_IGNORE_STATE, CASE_IGNORE_STATE, CASE_IGNORE_STATE, CASE_IGNORE_STATE, /* L M N O */ CASE_IGNORE_STATE, CASE_IGNORE_STATE, CASE_IGNORE_STATE, CASE_IGNORE_STATE, /* P Q R S */ CASE_IGNORE_STATE, CASE_IGNORE_STATE, CASE_IGNORE_STATE, CASE_IGNORE_STATE, /* T U V W */ CASE_IGNORE_STATE, CASE_IGNORE_STATE, CASE_IGNORE_STATE, CASE_IGNORE_STATE, /* X Y Z [ */ CASE_IGNORE_STATE, CASE_IGNORE_STATE, CASE_IGNORE_STATE, CASE_IGNORE_STATE, /* \ ] ^ _ */ CASE_GROUND_STATE, CASE_IGNORE_STATE, CASE_IGNORE_STATE, CASE_IGNORE_STATE, /* ` a b c */ CASE_IGNORE_STATE, CASE_IGNORE_STATE, CASE_IGNORE_STATE, CASE_IGNORE_STATE, /* d e f g */ CASE_IGNORE_STATE, CASE_IGNORE_STATE, CASE_IGNORE_STATE, CASE_IGNORE_STATE, /* h i j k */ CASE_IGNORE_STATE, CASE_IGNORE_STATE, CASE_IGNORE_STATE, CASE_IGNORE_STATE, /* l m n o */ CASE_IGNORE_STATE, CASE_IGNORE_STATE, CASE_IGNORE_STATE, CASE_IGNORE_STATE, /* p q r s */ CASE_IGNORE_STATE, CASE_IGNORE_STATE, CASE_IGNORE_STATE, CASE_IGNORE_STATE, /* t u v w */ CASE_IGNORE_STATE, CASE_IGNORE_STATE, CASE_IGNORE_STATE, CASE_IGNORE_STATE, /* x y z { */ CASE_IGNORE_STATE, CASE_IGNORE_STATE, CASE_IGNORE_STATE, CASE_IGNORE_STATE, /* | } ~ DEL */ CASE_IGNORE_STATE, CASE_IGNORE_STATE, CASE_IGNORE_STATE, CASE_IGNORE_STATE, /* 0x80 0x81 0x82 0x83 */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* 0x84 0x85 0x86 0x87 */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* 0x88 0x89 0x8a 0x8b */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* 0x8c 0x8d 0x8e 0x8f */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* 0x90 0x91 0x92 0x93 */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* 0x94 0x95 0x96 0x97 */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* 0x99 0x99 0x9a 0x9b */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* 0x9c 0x9d 0x9e 0x9f */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* nobreakspace exclamdown cent sterling */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* currency yen brokenbar section */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* diaeresis copyright ordfeminine guillemotleft */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* notsign hyphen registered macron */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* degree plusminus twosuperior threesuperior */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* acute mu paragraph periodcentered */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* cedilla onesuperior masculine guillemotright */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* onequarter onehalf threequarters questiondown */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* Agrave Aacute Acircumflex Atilde */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* Adiaeresis Aring AE Ccedilla */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* Egrave Eacute Ecircumflex Ediaeresis */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* Igrave Iacute Icircumflex Idiaeresis */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* Eth Ntilde Ograve Oacute */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* Ocircumflex Otilde Odiaeresis multiply */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* Ooblique Ugrave Uacute Ucircumflex */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* Udiaeresis Yacute Thorn ssharp */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* agrave aacute acircumflex atilde */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* adiaeresis aring ae ccedilla */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* egrave eacute ecircumflex ediaeresis */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* igrave iacute icircumflex idiaeresis */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* eth ntilde ograve oacute */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* ocircumflex otilde odiaeresis division */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* oslash ugrave uacute ucircumflex */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* udiaeresis yacute thorn ydiaeresis */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, }; Const int igntable[] = /* CASE_IGNORE_STATE */ { /* NUL SOH STX ETX */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* EOT ENQ ACK BEL */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* BS HT NL VT */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* NP CR SO SI */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* DLE DC1 DC2 DC3 */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* DC4 NAK SYN ETB */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* CAN EM SUB ESC */ CASE_GROUND_STATE, CASE_IGNORE, CASE_GROUND_STATE, CASE_IGNORE_ESC, /* FS GS RS US */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* SP ! " # */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* $ % & ' */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* ( ) * + */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* , - . / */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* 0 1 2 3 */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* 4 5 6 7 */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* 8 9 : ; */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* < = > ? */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* @ A B C */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* D E F G */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* H I J K */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* L M N O */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* P Q R S */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* T U V W */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* X Y Z [ */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* \ ] ^ _ */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* ` a b c */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* d e f g */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* h i j k */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* l m n o */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* p q r s */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* t u v w */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* x y z { */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* | } ~ DEL */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* 0x80 0x81 0x82 0x83 */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* 0x84 0x85 0x86 0x87 */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* 0x88 0x89 0x8a 0x8b */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* 0x8c 0x8d 0x8e 0x8f */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* 0x90 0x91 0x92 0x93 */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* 0x94 0x95 0x96 0x97 */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* 0x99 0x99 0x9a 0x9b */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* 0x9c 0x9d 0x9e 0x9f */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* nobreakspace exclamdown cent sterling */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* currency yen brokenbar section */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* diaeresis copyright ordfeminine guillemotleft */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* notsign hyphen registered macron */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* degree plusminus twosuperior threesuperior */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* acute mu paragraph periodcentered */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* cedilla onesuperior masculine guillemotright */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* onequarter onehalf threequarters questiondown */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* Agrave Aacute Acircumflex Atilde */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* Adiaeresis Aring AE Ccedilla */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* Egrave Eacute Ecircumflex Ediaeresis */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* Igrave Iacute Icircumflex Idiaeresis */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* Eth Ntilde Ograve Oacute */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* Ocircumflex Otilde Odiaeresis multiply */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* Ooblique Ugrave Uacute Ucircumflex */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* Udiaeresis Yacute Thorn ssharp */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* agrave aacute acircumflex atilde */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* adiaeresis aring ae ccedilla */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* egrave eacute ecircumflex ediaeresis */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* igrave iacute icircumflex idiaeresis */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* eth ntilde ograve oacute */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* ocircumflex otilde odiaeresis division */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* oslash ugrave uacute ucircumflex */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* udiaeresis yacute thorn ydiaeresis */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, }; Const int scrtable[] = /* ESC # */ { /* NUL SOH STX ETX */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* EOT ENQ ACK BEL */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_BELL, /* BS HT NL VT */ CASE_BS, CASE_TAB, CASE_VMOT, CASE_VMOT, /* NP CR SO SI */ CASE_VMOT, CASE_CR, CASE_SO, CASE_SI, /* DLE DC1 DC2 DC3 */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* DC4 NAK SYN ETB */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* CAN EM SUB ESC */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_ESC, /* FS GS RS US */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* SP ! " # */ CASE_ESC_IGNORE, CASE_ESC_IGNORE, CASE_ESC_IGNORE, CASE_ESC_IGNORE, /* $ % & ' */ CASE_ESC_IGNORE, CASE_ESC_IGNORE, CASE_ESC_IGNORE, CASE_ESC_IGNORE, /* ( ) * + */ CASE_ESC_IGNORE, CASE_ESC_IGNORE, CASE_ESC_IGNORE, CASE_ESC_IGNORE, /* , - . / */ CASE_ESC_IGNORE, CASE_ESC_IGNORE, CASE_ESC_IGNORE, CASE_ESC_IGNORE, /* 0 1 2 3 */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* 4 5 6 7 */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* 8 9 : ; */ CASE_DECALN, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* < = > ? */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* @ A B C */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* D E F G */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* H I J K */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* L M N O */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* P Q R S */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* T U V W */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* X Y Z [ */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* \ ] ^ _ */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* ` a b c */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* d e f g */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* h i j k */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* l m n o */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* p q r s */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* t u v w */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* x y z { */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* | } ~ DEL */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* 0x80 0x81 0x82 0x83 */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* 0x84 0x85 0x86 0x87 */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* 0x88 0x89 0x8a 0x8b */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* 0x8c 0x8d 0x8e 0x8f */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* 0x90 0x91 0x92 0x93 */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* 0x94 0x95 0x96 0x97 */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* 0x99 0x99 0x9a 0x9b */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* 0x9c 0x9d 0x9e 0x9f */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* nobreakspace exclamdown cent sterling */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* currency yen brokenbar section */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* diaeresis copyright ordfeminine guillemotleft */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* notsign hyphen registered macron */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* degree plusminus twosuperior threesuperior */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* acute mu paragraph periodcentered */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* cedilla onesuperior masculine guillemotright */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* onequarter onehalf threequarters questiondown */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* Agrave Aacute Acircumflex Atilde */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* Adiaeresis Aring AE Ccedilla */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* Egrave Eacute Ecircumflex Ediaeresis */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* Igrave Iacute Icircumflex Idiaeresis */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* Eth Ntilde Ograve Oacute */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* Ocircumflex Otilde Odiaeresis multiply */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* Ooblique Ugrave Uacute Ucircumflex */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* Udiaeresis Yacute Thorn ssharp */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* agrave aacute acircumflex atilde */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* adiaeresis aring ae ccedilla */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* egrave eacute ecircumflex ediaeresis */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* igrave iacute icircumflex idiaeresis */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* eth ntilde ograve oacute */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* ocircumflex otilde odiaeresis division */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* oslash ugrave uacute ucircumflex */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* udiaeresis yacute thorn ydiaeresis */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, }; Const int scstable[] = /* ESC ( etc. */ { /* NUL SOH STX ETX */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* EOT ENQ ACK BEL */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_BELL, /* BS HT NL VT */ CASE_BS, CASE_TAB, CASE_VMOT, CASE_VMOT, /* NP CR SO SI */ CASE_VMOT, CASE_CR, CASE_SO, CASE_SI, /* DLE DC1 DC2 DC3 */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* DC4 NAK SYN ETB */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* CAN EM SUB ESC */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_ESC, /* FS GS RS US */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* SP ! " # */ CASE_ESC_IGNORE, CASE_ESC_IGNORE, CASE_ESC_IGNORE, CASE_ESC_IGNORE, /* $ % & ' */ CASE_ESC_IGNORE, CASE_ESC_IGNORE, CASE_ESC_IGNORE, CASE_ESC_IGNORE, /* ( ) * + */ CASE_ESC_IGNORE, CASE_ESC_IGNORE, CASE_ESC_IGNORE, CASE_ESC_IGNORE, /* , - . / */ CASE_ESC_IGNORE, CASE_ESC_IGNORE, CASE_ESC_IGNORE, CASE_ESC_IGNORE, /* 0 1 2 3 */ CASE_GSETS, CASE_GSETS, CASE_GSETS, CASE_GSETS, /* 4 5 6 7 */ CASE_GSETS, CASE_GSETS, CASE_GSETS, CASE_GSETS, /* 8 9 : ; */ CASE_GSETS, CASE_GSETS, CASE_GSETS, CASE_GSETS, /* < = > ? */ CASE_GSETS, CASE_GSETS, CASE_GSETS, CASE_GSETS, /* @ A B C */ CASE_GSETS, CASE_GSETS, CASE_GSETS, CASE_GSETS, /* D E F G */ CASE_GSETS, CASE_GSETS, CASE_GSETS, CASE_GSETS, /* H I J K */ CASE_GSETS, CASE_GSETS, CASE_GSETS, CASE_GSETS, /* L M N O */ CASE_GSETS, CASE_GSETS, CASE_GSETS, CASE_GSETS, /* P Q R S */ CASE_GSETS, CASE_GSETS, CASE_GSETS, CASE_GSETS, /* T U V W */ CASE_GSETS, CASE_GSETS, CASE_GSETS, CASE_GSETS, /* X Y Z [ */ CASE_GSETS, CASE_GSETS, CASE_GSETS, CASE_GSETS, /* \ ] ^ _ */ CASE_GSETS, CASE_GSETS, CASE_GSETS, CASE_GSETS, /* ` a b c */ CASE_GSETS, CASE_GSETS, CASE_GSETS, CASE_GSETS, /* d e f g */ CASE_GSETS, CASE_GSETS, CASE_GSETS, CASE_GSETS, /* h i j k */ CASE_GSETS, CASE_GSETS, CASE_GSETS, CASE_GSETS, /* l m n o */ CASE_GSETS, CASE_GSETS, CASE_GSETS, CASE_GROUND_STATE, /* GSET('p') >= 0x40 (MBCS flag) */ /* p q r s */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* t u v w */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* x y z { */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* | } ~ DEL */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* empty character set */ CASE_GROUND_STATE, /* 0x80 0x81 0x82 0x83 */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* 0x84 0x85 0x86 0x87 */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* 0x88 0x89 0x8a 0x8b */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* 0x8c 0x8d 0x8e 0x8f */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* 0x90 0x91 0x92 0x93 */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* 0x94 0x95 0x96 0x97 */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* 0x99 0x99 0x9a 0x9b */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* 0x9c 0x9d 0x9e 0x9f */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* nobreakspace exclamdown cent sterling */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* currency yen brokenbar section */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* diaeresis copyright ordfeminine guillemotleft */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* notsign hyphen registered macron */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* degree plusminus twosuperior threesuperior */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* acute mu paragraph periodcentered */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* cedilla onesuperior masculine guillemotright */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* onequarter onehalf threequarters questiondown */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* Agrave Aacute Acircumflex Atilde */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* Adiaeresis Aring AE Ccedilla */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* Egrave Eacute Ecircumflex Ediaeresis */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* Igrave Iacute Icircumflex Idiaeresis */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* Eth Ntilde Ograve Oacute */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* Ocircumflex Otilde Odiaeresis multiply */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* Ooblique Ugrave Uacute Ucircumflex */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* Udiaeresis Yacute Thorn ssharp */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* agrave aacute acircumflex atilde */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* adiaeresis aring ae ccedilla */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* egrave eacute ecircumflex ediaeresis */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* igrave iacute icircumflex idiaeresis */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* eth ntilde ograve oacute */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* ocircumflex otilde odiaeresis division */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* oslash ugrave uacute ucircumflex */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* udiaeresis yacute thorn ydiaeresis */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, }; Const int mbcstable[] = { /* NUL SOH STX ETX */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* EOT ENQ ACK BEL */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_BELL, /* BS HT NL VT */ CASE_BS, CASE_TAB, CASE_VMOT, CASE_VMOT, /* NP CR SO SI */ CASE_VMOT, CASE_CR, CASE_SO, CASE_SI, /* DLE DC1 DC2 DC3 */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* DC4 NAK SYN ETB */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* CAN EM SUB ESC */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_ESC, /* FS GS RS US */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* SP ! " # */ CASE_ESC_IGNORE, CASE_ESC_IGNORE, CASE_ESC_IGNORE, CASE_ESC_IGNORE, /* $ % & ' */ CASE_ESC_IGNORE, CASE_ESC_IGNORE, CASE_ESC_IGNORE, CASE_ESC_IGNORE, /* ( ) * + */ CASE_SCS_STATE, CASE_SCS_STATE, CASE_SCS_STATE, CASE_SCS_STATE, /* , - . / */ CASE_ESC_IGNORE, CASE_SCS_STATE, CASE_SCS_STATE, CASE_SCS_STATE, /* 0 1 2 3 */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* 4 5 6 7 */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* 8 9 : ; */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* < = > ? */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* @ A B C */ CASE_GSETS, /* ESC-$-@ (JIS-78) */ CASE_GSETS, /* ESC-$-A (GB) */ CASE_GSETS, /* ESC-$-B (JIS-83) */ CASE_GROUND_STATE, /* D E F G */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* H I J K */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* L M N O */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* P Q R S */ CASE_IGNORE_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* T U V W */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* X Y Z [ */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* \ ] ^ _ */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_IGNORE_STATE, CASE_IGNORE_STATE, /* ` a b c */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* d e f g */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* h i j k */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* l m n o */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* p q r s */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* t u v w */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* x y z { */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* | } ~ DEL */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* 0x80 0x81 0x82 0x83 */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* 0x84 0x85 0x86 0x87 */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* 0x88 0x89 0x8a 0x8b */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* 0x8c 0x8d 0x8e 0x8f */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* 0x90 0x91 0x92 0x93 */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* 0x94 0x95 0x96 0x97 */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* 0x99 0x99 0x9a 0x9b */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* 0x9c 0x9d 0x9e 0x9f */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* nobreakspace exclamdown cent sterling */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* currency yen brokenbar section */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* diaeresis copyright ordfeminine guillemotleft */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* notsign hyphen registered macron */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* degree plusminus twosuperior threesuperior */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* acute mu paragraph periodcentered */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* cedilla onesuperior masculine guillemotright */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* onequarter onehalf threequarters questiondown */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* Agrave Aacute Acircumflex Atilde */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* Adiaeresis Aring AE Ccedilla */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* Egrave Eacute Ecircumflex Ediaeresis */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* Igrave Iacute Icircumflex Idiaeresis */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* Eth Ntilde Ograve Oacute */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* Ocircumflex Otilde Odiaeresis multiply */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* Ooblique Ugrave Uacute Ucircumflex */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* Udiaeresis Yacute Thorn ssharp */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* agrave aacute acircumflex atilde */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* adiaeresis aring ae ccedilla */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* egrave eacute ecircumflex ediaeresis */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* igrave iacute icircumflex idiaeresis */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* eth ntilde ograve oacute */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* ocircumflex otilde odiaeresis division */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* oslash ugrave uacute ucircumflex */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* udiaeresis yacute thorn ydiaeresis */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, }; Const int smbcstable[] = { /* NUL SOH STX ETX */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* EOT ENQ ACK BEL */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_BELL, /* BS HT NL VT */ CASE_BS, CASE_TAB, CASE_VMOT, CASE_VMOT, /* NP CR SO SI */ CASE_VMOT, CASE_CR, CASE_SO, CASE_SI, /* DLE DC1 DC2 DC3 */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* DC4 NAK SYN ETB */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* CAN EM SUB ESC */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_ESC, /* FS GS RS US */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* SP ! " # */ CASE_ESC_IGNORE, CASE_ESC_IGNORE, CASE_ESC_IGNORE, CASE_ESC_IGNORE, /* $ % & ' */ CASE_ESC_IGNORE, CASE_ESC_IGNORE, CASE_ESC_IGNORE, CASE_ESC_IGNORE, /* ( ) * + */ CASE_ESC_IGNORE, CASE_ESC_IGNORE, CASE_ESC_IGNORE, CASE_ESC_IGNORE, /* , - . / */ CASE_ESC_IGNORE, CASE_ESC_IGNORE, CASE_ESC_IGNORE, CASE_ESC_IGNORE, /* 0 1 2 3 */ CASE_GROUND_STATE, /* (2-byte or more) private character set */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* 4 5 6 7 */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* 8 9 : ; */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* < = > ? */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* @ A B C */ CASE_GSETS, /* ESC-$-I-F */ CASE_GSETS, CASE_GSETS, CASE_GSETS, /* D E F G */ CASE_GSETS, CASE_GSETS, CASE_GSETS, CASE_GSETS, /* H I J K */ CASE_GSETS, CASE_GSETS, CASE_GSETS, CASE_GSETS, /* L M N O */ CASE_GSETS, CASE_GSETS, CASE_GSETS, CASE_GSETS, /* P Q R S */ CASE_GSETS, CASE_GSETS, CASE_GSETS, CASE_GSETS, /* T U V W */ CASE_GSETS, CASE_GSETS, CASE_GSETS, CASE_GSETS, /* X Y Z [ */ CASE_GSETS, CASE_GSETS, CASE_GSETS, CASE_GSETS, /* \ ] ^ _ */ CASE_GSETS, CASE_GSETS, CASE_GSETS, CASE_GSETS, /* ` a b c */ CASE_GROUND_STATE, /* 3-byte character set */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* d e f g */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* h i j k */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* l m n o */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* p q r s */ CASE_GROUND_STATE, /* 4-byte character set */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* t u v w */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* x y z { */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* | } ~ DEL */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* 0x80 0x81 0x82 0x83 */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* 0x84 0x85 0x86 0x87 */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* 0x88 0x89 0x8a 0x8b */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* 0x8c 0x8d 0x8e 0x8f */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* 0x90 0x91 0x92 0x93 */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* 0x94 0x95 0x96 0x97 */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* 0x99 0x99 0x9a 0x9b */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* 0x9c 0x9d 0x9e 0x9f */ CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, CASE_IGNORE, /* nobreakspace exclamdown cent sterling */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* currency yen brokenbar section */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* diaeresis copyright ordfeminine guillemotleft */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* notsign hyphen registered macron */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* degree plusminus twosuperior threesuperior */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* acute mu paragraph periodcentered */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* cedilla onesuperior masculine guillemotright */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* onequarter onehalf threequarters questiondown */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* Agrave Aacute Acircumflex Atilde */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* Adiaeresis Aring AE Ccedilla */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* Egrave Eacute Ecircumflex Ediaeresis */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* Igrave Iacute Icircumflex Idiaeresis */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* Eth Ntilde Ograve Oacute */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* Ocircumflex Otilde Odiaeresis multiply */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* Ooblique Ugrave Uacute Ucircumflex */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* Udiaeresis Yacute Thorn ssharp */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* agrave aacute acircumflex atilde */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* adiaeresis aring ae ccedilla */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* egrave eacute ecircumflex ediaeresis */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* igrave iacute icircumflex idiaeresis */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* eth ntilde ograve oacute */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* ocircumflex otilde odiaeresis division */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* oslash ugrave uacute ucircumflex */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, /* udiaeresis yacute thorn ydiaeresis */ CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, CASE_GROUND_STATE, }; TiMidity++-2.13.2/interface/VTparse.h0100644004711200001440000000650507421005040016370 0ustar tamukiusers/* * Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. * * All Rights Reserved * * Permission to use, copy, modify, and distribute this software and its * documentation for any purpose and without fee is hereby granted, * provided that the above copyright notice appear in all copies and that * both that copyright notice and this permission notice appear in * supporting documentation, and that the name of Digital Equipment * Corporation not be used in advertising or publicity pertaining to * distribution of the software without specific, written prior permission. * * * DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL * DIGITAL BE LIABLE FOR ANY SPECIAL, 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 following list of definitions is generated from VTparse.def using the * following command line: * * grep '^CASE_' VTparse.def | awk '{printf "#define %s %d\n", $1, n++}' * * You you need to change something, change VTparse.def and regenerate the * definitions. This would have been automatic, but since this doesn't change * very often, it isn't worth the makefile hassle. */ #define CASE_GROUND_STATE 0 #define CASE_IGNORE_STATE 1 #define CASE_IGNORE_ESC 2 #define CASE_IGNORE 3 #define CASE_BELL 4 #define CASE_BS 5 #define CASE_CR 6 #define CASE_ESC 7 #define CASE_VMOT 8 #define CASE_TAB 9 #define CASE_SI 10 #define CASE_SO 11 #define CASE_SCR_STATE 12 #define CASE_SCS0_STATE 13 #define CASE_SCS1_STATE 14 #define CASE_SCS2_STATE 15 #define CASE_SCS3_STATE 16 #define CASE_ESC_IGNORE 17 #define CASE_ESC_DIGIT 18 #define CASE_ESC_SEMI 19 #define CASE_DEC_STATE 20 #define CASE_ICH 21 #define CASE_CUU 22 #define CASE_CUD 23 #define CASE_CUF 24 #define CASE_CUB 25 #define CASE_CUP 26 #define CASE_ED 27 #define CASE_EL 28 #define CASE_IL 29 #define CASE_DL 30 #define CASE_DCH 31 #define CASE_DA1 32 #define CASE_TRACK_MOUSE 33 #define CASE_TBC 34 #define CASE_SET 35 #define CASE_RST 36 #define CASE_SGR 37 #define CASE_CPR 38 #define CASE_DECSTBM 39 #define CASE_DECREQTPARM 40 #define CASE_DECSET 41 #define CASE_DECRST 42 #define CASE_DECALN 43 #define CASE_GSETS 44 #define CASE_DECSC 45 #define CASE_DECRC 46 #define CASE_DECKPAM 47 #define CASE_DECKPNM 48 #define CASE_IND 49 #define CASE_NEL 50 #define CASE_HTS 51 #define CASE_RI 52 #define CASE_SS2 53 #define CASE_SS3 54 #define CASE_CSI_STATE 55 #define CASE_OSC 56 #define CASE_RIS 57 #define CASE_LS2 58 #define CASE_LS3 59 #define CASE_LS3R 60 #define CASE_LS2R 61 #define CASE_LS1R 62 #define CASE_PRINT 63 #define CASE_XTERM_SAVE 64 #define CASE_XTERM_RESTORE 65 #define CASE_XTERM_TITLE 66 #define CASE_DECID 67 #define CASE_HP_MEM_LOCK 68 #define CASE_HP_MEM_UNLOCK 69 #define CASE_HP_BUGGY_LL 70 #define CASE_TO_STATUS 71 #define CASE_FROM_STATUS 72 #define CASE_SHOW_STATUS 73 #define CASE_HIDE_STATUS 74 #define CASE_ERASE_STATUS 75 #define CASE_MBCS 76 #define CASE_SCS_STATE 77 #define CASE_MY_GRAPHIC_CMD 78 #define CASE_MY_LINE 79 /* 80 (Not used) */ /* 81 (Not used) */ #define CASE_BACK_BYTE 82 TiMidity++-2.13.2/interface/x_mag.c0100644004711200001440000001553607421005040016076 0ustar tamukiusers/* TiMidity++ -- MIDI to WAVE converter and player Copyright (C) 1999-2002 Masanao Izumo Copyright (C) 1995 Tuukka Toivonen 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Macintosh interface for TiMidity by T.Nogami mac_mag.c Macintosh mag loader */ /* *X mag loader By Takanori Watanabe. Based on Mac mag loader. */ #ifdef HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ #include #include #include #include #include #include #include "timidity.h" #include "common.h" #include "x_mag.h" #include "controls.h" #include "wrd.h" #define BUFSIZE 512 static const char *MAGSIG="MAKI02 "; #define READSHORT(p) ((int)*(uint8*)((p)+1)*256+(int)*(uint8 *)(p)) #define READLONG(p) (\ (int)*(uint8*)((p)+3)*256*256*256+\ (int)*(uint8*)((p)+2)*256*256+\ (int)*(uint8*)((p)+1)*256+\ (int)*(uint8 *)(p)\ ) #define MAGHDRLEN 31 static void mag_delete(magdata *mg); static magdata *top=NULL; struct magfilehdr{ char machine; char mflag; char scrmode; char xorig[2]; char yorig[2]; char xend[2]; char yend[2]; char flagaoff[4]; char flagboff[4]; char flagbsize[4]; char pxloff[4]; char pxlsize[4]; }; static int read_flag_1line(magdata * mh,uint8 *flag ) { int x, flagA,flagB,j; j=0; for( x=0; x<=mh->xend-(mh->xorig/8*8); ){ flagA= mh->flagadata[mh->flagapos/8] & (0x80 >> (mh->flagapos & 0x07) ); mh->flagapos++; if( flagA ){ flagB= mh->flagbdata[mh->flagbpos++]; }else{ flagB= 0; } flag[x] ^= flagB>>4; x+=4;j++; flag[x] ^= flagB & 0x0F; x+=4;j++; } return j; } /*This Function Requires Blank XImage*/ Bool pho_load_pixel(XImage *image,XColor *pallet,char *filename){ int i,j,k,l; static const int shift[4]={0,2,1,3};/*B,R,G,E*/ struct timidity_file *fp; char buffer[640/8]; if((fp=wrd_open_file(filename))==NULL) return False; for(l=0;l<4;l++){ for(i=0;i<400;i++){ if(tf_read(buffer,sizeof(buffer),1,fp)==0){ goto close; } for(j=0;jflagapos=mh->flagbpos=pxlpos=0; w=image->width; for( y=0; y<=mh->yend-mh->yorig; y++ ){ repl=read_flag_1line( mh,flag ); x=0; for( j=0; jpxldata[pxlpos]*256+mh->pxldata[pxlpos+1]; pxlpos+=2; for( i=3; i>=0; i-- ){ if(x+i < w) XPutPixel(image,x+i, y, pallet[pixels & 0x000F].pixel); pixels >>= 4; } } else { dx=DX[flag[x]]; dy=DY[flag[x]]; for(i=0;i<4;i++) { if(x+i < w) XPutPixel(image,x+i,y,XGetPixel(image,x+dx+i,y+dy)); } } x+=4; } } } void mag_deletetab(void) { if(top!=NULL){ mag_delete(top); } top=NULL; } static void mag_delete(magdata *mg){ if(mg->next!=NULL) mag_delete(mg->next); free(mg->filename); free(mg->flagadata); free(mg->flagbdata); free(mg->pxldata); free(mg); } magdata *mag_search(char *filename) { magdata *m; for(m=top;m!=NULL;m=m->next) if(strcmp(filename,m->filename)==0) return m; return NULL; } magdata *mag_create(char *file) { struct timidity_file *fp=NULL; int i; uint8 buffer[BUFSIZE]; int *pal; magdata mg,*res; struct magfilehdr mfh; int len,c,header_pos; char *flaga=NULL,*flagb=NULL,*pixels=NULL; if((res=mag_search(file))){ return res; } mg.filename=safe_malloc(strlen(file)+2); strcpy(mg.filename,file); fp=wrd_open_file(file); if(fp==NULL){ goto error; } header_pos=0; while((c=tf_getc(fp))!=0){ len=strlen(MAGSIG); if(header_poscmsg(CMSG_INFO,VERB_VERBOSE,"BAD SIGNATURE\n"); goto error; } } header_pos++; } /*READ FHDR*/ { if(tf_read(&mfh,sizeof(mfh),1,fp)==0){ fprintf(stderr,"FOO!\n"); goto error; } mg.machine=mfh.machine; mg.mflag=mfh.mflag; mg.scrmode=mfh.scrmode; mg.xorig=READSHORT(mfh.xorig); mg.yorig=READSHORT(mfh.yorig); mg.xend=READSHORT(mfh.xend); mg.yend=READSHORT(mfh.yend); mg.flagaoff=READLONG(mfh.flagaoff); mg.flagboff=READLONG(mfh.flagboff); mg.flagbsize=READLONG(mfh.flagbsize); mg.pxloff=READLONG(mfh.pxloff); mg.pxlsize=READLONG(mfh.pxlsize); } /*READ PALLET*/ pal=mg.pal+1; for(i=0;inext=top; top=res; return res; error: if(fp!=NULL) { close_file(fp); ctl->cmsg(CMSG_INFO,VERB_VERBOSE,"Mag error: %s\n", file); } free(mg.filename); if(flaga != NULL) free(flaga); if(flagb != NULL) free(flagb); if(pixels != NULL) free(pixels); return NULL; } TiMidity++-2.13.2/interface/x_mag.h0100644004711200001440000000306707421005040016077 0ustar tamukiusers/* TiMidity++ -- MIDI to WAVE converter and player Copyright (C) 1999-2002 Masanao Izumo Copyright (C) 1995 Tuukka Toivonen 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _X_MAG_H #define _X_MAG_H typedef struct _magdata{ char *filename; char machine; char mflag; char scrmode; int xorig; int yorig; int xend; int yend; long flagaoff; long flagboff; long flagbsize; long pxloff; long pxlsize; long flagapos; long flagbpos; uint8 *flagadata; uint8 *flagbdata; uint8 *pxldata; struct _magdata *next; #define PALSIZE 16 int pal[PALSIZE+1]; }magdata; extern magdata *mag_create(char *file); extern void mag_deletetab(void); extern magdata *mag_search(char *file); extern void mag_load_pixel(XImage *image,XColor *pallet,magdata *mh); extern Bool pho_load_pixel(XImage *image,XColor *pallet,char *filename); #endif TiMidity++-2.13.2/interface/dynamic_c.c0100644004711200001440000000627507421005040016731 0ustar tamukiusers/* TiMidity++ -- MIDI to WAVE converter and player Copyright (C) 1999-2002 Masanao Izumo Copyright (C) 1995 Tuukka Toivonen 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ /* dynamic_c.c Dynamic loading control mode */ #include #include #include #ifndef NO_STRING_H #include #else #include #endif #include "timidity.h" #include "common.h" #include "output.h" #include "controls.h" #include "dlutils.h" static int ctl_open(int using_stdin, int using_stdout); static void ctl_close(void); extern char *dynamic_interface_module(int id); static void ctl_event(){} /* Do nothing */ static int cmsg(int type, int verbosity_level, char *fmt, ...); static void *libhandle; static void (* ctl_close_hook)(void); ControlMode dynamic_control_mode = { "Dynamic interface", 0, 1,0,0,0, ctl_open, ctl_close, NULL, NULL, cmsg, ctl_event, }; static int cmsg(int type, int verbosity_level, char *fmt, ...) { va_list ap; if ((type==CMSG_TEXT || type==CMSG_INFO || type==CMSG_WARNING) && dynamic_control_mode.verbosityverbosity = dynamic_control_mode.verbosity; ctl->trace_playing = dynamic_control_mode.trace_playing; ctl->flags = dynamic_control_mode.flags; ctl_close_hook = ctl->close; ctl->close = dynamic_control_mode.close; /* ctl_close() */ return ctl->open(using_stdin, using_stdout); } static void ctl_close(void) { if(ctl_close_hook) { ctl_close_hook(); dl_free(libhandle); ctl_close_hook = NULL; } } TiMidity++-2.13.2/interface/mac_c.c0100644004711200001440000006676410125651535016071 0ustar tamukiusers/* TiMidity++ -- MIDI to WAVE converter and player Copyright (C) 1999-2002 Masanao Izumo Copyright (C) 1995 Tuukka Toivonen 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Macintosh interface for TiMidity by T.Nogami mac_c.c Macintosh control mode */ #ifdef HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ #include #include #include #include #include #include #include #include #include "timidity.h" #include "common.h" #include "output.h" #include "controls.h" #include "instrum.h" #include "playmidi.h" #include "mfnode.h" #include "miditrace.h" #ifdef SUPPORT_SOUNDSPEC #include "soundspec.h" #endif /* SUPPORT_SOUNDSPEC */ #include "mac_main.h" #include "mac_util.h" #include "mac_c.h" #ifdef MAC_USE_OMS #include "mac_oms.h" #endif // ******************************* static void ctl_refresh(void); static void ctl_total_time(int tt); static void ctl_master_volume(int mv); static void ctl_file_name(char *name); static void ctl_current_time(int ct, int v); static void ctl_note(int status, int ch, int note, int vel); static void ctl_volume(int channel, int val); static void ctl_expression(int channel, int val); static void ctl_panning(int channel, int val); static void ctl_sustain(int channel, int val); static void ctl_pitch_bend(int channel, int val); static void ctl_reset(void); static int ctl_open(int using_stdin, int using_stdout); static void ctl_pass_playing_list(int number_of_files, char *list_of_files[]); static void ctl_close(void); static int ctl_read(int32 *valp); static int cmsg(int type, int verbosity_level, char *fmt, ...); static void ctl_event(CtlEvent *e); /**********************************/ /* export the interface functions */ #define ctl mac_control_mode ControlMode ctl= { "mac interface", 'm', 1,1,0, 0, ctl_open, ctl_close, ctl_pass_playing_list, ctl_read, cmsg, ctl_event }; // *********************************************** Boolean gCursorIsWatch, gHasDragMgr; #define FILESTR_LEN 40 #define TIMESTR_LEN 10 char fileStr[FILESTR_LEN]="", timeStr[TIMESTR_LEN]=""; Rect rFileName={10,10, 26,140}, rTime={10,150, 26,200}, rLogo={38,5,94,98}, rVol={28,220,92,239}, rPlay={40,110,62,142}, rStop={40,145,62,177}, rPause={40,180,62,212}, rPrevious={70,110,92,142}, rForward={70,145,92,177}, rEject={70,180,92,212}, rLoop={8,210,28,240}; PicHandle logo, logoDown; //static RgnHandle receiveRgn; CIconHandle button[6], iconPlay, iconPause, iconVol, iconTab, iconNotLoop,iconLoop; static TEHandle gLogTE=0,gDocTE=0; /****************************************/ static Boolean recieveHiliting; pascal OSErr DragTrackingProc( DragTrackingMessage theMessage, WindowPtr /*window*/, void* /*theRefCon*/, DragReference /*drag*/) { switch (theMessage) { case kDragTrackingEnterWindow: SetPort(mac_PlayerWindow.ref); //ShowDragHilite(drag, receiveRgn, true); DrawPicture(logoDown, &rLogo); recieveHiliting=true; break; case kDragTrackingInWindow: break; case kDragTrackingLeaveWindow: if( recieveHiliting ) { SetPort(mac_PlayerWindow.ref); //HideDragHilite(drag); DrawPicture(logo, &rLogo); recieveHiliting=false; } break; } return noErr; } pascal OSErr DragReceiveFunc( WindowPtr /*window*/, void* /*theRefCon*/, DragReference drag) { long i; char* data; unsigned short numFlavors; Size dataSize; ItemReference theItem; unsigned short itemCount; FlavorType flavor; if( recieveHiliting ) { int oldListEnd=mac_n_files; CountDragItems(drag, &itemCount); for( i=1; i<=itemCount; i++) { GetDragItemReferenceNumber(drag, i, &theItem); if( noErr!=CountDragItemFlavors(drag, theItem, &numFlavors)) continue; if( noErr!=GetFlavorType(drag, theItem, 1, &flavor)) continue; if( noErr!=GetFlavorDataSize(drag, theItem, flavor, &dataSize)) continue; data= (char*)malloc(dataSize); if( data==0 ) continue; if( noErr!=GetFlavorData(drag, theItem, flavor, data, &dataSize, 0)) continue; if(flavor== flavorTypeHFS) AddHFS2PlayList((HFSFlavor*)data); free(data); } if( gShuffle ) ShuffleList( oldListEnd, mac_n_files); } return noErr; } // ***************************************************** #pragma mark - int open_window(MacWindow* macwin, short resID) { macwin->ref=GetNewCWindow(resID, 0, (WindowRef)-1); if( macwin->ref==0) mac_ErrorExit("\pCannot open Window!"); SetWRefCon(macwin->ref, (long)macwin); return 0; } void position_window(MacWindow* macwin) { Point p; p.h=macwin->X; p.v=macwin->Y; if( PtInRect(p, &qd.screenBits.bounds) ){ MoveWindow(macwin->ref, macwin->X, macwin->Y, true); } SizeWindow(macwin->ref, macwin->width, macwin->hight, 0); if( macwin->show ) ShowWindow(macwin->ref); } static void setsize_window(MacWindow* macwin) { SizeWindow(macwin->ref, macwin->width, macwin->hight, 0); } void goaway_default(MacWindow* macwin) { HideWindow(macwin->ref); macwin->show=false; } void close_default(MacWindow* macwin) { Point p; Rect r; //Get Log Window position SetPortWindowPort(macwin->ref); p.v=p.h=0; LocalToGlobal(&p); macwin->X=p.h, macwin->Y=p.v; r= GetWindowPort(macwin->ref)->portRect; macwin->width= r.right-r.left; macwin->hight= r.bottom-r.top; } // ***************************************************** #pragma mark - #pragma mark =================Player Window static int open_PlayerWin(); static void click_PlayerWin(Point local, short modifiers); static void update_PlayerWin(); static void goaway_PlayerWin(MacWindow*); static int message_PlayerWin(int message, long param); #define win mac_PlayerWindow MacWindow win={ 0, //WindowRef open_PlayerWin, click_PlayerWin, update_PlayerWin, goaway_PlayerWin, close_default, message_PlayerWin, 1, 10,50 }; void mac_setVolume(short amplitude) { SndCommand theCmd; if( amplitude<0 ) amplitude=0; if( amplitude>255 ) amplitude=255; theCmd.cmd=ampCmd; theCmd.param1=amplitude; SndDoImmediate(gSndCannel, &theCmd); } void DoVolume() { short lastAmp=mac_amplitude; //SndCommand theCmd; Point p; SetPortWindowPort(win.ref); GetMouse(&p); /*GlobalToLocal(&p);*/ if( PtInRect(p, &rVol) && FrontWindow()==win.ref ) { mac_amplitude=255*((double)rVol.bottom-10-p.v)/(rVol.bottom-rVol.top-20); if( mac_amplitude<0 ) mac_amplitude=0; if( mac_amplitude>255 ) mac_amplitude=255; if( lastAmp!=mac_amplitude ) { //theCmd.cmd=ampCmd; //theCmd.param1=mac_amplitude; //SndDoImmediate(gSndCannel, &theCmd); mac_setVolume(mac_amplitude); InvalRect(&rVol); } } } void DrawButton() { SetPortWindowPort(win.ref); PlotCIcon(&rPlay, skin_state==PLAYING || skin_state==PAUSE? iconPlay:button[0] ); PlotCIcon(&rStop, button[1]); PlotCIcon(&rPause, skin_state==PAUSE? iconPause:button[2] ); PlotCIcon(&rPrevious, button[3]); PlotCIcon(&rForward, button[4]); PlotCIcon(&rEject, button[5]); } static void DrawFileStr() { SetPortWindowPort(win.ref); TETextBox(fileStr, strlen(fileStr), &rFileName, teCenter); } static void DrawTimeStr() { SetPortWindowPort(win.ref); TETextBox(timeStr, strlen(timeStr), &rTime, teCenter); } static int open_PlayerWin() /*success-> return 0;*/ { int i; OSErr err; RGBColor back={0,0,0}, fore={65535,65535,65535}; open_window( &win, kPlayerWinID); position_window(&win); SetPortWindowPort(win.ref); RGBForeColor(&fore); RGBBackColor(&back); logo= GetPicture(128); logoDown= GetPicture(132); for(i=0; i<6; i++) button[i]= GetCIcon(i+200); iconPlay=GetCIcon(210); iconPause=GetCIcon(211); iconVol=GetCIcon(206); iconTab=GetCIcon(207); iconNotLoop=GetCIcon(208); iconLoop=GetCIcon(209); if(gHasDragMgr) { //receiveRgn=NewRgn(); //if( receiveRgn ) { //GetWindowContentRgn(win.ref, receiveRgn); err=InstallTrackingHandler(NewDragTrackingHandlerProc(DragTrackingProc), (WindowPtr)win.ref, 0); if(err) ExitToShell(); err=InstallReceiveHandler(NewDragReceiveHandlerProc(DragReceiveFunc), (WindowPtr)win.ref, 0); if(err) ExitToShell(); } } return 0; } static void click_PlayerWin(Point p, short /*modifiers*/) { if( PtInRect(p, &rStop)){ mac_rc=RC_QUIT; ctl_current_time(0,0); } else if( PtInRect(p, &rPlay)){ mac_rc=RC_CONTINUE; } else if( PtInRect(p, &rPause)){ mac_rc=RC_TOGGLE_PAUSE; } else if( PtInRect(p, &rPrevious)){ mac_rc=RC_PREVIOUS; } else if( PtInRect(p, &rForward)){ mac_rc=RC_NEXT; } else if( PtInRect(p, &rEject)){ if( skin_state==PLAYING ) mac_rc=RC_QUIT; skin_state=WAITING; mac_n_files=nPlaying=0; fileStr[0]=timeStr[0]=0; init_ListWin(); update_PlayerWin(); } else if( PtInRect(p, &rLoop)){ skin_f_repeat=!skin_f_repeat; SetPortWindowPort(win.ref); InvalRect(&rLoop); return; } /* don't call mac_HandleControl();*/ else if( PtInRect(p, &rVol)) DoVolume(); else return; /* no button click*/ /* if button clicked */ mac_HandleControl(); } static void update_PlayerWin() { short y=((double)mac_amplitude/255)*(rVol.bottom-rVol.top-20); Rect rFrame,rTab; SetPortWindowPort(win.ref); DrawButton(); skin_f_repeat? PlotCIcon(&rLoop, iconLoop):PlotCIcon(&rLoop, iconNotLoop); PlotCIcon(&rVol, iconVol); SetRect(&rTab, rVol.left+2, rVol.top+49-y, rVol.right-2, rVol.top+59-y); PlotCIcon(&rTab, iconTab); rFrame=rFileName; InsetRect(&rFrame, -2, -2); DrawPicture(GetPicture(129), &rFrame); rFrame=rTime; InsetRect(&rFrame, -2, -2); DrawPicture(GetPicture(130), &rFrame); DrawPicture(logo, &rLogo); DrawTimeStr(); DrawFileStr(); } static void goaway_PlayerWin(MacWindow *macwin) { Do_Quit(); } static int message_PlayerWin(int /*message*/, long /*param*/) { return -1; } #undef win // ***************************************************** #pragma mark - #pragma mark ==================Log Window static int open_LogWin(); static void click_LogWin(Point local, short modifiers); static void update_LogWin(); static int message_LogWin(int message, long param); #define win mac_LogWindow MacWindow win={ 0, //WindowRef open_LogWin, click_LogWin, update_LogWin, goaway_default, close_default, message_LogWin, 1, 270,60, 300,200 }; static void PrintLogStr(char str[]) { int len=strlen(str); if( !mac_LogWindow.show ) return; if( (**gLogTE).teLength > 10000) /* clear first half*/ { TEFeatureFlag(teFAutoScroll, teBitClear, gLogTE); TESetSelect(0, 5000, gLogTE); TEDelete(gLogTE); } TESetSelect((**gLogTE).teLength, (**gLogTE).teLength, gLogTE); /* move to end*/ if( len>=1 && str[len-1]=='\n' ){ str[len-1]=0; len--; //convert dos return code to mac's } TEInsert(str, len, gLogTE); TESelView(gLogTE); TEFeatureFlag(teFAutoScroll, teBitSet, gLogTE); } static int open_LogWin() /*success-> return 0;*/ { open_window(&win, kLogWinID); position_window(&win); setsize_window(&win); SetPortWindowPort(win.ref); TextSize(10); gLogTE=TENew(&win.ref->portRect, &win.ref->portRect); if( gLogTE==0 ) mac_ErrorExit("\ppCannot open LogWindow!"); TEFeatureFlag(teFAutoScroll, teBitSet, gLogTE); TEActivate(gLogTE); return 0; } static void click_LogWin(Point local, short /*modifiers*/) { TEClick(local, 0, gLogTE); } static void update_LogWin() { SetPortWindowPort(win.ref); TEUpdate(&win.ref->portRect, gLogTE); } static int message_LogWin(int message, long /*param*/) { Rect rect; switch(message){ case MW_GROW: rect=win.ref->portRect; //rect.right-=15; rect.bottom-=15; rect = win.ref->portRect; rect.right -= 15; //rect.bottom -= 15; (**gLogTE).viewRect= (**gLogTE).destRect= rect; (**gLogTE).destRect.right = (**gLogTE).destRect.right - 14; TECalText(gLogTE); TESetSelect((**gLogTE).teLength, (**gLogTE).teLength, gLogTE); return 0; } return -1; //not supported } #undef win // ***************************************************** #pragma mark - #pragma mark ==================List Window ListHandle gPlaylist; static int open_ListWin(); static void click_ListWin(Point local, short modifiers); static void update_ListWin(); static int message_ListWin(int message, long param); enum{ MW_LIST_SELECT= 0x00010001, MW_DOC_SET= 0x00020001 }; #define win mac_ListWindow MacWindow win={ 0, //WindowRef open_ListWin, click_ListWin, update_ListWin, goaway_default, close_default, message_ListWin, 1, 100,100, 300,200 }; void change_ListRow( short row, const MidiFile* file) { Point aCell; char buf[256]="",*p; if( file && file->mfn && file->mfn->title ) { strncpy(buf, file->mfn->title, sizeof(buf) - 1); buf[sizeof(buf)-1] = '\0'; } p= strrchr(file->filename, PATH_SEP); if( p ){ size_t len = strlen(buf); char* q = buf[len]; /* last */ snprintf(buf, 256-len-1, " (%s)", p+1); buf[sizeof(buf)-1] = '\0'; } SetPt(&aCell, 0, row); LSetCell( buf, strlen(buf), aCell, gPlaylist); } void add_ListWin(MidiFile * file) { short rowNum=1; //Str255 fullPath; //GetFullPath(&file->spec, fullPath); file->mfn=make_new_MFnode_entry(file->filename); rowNum = (**gPlaylist).dataBounds.bottom; rowNum = LAddRow(1, rowNum, gPlaylist); change_ListRow( rowNum, file); } void init_ListWin() { short rowNum= (**gPlaylist).dataBounds.bottom; SetPortWindowPort(win.ref); LDelRow(0, 0, gPlaylist); } static int open_ListWin() /*success-> return 0;*/ { Rect listRect, dataBounds; Point cSize; open_window(&win, kListWinID); position_window(&win); setsize_window(&win); SetPortWindowPort(win.ref); TextSize(10); listRect=win.ref->portRect; listRect.right-=14; listRect.bottom-=14; dataBounds.top=dataBounds.left=0; dataBounds.right=1; dataBounds.bottom=0; cSize.h=1024; cSize.v=14; gPlaylist = LNew(&listRect, &dataBounds, cSize, 0, win.ref, 1, 1, 0, 1); return 0; } static void click_ListWin(Point local, short modifiers) { Boolean doubleclick; Cell cell; SetPortWindowPort(win.ref); doubleclick=LClick(local, modifiers, gPlaylist); if(doubleclick){ mac_rc=RC_LOAD_FILE; cell = LLastClick(gPlaylist); nPlaying=cell.v; mac_HandleControl(); } } static void update_ListWin() { SetPortWindowPort(win.ref); LUpdate( win.ref->visRgn, gPlaylist); DrawGrowIcon(win.ref); } static int message_ListWin(int message, long param) { Cell cell; Rect rect; switch(message){ case MW_GROW: rect=win.ref->portRect; LSize(rect.right-14, rect.bottom-14, gPlaylist); return 0; case MW_LIST_SELECT: LDeselectAll(gPlaylist); cell.h=0; cell.v=param; LSetSelect(true, cell, gPlaylist); LAutoScroll(gPlaylist); return 0; } return -1; //not supported } #undef win // ***************************************************** #pragma mark - #pragma mark ==================Doc Window static int open_DocWin(); static void click_DocWin(Point local, short modifiers); static void update_DocWin(); static void close_DocWin(); static int message_DocWin(int message, long param); #define win mac_DocWindow MacWindow win={ 0, //WindowRef open_DocWin, click_DocWin, update_DocWin, goaway_default, close_default, message_DocWin, 0, 150,150, 300,200 }; static void PrintDocStr(char str[]) { if( (**gDocTE).teLength > 10000) /* clear first half*/ { TESetSelect(0, 5000, gDocTE); TEDelete(gDocTE); } TESetSelect((**gDocTE).teLength, (**gDocTE).teLength, gDocTE); /* move to end*/ TEInsert(str, strlen(str), gDocTE); TESelView(gDocTE); } static int open_DocWin() /*success-> return 0;*/ { Rect r; open_window(&win, kDocWinID); position_window(&win); setsize_window(&win); SetPortWindowPort(win.ref); TextSize(10); r=win.ref->portRect; r.right-=16; gDocTE=TENew(&r, &r); if( gDocTE==0 ) mac_ErrorExit("\pCannot open DocWindow!"); TEFeatureFlag(teFAutoScroll, teBitSet, gDocTE); TEActivate(gDocTE); return 0; } static void click_DocWin(Point local, short /*modifiers*/) { TEClick(local, 0, gDocTE); } static void update_DocWin() { SetPortWindowPort(win.ref); DrawGrowIcon(win.ref); TEUpdate(&win.ref->portRect, gDocTE); } static int message_DocWin(int message, long param) { switch(message){ case MW_GROW: { Rect rect; rect=win.ref->portRect; //rect.right-=15; rect.bottom-=15; rect = win.ref->portRect; rect.right -= 16; //rect.bottom -= 15; (**gDocTE).viewRect= (**gDocTE).destRect= rect; //(**gDocTE).destRect.right = (**gDocTE).destRect.right - 14; TECalText(gDocTE); TESetSelect((**gDocTE).teLength, (**gDocTE).teLength, gDocTE); return 0; } case MW_DOC_SET: { const char *midiname=(char*)param; char *p, docname[256]; //midiname= (char*)param; strcpy(docname, midiname, 256); if((p = strrchr(docname, '.')) == NULL){ return 0; } else if(p - docname >= 256 - 4) { /* cannot strcpy: that cause buffer overrun */ } if('A' <= p[1] && p[1] <= 'Z') strcpy(p + 1, "DOC"); else strcpy(p + 1, "doc"); TEReadFile( docname, gDocTE ); break; } } return -1; //not supported } #undef win // ***************************************************** #pragma mark - #pragma mark ================== spec Window static int open_SpecWin(); static void click_SpecWin(Point local, short modifiers); static void update_SpecWin(); static void goaway_SpecWin(MacWindow*); static int message_SpecWin(int message, long param); #define win mac_SpecWindow MacWindow win={ 0, //WindowRef open_SpecWin, click_SpecWin, update_SpecWin, goaway_SpecWin, close_default, message_SpecWin, 0, 100,100 }; static int open_SpecWin() /*success-> return 0;*/ { #ifdef SUPPORT_SOUNDSPEC open_window(&win, kSpecWinID); position_window(&win); //always //if( win.show ){ //Preference on open_soundspec(); soundspec_update_wave(NULL, 0); //} #endif /* SUPPORT_SOUNDSPEC */ return 0; } static void click_SpecWin(Point /*local*/, short /*modifiers*/) { } static void update_SpecWin() { SetPortWindowPort(win.ref); } static void goaway_SpecWin(MacWindow *macwin) { goaway_default(macwin); //close_soundspec(); } static int message_SpecWin(int message, long /*param*/) { Rect rect; switch(message){ case MW_GROW: rect=win.ref->portRect; //rect.right-=15; rect.bottom-=15; rect = win.ref->portRect; rect.right -= 15; //rect.bottom -= 15; return 0; } return -1; //not supported } #undef win // ***************************************************** #pragma mark - static MacWindow* WindowList[]={ &mac_PlayerWindow, &mac_LogWindow, &mac_ListWindow, &mac_WrdWindow, &mac_DocWindow, &mac_SpecWindow, &mac_TraceWindow, &mac_SkinWindow, 0 }; void DoUpdate(WindowRef win_ref) { MacWindow* macwin; macwin = (MacWindow*)GetWRefCon(win_ref); if( macwin ) macwin->update(); } static void mac_AdjustMenus(short modifiers) { MenuHandle filenemu=GetMenu(mFile), synthemu=GetMenu(mSynth); //CheckItem(filenemu, iLogWindow & 0xFFFF, gShowMsg); //CheckItem(filenemu, iListWindow & 0xFFFF, gShowList); //CheckItem(filenemu, iWrdWindow & 0xFFFF, gShowWrd); if( modifiers & optionKey ){ //EnableItem(filenemu, iSkinWindow); EnableItem(synthemu, iQuickTime); EnableItem(synthemu, iOMS); } } void HandleMouseDown(EventRecord *event) { short part; WindowRef window; MacWindow *macwin; Rect growRect={100,100,32000,32000}; long size; part=FindWindow(event->where, &window); macwin = (MacWindow*)GetWRefCon(window); switch(part) { case inMenuBar: mac_AdjustMenus(event->modifiers); mac_HandleMenuSelect(MenuSelect(event->where), event->modifiers); HiliteMenu(0); break; case inContent: SetPortWindowPort(window); SelectWindow(window); GlobalToLocal(&event->where); if(macwin) macwin->click(event->where, event->modifiers); break; case inDrag: DragWindow(window, event->where, &qd.screenBits.bounds); break; case inGrow: SetPortWindowPort(window); size=GrowWindow(window, event->where, &growRect); if( size ) { SizeWindow(window, size&0x0000FFFF, size>>16, 0); EraseRect(&GetWindowPort(window)->portRect); InvalRect(&GetWindowPort(window)->portRect); if( macwin ) macwin->message(MW_GROW, size); } break; case inGoAway: if( TrackGoAway(window, event->where) ){ if( macwin ){ macwin->goaway(macwin); } } break; //case inZoomIn: //case inZoomOut: // break; } } // ***************************************************** #pragma mark - #pragma mark ===============control function static int ctl_open(int /*using_stdin*/, int /*using_stdout*/) /*success-> return 0;*/ { int i, err; for(i=0; WindowList[i]; i++){ err=WindowList[i]->open(); if(err) break; } if( !err ) ctl.opened=1; return err; } static void ctl_close(void) { int i; for( i=0; WindowList[i]; i++ ){ WindowList[i]->close(WindowList[i]); } ctl.opened=0; return; } static void ctl_pass_playing_list(int init_number_of_files, char * /*init_list_of_files*/ []) { EventRecord event; if( init_number_of_files!=0 ){ cmsg(CMSG_FATAL, VERB_NORMAL, "ctl_pass_playing_list: Sorry. Fatal error."); } #ifdef MAC_USE_OMS mac_oms_setup(); #endif { FSSpec spec; OSErr err; err=FSMakeFSSpec(0, 0, MAC_STARTUP_FOLDER_NAME, &spec); if( err==noErr ){ mac_add_fsspec( &spec ); } } gQuit=false; while(!gQuit) { WaitNextEvent(everyEvent, &event, 1,0); mac_HandleEvent(&event); } Do_Quit(); } static Boolean UserWantsControl() { /* Mouse downor key down*/ KeyMap km; GetKeys(km); km[1] &= ~0x02; /* exclude caps lock */ return Button() || km[0]|| km[1] || km[2] || km[3] || skin_state==PAUSE; } static int ctl_read(int32* /*valp*/) { int ret; //if( gCursorIsWatch ){ gCursorIsWatch=false; InitCursor(); } if( gQuit ) Do_Quit(); /* Quit Apple event occured */ if( mac_rc ){ret=mac_rc; mac_rc=0; return ret;} if( !gBusy || UserWantsControl()){ YieldToAnyThread(); } return RC_NONE; } static void ctl_lyric(int lyricid) { char *lyric; lyric = event2string(lyricid); if(lyric == NULL) return; ctl.cmsg(CMSG_TEXT, VERB_VERBOSE, "%s", lyric + 1); } static void ctl_gslcd(int lyricid) { char *lyric; lyric = event2string(lyricid); if(lyric == NULL) return; if( lyric[0] == ME_GSLCD ){ int i,j, data, mask; char tmp[3]= "00"; lyric++; for( j=0; j<4; j++ ){ for( i=0; i<16; i++ ){ tmp[0]= lyric[0]; tmp[1]= lyric[1]; lyric+=2; sscanf(tmp, "%X", &data); mask=0x10; ctl_note((data&mask)? VOICE_ON:-1, i, 40+j*10, 127); ctl_note((data&mask)? VOICE_ON:-1, i, 41+j*10, 127); mask>>=1; ctl_note((data&mask)? VOICE_ON:-1, i, 42+j*10, 127); ctl_note((data&mask)? VOICE_ON:-1, i, 43+j*10, 127); mask>>=1; ctl_note((data&mask)? VOICE_ON:-1, i, 44+j*10, 127); ctl_note((data&mask)? VOICE_ON:-1, i, 45+j*10, 127); mask>>=1; ctl_note((data&mask)? VOICE_ON:-1, i, 46+j*10, 127); ctl_note((data&mask)? VOICE_ON:-1, i, 47+j*10, 127); mask>>=1; ctl_note((data&mask)? VOICE_ON:-1, i, 48+j*10, 127); ctl_note((data&mask)? VOICE_ON:-1, i, 49+j*10, 127); mask>>=1; } } return; } //else normal text ctl.cmsg(CMSG_TEXT, VERB_VERBOSE, "%s", lyric + 1); } static int cmsg(int type, int verbosity_level, char * fmt, ...) { #define BUFSIZE 1024 char buf[BUFSIZE]; va_list ap; if ((type==CMSG_TEXT || type==CMSG_INFO || type==CMSG_WARNING) && ctl.verbosityrate); mac_SkinWindow.message(MW_SKIN_TOTAL_TIME, tt/play_mode->rate); } static void ctl_master_volume(int /*mv*/) {} static void ctl_file_name(char *name) { int i; char *s; for( i=strlen(name); i>=0; i--) if( name[i]==PATH_SEP ) { s=&name[i]+1; //remove pathname break; } snprintf(fileStr, FILESTR_LEN, "%d. %s", nPlaying+1, s); if (ctl.verbosity>=0 || ctl.trace_playing){ DrawFileStr(); } mac_ListWindow.message(MW_LIST_SELECT, nPlaying); mac_DocWindow.message(MW_DOC_SET, (long)name); mac_trc_update_all_info(); mac_SkinWindow.message(MW_SKIN_FILENAME, (long)fileStr); } static void ctl_current_time(int current, int /*v*/) { static int lastSec=-1, lastYieldThread=-1; int mins, secs, realSecs; if( gStartTick==0 ) gStartTick=TickCount(); /*select*/ realSecs=(TickCount()-gStartTick)/60; /*real time*/ secs=current; if( secs!=lastSec && (skin_state==PLAYING || skin_state==PAUSE)) { lastSec=secs; mins=secs/60; secs-=mins*60; snprintf(timeStr, TIMESTR_LEN, "%02d:%02d", mins, secs); DrawTimeStr(); mac_trc_update_time(current,-1); mac_SkinWindow.message(MW_SKIN_TIME, lastSec); } if( realSecs!=lastYieldThread ){ lastYieldThread= realSecs; mac_trc_update_time(current,-1); mac_trc_update_voices(); if( (realSecs % (evil_level*evil_level))==0 ) YieldToAnyThread(); // YieldToAnyThread every 1sec } } static void ctl_note(int status, int ch, int note, int vel) { if( ! mac_TraceWindow.show ) return; if(note == -1) { //if(ctl.trace_playing && !midi_trace.flush_flag) // push_midi_trace0(update_indicator); return; } //push_midi_note(v_ctl_note, note); v_ctl_note( status, ch, note, vel); } static void ctl_program(int ch, int val, char *comm){mac_ctl_program(ch,val,comm);} static void ctl_volume(int /*channel*/, int /*val*/) {} static void ctl_expression(int /*channel*/, int /*val*/) {} static void ctl_panning(int /*channel*/, int /*val*/) {} static void ctl_sustain(int /*channel*/, int /*val*/) {} static void ctl_pitch_bend(int /*channel*/, int /*val*/) {} static void ctl_reset(void) { mac_ctl_reset_trc(); } static void ctl_event(CtlEvent *e) { switch(e->type) { case CTLE_NOW_LOADING: ctl_file_name((char *)e->v1); break; case CTLE_LOADING_DONE: break; case CTLE_PLAY_START: ctl_total_time((int)e->v1); break; case CTLE_PLAY_END: break; case CTLE_TEMPO: break; case CTLE_METRONOME: break; case CTLE_CURRENT_TIME: ctl_current_time((int)e->v1, (int)e->v2); break; case CTLE_NOTE: ctl_note((int)e->v1, (int)e->v2, (int)e->v3, (int)e->v4); break; case CTLE_MASTER_VOLUME: ctl_master_volume((int)e->v1); break; case CTLE_PROGRAM: ctl_program((int)e->v1, (int)e->v2, (char *)e->v3); break; case CTLE_VOLUME: ctl_volume((int)e->v1, (int)e->v2); break; case CTLE_EXPRESSION: ctl_expression((int)e->v1, (int)e->v2); break; case CTLE_PANNING: ctl_panning((int)e->v1, (int)e->v2); break; case CTLE_SUSTAIN: ctl_sustain((int)e->v1, (int)e->v2); break; case CTLE_PITCH_BEND: ctl_pitch_bend((int)e->v1, (int)e->v2); break; case CTLE_MOD_WHEEL: ctl_pitch_bend((int)e->v1, e->v2 ? -1 : 0x2000); break; case CTLE_CHORUS_EFFECT: break; case CTLE_REVERB_EFFECT: break; case CTLE_LYRIC: ctl_lyric((int)e->v1); break; case CTLE_GSLCD: ctl_gslcd((int)e->v1); break; case CTLE_REFRESH: ctl_refresh(); break; case CTLE_RESET: ctl_reset(); break; #ifdef SUPPORT_SOUNDSPEC case CTLE_SPEANA: ctl_speana_data((double *)e->v1, (int)e->v2); break; #endif /* SUPPORT_SOUNDSPEC */ } } TiMidity++-2.13.2/interface/mac_c.h0100644004711200001440000000435107421005040016043 0ustar tamukiusers/* TiMidity++ -- MIDI to WAVE converter and player Copyright (C) 1999-2002 Masanao Izumo Copyright (C) 1995 Tuukka Toivonen 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Macintosh interface for TiMidity by T.Nogami mac_c.h header for Macintosh control mode */ #ifndef MAC_C_H #define MAC_C_H void position_window(MacWindow* macwin); int open_window(MacWindow* macwin, short resID); void goaway_default(MacWindow* macwin); void close_default(MacWindow* macwin); void mac_ctl_reset_trc(); void mac_ctl_program(int ch, int val, void *comm); void v_ctl_note(int status, int ch, int note, int vel); void mac_trc_update_time( int cur_sec, int tot_sec ); void mac_trc_update_voices(); void mac_trc_update_all_info(); void mac_setVolume(short amplitude); void ctl_speana_data(double *val, int size); pascal OSErr DragTrackingProc( DragTrackingMessage theMessage, WindowPtr window, void* /*theRefCon*/, DragReference /*drag*/); pascal OSErr DragReceiveFunc( WindowPtr /*window*/, void* /*theRefCon*/, DragReference drag); enum{ MW_SKIN_LOAD_BMP, MW_SKIN_TOTAL_TIME, MW_SKIN_TIME, MW_SKIN_FILENAME }; #define SKIN_ACTION_PREV() {mac_rc=RC_PREVIOUS;mac_HandleControl();} #define SKIN_ACTION_PLAY() {mac_rc=RC_CONTINUE;mac_HandleControl();} #define SKIN_ACTION_PAUSE() {mac_rc=RC_TOGGLE_PAUSE;mac_HandleControl();} #define SKIN_ACTION_STOP() {mac_rc=RC_QUIT;mac_HandleControl();} #define SKIN_ACTION_NEXT() {mac_rc=RC_NEXT;mac_HandleControl();} #define SKIN_ACTION_EJECT() #define SKIN_ACTION_EXIT() #endif //MAC_C_H TiMidity++-2.13.2/interface/mac_mag.c0100644004711200001440000001652510003327272016372 0ustar tamukiusers/* TiMidity++ -- MIDI to WAVE converter and player Copyright (C) 1999-2002 Masanao Izumo Copyright (C) 1995 Tuukka Toivonen 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Macintosh interface for TiMidity by T.Nogami mac_mag.c Macintosh mag loader */ #ifdef HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ #include #include #include #include "timidity.h" #include "common.h" #include "wrd.h" #include "mac_wrdwindow.h" #include "mac_mag.h" #pragma mark ==mag_header typedef struct { uint8 header; uint8 machine_code; uint8 machine_depend_flag; uint8 screen_mode; uint16 x1,y1,x2,y2; uint32 offset_flagA; uint32 offset_flagB; uint32 size_flagB; uint32 offset_pixel; uint32 size_pixel; char filename[256]; int width, hight; long header_pos; uint8 flag[1280]; //for safty uint8 *flagA_work, *flagB_work; int flagA_pos, flagB_pos, pixel_pos; Ptr bitMap; int rowBytes; } Mag_Header; static void read_flagA_setup(Mag_Header * mh, struct timidity_file *tf ) { int readbytes; readbytes=mh->offset_flagB - mh->offset_flagA; mh->flagA_work=(uint8*)safe_malloc( readbytes ); tf_seek(tf, mh->header_pos + mh->offset_flagA, SEEK_SET); tf_read(mh->flagA_work, 1, readbytes, tf); mh->flagA_pos=0; } static void read_flagB_setup(Mag_Header * mh, struct timidity_file *tf ) { mh->flagB_work=(uint8*)safe_malloc( mh->size_flagB ); tf_seek(tf, mh->header_pos + mh->offset_flagB, SEEK_SET); tf_read(mh->flagB_work, 1, mh->size_flagB, tf); mh->flagB_pos=0; } static void read_flag_1line(Mag_Header * mh ) { int x, flagA,flagB; for( x=mh->x1; x<=mh->x2; ){ flagA= mh->flagA_work[mh->flagA_pos/8] & (0x80 >> (mh->flagA_pos & 0x07) ); mh->flagA_pos++; if( flagA ){ flagB= mh->flagB_work[mh->flagB_pos++]; }else{ flagB= 0; } mh->flag[x] ^= flagB>>4; x+=4; mh->flag[x] ^= flagB & 0x0F; x+=4; } } static void load_pixel(Mag_Header * mh, struct timidity_file *tf ) { int fpos,x,y,i, dx,dy; uint16 pixels; const int DX[]={0,-4,-8,-16, 0,-4, 0,-4,-8, 0,-4,-8, 0,-4,-8, 0}, DY[]={0, 0, 0, 0, -1,-1, -2,-2,-2, -4,-4,-4, -8,-8,-8, -16}; #define OUT_OF_DISP (x>=640 || y>=400) read_flagA_setup(mh, tf ); read_flagB_setup(mh, tf ); fpos= mh->header_pos + mh->offset_pixel; tf_seek(tf, fpos, SEEK_SET); for( y=mh->y1; y<=mh->y2; y++ ){ read_flag_1line( mh ); for( x=mh->x1; x<=mh->x2; x+=4 ){ if( mh->flag[x]==0 ){ tf_read(&pixels, 1, 2, tf); if( OUT_OF_DISP ) continue; for( i=3; i>=0; i-- ){ *(uint8*)(&mh->bitMap[y*mh->rowBytes+x+i])= (pixels & 0x000F); pixels >>= 4; } } else { if( OUT_OF_DISP ) continue; dx=DX[mh->flag[x]]; dy=DY[mh->flag[x]]; //*(uint32*)(&mh->bitMap[y*mh->rowBytes+x]) = //copy 4bytes, danger? // *(uint32*)(&mh->bitMap[(y+dy)*mh->rowBytes+ x+dx]); mh->bitMap[y*mh->rowBytes+x ]= mh->bitMap[(y+dy)*mh->rowBytes+ x+dx ]; mh->bitMap[y*mh->rowBytes+x+1]= mh->bitMap[(y+dy)*mh->rowBytes+ x+dx+1]; mh->bitMap[y*mh->rowBytes+x+2]= mh->bitMap[(y+dy)*mh->rowBytes+ x+dx+2]; mh->bitMap[y*mh->rowBytes+x+3]= mh->bitMap[(y+dy)*mh->rowBytes+ x+dx+3]; } } } } int mac_mag_load(const char* fn, int dx, int dy, PixMapHandle pixmap, int mode, Rect *imageRect) { // pixmap must be locked by caller // store imagerect in this function // no err -> return 0; else return 1; uint8 buf[80]; int ret,i, err=0; struct timidity_file *tf; static Mag_Header mag_header; RGBColor color; // if( strcmp( mag_header.filename, fn)==0 ){ // SetRect(imageRect, mag_header.x1, mag_header.y1, mag_header.x2+1, mag_header.y2+1); // return; //nothing to do // } if( (tf=wrd_open_file((char *)fn))==0 ) return 1; // initialize table memset(&mag_header, 0, sizeof(Mag_Header) ); strcpy( mag_header.filename, fn ); mag_header.bitMap = GetPixBaseAddr(pixmap); mag_header.rowBytes= (**pixmap).rowBytes & 0x1FFF; // magic string check ret=tf_read(buf, 1, 8,tf); if( ret!=8 || memcmp(buf, "MAKI02 ",8)!=0 ){ err=1; goto mac_mag_load_exit; } while( tf_getc(tf) != 0x1A ) //skip machine code,user name, comment /*nothing*/; mag_header.header_pos=tf_tell(tf); //get header position // read header ret=tf_read(&mag_header, 1, 32, tf); if( ret!=32 ) goto mac_mag_load_exit; //unexpected end of file //transrate endian mag_header.x1=LE_SHORT(mag_header.x1); mag_header.y1=LE_SHORT(mag_header.y1); mag_header.x2=LE_SHORT(mag_header.x2); mag_header.y2=LE_SHORT(mag_header.y2); mag_header.offset_flagA=LE_LONG(mag_header.offset_flagA); mag_header.offset_flagB=LE_LONG(mag_header.offset_flagB); mag_header.size_flagB=LE_LONG(mag_header.size_flagB); mag_header.offset_pixel=LE_LONG(mag_header.offset_pixel); mag_header.size_pixel=LE_LONG(mag_header.size_pixel); mag_header.x1 &= ~0x7; mag_header.x2 |= 0x7; if( dx!=WRD_NOARG ){ int width= mag_header.x2-mag_header.x1; mag_header.x1= dx; mag_header.x2= mag_header.x1+width; } if( dy!=WRD_NOARG ){ int hight= mag_header.y2-mag_header.y1; mag_header.y1= dy; mag_header.y2= mag_header.y1+hight; } mag_header.width=mag_header.x2-mag_header.x1+1; mag_header.hight=mag_header.y2-mag_header.y1+1; SetRect(imageRect, mag_header.x1, mag_header.y1, mag_header.x2+1, mag_header.y2+1); if( mag_header.screen_mode != 0 ){ goto mac_mag_load_exit; //not support mode } //read pallet for( i=0; i<16; i++){ ret=tf_read(buf, 1, 3, tf); if( ret!=3 ) goto mac_mag_load_exit; //unexpected end of file color.green=buf[0]*256; color.red=buf[1]*256; color.blue=buf[2]*256; dev_palette[17][i]=color; //(buf[1]>>4)*0x100 + (buf[0]>>4)*0x10 + (buf[2]>>4); } //ActivatePalette(qd.thePort); if( mode==0 || mode==1 ) load_pixel(&mag_header, tf ); mac_mag_load_exit: free(mag_header.flagA_work); free(mag_header.flagB_work); close_file(tf); return err; } // ********************************************************************** #pragma mark - int mac_pho_load(const char* fn, PixMapHandle pm) { // pixmap must be locked by caller uint8 buf[80]; int ret,i,j,x,y,rowBytes; struct timidity_file *tf; Ptr bitMap; SET_G_COLOR(0,graphicWorld[activeGraphics]); PaintRect(&portRect); if( (tf=wrd_open_file((char *)fn))==0 ) return 1; rowBytes= (**pm).rowBytes & 0x1FFF; bitMap = GetPixBaseAddr(pm); for( j=0; j<=3; j++){ for( y=0; y<400; y++){ for( x=0; x<640; ){ ret=tf_read(buf, 1, 1, tf); if( ret!=1 ) goto mac_mag_load_exit; //unexpected end of file //bitMap[y*rowBytes+x] &= 0x1F; for( i=7; i>=0; i--){ bitMap[y*rowBytes+x+i] |= ((buf[0] & 0x01)<>=1; } x+=8; } } } mac_mag_load_exit: close_file(tf); return 0; } TiMidity++-2.13.2/interface/mac_mag.h0100644004711200001440000000234007421005040016361 0ustar tamukiusers/* TiMidity++ -- MIDI to WAVE converter and player Copyright (C) 1999-2002 Masanao Izumo Copyright (C) 1995 Tuukka Toivonen 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Macintosh interface for TiMidity by T.Nogami mac_mag.h Macintosh mag loader */ #ifndef MAC_MAG_H #define MAC_MAG_H //#include int mac_mag_load(const char* fn, int dx, int dy, PixMapHandle pixmap, int mode, Rect *imageRect); int mac_pho_load(const char* fn, PixMapHandle pm); #endif //MAC_MAG_H TiMidity++-2.13.2/interface/mac_trace.c0100644004711200001440000002377207421005040016722 0ustar tamukiusers/* TiMidity++ -- MIDI to WAVE converter and player Copyright (C) 1999-2002 Masanao Izumo Copyright (C) 1995 Tuukka Toivonen 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Macintosh interface for TiMidity by T.Nogami mac_trace.c Macintosh trace window */ // includs #ifdef HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ #include "string.h" #include "timidity.h" #include "common.h" #include "output.h" #include "controls.h" #include "instrum.h" #include "playmidi.h" #include "miditrace.h" #include "bitset.h" #include "mfnode.h" //#include "aq.h" #include "mac_main.h" #include "mac_util.h" #include "mac_c.h" // macros & const #define UPPER_MERGIN 40 #define LEFT_MERGIN 130 #define CHANNEL_HIGHT 12 #define CHANNEL_WIDTH 4 #define win mac_TraceWindow #define COLS 80 const RGBColor black={0,0,0}; // global static int selected_channel = -1; static int current_voices=0; static Bitset channel_program_flags[MAX_CHANNELS]; static int scr_modified_flag = 1; /* delay flush for trace mode */ static int display_velocity_flag = 0; static const char note_name_char[12] = { 'c', 'C', 'd', 'D', 'e', 'f', 'F', 'g', 'G', 'a', 'A', 'b' }; // static function static int open_TraceWin(); static void click_TraceWin(Point local, short modifiers); static void update_TraceWin(); static void goaway_TraceWin(); static void close_TraceWin(); static int message_TraceWin(int message, long param); // **************************************************** static void init_trace_window_chan(int /*ch*/) { } static void DrawInstrumentName(int ch, char *comm) { char buf[80]; RGBColor black={0,0,0}; Rect box; SetPortWindowPort(win.ref); RGBForeColor(&black); //channel number MoveTo(2, UPPER_MERGIN+CHANNEL_HIGHT*(ch+1)-1); snprintf(buf, 80,"%2d", ch+1); DrawText(buf, 0, strlen(buf)); //InstrumentName box.top=UPPER_MERGIN+CHANNEL_HIGHT*ch; box.left=20; box.bottom=box.top+12; box.right=LEFT_MERGIN-10; if( !comm || !*comm ) EraseRect(&box); else TETextBox(comm, strlen(comm), &box, teFlushDefault); } static void mac_ctl_refresh_trc() { int i; Rect r; RGBColor black={0,0,0}, darkGray={0x2000,0x2000,0x2000}; if( !win.show ) return; SetPortWindowPort(win.ref); for( i=0; i<16; i++ ){ DrawInstrumentName(i, instr_comment[i].comm); } #define MAX_NOTE_NUM 120 r.top= UPPER_MERGIN; r.left= LEFT_MERGIN; r.bottom= r.top+CHANNEL_HIGHT*16; r.right= r.left+CHANNEL_WIDTH*MAX_NOTE_NUM; RGBForeColor(&darkGray); PaintRect(&r); //draw separater line RGBForeColor(&black); for(i=1; i<16; i++){ //horizontal MoveTo(LEFT_MERGIN, UPPER_MERGIN+CHANNEL_HIGHT*i-1); Line(CHANNEL_WIDTH*MAX_NOTE_NUM-1, 0); } for(i=12; i= 16) return; if(!ctl->trace_playing) return; if(IS_CURRENT_MOD_FILE) pr = val; else pr = val + progbase; //if(ctl_ncurs_mode == NCURS_MODE_TRACE) { if(ch == selected_channel) init_trace_window_chan(ch); else { //wmove(dftwin, NOTE_LINE+ch, COLS-21); if(ISDRUMCHANNEL(ch)) { //wattron(dftwin, A_BOLD); //wprintw(dftwin, " %03d", pr); //wattroff(dftwin, A_BOLD); } else //wprintw(dftwin, " %03d", pr); ; } } //if(comm != NULL) indicator_set_prog(ch, val, (char *)comm); //scr_modified_flag = 1; instr_comment[ch].last_note_on = 0.0; instr_comment[ch].comm = channel_instrum_name(ch); DrawInstrumentName(ch, instr_comment[ch].comm); } // **************************************************** #pragma mark - static void update_channel(int /*ch*/) { } static void update_filename() { char buf[256]=""; if( !mac_TraceWindow.show ) return; SetPortWindowPort(win.ref); if( mac_n_files>0 && nPlaying<=mac_n_files && fileList[nPlaying].mfn && fileList[nPlaying].mfn->file ) snprintf(buf, 256,"File: %s", fileList[nPlaying].mfn->file); RGBForeColor(&black); MoveTo(2,12); DrawText(buf, 0, strlen(buf)); } static void update_title() { char buf[256]=""; if( !mac_TraceWindow.show ) return; SetPortWindowPort(win.ref); if( mac_n_files>0 && nPlaying<=mac_n_files && fileList[nPlaying].mfn && fileList[nPlaying].mfn->title ) snprintf(buf, 256, "Title: %s", fileList[nPlaying].mfn->title); RGBForeColor(&black); MoveTo(2,24); DrawText(buf, 0, strlen(buf)); } void mac_trc_update_time( int cur_sec, int tot_sec ) { static int save_tot_sec=0, save_cur_sec; //int rate; char buf[80]; if( cur_sec!=-1 ) save_cur_sec=tot_sec; if( tot_sec!=-1 ) save_tot_sec=tot_sec; if( cur_sec==-1 ) cur_sec=0; if( cur_sec > save_tot_sec ) cur_sec=save_tot_sec; if( !win.show ) return; //rate = (int)(aq_filled_ratio() * 100 + 0.5); SetPortWindowPort(win.ref); snprintf(buf, 80," %3d:%02d /%3d:%02d " /*"buffering=%3d %% "*/ "buffer %d/256 ", cur_sec/60, cur_sec%60, save_tot_sec/60,save_tot_sec%60, /*rate,*/ mac_buf_using_num ); RGBForeColor(&black); MoveTo(400,12); DrawText(buf, 0, strlen(buf)); } void mac_trc_update_voices() { char buf[20]; static int prev=-1; if( !mac_TraceWindow.show ) return; SetPortWindowPort(win.ref); snprintf(buf, 20, "Voice %3d/%3d ", current_voices, voices); RGBForeColor(&black); MoveTo(450,24); DrawText(buf, 0, strlen(buf)); } void mac_trc_update_all_info() { Rect r; SetPortWindowPort(win.ref); SetRect(&r, 0,0, win.ref->portRect.right,UPPER_MERGIN); EraseRect(&r); mac_trc_update_voices(); update_filename(); update_title(); mac_trc_update_time(-1,-1); } // ***************************************************** #pragma mark - MacWindow win={ 0, //WindowRef open_TraceWin, click_TraceWin, update_TraceWin, goaway_default, close_default, message_TraceWin, 0, 120,120 }; static int open_TraceWin() /*success-> return 0;*/ { int i; open_window(&win, kTraceWinID); position_window(&win); mac_ctl_reset_trc(); for(i = 0; i < 16; i++) init_bitset(channel_program_flags + i, 128); return 0; } static void click_TraceWin(Point /*local*/, short /*modifiers*/) { } static void update_TraceWin() { SetPortWindowPort(win.ref); mac_ctl_refresh_trc(); mac_trc_update_all_info(); } static int message_TraceWin(int /*message*/, long /*param*/) { //Rect rect; //switch(message){ //} return -1; //not supported } const RGBColor vel_color[10]={ {0x0000, 0x0000, 0xFFFF}, //0:blue {0x0000, 0xFFFF, 0x0000}, //6;green {0x0000, 0x6666, 0xFFFF}, //1; {0x0000, 0xFFFF, 0x6666}, //5; {0x6666, 0xFFFF, 0x0000}, //7; {0x0000, 0x9999, 0xFFFF}, //2; {0x0000, 0xFFFF, 0x9999}, //4; {0x9999, 0xFFFF, 0x0000}, //8; {0x0000, 0xFFFF, 0xFFFF}, //3; {0xFFFF, 0xFFFF, 0x0000}, //9;yellow }; #define DARKEN2(c) (c.red/=2,c.green/=2,c.blue/=2) #define DARKEN4(c) (c.red/=4,c.green/=4,c.blue/=4) static unsigned int UpdateNote(int status, int ch, int note, int vel) { //int vel; Rect r1,r2; unsigned int onoff=0 /*, check, prev_check*/; const RGBColor dieColor= {0x3000,0x3000,0x3000}, //dark gray freeColor= {0x3000,0x3000,0x3000}, //dark gray onColor= {0xffff,0xffff,0}, //yellow sustainedColor={0x8000,0x8000,0}, //dark yellow offColor= {0x4000,0x4000,0}, //dark yellow noColor= {0x2000,0x2000,0x2000}; RGBColor color; vel=(10 * vel) / 128; /* 0-9 */ if( vel>9 ) vel=9; r1.left=r2.left= LEFT_MERGIN+CHANNEL_WIDTH* note; r1.right=r2.right= r1.left+CHANNEL_WIDTH-1; r1.top= UPPER_MERGIN+CHANNEL_HIGHT* ch; r1.bottom= r1.top+(9-vel); r2.top= r1.bottom; r2.bottom= r1.top+CHANNEL_HIGHT-1; SetPortWindowPort(win.ref); color=vel_color[vel]; switch(status){ case VOICE_DIE: DARKEN2(color); onoff = 1; break; case VOICE_FREE: color=freeColor; onoff = 0; break; case VOICE_SUSTAINED:DARKEN2(color); onoff = 1; break; case VOICE_OFF: DARKEN4(color); onoff = 1; break; case VOICE_ON: onoff = 1; break; default: color= noColor; break; } RGBForeColor(&freeColor); PaintRect(&r1); RGBForeColor(&color); PaintRect(&r2); return onoff; } //void v_ctl_note(struct MidiTraceNote v) void v_ctl_note(int status, int ch, int note, int vel) { int xl, n, c; unsigned int onoff=0, prev_onoff, check; Bitset *bitset; if( !mac_TraceWindow.show || ch >= 16) return; if( /*ctl_ncurs_mode != NCURS_MODE_TRACE ||*/ selected_channel == ch) return; scr_modified_flag = 1; if(display_velocity_flag) n = '0' + (10 * vel) / 128; else n = note_name_char[note % 12]; c = (COLS - 24) / 12 * 12; if(c <= 0) c = 1; xl=note % c; if( note>=MAX_NOTE_NUM ) return; onoff= UpdateNote( status, ch, note, vel); //draw at first bitset = channel_program_flags + ch; get_bitset(bitset, &prev_onoff, note, 1); onoff <<= (8 * sizeof(onoff) - 1); set_bitset(bitset, &onoff, note, 1); check = has_bitset(bitset); if( prev_onoff && !onoff ) current_voices--; if( !prev_onoff && onoff ){ current_voices++; mac_trc_update_voices(); } } #undef win TiMidity++-2.13.2/interface/mac_wrdwindow.c0100644004711200001440000003015410003327314017641 0ustar tamukiusers/* TiMidity++ -- MIDI to WAVE converter and player Copyright (C) 1999-2002 Masanao Izumo Copyright (C) 1995 Tuukka Toivonen 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Macintosh interface for TiMidity by T.Nogami mac_wrdwindow.c Macintosh graphics driver for WRD */ #ifdef HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ #include #include #include "timidity.h" #define ENTITY 1 #include "mac_wrdwindow.h" void dev_change_1_palette(int code, RGBColor color) { (**(**dispWorld->portPixMap).pmTable).ctTable[code].rgb=color; (**(**dispWorld->portPixMap).pmTable).ctSeed++; //CTabChanged( (**dispWorld->portPixMap).pmTable ); dev_palette[0][code]=color; //if( wrd_palette ){ // SetEntryUsage(wrd_palette, code, pmAnimated, 0x0000); // //SetEntryColor(wrd_palette, code, &color); // AnimateEntry(wrd_palette, code, &color); // SetEntryUsage(wrd_palette, code, pmTolerant, 0x0000); //} pallette_exist |= color.red; pallette_exist |= color.green; pallette_exist |= color.blue; } void dev_change_palette(RGBColor pal[16]) { // don't update graphics int i; //RGBColor color; pallette_exist=0; for( i=0; i<16; i++ ){ pallette_exist |= pal[i].red; pallette_exist |= pal[i].green; pallette_exist |= pal[i].blue; dev_change_1_palette( i, pal[i]); } //dev_remake_disp(portRect); //dev_redisp(portRect); } void dev_init_text_color() { int code; for( code=0; code<=7; code++){ //(**(**graphicWorld[0]->portPixMap).pmTable).ctTable[TCODE2INDEX(code)].rgb=textcolor[code]; //(**(**graphicWorld[1]->portPixMap).pmTable).ctTable[TCODE2INDEX(code)].rgb=textcolor[code]; (**(**dispWorld->portPixMap).pmTable).ctTable[TCOLOR_INDEX_SHIFT+code].rgb=textcolor[code]; //(**(**graphicWorld[0]->portPixMap).pmTable).ctSeed++; //(**(**graphicWorld[1]->portPixMap).pmTable).ctSeed++; (**(**dispWorld->portPixMap).pmTable).ctSeed++; } } static void expand_horizontality( PixMapHandle pixmap, int width, int height ) { //pixmap must be locked //for @TON(2) int x,y; Ptr baseAdr= GetPixBaseAddr(pixmap), xbase; int rowBytes= (**pixmap).rowBytes & 0x1FFF; for( y=0; y=0; x-- ){ xbase[x*2]= xbase[x*2+1]= xbase[x]; } } } void dev_draw_text_gmode(PixMapHandle pixmap, int x, int y, const char* s, int len, int pmask, int mode, int fgcolor, int bgcolor, int ton_mode) { //pixmap must be already locked GDHandle oldGD; GWorldPtr oldGW; int color, trans, width; Rect rect= {0,0,16,32}, destrect; GetGWorld(&oldGW, &oldGD); LockPixels(charbufWorld->portPixMap); SetGWorld(charbufWorld,0); trans=0; if( fgcolor==trans ) trans++; if( bgcolor==trans ) trans++; if( fgcolor==trans ) trans++; color= ( (mode&2)? bgcolor:trans ); dev_box(charbufWorld->portPixMap, rect, color, 0xFF); color= ( (mode&1)? fgcolor:trans ); charbufWorld->fgColor= color; TextMode(srcOr); MoveTo(0,13); DrawText(s,0,len); if( ton_mode==2 ){ expand_horizontality(charbufWorld->portPixMap, len*8, 16); } width= len*8; if( ton_mode==2 ) width*=2; rect.right=width; destrect.left=x; destrect.top=y; destrect.right=x+width; destrect.bottom=destrect.top+16; MyCopyBits(charbufWorld->portPixMap, pixmap, rect, destrect, 0x11/*trans*/, trans, pmask, 0, 0, NULL); SetGWorld(oldGW, oldGD); UnlockPixels(charbufWorld->portPixMap); } static void BlockMoveData_transparent(const void* srcPtr, void *destPtr, Size byteCount, int pmask, int trans) { int i, tmp; if( srcPtr>destPtr ){ for( i=0; i=0; i--){ if( ((char*)srcPtr)[i]!=trans ){ tmp=((char*)destPtr)[i]; tmp &= ~pmask; tmp |= ( ((char*)srcPtr)[i] & pmask); ((char*)destPtr)[i]= tmp; } } } } #define PMASK_COPY(s,d,pmask) ((d)=((d)&~(pmask))|((s)&(pmask))) static pascal void BlockMoveData_gmode(const void* srcPtr, void *destPtr, Size byteCount) { int i; const char* src=srcPtr; char* dest=destPtr; if( srcPtr>destPtr ){ for( i=0; i=0; i--){ PMASK_COPY(src[i],dest[i], gmode_mask); } } } static pascal void BlockMoveData_masktrans(const uint8* srcPtr, uint8 *destPtr, Size byteCount, int trans, int maskx, const uint8 maskdata[]) { #define BITON(x, data) (data[(x)/8]&(0x80>>((x)%8))) int i; if( srcPtr>destPtr ){ for( i=0; i=0; i--){ if( BITON(i%maskx, maskdata) ){ PMASK_COPY(srcPtr[i],destPtr[i], gmode_mask); } } } } #if __MC68K__ static pascal void mymemmove(const void* srcPtr, void * destPtr,Size byteCount) { memmove(destPtr, srcPtr, byteCount); } #define BlockMoveData mymemmove #endif void MyCopyBits(PixMapHandle srcPixmap, PixMapHandle dstPixmap, Rect srcRect, Rect dstRect, short mode, int trans, int pmask, int maskx, int masky, const uint8 maskdata[]) { //I ignore destRect.right,bottom int srcRowBytes= (**srcPixmap).rowBytes & 0x1FFF, destRowBytes= (**dstPixmap).rowBytes & 0x1FFF, y1, y2, width,hight, cut, dy, maskwidth; Ptr srcAdr= GetPixBaseAddr(srcPixmap), dstAdr= GetPixBaseAddr(dstPixmap); Rect srcBounds= (**srcPixmap).bounds, dstBounds= (**dstPixmap).bounds; //check params //chech src top if( srcRect.topsrcBounds.bottom ) return; //check left if( srcRect.left srcBounds.right ) return; //chech src bottom if( srcRect.bottom>srcBounds.bottom ){ cut= srcRect.bottom-srcBounds.bottom; srcRect.bottom-= cut; dstRect.bottom-=cut; } if( srcRect.bottomsrcBounds.right ){ cut= srcRect.right-srcBounds.right; srcRect.right-= cut; srcBounds.right-= cut; } if( srcRect.rightdstBounds.bottom ) return; //check hight if( dstRect.top+hight>dstBounds.bottom ){ hight=dstBounds.bottom-dstRect.top; srcRect.bottom=srcRect.top+hight; } //check left if( dstRect.left dstBounds.right ) return; //check width if( dstRect.left+width>dstBounds.right ) width=dstBounds.right-dstRect.left; switch( mode ){ case 0://srcCopy case 0x10: { pascal void (*func)(const void* srcPtr, void * destPtr,Size byteCount); if( pmask==0xFF ) func=BlockMoveData; else func= BlockMoveData_gmode; if( srcRect.top >= dstRect.top ){ for( y1=srcRect.top, y2=dstRect.top; y1=srcRect.top; y1--, y2-- ){ func( &(srcAdr[y1*srcRowBytes+srcRect.left]), &(dstAdr[y2*destRowBytes+dstRect.left]), width); } } } break; case 0x11://transparent if( srcRect.top >= dstRect.top ){ for( y1=srcRect.top, y2=dstRect.top; y1=srcRect.top; y1--, y2-- ){ BlockMoveData_transparent( &(srcAdr[y1*srcRowBytes+srcRect.left]), &(dstAdr[y2*destRowBytes+dstRect.left]), width, pmask, trans); } } break; case 0x30: case 0x31: // masking & transparent //sherry op=0x62 if( maskx<=0 ) break; maskwidth= ((maskx+7)& ~0x07)/8; //kiriage if( srcRect.top >= dstRect.top ){ for( y1=srcRect.top, y2=dstRect.top, dy=0; y1=srcRect.top; y1--, y2--,dy+=masky-1, dy%=masky ){ BlockMoveData_masktrans( (uint8 *)&(srcAdr[y1*srcRowBytes+srcRect.left]), (uint8 *)&(dstAdr[y2*destRowBytes+dstRect.left]), width, trans, maskx, &maskdata[maskwidth*dy]); } } break; } } void dev_line(int x1, int y1, int x2, int y2, int color, int style, int pmask, PixMapHandle pixmap ) { int i, dx, dy, s, step; int rowBytes= (**pixmap).rowBytes & 0x1FFF; Ptr baseAdr= GetPixBaseAddr(pixmap); Rect bounds= (**pixmap).bounds; Point pt; static const int mask[8]={0x80,0x40,0x20,0x10, 0x08,0x04,0x02,0x01}; int style_count=0; #define DOT(x,y,col) {Ptr p=&baseAdr[y*rowBytes+x]; pt.h=x;pt.v=y; \ if(PtInRect(pt,&bounds)){(*p)&=~pmask; (*p)|=col;} } color &= pmask; step= ( (x1dy ){ if( x1>x2 ){ x1=x2; y1=y2; } if(style & mask[style_count]){ DOT(x1,y1,color); } //else { DOT(x1,y1,0); } style_count= (style_count+1)%8; s= dx/2; for(i=x1+1; iy2 ){ x1=x2; y1=y2; } if(style & mask[style_count]){ DOT(x1,y1,color); } //else{ DOT(x1,y1,0); } style_count= (style_count+1)%8; s= dy/2; for(i=y1+1; ibounds.bottom ) return; //check left if( rect.left bounds.right ) return; //chech src bottom if( rect.bottom>bounds.bottom ){ rect.bottom= bounds.bottom; } if( rect.bottombounds.right ){ rect.right= bounds.right; } if( rect.rightportPixMap); { short fontID; SetGWorld( world, 0); GetFNum(fontname, &fontID); TextFont(fontID); TextSize(14); TextFace(extend/*|bold*/); } SetGWorld(oldGW, oldGD); UnlockPixels(world->portPixMap); } TiMidity++-2.13.2/interface/mac_wrdwindow.h0100644004711200001440000001235407421005040017647 0ustar tamukiusers/* TiMidity++ -- MIDI to WAVE converter and player Copyright (C) 1999-2002 Masanao Izumo Copyright (C) 1995 Tuukka Toivonen 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Macintosh interface for TiMidity by T.Nogami mac_wrdwindow.h Macintosh graphics driver for WRD */ #ifndef MAC_GRF_H #define MAC_GRF_H #include "png.h" #include "wrd.h" #if ENTITY #define EXTERN /*entitiy*/ #else #define EXTERN extern #endif static const RGBColor black={0,0,0},white={0xFFFF,0xFFFF,0xFFFF}; #define BASE_X 8 #define BASE_Y 16 #define LINES 25 #define COLS 80 #define SIZEX 640 #define SIZEY 400 // for graphics EXTERN GWorldPtr graphicWorld[8], dispWorld, charbufWorld; #define GACTIVE_PIX (graphicWorld[activeGraphics]->portPixMap) #define GDISP_PIX (graphicWorld[dispGraphics]->portPixMap) #define DISP_PIX (dispWorld->portPixMap) EXTERN int gmode_mask, gmode_mask_gline, dev_gon_flag, dev_redrawflag; #define DEV_SET_GMODE(mask) (gmode_mask=gmode_mask_gline=(mask)) EXTERN RGBColor dev_palette[20][17]; EXTERN int startpal, endpal; //for @FADE //for text EXTERN char char_vram[25+1][80+2]; EXTERN int wrd_ton; #define CHAR_VRAM(x,y) (char_vram[y][x]) EXTERN char char_color_vram[25+1][80+1]; #define CHAR_COLOR_VRAM(x,y) (char_color_vram[y][x]) EXTERN char multi_byte_flag[25+1][80+1]; #define MULTI_BYTE_FLAG(x,y) (multi_byte_flag[y][x]) //...Umm EXTERN int activeGraphics, dispGraphics, gvram_bank_num; #define WRD_LOCX(x) (((x)-1)*BASE_X) #define WRD_LOCY(y) ((y)*BASE_Y-3) #define WRD_MOVE_COURSOR_TMP(x,y) MoveTo( WRD_LOCX(x), WRD_LOCY(y) ) #define IS_MULTI_BYTE(c) ( ((c)&0x80) && ((0x1 <= ((c)&0x7F) && ((c)&0x7F) <= 0x1f) ||\ (0x60 <= ((c)&0x7F) && ((c)&0x7F) <= 0x7c))) #define SYNC_DISP(rect) (CopyBits((BitMap*)&DISP_PIX, &win.ref->portBits, \ &(rect), &(rect), srcCopy,0)) //make visible Graphics #define LOCK_ALL_PIXMAP() (LockPixels(GDISP_PIX),LockPixels(GACTIVE_PIX),LockPixels(DISP_PIX)) #define UNLOCK_ALL_PIXMAP() (UnlockPixels(GDISP_PIX),UnlockPixels(GACTIVE_PIX),UnlockPixels(DISP_PIX)) #define SET_G_COLOR(code,world) ((world)->fgColor=(code)) EXTERN int pallette_exist, fading; EXTERN int wrd_coursor_x,wrd_coursor_y; EXTERN int wrd_text_color_attr; #define CATTR_LPART (1) #define CATTR_16FONT (1<<1) #define CATTR_COLORED (1<<2) #define CATTR_BGCOLORED (1<<3) #define CATTR_TXTCOL_MASK_SHIFT 4 #define CATTR_TXTCOL_MASK (7<>CATTR_TXTCOL_MASK_SHIFT)+TCOLOR_INDEX_SHIFT) #define SET_T_COLOR(attr) (wrd_text_color_attr=(attr)) #define SET_T_RGBFORECOLOR_TMP(attr) (dispWorld->fgColor=TCODE2INDEX(attr)) void dev_init(int version); void dev_set_height(int height); void dev_redisp(Rect rect); void dev_remake_disp(Rect rect); void dev_draw_text_gmode(PixMapHandle pixmap, int x, int y, const char* s, int len, int pmask, int mode, int fgcolor, int bgcolor, int ton_mode); void dev_change_palette(RGBColor pal[16]); void dev_change_1_palette(int code, RGBColor color); void dev_init_text_color(); void MyCopyBits(PixMapHandle srcPixmap, PixMapHandle dstPixmap, Rect srcRect, Rect dstRect, short mode, int trans, int pmask, int maskx, int masky, const uint8 maskdata[]); void dev_gmove(int x1, int y1, int x2, int y2, int xd, int yd, GWorldPtr srcworld, GWorldPtr destworld, int sw, int trans, int mask, int maskx, int masky, const uint8 maskdata[]); void dev_box(PixMapHandle pixmap, Rect rect, int color, int pmask); void dev_line(int x1, int y1, int x2, int y2, int color, int style, int pmask, PixMapHandle pixmap ); void dev_gline(int x1, int y1, int x2, int y2, int p1, int sw, int p2, GWorldPtr world); void mac_setfont(GWorldPtr world, Str255 fontname); //#define WRD_FONTNAME "\p" #define WRD_FONTNAME "\pOsaka|" void sry_start(); void sry_end(); void sry_start(); void sry_update(); int mac_loadpng_pre( png_structp *png_ptrp, png_infop *info_ptrp, struct timidity_file * tf); int mac_loadpng(png_structp png_ptr, png_infop info_ptr, GWorldPtr world, RGBColor pal[256] ); void mac_loadpng_post(png_structp png_ptr, png_infop info_ptr); EXTERN Rect portRect #if ENTITY ={0,0,480,640} #endif ; EXTERN RGBColor textcolor[8] #if ENTITY ={{0x0000,0x0000,0x0000}, //0: black {0xFFFF,0x0000,0x0000}, //1:red {0x0000,0xFFFF,0x0000}, //2:green {0xFFFF,0xFFFF,0x0000}, //3:yellow {0x0000,0x0000,0xFFFF}, //4:blue {0xFFFF,0x0000,0xFFFF}, //5:purpl {0x0000,0xFFFF,0xFFFF}, //6:mizuiro {0xFFFF,0xFFFF,0xFFFF} } //7:white #endif ; #endif //MAC_GRF_H TiMidity++-2.13.2/interface/wrdt_mac.c0100644004711200001440000012200410125651536016604 0ustar tamukiusers/* TiMidity++ -- MIDI to WAVE converter and player Copyright (C) 1999-2002 Masanao Izumo Copyright (C) 1995 Tuukka Toivonen 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA wrdt_mac.c Written by by T.Nogami */ #ifdef HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ #include #include #ifndef NO_STRING_H #include #else #include #endif #include "timidity.h" #include "common.h" #include "instrum.h" #include "playmidi.h" #include "readmidi.h" #include "controls.h" #include "wrd.h" #include "VTparse.h" //#include #include "mac_main.h" #include "mac_c.h" #include "mac_wrdwindow.h" #include "mac_mag.h" #include "mac_wrd.h" #include "aq.h" static int wrd_argc; //static int wrd_args[WRD_MAXPARAM]; static int inkey_flag; //#define WRD_DEBUG(x) ctl->cmsg x #define WRD_DEBUG(x) /*nothing*/ static int wrdt_open(char *wrdt_opts); static void wrdt_apply(int cmd, int wrd_argc, int wrd_args[]); static void wrdt_update_events(void); static int wrdt_start(int wrdflag) { if( wrdflag ){ #ifdef ENABLE_SHERRY sry_start(); #endif ctl->cmsg(CMSG_INFO, VERB_VERBOSE, "WRD START"); } return 0; } static void wrdt_end(void) { wrd_argc = 0; inkey_flag = 0; #ifdef ENABLE_SHERRY sry_end(); #endif ctl->cmsg(CMSG_INFO, VERB_VERBOSE, "WRD END"); } static void wrdt_end(void); static void wrdt_close(void); #define wrdt mac_wrdt_mode #define win mac_WrdWindow WRDTracer wrdt = { "mac WRD tracer", 'm', 0, wrdt_open, wrdt_apply, #ifdef ENABLE_SHERRY sry_wrdt_apply, #else NULL, #endif wrdt_update_events, wrdt_start, wrdt_end, wrdt_close }; // *********************************************** // Low level output void dev_set_height(int height) { SizeWindow(win.ref, WRD_GSCR_WIDTH, height, false); } static void mac_RedrawControl(int flag) { dev_redrawflag=flag; } void dev_redisp(Rect rect) { GDHandle oldGD; GWorldPtr oldGW; if( !dev_redrawflag ) return; //ActivatePalette(win.ref); LOCK_ALL_PIXMAP(); GetGWorld(&oldGW, &oldGD); SetPortWindowPort(win.ref); RGBBackColor(&white); RGBForeColor(&black); CopyBits((BitMap*)&DISP_PIX, &win.ref->portBits, &rect, &rect, srcCopy,0); SetGWorld(oldGW, oldGD); UNLOCK_ALL_PIXMAP(); } static void reverse_helper(int x, int y, int byte) { Rect rect; rect.left=WRD_LOCX(x); //erase upper rect.top=WRD_LOCY(y-1)+3; rect.right=rect.left+BASE_X*byte; rect.bottom=rect.top+1; PaintRect(&rect); rect.left=WRD_LOCX(x)+7*byte; //erase right //rect.top=WRD_LOCY(y-1)+2; rect.right=rect.left+byte; rect.bottom=WRD_LOCY(y)+3; PaintRect(&rect); } static void dev_text_redraw(int locx1, int locy1, int locx2, int locy2) { int x,y,startx, mode,color, len; GDHandle oldGD; GWorldPtr oldGW; if( !wrd_ton ) return; if( locx1<1 ) locx1=1; if( locx2>80 ) locx2=80; if( locy1<1 ) locy1=1; if( locy2>25 ) locy2=25; if( wrd_ton==2 ){ //locx1-= (locx1-1)%4; locx1=1; } LOCK_ALL_PIXMAP(); GetGWorld(&oldGW, &oldGD); SetGWorld(dispWorld,0); TextMode(srcOr); for( y=locy1; y<=locy2; y++){ startx=locx1; if( startx-1>=1 && MULTI_BYTE_FLAG(startx-1,y) ) startx--; for( x=startx; x<=locx2; ){ if( CHAR_VRAM(x,y)==0 ){ x++; continue;} SET_T_RGBFORECOLOR_TMP(CHAR_COLOR_VRAM(x,y)&CATTR_TXTCOL_MASK); mode= (CHAR_COLOR_VRAM(x,y)&CATTR_BGCOLORED)? 2:1; color= TCODE2INDEX(CHAR_COLOR_VRAM(x,y)); len= MULTI_BYTE_FLAG(x,y)? 2:1; if( wrd_ton==2 ){ char *cp; if( MULTI_BYTE_FLAG(x-1,y) ){ cp= &CHAR_VRAM(x-1,y); len=2; SET_T_RGBFORECOLOR_TMP(CHAR_COLOR_VRAM(x-1,y)&CATTR_TXTCOL_MASK); mode= (CHAR_COLOR_VRAM(x-1,y)&CATTR_BGCOLORED)? 2:1; color= TCODE2INDEX(CHAR_COLOR_VRAM(x-1,y)); }else{ cp= &CHAR_VRAM(x,y); } dev_draw_text_gmode( dispWorld->portPixMap, WRD_LOCX(x), WRD_LOCY(y-1)+3, cp, len, 0xFF, mode, color, color, wrd_ton ); x+= len*2; continue; } (CHAR_COLOR_VRAM(x,y)&CATTR_BGCOLORED)? TextMode(notSrcOr) : TextMode(srcOr); WRD_MOVE_COURSOR_TMP(x,y); if( MULTI_BYTE_FLAG(x,y) ){ DrawText(&CHAR_VRAM(x,y), 0, 2); if(CHAR_COLOR_VRAM(x,y)&CATTR_BGCOLORED) reverse_helper(x,y, 2); x+=2; }else{ if( CHAR_VRAM(x,y)==' ' && (CHAR_COLOR_VRAM(x,y)&CATTR_BGCOLORED) ){ Rect rect; //speedy draw rect.top=WRD_LOCY(y-1)+3; rect.left=WRD_LOCX(x); rect.bottom=rect.top+BASE_Y; rect.right=rect.left+BASE_X; PaintRect(&rect); x++; }else{ DrawText(&CHAR_VRAM(x,y), 0, 1); if(CHAR_COLOR_VRAM(x,y)&CATTR_BGCOLORED) reverse_helper(x,y, 1); x++; } } } } SetGWorld(oldGW, oldGD); UNLOCK_ALL_PIXMAP(); } static void dev_text_redraw_rect(Rect rect) { dev_text_redraw(rect.left/BASE_X+1, rect.top/BASE_Y+1, rect.right/BASE_X+1, rect.bottom/BASE_Y+1); } void dev_remake_disp(Rect rect) { //copy gdisp -> disp, draw text on gdisp LOCK_ALL_PIXMAP(); if( dev_gon_flag) MyCopyBits(GDISP_PIX, DISP_PIX, rect, rect, 0, 0, 0xFF, 0,0,0); else dev_box(DISP_PIX, rect, 0, 0xFF); //all pal=0 color UNLOCK_ALL_PIXMAP(); dev_text_redraw_rect(rect); } static Rect loc2rect(int locx1, int locy1, int locx2, int locy2) { Rect rect; if( locx1 < 1 ) locx1=1; if( locx2 > COLS ) locx2=COLS; if( locy1 < 1 ) locy1=1; if( locy2 > LINES ) locy2=LINES; rect.top=WRD_LOCY(locy1-1)+3; rect.left=WRD_LOCX(locx1); rect.bottom=WRD_LOCY(locy2)+3; rect.right=WRD_LOCX(locx2+1); return rect; } static void dev_text_clear(int locx1, int locy1, int locx2, int locy2, int color, char ch, int need_update) { // clear (x1,y1) .... (x2,y1) int y, startx,endx, width; if( COLS=y1 && y>=1; y-- ){ if( y+num> y2 ) continue; memcpy(&CHAR_VRAM(1,y+num),&CHAR_VRAM(1,y),COLS); memcpy(&CHAR_COLOR_VRAM(1,y+num),&CHAR_COLOR_VRAM(1,y),COLS); memcpy(&MULTI_BYTE_FLAG(1,y+num),&MULTI_BYTE_FLAG(1,y),COLS); } dev_text_clear(x1, y1, x2, y1+num-1, color, ch, false); break; case 2: //scroll right case 3: //scroll left if( mode==3 ) num*=-1; if( x1+num<1 ) x1=1-num; if( x2+num>COLS ) x2=COLS-num; width=x2-x1+1; if( width<=0 ) break; for( y=y1; y<=y2 && y<=LINES; y++ ){ memmove(&CHAR_VRAM(x1+num,y),&CHAR_VRAM(x1,y),width); memmove(&CHAR_COLOR_VRAM(x1+num,y),&CHAR_COLOR_VRAM(x1,y),width); memmove(&MULTI_BYTE_FLAG(x1+num,y),&MULTI_BYTE_FLAG(x1,y),width); } if( mode==2 ) //right dev_text_clear(x1, y1, x1+num-1, y2, color, ch, false); else if( mode==3 ) dev_text_clear(x2+num+1, y1, x2, y2, color, ch, false); break; } } static void dev_move_coursor(int x, int y) { wrd_coursor_x=x; wrd_coursor_y=y; if( wrd_coursor_x<1 ) wrd_coursor_x=1; else if( wrd_coursor_x>COLS ) wrd_coursor_x=COLS; if( wrd_coursor_y<1 ) wrd_coursor_y=1; else if( wrd_coursor_y>LINES ) wrd_coursor_y=LINES; } static void dev_newline() { if( wrd_coursor_y>=25 ){ dev_text_scroll(1, 1, 80, 25, 0, 0, 0, 1); dev_remake_disp(portRect); dev_redisp(portRect); dev_move_coursor(1, 25); }else{ dev_move_coursor(1, wrd_coursor_y+1); } } static void dev_clear_graphics(int pmask) { //clear active bank only GDHandle oldGD; GWorldPtr oldGW; GetGWorld(&oldGW, &oldGD); LOCK_ALL_PIXMAP(); SetGWorld(graphicWorld[activeGraphics],0); dev_box(GACTIVE_PIX, portRect, 0, pmask); UNLOCK_ALL_PIXMAP(); SetGWorld(oldGW, oldGD); if( activeGraphics==dispGraphics ){ dev_remake_disp(portRect); dev_redisp(portRect); } } #define CHECK_RECT(rect) { \ short tmp; \ if( rect.left>rect.right ){ tmp=rect.left; rect.left=rect.right; rect.right=tmp;} \ if( rect.top>rect.bottom ){ tmp=rect.top; rect.top=rect.bottom; rect.bottom=tmp;} \ } void dev_gmove(int x1, int y1, int x2, int y2, int xd, int yd, GWorldPtr srcworld, GWorldPtr destworld, int sw, int trans, int pmask, int maskx, int masky, const uint8 maskdata[]) { static Rect src,dest, rect; GDHandle oldGD; GWorldPtr oldGW; if( srcworld==NULL || destworld==NULL ){ ctl->cmsg(CMSG_ERROR, VERB_NORMAL, "Can't use gvram bank" ); return; } LOCK_ALL_PIXMAP(); GetGWorld(&oldGW, &oldGD); LockPixels(srcworld->portPixMap); LockPixels(destworld->portPixMap); SetRect(&src, x1,y1,x2+1,y2+1); CHECK_RECT(src); SetRect(&dest, xd,yd, xd+x2-x1+1, yd+y2-y1+1); CHECK_RECT(dest); SetPortWindowPort(win.ref); RGBBackColor(&white); RGBForeColor(&black); if( sw==0 ){ //simple copy //CopyBits((BitMap*)&graphicWorld[vs]->portPixMap, (BitMap*)&graphicWorld[vd]->portPixMap, // &src, &dest, srcCopy,0); //make offscreen Graphics MyCopyBits(srcworld->portPixMap, destworld->portPixMap, src, dest, 0, 0, gmode_mask,0,0,0); //make offscreen Graphics } else if(sw==1){ //exchange CopyBits((BitMap*)&srcworld->portPixMap, (BitMap*)&destworld->portPixMap, &src, &dest, srcXor,0); CopyBits((BitMap*)&destworld->portPixMap, (BitMap*)&srcworld->portPixMap, &dest, &src, srcXor,0); CopyBits((BitMap*)&srcworld->portPixMap, (BitMap*)&destworld->portPixMap, &src, &dest, srcXor,0); //make offscreen Graphics } else if(sw==2){ //xor copy CopyBits((BitMap*)&srcworld->portPixMap, (BitMap*)&destworld->portPixMap, &src, &dest, srcXor,0); //make offscreen Graphics }else if( sw & 0x10 ){ //xcopy mode MyCopyBits(srcworld->portPixMap, destworld->portPixMap, src, dest, sw, trans, pmask, maskx, masky, maskdata); //make offscreen Graphics } SetGWorld(oldGW, oldGD); UNLOCK_ALL_PIXMAP(); UnlockPixels(srcworld->portPixMap); UnlockPixels(destworld->portPixMap); if( graphicWorld[dispGraphics]==destworld ){ dev_remake_disp(dest); dev_redisp(dest); } if( graphicWorld[dispGraphics]==srcworld && sw==1 ){ //exchange? update src dev_remake_disp(src); dev_redisp(src); } } static void dev_gscreen(int act, int dis) { if( act!=0 && act!=1 ) return; if( dis!=0 && dis!=1 ) return; activeGraphics=act; if( dispGraphics!=dis ){ dispGraphics=dis; dev_remake_disp(portRect); dev_redisp(portRect); } } static int dev_get_pixel(int x, int y) { Ptr baseadr; int rowBytes; baseadr=GetPixBaseAddr(graphicWorld[activeGraphics]->portPixMap); rowBytes= (**graphicWorld[activeGraphics]->portPixMap).rowBytes & 0x1FFF; return baseadr[y*rowBytes+x]; } void dev_gline(int x1, int y1, int x2, int y2, int p1, int sw, int p2, GWorldPtr world) { Rect rect; GDHandle oldGD; GWorldPtr oldGW; GetGWorld(&oldGW, &oldGD); LockPixels(world->portPixMap); SetGWorld(world,0); rect.left=x1; rect.right=x2; rect.top=y1; rect.bottom=y2; CHECK_RECT(rect); switch(sw) { case 0: //line if( p2==0 || p2==WRD_NOARG ) p2= 0xFF; dev_line(x1, y1, x2, y2, p1,p2, gmode_mask_gline, world->portPixMap ); break; case 1: //rect if( p2==0 || p2==WRD_NOARG ) p2= 0xFF; dev_line(x1, y1, x2, y1, p1,p2, gmode_mask_gline,world->portPixMap ); dev_line(x1, y1, x1, y2, p1,p2, gmode_mask_gline,world->portPixMap ); dev_line(x2, y1, x2, y2, p1,p2, gmode_mask_gline,world->portPixMap ); dev_line(x1, y2, x2, y2, p1,p2, gmode_mask_gline,world->portPixMap ); break; case 2: //filled rect if( p2==WRD_NOARG ) p2= p1; rect.right++; rect.bottom++; dev_box(world->portPixMap, rect, p2, gmode_mask_gline); if( p1!=p2 ){ dev_line(x1, y1, x2, y1, p1,0xFF, gmode_mask_gline,world->portPixMap ); dev_line(x1, y1, x1, y2, p1,0xFF, gmode_mask_gline,world->portPixMap ); dev_line(x2, y1, x2, y2, p1,0xFF, gmode_mask_gline,world->portPixMap ); dev_line(x1, y2, x2, y2, p1,0xFF, gmode_mask_gline,world->portPixMap ); } break; } SetGWorld(oldGW, oldGD); UnlockPixels(world->portPixMap); if( graphicWorld[dispGraphics]==world ){ rect.right++; rect.bottom++; dev_remake_disp(rect); if( pallette_exist) dev_redisp(rect); } } static void dev_gcircle(int x, int y, int r, int p1, int sw, int p2) { //int onbit; Rect rect; GDHandle oldGD; GWorldPtr oldGW; GetGWorld(&oldGW, &oldGD); LockPixels(GACTIVE_PIX); SetGWorld(graphicWorld[activeGraphics],0); rect.left=x-r; rect.right=x+r; rect.top=y-r; rect.bottom=y+r; switch(sw) { case 0: case 1: //frame SET_G_COLOR(p1,graphicWorld[activeGraphics]); FrameOval(&rect); break; case 2: //filled circle SET_G_COLOR(p2,graphicWorld[activeGraphics]); PaintOval(&rect); SET_G_COLOR(p1,graphicWorld[activeGraphics]); FrameOval(&rect); break; } SetGWorld(oldGW, oldGD); UnlockPixels(GACTIVE_PIX); if( activeGraphics==dispGraphics ){ rect.right++; rect.bottom++; dev_remake_disp(rect); dev_redisp(rect); } } static void dev_set_text_attr(int esccode); static int Parse(int c); void dev_init(int version) { int i; inkey_flag = 0; dev_gon_flag=1; dev_set_text_attr(37); //white dev_change_1_palette(0, black); dev_change_1_palette(16, black); //for gon(0) gmode_mask=0xF; if( version<=0 || (380<=version && version<=399)) gmode_mask_gline=0x7; //change gline behavier else gmode_mask_gline=0xF; for(i=0; icmsg(CMSG_INFO, VERB_NORMAL, "get gvram bank %d",gvram_bank_num ); gvram_bank_num++; }else{ ctl->cmsg(CMSG_ERROR, VERB_NORMAL, "Can't get gvram bank %d",gvram_bank_num ); } return err; } static OSErr dev_vsget(int num) { OSErr err; int i; for( i=gvram_bank_num; i<2+num; i++ ){ err=get_vsscreen(); if( err ) return err; } return 0; } static OSErr dev_setup() { static OSErr err=0; int i; Rect destRect; if( err ) return err; // once errored, do not retry destRect.top=destRect.left=0; destRect.right=640; destRect.bottom=480; gvram_bank_num=0; err=NewGWorld(&dispWorld, 8, &destRect,0,0,0); if( err ) return err; { Rect charbufRect={0,0,16,32}; err=NewGWorld(&charbufWorld, 8, &charbufRect,0,0,0); if( err ) return err; mac_setfont(charbufWorld, WRD_FONTNAME); } //wrd_palette= NewPalette( 33, 0, pmTolerant, 0x0000); //if( wrd_palette ) SetPalette(win.ref, wrd_palette, true); for( i=0; i<=1; i++){ err=get_vsscreen(); if( err ) return err; } dev_init_text_color(); mac_setfont(dispWorld, WRD_FONTNAME); dev_init(-1); return 0; //noErr } // *********************************************** #pragma mark - /*VTParse Table externals*/ extern int groundtable[]; extern int csitable[]; extern int dectable[]; extern int eigtable[]; extern int esctable[]; extern int iestable[]; extern int igntable[]; extern int scrtable[]; extern int scstable[]; extern int mbcstable[]; extern int smbcstable[]; #define MAXPARAM 20 #define DEFAULT -1 #define TAB_SET 8 #define MBCS 1 #define CATTR_LPART (1) #define CATTR_16FONT (1<<1) #define CATTR_COLORED (1<<2) #define CATTR_BGCOLORED (1<<3) #define CATTR_TXTCOL_MASK_SHIFT 4 #define CATTR_TXTCOL_MASK (7<=30)?(esccode-30):(esccode-16))<< CATTR_TXTCOL_MASK_SHIFT); wrd_text_color_attr|=CATTR_COLORED; wrd_text_color_attr&=~CATTR_BGCOLORED; break; case 40: case 41: case 42: case 43: case 44: case 45: case 46: case 47: wrd_text_color_attr&=~CATTR_TXTCOL_MASK; wrd_text_color_attr|=(esccode-40)< 0) wrd_coursor_x--; #if 0 /* ^H maybe work backward character in MIMPI's screen */ DelChar(wrd_coursor_y,wrd_coursor_x); mywin.scrnbuf[wrd_coursor_y][wrd_coursor_x].c=0; mywin.scrnbuf[wrd_coursor_y][wrd_coursor_x].attr=0; #endif break; case CASE_CSI_STATE: nparam=0; params[0]=DEFAULT; prstbl=csitable; break; case CASE_SCR_STATE: prstbl=scrtable; mbcs=0; break; case CASE_MBCS: hankaku=0; prstbl=mbcstable; mbcs=MBCS; break; case CASE_SCS_STATE: if(mbcs) prstbl=smbcstable; else prstbl=scstable; break; case CASE_GSETS: wrd_text_color_attr=(mbcs)?(wrd_text_color_attr|CATTR_16FONT): (wrd_text_color_attr&~(CATTR_16FONT)); if(!mbcs){ hankaku=(c=='I')?1:0; } prstbl=groundtable; break; case CASE_DEC_STATE: prstbl =dectable; break; case CASE_SS2: case CASE_SS3: /*These are ignored because this will not accept SS2 SS3 charset*/ case CASE_GROUND_STATE: prstbl=groundtable; break; case CASE_CR: wrd_coursor_x=1; prstbl=groundtable; break; case CASE_IND: case CASE_VMOT: wrd_coursor_y++; wrd_coursor_x=1; prstbl=groundtable; break; case CASE_CUP: wrd_coursor_y=(params[0]<1)?0:params[0]; if(nparam>=1) wrd_coursor_x=(params[1]<1)?0:params[1]; else wrd_coursor_x=0; prstbl=groundtable; break; case CASE_PRINT: if(wrd_text_color_attr&CATTR_16FONT){ if(!(wrd_text_color_attr&CATTR_LPART)&&(wrd_coursor_x==COLS)){ wrd_coursor_x++; return 1; } wrd_text_color_attr^=CATTR_LPART; } else wrd_text_color_attr&=~CATTR_LPART; DelChar(wrd_coursor_y,wrd_coursor_x); if(hankaku==1) c|=0x80; //mywin.scrnbuf[wrd_coursor_y][wrd_coursor_x].attr=wrd_text_color_attr; //mywin.scrnbuf[wrd_coursor_y][wrd_coursor_x].c=c; wrd_coursor_x++; break; case CASE_CUU: wrd_coursor_y-=((params[0]<1)?1:params[0]); prstbl=groundtable; break; case CASE_CUD: wrd_coursor_y+=((params[0]<1)?1:params[0]); prstbl=groundtable; break; case CASE_CUF: wrd_coursor_x+=((params[0]<1)?1:params[0]); prstbl=groundtable; break; case CASE_CUB: wrd_coursor_x-=((params[0]<1)?1:params[0]); if( wrd_coursor_x<1 ) wrd_coursor_x=1; prstbl=groundtable; break; case CASE_ED: switch(params[0]){ case DEFAULT: case 0: { int j; ClearRight(); for(j=wrd_coursor_y+1;j<=LINES;j++) ClearLine(j); } break; case 1: { int j; ClearLeft(); for(j=1;jcmsg(CMSG_INFO,VERB_VERBOSE,"NOT IMPREMENTED:%d\n",prstbl[c]); prstbl=groundtable; break; case CASE_BELL: case CASE_IGNORE: default: break; } if( prstbl==groundtable ) return 1; return 0; } // *********************************************** #pragma mark - #pragma mark ================== Wrd Window static int open_WrdWin(); static void click_WrdWin(Point local, short modifiers); static void update_WrdWin(); static int message_WrdWin(int message, long param); //#define win mac_WrdWindow //already defined MacWindow win={ 0, //WindowRef open_WrdWin, click_WrdWin, update_WrdWin, goaway_default, close_default, message_WrdWin, 0, 50,70 }; static int open_WrdWin() /*success-> return 0;*/ { open_window(&win, kWrdWinID); position_window(&win); return 0; } static void click_WrdWin(Point /*local*/, short /*modifiers*/) { } static void update_WrdWin() { dev_redisp(portRect); } static int message_WrdWin(int message, long /*param*/) { Rect rect; switch(message){ case MW_GROW: rect=win.ref->portRect; //rect.right-=15; rect.bottom-=15; rect = win.ref->portRect; rect.right -= 15; //rect.bottom -= 15; return 0; } return -1; //not supported } // *********************************************** #pragma mark - /*ARGSUSED*/ static int wrdt_open(char * /*wrdt_opts*/) { // success -> return 0 OSErr err; err=dev_setup(); if( err ) return err; wrdt.opened = 1; wrd_argc = 0; inkey_flag = 0; ctl->cmsg(CMSG_INFO,VERB_VERBOSE,"open macintosh wrd player\n"); return 0; } static void wrdt_update_events(void) { } static void wrdt_close(void) { wrdt.opened = 0; inkey_flag = 0; } static char *wrd_event2string(int id) { char *name; name = event2string(id); if(name != NULL) return name + 1; return ""; } // ************************************************** #pragma mark - static void mac_wrd_pal(int pnum, int wrd_args[]) { int code; RGBColor color; for( code=0; code<16; code++ ){ color.red=((wrd_args[code] >> 8) & 0x000F) * 0x1111; color.green=((wrd_args[code] >> 4) & 0x000F) * 0x1111; color.blue=(wrd_args[code] & 0x000F) * 0x1111; dev_palette[pnum][code]=color; if( pnum==0 ){ dev_change_1_palette(code, color); } } if( pnum==0 ){ //dev_remake_disp(portRect); dev_redisp(portRect); } } static void wrd_fadestep(int nowstep, int maxstep) { RGBColor pal[16]; int code; //static unsigned long lasttick=0; static int skip_num; //if( nowstep!=1 && nowstep!=maxstep /*&& (nowstep%4)==0*/ && lasttick==TickCount() ){ // return; //too fast fade. skip fading. //} if( nowstep==1 ){ skip_num=0; } if( nowstep!=maxstep && !mac_flushing_flag){ //consider skipping const int skip_threshold[11]={99,99,6,5,4, 2,1,0,0,0,0}; int threshold= skip_threshold[ (int)(aq_filled_ratio()*10) ]; if( skip_numfilename, sizeof(filename)); p= strrchr( filename, '.' ); if( p==0 ) return; strncpy( p, ".mag", sizeof(filename) - (p - filename) - 1 ); filename[sizeof(filename) - 1] = '\0'; ctl->cmsg(CMSG_INFO, VERB_VERBOSE, "@DEFAULT_LOAD_MAG(%s)", filename); if( wrd_mag(filename, WRD_NOARG, WRD_NOARG, 1,0)==0 ) //no err return; //retry pho file strncpy(filename, current_file_info->filename sizeof(filename)); p= strrchr( filename, '.' ); if( p==0 ) return; strncpy( p, ".pho", sizeof(filename) - (p - filename) - 1 ); filename[sizeof(filename) - 1] = '\0'; wrd_pho(filename); } // ************************************************** #pragma mark - static void mac_wrd_color(int c) { dev_set_text_attr(c); } static void mac_wrd_DrawText(const char* str, int len) { int i; for( i=0; i<=len; ){ if( str[i]==0 || i==len ){ dev_text_output(str, i); break; }else if( wrd_coursor_x+i>80 ){ dev_text_output(str, i); dev_newline(); //i++; str+=i; len-=i; i=0; }else if( str[i]=='\x1b' ){ //esc sequence if( i ){ dev_text_output(str, i); str+=i; len-=i; i=0; } for(;;i++){ if( Parse(str[i]) ){ break; //esc sequence ended } } i++; str+=i; len-=i; i=0; }else if (str[i]=='\t' ){ //tab space int newx; dev_text_output(str, i); newx=((wrd_coursor_x-1)|7)+2; dev_text_clear(wrd_coursor_x, wrd_coursor_y, newx-1, wrd_coursor_y, 0, 0, true); dev_move_coursor(newx,wrd_coursor_y); i++; str+=i; len-=i; i=0; }else{ i++; } } } static void mac_wrd_doESC(const char* code ) { char str[20]="\33["; strncat(str, code, sizeof(str) - strlen(str) - 1); str[sizeof(str)-1] = '\0'; mac_wrd_DrawText(str, strlen(str)); } static void mac_wrd_event_esc(int esc) { mac_wrd_doESC(event2string(esc)+1); } static void wrdt_apply(int cmd, int wrd_argc, int wrd_args[]) { char *p; char *text; int i, len; if( ! win.show ) return; //wrd_args[wrd_argc++] = arg; if(cmd == WRD_ARG) return; if(cmd == WRD_MAGPRELOAD){ //char *p = wrd_event2string(arg); /* Load MAG file */ WRD_DEBUG((CMSG_INFO, VERB_VERBOSE, "@WRD_MAGPRELOAD")); wrd_argc = 0; return; } if(inkey_flag) printf("* "); switch(cmd) { case WRD_LYRIC: case WRD_NL: if(cmd == WRD_NL) text = "\n"; else{ p = wrd_event2string(wrd_args[0]); len = strlen(p); text = (char *)new_segment(&tmpbuffer, SAFE_CONVERT_LENGTH(len)); code_convert(p, text, SAFE_CONVERT_LENGTH(len), NULL, NULL); } len = strlen(text); if( len ){ mac_wrd_DrawText(text, text[len-1]=='\n'? len-1:len); if( text[len-1]=='\n' ){ dev_newline(); } ctl->cmsg(CMSG_INFO, VERB_VERBOSE, "%s", text); } reuse_mblock(&tmpbuffer); break; case WRD_COLOR: mac_wrd_color(wrd_args[0]); WRD_DEBUG((CMSG_INFO, VERB_VERBOSE, "@COLOR(%d)", wrd_args[0])); break; case WRD_END: /* Never call */ WRD_DEBUG((CMSG_INFO, VERB_VERBOSE,"@END")); break; case WRD_ESC: mac_wrd_event_esc(wrd_args[0]); WRD_DEBUG((CMSG_INFO, VERB_VERBOSE, "@ESC(%s)", wrd_event2string(wrd_args[0]))); break; case WRD_EXEC: WRD_DEBUG((CMSG_INFO, VERB_VERBOSE, "@EXEC(%s)", wrd_event2string(wrd_args[0]))); break; case WRD_FADE: mac_wrd_fade(wrd_args[0], wrd_args[1], wrd_args[2]); WRD_DEBUG((CMSG_INFO, VERB_VERBOSE, "@FADE(%d,%d,%d)", wrd_args[0], wrd_args[1], wrd_args[2])); break; case WRD_FADESTEP: wrd_fadestep(wrd_args[0], WRD_MAXFADESTEP); WRD_DEBUG((CMSG_INFO, VERB_VERBOSE, "@FADESTEP(%d/%d)", wrd_args[0], WRD_MAXFADESTEP)); break; case WRD_GCIRCLE: dev_gcircle(wrd_args[0], wrd_args[1], wrd_args[2], wrd_args[3], wrd_args[4], wrd_args[5]); WRD_DEBUG((CMSG_INFO, VERB_VERBOSE, "@GCIRCLE(%d,%d,%d,%d,%d,%d)", wrd_args[0], wrd_args[1], wrd_args[2], wrd_args[3], wrd_args[4], wrd_args[5])); break; case WRD_GCLS: dev_clear_graphics(wrd_args[0]? wrd_args[0]:0xFF); WRD_DEBUG((CMSG_INFO, VERB_VERBOSE, "@GCLS(%d)", wrd_args[0])); break; case WRD_GINIT: WRD_DEBUG((CMSG_INFO, VERB_VERBOSE, "@GINIT()")); break; case WRD_GLINE: dev_gline(wrd_args[0], wrd_args[1], wrd_args[2], wrd_args[3], wrd_args[4], wrd_args[5], wrd_args[6],graphicWorld[activeGraphics]); WRD_DEBUG((CMSG_INFO, VERB_VERBOSE, "@GLINE(%d,%d,%d,%d,%d,%d,%d)", wrd_args[0], wrd_args[1], wrd_args[2], wrd_args[3], wrd_args[4], wrd_args[5], wrd_args[6])); break; case WRD_GMODE: DEV_SET_GMODE(wrd_args[0]); WRD_DEBUG((CMSG_INFO, VERB_VERBOSE, "@GMODE(%d)", wrd_args[0])); break; case WRD_GMOVE: wrd_args[0] &= ~0x7; wrd_args[4] &= ~0x7; wrd_args[2] |= 0x7; dev_gmove(wrd_args[0], wrd_args[1], wrd_args[2], wrd_args[3], wrd_args[4], wrd_args[5], graphicWorld[wrd_args[6]], graphicWorld[wrd_args[7]], wrd_args[8], 0, gmode_mask, 0,0,0); WRD_DEBUG((CMSG_INFO, VERB_VERBOSE, "@GMOVE(%d,%d, %d,%d, %d,%d, %d,%d,%d)", wrd_args[0], wrd_args[1], wrd_args[2], wrd_args[3], wrd_args[4], wrd_args[5], wrd_args[6], wrd_args[7], wrd_args[8])); break; case WRD_GON: dev_gon(wrd_args[0]); WRD_DEBUG((CMSG_INFO, VERB_VERBOSE, "@GON(%d)", wrd_args[0])); break; case WRD_GSCREEN: dev_gscreen(wrd_args[0], wrd_args[1]); WRD_DEBUG((CMSG_INFO, VERB_VERBOSE, "@GSCREEN(%d,%d)", wrd_args[0], wrd_args[1])); break; case WRD_INKEY: inkey_flag = 1; WRD_DEBUG((CMSG_INFO, VERB_VERBOSE, "@INKEY - begin")); break; case WRD_OUTKEY: inkey_flag = 0; WRD_DEBUG((CMSG_INFO, VERB_VERBOSE, "@INKEY - end")); break; case WRD_LOCATE: dev_move_coursor(wrd_args[0], wrd_args[1]); WRD_DEBUG((CMSG_INFO, VERB_VERBOSE, "@LOCATE(%d,%d)", wrd_args[0], wrd_args[1])); break; case WRD_LOOP: /* Never call */ break; case WRD_MAG: wrd_mag(wrd_event2string(wrd_args[0]), wrd_args[1], wrd_args[2], wrd_args[3], wrd_args[4]); /* p = (char *)new_segment(&tmpbuffer, MIN_MBLOCK_SIZE); */ /* strcpy(p, "@MAG("); */ /* strcat(p, wrd_event2string(wrd_args[0])); */ /* strcat(p, ","); */ /* for(i = 1; i < 3; i++) */ /* { */ /* if(wrd_args[i] == WRD_NOARG) */ /* strcat(p, "*,"); */ /* else */ /* sprintf(p + strlen(p), "%d,", wrd_args[i]); */ /* } */ /* sprintf(p + strlen(p), "%d,%d)", wrd_args[3], wrd_args[4]); */ /* WRD_DEBUG((CMSG_INFO, VERB_VERBOSE, "%s", p)); */ /* reuse_mblock(&tmpbuffer); */ break; case WRD_MIDI: /* Never call */ break; case WRD_OFFSET: /* Never call */ break; case WRD_PAL: /* mac_wrd_pal( wrd_args[0], &wrd_args[1]); */ /* p = (char *)new_segment(&tmpbuffer, MIN_MBLOCK_SIZE); */ /* sprintf(p, "@PAL(%03x", wrd_args[0]); */ /* for(i = 1; i < 17; i++) */ /* sprintf(p + strlen(p), ",%03x", wrd_args[i]); */ /* strcat(p, ")"); */ /* WRD_DEBUG((CMSG_INFO, VERB_VERBOSE, "%s", p)); */ /* reuse_mblock(&tmpbuffer); */ break; case WRD_PALCHG: WRD_DEBUG((CMSG_INFO, VERB_VERBOSE, "@PALCHG(%s)", wrd_event2string(wrd_args[0]))); break; case WRD_PALREV: dev_palrev(wrd_args[0]); WRD_DEBUG((CMSG_INFO, VERB_VERBOSE, "@PALREV(%d)", wrd_args[0])); break; case WRD_PATH: WRD_DEBUG((CMSG_INFO, VERB_VERBOSE, "@PATH(%s)", wrd_event2string(wrd_args[0]))); break; case WRD_PLOAD: wrd_pho(wrd_event2string(wrd_args[0])); WRD_DEBUG((CMSG_INFO, VERB_VERBOSE, "@PLOAD(%s)", wrd_event2string(wrd_args[0]))); break; case WRD_REM: p = wrd_event2string(wrd_args[0]); len = strlen(p); text = (char *)new_segment(&tmpbuffer, SAFE_CONVERT_LENGTH(len)); code_convert(p, text, SAFE_CONVERT_LENGTH(len), NULL, NULL); WRD_DEBUG((CMSG_INFO, VERB_VERBOSE, "@REM %s", text)); reuse_mblock(&tmpbuffer); break; case WRD_REMARK: WRD_DEBUG((CMSG_INFO, VERB_VERBOSE, "@REMARK(%s)", wrd_event2string(wrd_args[0]))); break; case WRD_REST: /* Never call */ break; case WRD_SCREEN: /* Not supported */ break; case WRD_SCROLL: dev_text_scroll(wrd_args[0], wrd_args[1], wrd_args[2], wrd_args[3], wrd_args[4], wrd_args[5], wrd_args[6], 1); dev_remake_disp(portRect); dev_redisp(portRect); WRD_DEBUG((CMSG_INFO, VERB_VERBOSE, "@SCROLL(%d,%d,%d,%d,%d,%d,%d)", wrd_args[0], wrd_args[1], wrd_args[2], wrd_args[3], wrd_args[4], wrd_args[5], wrd_args[6])); break; case WRD_STARTUP: dev_init(wrd_args[0]); dev_init_text_color(); wrd_load_default_image(); inkey_flag = 0; dev_set_height(400); WRD_DEBUG((CMSG_INFO, VERB_VERBOSE, "@STARTUP(%d)", wrd_args[0])); break; case WRD_STOP: /* Never call */ break; case WRD_TCLS: dev_text_clear(wrd_args[0], wrd_args[1], wrd_args[2], wrd_args[3],wrd_args[4],wrd_args[5], true); WRD_DEBUG((CMSG_INFO, VERB_VERBOSE, "@TCLS(%d,%d,%d,%d,%d,%d)", wrd_args[0], wrd_args[1], wrd_args[2], wrd_args[3], wrd_args[4], wrd_args[5])); break; case WRD_TON: wrd_ton=wrd_args[0]; dev_remake_disp(portRect); dev_redisp(portRect); WRD_DEBUG((CMSG_INFO, VERB_VERBOSE, "@TON(%d)", wrd_args[0])); break; case WRD_WAIT: /* Never call */ break; case WRD_WMODE: /* Never call */ break; /* Ensyutsukun */ case WRD_eFONTM: print_ecmd("FONTM", wrd_args, 1); break; case WRD_eFONTP: print_ecmd("FONTP", wrd_args, 4); break; case WRD_eFONTR: print_ecmd("FONTR", wrd_args, 17); break; case WRD_eGSC: print_ecmd("GSC", wrd_args, 1); break; case WRD_eLINE: print_ecmd("LINE", wrd_args, 1); break; case WRD_ePAL: print_ecmd("PAL", wrd_args, 2); break; case WRD_eREGSAVE: print_ecmd("REGSAVE", wrd_args, 17); break; case WRD_eSCROLL: print_ecmd("SCROLL",wrd_args, 2); break; case WRD_eTEXTDOT: print_ecmd("TEXTDOT", wrd_args, 1); break; case WRD_eTMODE: print_ecmd("TMODE", wrd_args, 1); break; case WRD_eTSCRL: print_ecmd("TSCRL", wrd_args, 0); break; case WRD_eVCOPY: wrd_args[0] &= ~0x7; wrd_args[4] &= ~0x7; wrd_args[2] |= 0x7; dev_gmove(wrd_args[0], wrd_args[1], wrd_args[2], wrd_args[3], wrd_args[4],wrd_args[5], graphicWorld[wrd_args[6]+(wrd_args[8]? 2:0)], graphicWorld[wrd_args[7]+ (wrd_args[8]? 0:2)], 0/*normal copy*/,0,gmode_mask, 0,0,0 ); //ignore mode in this version, always EMS->GVRAM print_ecmd("VCOPY", wrd_args, 9); break; case WRD_eVSGET: dev_vsget(wrd_args[0]); print_ecmd("VSGE", wrd_args, 4); break; case WRD_eVSRES: print_ecmd("VSRES", wrd_args, 0); break; case WRD_eXCOPY: dev_gmove(wrd_args[0], wrd_args[1], wrd_args[2], wrd_args[3], wrd_args[4], wrd_args[5], graphicWorld[wrd_args[6]], graphicWorld[wrd_args[7]], wrd_args[8]+0x10, 0/*trans*/, gmode_mask, 0,0,0 ); print_ecmd("XCOPY", wrd_args, 14); break; /* Extensionals */ case WRD_START_SKIP: mac_RedrawControl(0); ctl->cmsg(CMSG_INFO, VERB_VERBOSE, "WRD START SKIP"); break; case WRD_END_SKIP: mac_RedrawControl(1); ctl->cmsg(CMSG_INFO, VERB_VERBOSE, "WRD END SKIP"); break; #ifdef ENABLE_SHERRY case WRD_SHERRY_UPDATE: sry_update(); break; #endif } wrd_argc = 0; } TiMidity++-2.13.2/interface/wrdt_wcon.c0100644004711200001440000005520110127503371017011 0ustar tamukiusers/* TiMidity++ -- MIDI to WAVE converter and player Copyright (C) 1999-2002 Masanao Izumo Copyright (C) 1995 Tuukka Toivonen 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* * WRD Tracer for vt100 control terminal * Written by Takanori Watanabe */ /* * WRD Tracer for Windows console control terminal * modified for Windows console by Daisuke Aoki */ #ifdef HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ #include #include #ifndef NO_STRING_H #include #else #include #endif #ifndef __CYGWIN32__ #include #endif #include "timidity.h" #include "common.h" #include "instrum.h" #include "playmidi.h" #include "readmidi.h" #include "controls.h" #include "wrd.h" // #define DEBUG1 #ifndef __OLD_BORLANDC__ #define USE_ESC #define NULL_STMT do ; while(0) #define gotoxy(x, y) NULL_STMT #define wherex() 1 #define wherey() 1 #define putch putchar #define cputs puts #define delline() NULL_STMT #define clrscr() NULL_STMT #define clreol() NULL_STMT #endif /* __OLD_BORLANDC__ */ static int wrdt_open(char *dummy); static void wrdt_apply(int cmd, int wrd_argc, int wrd_args[]); static void wrdt_update_events(void); static void wrdt_end(void); static void wrdt_close(void); #define NO_GRAPHIC_SUPPORT #define wrdt wcon_wrdt_mode #define COLOR_REMAP(k) ((k)>16)&&((k)<30)?(k)+14:k WRDTracer wrdt = { "Windows Console WRD tracer", 'w', 0, wrdt_open, wrdt_apply, NULL, wrdt_update_events, NULL, wrdt_end, wrdt_close }; static int wrd_argc; static int wrd_args[WRD_MAXPARAM]; static int inkey_flag; #ifdef __OLD_BORLANDC__ static struct text_info text_info; static struct conattr { int attr; int bc; int fc; } iniattr, curattr, saveattr; static void borlandc_con_set_attr(struct conattr *attr) { if(attr->attr & REVERSE) textattr((attr->attr & ~REVERSE) + (attr->bc >> 4) + (attr->fc << 4)); else textattr((attr->attr & ~REVERSE) + attr->bc + attr->fc); } static void borlandc_con_save_attr(void) { saveattr.attr = curattr.attr; saveattr.bc = curattr.bc; saveattr.fc = curattr.fc; } static void borlandc_con_restore_attr(void) { curattr.attr = saveattr.attr; curattr.bc = saveattr.bc; curattr.fc = saveattr.fc; borlandc_con_set_attr(&curattr); } static void borlandc_con_reset_attr(void) { borlandc_con_set_attr(&iniattr); } static void borlandc_con_init(void) { gettextinfo(&text_info); iniattr.attr = text_info.attribute & 0xff00; iniattr.bc = text_info.attribute & 0xf0; iniattr.fc = text_info.attribute & 0x0f; curattr.attr = text_info.attribute & 0xff00; curattr.bc = text_info.attribute & 0xf0; curattr.fc = text_info.attribute & 0x0f; borlandc_con_save_attr(); } static void borlandc_con_reset(void) { borlandc_con_reset_attr(); } #else struct { int winleft, winright; int wintop, winbottom; } text_info = { 1,25, 1,80, }; #endif #define CANNOC_X(x) \ {\ if(x < text_info.winleft) x = text_info.winleft;\ else if(x > text_info.winright) x = text_info.winright;\ } #define CANNOC_Y(y) \ {\ if(y < text_info.wintop) y = text_info.wintop;\ else if(y > text_info.winbottom) y = text_info.winbottom;\ } static void putstring(char *str) { cputs(str); } static void putstringn(char *str, int n) { while(n--) putch(*(str++)); } #ifdef __OLD_BORLANDC__ static void borlandc_con_color(int color) { switch(color){ case 0: borlandc_con_reset_attr(); break; case 2: curattr.attr |= VERTICALLINE; borlandc_con_set_attr(&curattr); break; case 4: curattr.attr |= UNDERLINE; borlandc_con_set_attr(&curattr); break; case 5: curattr.attr |= BLINK; borlandc_con_set_attr(&curattr); break; case 8: case 16: case 30: curattr.attr &= ~REVERSE; curattr.fc = BLACK; borlandc_con_set_attr(&curattr); break; case 17: case 31: curattr.attr &= ~REVERSE; curattr.fc = LIGHTRED; borlandc_con_set_attr(&curattr); break; case 18: case 34: curattr.attr &= ~REVERSE; curattr.fc = LIGHTBLUE; borlandc_con_set_attr(&curattr); break; case 19: case 35: curattr.attr &= ~REVERSE; curattr.fc = LIGHTMAGENTA; borlandc_con_set_attr(&curattr); break; case 20: case 32: curattr.attr &= ~REVERSE; curattr.fc = LIGHTGREEN; borlandc_con_set_attr(&curattr); break; case 21: case 33: curattr.attr &= ~REVERSE; curattr.fc = YELLOW; borlandc_con_set_attr(&curattr); break; case 22: case 36: curattr.attr &= ~REVERSE; curattr.fc = LIGHTCYAN; borlandc_con_set_attr(&curattr); break; case 23: case 37: curattr.attr &= ~REVERSE; curattr.fc = WHITE; borlandc_con_set_attr(&curattr); break; /* case 40: attr = REVERSE + (bc << 4) + BLACK; textattr(attr); break; case 41: attr = REVERSE + (bc << 4) + LIGHTRED; textattr(attr); break; case 42: attr = REVERSE + (bc << 4) + LIGHTGREEN; textattr(attr); break; case 43: attr = REVERSE + (bc << 4) + YELLOW; textattr(attr); break; case 44: attr = REVERSE + (bc << 4) + LIGHTBLUE; textattr(attr); break; case 45: attr = REVERSE + (bc << 4) + LIGHTMAGENTA; textattr(attr); break; case 46: attr = REVERSE + (bc << 4) + LIGHTCYAN; textattr(attr); break; case 47: attr = REVERSE + (bc << 4) + WHITE; textattr(attr); break; */ case 40: curattr.attr |= REVERSE; curattr.fc = BLACK; borlandc_con_set_attr(&curattr); break; case 41: curattr.attr |= REVERSE; curattr.fc = LIGHTRED; borlandc_con_set_attr(&curattr); break; case 42: curattr.attr |= REVERSE; curattr.fc = LIGHTGREEN; borlandc_con_set_attr(&curattr); break; case 43: curattr.attr |= REVERSE; curattr.fc = YELLOW; borlandc_con_set_attr(&curattr); break; case 44: curattr.attr |= REVERSE; curattr.fc = LIGHTBLUE; borlandc_con_set_attr(&curattr); break; case 45: curattr.attr |= REVERSE; curattr.fc = LIGHTMAGENTA; borlandc_con_set_attr(&curattr); break; case 46: curattr.attr |= REVERSE; curattr.fc = LIGHTCYAN; borlandc_con_set_attr(&curattr); break; case 47: curattr.attr |= REVERSE; curattr.fc = WHITE; borlandc_con_set_attr(&curattr); break; default: break; } return; } #endif /* Escape sequence */ static void esc_index(void) { int x = wherex(), y = wherey(); if(y=text_info.winright;x--) putstringn(" ",1); gotoxy(oldx,oldy); } void esc_clearentirelinecontainingcursor(void) { int oldx = wherex(), oldy = wherey(); int x; for(x=text_info.winleft;x<=text_info.winright;x++) putstringn(" ",1); gotoxy(oldx,oldy); } void esc_deleteline(int n) { int i, n_max; if(n < 1) n = 1; n_max = text_info.winbottom - wherey() + 1; if(n > n_max) n = n_max; for(i=1;i<=n;i++) delline(); gotoxy(text_info.winleft,wherey()); } void esc_insertline(int n) { int i; if(n < 1) n = 1; for(i=1;i<=n;i++) delline(); gotoxy(text_info.winleft,wherey()); } void esc_savecursorposition(void) { return; } void esc_setcursorposition(void) { return; } void esc_enablecursordisplay(void) { #ifdef __OLD_BORLANDC__ _setcursortype(_NORMALCURSOR); #endif /* __OLD_BORLANDC__ */ } void esc_disablecursordisplay(void) { #ifdef __OLD_BORLANDC__ _setcursortype(_NOCURSOR); #endif /* __OLD_BORLANDC__ */ } void esc_characterattribute(int n) { #ifdef __OLD_BORLANDC__ borlandc_con_color(n); #endif } /* return figures */ static int getdigit(char *str,int *num) { int i; char local[20]; for(i=0;i<=10;i++) if(str[i] < '0' || str[i] > '9'){ if(i<1) return 0; else break; } strncpy(local,str,i); local[i] = '\0'; *num = atoi(local); return i; } static void putstring_with_esc(char *str) { char *p; while(*str) { p = str; for(;;) { if((unsigned char)*p >= 0x20){ p++; continue; } if(p-str > 0){ putstringn(str,p-str); str = p; break; } if(*p == '\0') break; if(*p == 0x1b){ int res, n[1024], n_max = 0; char *oldp = p; p++; if(*p == '['){ p++; for(;;){ res = getdigit(p,&(n[n_max+1])); if(res>0){ n_max++; p += res; } if(*p != ';') break; } } else if(*p == 'D'){ esc_index(); p++; str = p; break; } else if(*p == 'E'){ esc_nextline(); p++; str = p; break; } else if(*p == 'M'){ esc_reverseindex(); p++; str = p; break; } else if(*p == '*'){ esc_clearscreen(); p++; str = p; break; } else { p = oldp; if(p-str > 0){ putstringn(str,p-str); str = p; break; } } if(n_max == 2 && (*p == 'H' || *p == 'f')){ esc_directcursoraddressing(n[1],n[2]); p++; str = p; break; } if((n_max == 1 && *p == 'A') || (n_max == 0 && *p == 'A')){ if(n_max == 0) n[1] = 1; esc_cursorup(n[1]); p++; str = p; break; } if((n_max == 1 && *p == 'B') || (n_max == 0 && *p == 'B')){ if(n_max == 0) n[1] = 1; esc_cursordown(n[1]); p++; str = p; break; } if((n_max == 1 && *p == 'C') || (n_max == 0 && *p == 'C')){ if(n_max == 0) n[1] = 1; esc_cursorforward(n[1]); p++; str = p; break; } if((n_max == 1 && *p == 'D') || (n_max == 0 && *p == 'D')){ if(n_max == 0) n[1] = 1; esc_cursorbackward(n[1]); p++; str = p; break; } if((n_max == 1 && *p == 'J') || (n_max == 0 && *p == 'J')){ if(n_max == 0 || n[1] == 0) esc_clearfromcursortoendofscreen(); else if(n[1] == 1) esc_clearfrombeginningofscreentocursor(); else if(n[1] == 2) esc_clearscreen(); p++; str = p; break; } if((n_max == 1 && *p == 'K') || (n_max == 0 && *p == 'K')){ if(n_max == 0 || n[1] == 0) esc_clearfromcursortoendofline(); else if(n[1] == 1) esc_clearfrombeginningoflinetocursor(); else if(n[1] == 2) esc_clearentirelinecontainingcursor(); p++; str = p; break; } if((n_max == 1 && *p == 'M') || (n_max == 0 && *p == 'M')){ if(n_max == 0) n[1] = 1; esc_deleteline(n[1]); p++; str = p; break; } if((n_max == 1 && *p == 'L') || (n_max == 0 && *p == 'L')){ if(n_max == 0) n[1] = 1; esc_insertline(n[1]); p++; str = p; break; } if(n_max == 0 && *p == 's'){ esc_savecursorposition(); p++; str = p; break; } if(n_max == 0 && *p == 'u'){ esc_setcursorposition(); p++; str = p; break; } if(!strncmp(p,">5l",3)){ esc_enablecursordisplay(); p += 3; str = p; break; } if(!strncmp(p,">5h",3)){ esc_disablecursordisplay(); p += 3; str = p; break; } if(!strncmp(p,">1h",3)){ /* Enabel bottom line */ p += 3; str = p; break; } if(!strncmp(p,">1l",3)){ /* Disabel bottom line */ p += 3; str = p; break; } if(!strncmp(p,">3h",3)){ /* Select 31 line mode */ p += 3; str = p; break; } if(!strncmp(p,">3l",3)){ /* Select 25 line mode */ p += 3; str = p; break; } if(*p == 'm'){ int i; for(i=1;i<=n_max;i++) esc_characterattribute(n[i]); p++; str = p; break; } p = oldp; putstringn(p,1); p++; str = p; break; } } } } /* static void borlandc_esc(char *str) { if(!strncmp(str,"0J",2)){ int oldx = wherex(), oldy = wherey(); int y; clreol(); for(y=oldy+1;y<=text_info.winbottom;y++){ gotoxy(1,y); clreol(); } gotoxy(oldx,oldy); return; } if(!strncmp(str,"1J",2)){ int oldx = wherex(), oldy = wherey(); int y; for(y=oldy;y<=text_info.winbottom;y++){ gotoxy(1,y); clreol(); } gotoxy(oldx,oldy); return; } if(!strncmp(str,"2J",2)){ clrscr(); return; } } */ #ifdef __OLD_BORLANDC__ static void borlandc_esc(char *str) { char local[201]; local[0] = '\033'; local[1] = '['; strncpy(local+2,str,sizeof(local)-3); local[200] = '\0'; putstring_with_esc(local); } #endif /* __OLD_BORLANDC__ */ static int wrdt_open(char *dummy) { wrdt.opened = 1; inkey_flag = 0; #ifdef __OLD_BORLANDC__ // highvideo(); borlandc_con_init(); esc_disablecursordisplay(); #endif return 0; } static void wrdt_update_events(void) { } static void wrdt_end(void) { #ifdef USE_ESC printf("\033[0m\n");/*Restore Attributes*/ #else borlandc_con_reset(); esc_enablecursordisplay(); #endif #ifdef DEBUG1 printf("[wrdt_end]"); #endif inkey_flag = 0; } static void wrdt_close(void) { wrdt.opened = 0; inkey_flag = 0; } static char *wrd_event2string(int id) { char *name; name = event2string(id); if(name != NULL) return name + 1; return ""; } static void wrdt_apply(int cmd, int wrd_argc, int wrd_args[]) { char *p; char *text; int i, len; static txtclr_preserve=0; switch(cmd) { case WRD_LYRIC: p = wrd_event2string(wrd_args[0]); len = strlen(p); text = (char *)new_segment(&tmpbuffer, SAFE_CONVERT_LENGTH(len)); /*This must be not good thing,but as far as I know no wrd file written in EUC-JP code found*/ // code_convert(p, text, SAFE_CONVERT_LENGTH(len), "SJIS", "JISK"); // code_convert(p, text, SAFE_CONVERT_LENGTH(len), "SJIS", "NOCV"); strcpy(text,p); // printf("%s",text); // cprintf("%s",text); putstring_with_esc(text); fflush(stdout); reuse_mblock(&tmpbuffer); break; case WRD_NL: /* Newline (Ignored) */ putchar('\n'); break; case WRD_COLOR: /*Compatibility Hack,This remaps color(17-29 color seems to be ignored in kterm)*/ #ifdef USE_ESC txtclr_preserve=COLOR_REMAP(wrd_args[0]); printf("\033[%dm", txtclr_preserve); #else esc_characterattribute(wrd_args[0]); #endif #ifdef DEBUG1 printf("[wrd_color]"); #endif break; case WRD_END: /* Never call */ break; case WRD_ESC: #ifdef USE_ESC printf("\033[%s", wrd_event2string(wrd_args[0])); #else borlandc_esc(wrd_event2string(wrd_args[0])); #endif #ifdef DEBUG1 printf("[wrd_esc]"); #endif break; case WRD_EXEC: /*I don't spaun another program*/ ctl->cmsg(CMSG_INFO, VERB_VERBOSE, "@EXEC(%s)", wrd_event2string(wrd_args[0])); break; case WRD_FADE: ctl->cmsg(CMSG_INFO, VERB_VERBOSE, "@FADE(%d,%d,%d)", wrd_args[0], wrd_args[1], wrd_args[2]); break; case WRD_FADESTEP: ctl->cmsg(CMSG_INFO, VERB_VERBOSE, "@FADESTEP(%d/%d)", wrd_args[0], WRD_MAXFADESTEP); break; case WRD_GCIRCLE: ctl->cmsg(CMSG_INFO, VERB_VERBOSE, "@GCIRCLE(%d,%d,%d,%d,%d,%d)", wrd_args[0], wrd_args[1], wrd_args[2], wrd_args[3], wrd_args[4], wrd_args[5]); break; case WRD_GCLS: ctl->cmsg(CMSG_INFO, VERB_VERBOSE, "@GCLS(%d)", wrd_args[0]); break; case WRD_GINIT: ctl->cmsg(CMSG_INFO, VERB_VERBOSE, "@GINIT()"); break; case WRD_GLINE: ctl->cmsg(CMSG_INFO, VERB_VERBOSE, "@GLINE(%d,%d,%d,%d,%d,%d,%d)", wrd_args[0], wrd_args[1], wrd_args[2], wrd_args[3], wrd_args[4], wrd_args[5], wrd_args[6]); fflush(stdout); break; case WRD_GMODE: ctl->cmsg(CMSG_INFO, VERB_VERBOSE, "@GMODE(%d)", wrd_args[0]); break; case WRD_GMOVE: ctl->cmsg(CMSG_INFO, VERB_VERBOSE, "@GMOVE(%d,%d,%d,%d,%d,%d,%d)", wrd_args[0], wrd_args[1], wrd_args[2], wrd_args[3], wrd_args[4], wrd_args[5], wrd_args[6], wrd_args[7], wrd_args[8]); break; case WRD_GON: ctl->cmsg(CMSG_INFO, VERB_VERBOSE, "@GON(%d)", wrd_args[0]); break; case WRD_GSCREEN: ctl->cmsg(CMSG_INFO, VERB_VERBOSE, "@GSCREEN(%d,%d)", wrd_args[0], wrd_args[1]); break; case WRD_INKEY: inkey_flag = 1; ctl->cmsg(CMSG_INFO, VERB_VERBOSE, "@INKEY - begin"); break; case WRD_OUTKEY: inkey_flag = 0; ctl->cmsg(CMSG_INFO, VERB_VERBOSE, "@INKEY - end"); break; case WRD_LOCATE: #ifdef USE_ESC printf("\033[%d;%dH", wrd_args[1], wrd_args[0]); #else { int x = wrd_args[0], y = wrd_args[1]; if(x<1) x = 1; if(y<1) y = 1; gotoxy(x, y); } #endif #ifdef DEBUG1 printf("[wrd_locate]"); #endif break; case WRD_LOOP: /* Never call */ break; case WRD_MAG: p = (char *)new_segment(&tmpbuffer, MIN_MBLOCK_SIZE); strcpy(p, "@MAG("); strcat(p, wrd_event2string(wrd_args[0])); strcat(p, ","); for(i = 1; i < 3; i++) { if(wrd_args[i] == WRD_NOARG) strcat(p, "*,"); else sprintf(p + strlen(p), "%d,", wrd_args[i]); } sprintf(p + strlen(p), "%d,%d)", wrd_args[3], wrd_args[4]); ctl->cmsg(CMSG_INFO, VERB_VERBOSE, "%s", p); reuse_mblock(&tmpbuffer); break; case WRD_MIDI: /* Never call */ break; case WRD_OFFSET: /* Never call */ break; case WRD_PAL: p = (char *)new_segment(&tmpbuffer, MIN_MBLOCK_SIZE); sprintf(p, "@PAL(%03x", wrd_args[0]); for(i = 1; i < 17; i++) sprintf(p + strlen(p), ",%03x", wrd_args[i]); strcat(p, ")"); ctl->cmsg(CMSG_INFO, VERB_VERBOSE, "%s", p); reuse_mblock(&tmpbuffer); break; case WRD_PALCHG: ctl->cmsg(CMSG_INFO, VERB_VERBOSE, "@PALCHG(%s)", wrd_event2string(wrd_args[0])); break; case WRD_PALREV: ctl->cmsg(CMSG_INFO, VERB_VERBOSE, "@PALREV(%d)", wrd_args[0]); break; case WRD_PATH: ctl->cmsg(CMSG_INFO, VERB_VERBOSE, "@PATH(%s)", wrd_event2string(wrd_args[0])); break; case WRD_PLOAD: ctl->cmsg(CMSG_INFO, VERB_VERBOSE, "@PLOAD(%s)", wrd_event2string(wrd_args[0])); break; case WRD_REM: p = wrd_event2string(wrd_args[0]); len = strlen(p); text = (char *)new_segment(&tmpbuffer, SAFE_CONVERT_LENGTH(len)); code_convert(p, text, SAFE_CONVERT_LENGTH(len), NULL, NULL); ctl->cmsg(CMSG_INFO, VERB_VERBOSE, "@REM %s", text); reuse_mblock(&tmpbuffer); break; case WRD_REMARK: ctl->cmsg(CMSG_INFO, VERB_VERBOSE, "@REMARK(%s)", wrd_event2string(wrd_args[0])); break; case WRD_REST: /* Never call */ break; case WRD_SCREEN: /* Not supported */ break; case WRD_SCROLL: ctl->cmsg(CMSG_INFO, VERB_VERBOSE, "@SCROLL(%d,%d,%d,%d,%d,%d,%d)", wrd_args[0], wrd_args[1], wrd_args[2], wrd_args[3], wrd_args[4], wrd_args[5], wrd_args[6]); break; case WRD_STARTUP: inkey_flag = 0; ctl->cmsg(CMSG_INFO, VERB_VERBOSE, "@STARTUP(%d)", wrd_args[0]); #ifdef USE_ESC printf("\033[0m\033[H\033[J"); #else esc_clearscreen(); #endif #ifdef DEBUG1 printf("[wrd_startup]"); #endif fflush(stdout); break; case WRD_STOP: /* Never call */ break; case WRD_TCLS: { char fillbuf[1024]; #ifdef USE_ESC fillbuf[0]=0x1b; fillbuf[1]='7'; fillbuf[2]=0; printf(fillbuf); i=COLOR_REMAP(wrd_args[4]); printf("\033[%dm",i); #ifdef DEBUG1 printf("[wrd_tcls_1]"); #endif memset(fillbuf,wrd_args[5],wrd_args[2]-wrd_args[0]);/*X2-X1*/ fillbuf[wrd_args[2]-wrd_args[0]]=0; for(i=wrd_args[1];i<=wrd_args[3];i++)/*Y1 to Y2*/ printf("\033[%d;%dH%s",i,wrd_args[0],fillbuf);/*X1to....*/ #ifdef DEBUG1 printf("[wrd_tcls_2]"); #endif fillbuf[0]=0x1b; fillbuf[1]='8'; fillbuf[2]=0; printf(fillbuf); printf("\033[%dm",txtclr_preserve); #ifdef DEBUG1 printf("[wrd_tcls_3]"); #endif #else { int left = wrd_args[0], right = wrd_args[2]; int top = wrd_args[1], bottom = wrd_args[3]; CANNOC_X(left); CANNOC_X(right); CANNOC_Y(top); CANNOC_Y(bottom); if(left>right) right = left; if(top>bottom) bottom = top; memset(fillbuf,wrd_args[5],right-left);/*X2-X1*/ fillbuf[right-left]=0; borlandc_con_save_attr(); esc_characterattribute(wrd_args[4]); for(i=top;i<=bottom;i++)/*Y1 to Y2*/ { gotoxy(left,i); putstring(fillbuf); } borlandc_con_restore_attr(); } #ifdef DEBUG1 printf("[wrd_tcls]"); #endif #endif fflush(stdout); } #if 0 ctl->cmsg(CMSG_INFO, VERB_VERBOSE, "@TCLS(%d,%d,%d,%d,%d,%d,%d)", wrd_args[0], wrd_args[1], wrd_args[2], wrd_args[3], wrd_args[4], wrd_args[5]); #endif break; case WRD_TON: ctl->cmsg(CMSG_INFO, VERB_VERBOSE, "@TON(%d)", wrd_args[0]); break; case WRD_WAIT: /* Never call */ break; case WRD_WMODE: /* Never call */ break; /* Ensyutsukun */ case WRD_eFONTM: print_ecmd("FONTM", wrd_args, 1); break; case WRD_eFONTP: print_ecmd("FONTP", wrd_args, 4); break; case WRD_eFONTR: print_ecmd("FONTR", wrd_args, 17); break; case WRD_eGSC: print_ecmd("GSC", wrd_args, 1); break; case WRD_eLINE: print_ecmd("LINE", wrd_args, 1); break; case WRD_ePAL: print_ecmd("PAL", wrd_args, 2); break; case WRD_eREGSAVE: print_ecmd("REGSAVE", wrd_args, 17); break; case WRD_eSCROLL: print_ecmd("SCROLL",wrd_args, 2); break; case WRD_eTEXTDOT: print_ecmd("TEXTDOT", wrd_args, 1); break; case WRD_eTMODE: print_ecmd("TMODE", wrd_args, 1); break; case WRD_eTSCRL: print_ecmd("TSCRL", wrd_args, 0); break; case WRD_eVCOPY: print_ecmd("VCOPY", wrd_args, 9); break; case WRD_eVSGET: print_ecmd("VSGE", wrd_args, 4); break; case WRD_eVSRES: print_ecmd("VSRES", wrd_args, 0); break; case WRD_eXCOPY: print_ecmd("XCOPY", wrd_args, 14); break; /* Extensionals */ } } TiMidity++-2.13.2/interface/gtk_c.c0100644004711200001440000003114010117764305016073 0ustar tamukiusers/* TiMidity++ -- MIDI to WAVE converter and player Copyright (C) 1999-2002 Masanao Izumo Copyright (C) 1995 Tuukka Toivonen 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA motif_ctl.c: written by Vincent Pagel (pagel@loria.fr) 10/4/95 A motif interface for TIMIDITY : to prevent X redrawings from interfering with the audio computation, I don't use the XtAppAddWorkProc I create a pipe between the timidity process and a Motif interface process forked from the 1st one Copied the Motif file to create a Gtk+ interface. - Glenn Trigg 29 Oct 1998 Modified for TiMidity++ - Isaku Yamahata 03 Dec 1998 */ #ifdef HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H*/ #include #include #include #include #ifndef NO_STRING_H #include #else #include #endif #include "timidity.h" #include "common.h" #include "instrum.h" #include "playmidi.h" #include "output.h" #include "controls.h" #include "gtk_h.h" #include "readmidi.h" static int ctl_open(int using_stdin, int using_stdout); static void ctl_close(void); static void ctl_pass_playing_list(int number_of_files, char *list_of_files[]); static int ctl_read(int32 *valp); static int cmsg(int type, int verbosity_level, char *fmt, ...); static void ctl_event(CtlEvent *e); static void ctl_refresh(void); static void ctl_total_time(int tt); static void ctl_master_volume(int mv); static void ctl_file_name(char *name); static void ctl_current_time(int secs, int voices); static void ctl_note(int status, int channel, int note, int velocity); static void ctl_program(int ch, int val, char *vp); static void ctl_volume(int channel, int val); static void ctl_expression(int channel, int val); static void ctl_panning(int channel, int val); static void ctl_sustain(int channel, int val); static void ctl_pitch_bend(int channel, int val); static void ctl_reset(void); static void ctl_lyric(int); /**********************************************/ /* export the interface functions */ #define ctl gtk_control_mode ControlMode ctl = { "gtk+ interface", 'g', 1,0,0, 0, ctl_open, ctl_close, ctl_pass_playing_list, ctl_read, cmsg, ctl_event }; /***********************************************************************/ /* Put controls on the pipe */ /***********************************************************************/ static int cmsg(int type, int verbosity_level, char *fmt, ...) { char local[255]; va_list ap; if ((type==CMSG_TEXT || type==CMSG_INFO || type==CMSG_WARNING) && ctl.verbositytype) { case CTLE_NOW_LOADING: ctl_file_name((char *)e->v1); break; case CTLE_LOADING_DONE: break; case CTLE_PLAY_START: ctl_total_time((int)e->v1); break; case CTLE_PLAY_END: break; case CTLE_TEMPO: break; case CTLE_METRONOME: break; case CTLE_CURRENT_TIME: ctl_current_time((int)e->v1, (int)e->v2); break; case CTLE_NOTE: ctl_note((int)e->v1, (int)e->v2, (int)e->v3, (int)e->v4); break; case CTLE_MASTER_VOLUME: ctl_master_volume((int)e->v1); break; case CTLE_PROGRAM: ctl_program((int)e->v1, (int)e->v2, (char *)e->v3); break; case CTLE_VOLUME: ctl_volume((int)e->v1, (int)e->v2); break; case CTLE_EXPRESSION: ctl_expression((int)e->v1, (int)e->v2); break; case CTLE_PANNING: ctl_panning((int)e->v1, (int)e->v2); break; case CTLE_SUSTAIN: ctl_sustain((int)e->v1, (int)e->v2); break; case CTLE_PITCH_BEND: ctl_pitch_bend((int)e->v1, (int)e->v2); break; case CTLE_MOD_WHEEL: ctl_pitch_bend((int)e->v1, e->v2); break; case CTLE_CHORUS_EFFECT: break; case CTLE_REVERB_EFFECT: break; case CTLE_LYRIC: ctl_lyric((int)e->v1); break; case CTLE_REFRESH: ctl_refresh(); break; case CTLE_RESET: ctl_reset(); break; case CTLE_SPEANA: break; } } static void ctl_refresh(void) { /* gtk_pipe_int_write(REFRESH_MESSAGE); */ } static void ctl_total_time(int tt) { gtk_pipe_int_write(TOTALTIME_MESSAGE); gtk_pipe_int_write(tt); } static void ctl_master_volume(int mv) { gtk_pipe_int_write(MASTERVOL_MESSAGE); gtk_pipe_int_write(mv); } static void ctl_file_name(char *name) { gtk_pipe_int_write(FILENAME_MESSAGE); gtk_pipe_string_write(name); } static void ctl_current_time(int secs, int voices) { gtk_pipe_int_write(CURTIME_MESSAGE); gtk_pipe_int_write(secs); gtk_pipe_int_write(voices); } static void ctl_note(int status, int channel, int note, int velocity) { /* int xl; if (!ctl.trace_playing) return; xl=voice[v].note%(COLS-24); wmove(dftwin, 8+voice[v].channel,xl+3); switch(voice[v].status) { case VOICE_DIE: waddch(dftwin, ','); break; case VOICE_FREE: waddch(dftwin, '.'); break; case VOICE_ON: wattron(dftwin, A_BOLD); waddch(dftwin, '0'+(10*voice[v].velocity)/128); wattroff(dftwin, A_BOLD); break; case VOICE_OFF: case VOICE_SUSTAINED: waddch(dftwin, '0'+(10*voice[v].velocity)/128); break; } */ } static void ctl_program(int ch, int val, char *vp) { /* if (!ctl.trace_playing) return; wmove(dftwin, 8+ch, COLS-20); if (ISDRUMCHANNEL(ch)) { wattron(dftwin, A_BOLD); wprintw(dftwin, "%03d", val); wattroff(dftwin, A_BOLD); } else wprintw(dftwin, "%03d", val); */ } static void ctl_volume(int channel, int val) { /* if (!ctl.trace_playing) return; wmove(dftwin, 8+channel, COLS-16); wprintw(dftwin, "%3d", (val*100)/127); */ } static void ctl_expression(int channel, int val) { /* if (!ctl.trace_playing) return; wmove(dftwin, 8+channel, COLS-12); wprintw(dftwin, "%3d", (val*100)/127); */ } static void ctl_panning(int channel, int val) { /* if (!ctl.trace_playing) return; if (val==NO_PANNING) waddstr(dftwin, " "); else if (val<5) waddstr(dftwin, " L "); else if (val>123) waddstr(dftwin, " R "); else if (val>60 && val<68) waddstr(dftwin, " C "); */ } static void ctl_sustain(int channel, int val) { /* if (!ctl.trace_playing) return; if (val) waddch(dftwin, 'S'); else waddch(dftwin, ' '); */ } static void ctl_pitch_bend(int channel, int val) { /* if (!ctl.trace_playing) return; if (val>0x2000) waddch(dftwin, '+'); else if (val<0x2000) waddch(dftwin, '-'); else waddch(dftwin, ' '); */ } static void ctl_reset(void) { /* int i,j; if (!ctl.trace_playing) return; for (i=0; i<16; i++) { ctl_program(i, channel[i].program); ctl_volume(i, channel[i].volume); ctl_expression(i, channel[i].expression); ctl_panning(i, channel[i].panning); ctl_sustain(i, channel[i].sustain); ctl_pitch_bend(i, channel[i].pitchbend); } ctl_refresh(); */ } static void ctl_lyric(int lyricid) { char *lyric; static char lyric_buf[300]; lyric = event2string(lyricid); if(lyric != NULL) { if(lyric[0] == ME_KARAOKE_LYRIC) { if(!lyric[1]) return; if(lyric[1] == '/' || lyric[1] == '\\') { snprintf(lyric_buf, sizeof(lyric_buf), "\n%s", lyric + 2); gtk_pipe_int_write(LYRIC_MESSAGE); gtk_pipe_string_write(lyric_buf); } else if(lyric[1] == '@') { if(lyric[2] == 'L') snprintf(lyric_buf, sizeof(lyric_buf), "Language: %s\n", lyric + 3); else if(lyric[2] == 'T') snprintf(lyric_buf, sizeof(lyric_buf), "Title: %s\n", lyric + 3); else snprintf(lyric_buf, sizeof(lyric_buf), "%s\n", lyric + 1); gtk_pipe_int_write(LYRIC_MESSAGE); gtk_pipe_string_write(lyric_buf); } else { strncpy(lyric_buf, lyric + 1, sizeof(lyric_buf) - 1); gtk_pipe_int_write(LYRIC_MESSAGE); gtk_pipe_string_write(lyric_buf); } } else { strncpy(lyric_buf, lyric + 1, sizeof(lyric_buf) - 1); gtk_pipe_int_write(LYRIC_MESSAGE); gtk_pipe_string_write(lyric_buf); } } } /***********************************************************************/ /* OPEN THE CONNECTION */ /***********************************************************************/ static int ctl_open(int using_stdin, int using_stdout) { ctl.opened=1; /* The child process won't come back from this call */ gtk_pipe_open(); return 0; } /* Tells the window to disapear */ static void ctl_close(void) { if (ctl.opened) { gtk_pipe_int_write(CLOSE_MESSAGE); ctl.opened=0; } } /* * Read information coming from the window in a BLOCKING way */ static int ctl_blocking_read(int32 *valp) { int command; int new_volume; int new_centiseconds; gtk_pipe_int_read(&command); while (1) /* Loop after pause sleeping to treat other buttons! */ { switch(command) { case GTK_CHANGE_VOLUME: gtk_pipe_int_read(&new_volume); *valp= new_volume - amplification ; return RC_CHANGE_VOLUME; case GTK_CHANGE_LOCATOR: gtk_pipe_int_read(&new_centiseconds); *valp= new_centiseconds*(play_mode->rate / 100) ; return RC_JUMP; case GTK_QUIT: return RC_QUIT; case GTK_PLAY_FILE: return RC_LOAD_FILE; case GTK_NEXT: return RC_NEXT; case GTK_PREV: return RC_REALLY_PREVIOUS; case GTK_RESTART: return RC_RESTART; case GTK_FWD: *valp=play_mode->rate; return RC_FORWARD; case GTK_RWD: *valp=play_mode->rate; return RC_BACK; case GTK_KEYUP: *valp = 1; return RC_KEYUP; case GTK_KEYDOWN: *valp = -1; return RC_KEYDOWN; case GTK_SLOWER: *valp = 1; return RC_SPEEDDOWN; case GTK_FASTER: *valp = 1; return RC_SPEEDUP; } if (command==GTK_PAUSE) { gtk_pipe_int_read(&command); /* Blocking reading => Sleep ! */ if (command==GTK_PAUSE) return RC_NONE; /* Resume where we stopped */ } else { fprintf(stderr,"gtk UNKNOWN RC_MESSAGE %i\n",command); return RC_NONE; } } } /* * Read information coming from the window in a non blocking way */ static int ctl_read(int32 *valp) { int num; /* We don't wan't to lock on reading */ num = gtk_pipe_read_ready(); if (num==0) return RC_NONE; return(ctl_blocking_read(valp)); #if 0 num = ctl_blocking_read(valp); fprintf (stderr, "cmd=%i", num); return num; #endif } static void ctl_pass_playing_list(int number_of_files, char *list_of_files[]) { int i=0; char file_to_play[1000]; int command; int32 val; if( number_of_files > 0 ) { /* Pass the list to the interface */ gtk_pipe_int_write(FILE_LIST_MESSAGE); gtk_pipe_int_write(number_of_files); for (i=0;i begin to play automatically */ gtk_pipe_int_write(NEXT_FILE_MESSAGE); } command = ctl_blocking_read(&val); /* Main Loop */ for (;;) { if (command==RC_LOAD_FILE) { /* Read a LoadFile command */ gtk_pipe_string_read(file_to_play); command=play_midi_file(file_to_play); } else { if (command==RC_QUIT) return; if (command==RC_ERROR) command=RC_TUNE_END; /* Launch next file */ switch(command) { case RC_NEXT: gtk_pipe_int_write(NEXT_FILE_MESSAGE); break; case RC_REALLY_PREVIOUS: gtk_pipe_int_write(PREV_FILE_MESSAGE); break; case RC_TUNE_END: gtk_pipe_int_write(TUNE_END_MESSAGE); break; default: printf("PANIC !!! OTHER COMMAND ERROR ?!?! %i\n",command); } command = ctl_blocking_read(&val); } } } /* * interface__loader(); */ ControlMode *interface_g_loader(void) { return &ctl; } TiMidity++-2.13.2/interface/gtk_h.h0100644004711200001440000000432607421005040016077 0ustar tamukiusers/* TiMidity++ -- MIDI to WAVE converter and player Copyright (C) 1999-2002 Masanao Izumo Copyright (C) 1995 Tuukka Toivonen 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA motif.h: written by Vincent Pagel (pagel@loria.fr) 10/4/95 */ /* * MESSAGE FROM KERNEL TO MOTIF */ #define REFRESH_MESSAGE 1 #define HELPMODE_MESSAGE 2 #define TOTALTIME_MESSAGE 3 #define MASTERVOL_MESSAGE 4 #define FILENAME_MESSAGE 5 #define CURTIME_MESSAGE 6 #define NOTE_MESSAGE 7 #define PROGRAM_MESSAGE 8 #define VOLUME_MESSAGE 9 #define EXPRESSION_MESSAGE 10 #define PANNING_MESSAGE 11 #define SUSTAIN_MESSAGE 12 #define PITCH_MESSAGE 13 #define RESET_MESSAGE 14 #define CLOSE_MESSAGE 15 #define CMSG_MESSAGE 16 #define FILE_LIST_MESSAGE 17 #define NEXT_FILE_MESSAGE 18 #define PREV_FILE_MESSAGE 19 #define TUNE_END_MESSAGE 20 #define LYRIC_MESSAGE 21 typedef enum { GTK_CHANGE_VOLUME = 1, GTK_CHANGE_LOCATOR, GTK_QUIT, GTK_PLAY_FILE, GTK_NEXT, GTK_PREV, GTK_RESTART, GTK_FWD, GTK_RWD, GTK_PAUSE, GTK_KEYUP, GTK_KEYDOWN, GTK_SLOWER, GTK_FASTER, GTK_TOGGLE_DRUMS } GtkControls; /* * CONSTANTS FOR MOTIF/GTK+ MENUS */ #define MENU_OPEN 1 #define MENU_QUIT 2 #define MENU_TOGGLE 3 #define DIALOG_CANCEL 1 #define DIALOG_OK 2 #define DIALOG_ALL 3 void gtk_pipe_int_write(int c); void gtk_pipe_int_read(int *c); void gtk_pipe_string_write(char *str); void gtk_pipe_string_read(char *str); void gtk_pipe_open(void); int gtk_pipe_read_ready(void); void Launch_Gtk_Process(int pipe_number); TiMidity++-2.13.2/interface/gtk_i.c0100644004711200001440000006702010117764305016107 0ustar tamukiusers/* TiMidity++ -- MIDI to WAVE converter and player Copyright (C) 1999-2002 Masanao Izumo Copyright (C) 1995 Tuukka Toivonen 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA gtk_i.c - Glenn Trigg 29 Oct 1998 */ #ifdef HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H*/ #include #ifdef HAVE_GLOB_H #include #endif #if HAVE_SYS_PARAM_H #include #endif #include #include "timidity.h" #include "common.h" #include "output.h" #include "gtk_h.h" #include "pixmaps/playpaus.xpm" #include "pixmaps/prevtrk.xpm" #include "pixmaps/nexttrk.xpm" #include "pixmaps/rew.xpm" #include "pixmaps/ff.xpm" #include "pixmaps/restart.xpm" #include "pixmaps/quit.xpm" #include "pixmaps/quiet.xpm" #include "pixmaps/loud.xpm" #include "pixmaps/open.xpm" #include "pixmaps/keyup.xpm" #include "pixmaps/keydown.xpm" #include "pixmaps/slow.xpm" #include "pixmaps/fast.xpm" #include "pixmaps/timidity.xpm" static GtkWidget *create_menubar(void); static GtkWidget *create_button_with_pixmap(GtkWidget *, gchar **, gint, gchar *); static GtkWidget *create_pixmap_label(GtkWidget *, gchar **); static gint delete_event(GtkWidget *, GdkEvent *, gpointer); static void destroy (GtkWidget *, gpointer); static GtkTooltips *create_yellow_tooltips(void); static void handle_input(gpointer, gint, GdkInputCondition); static void generic_cb(GtkWidget *, gpointer); static void generic_scale_cb(GtkAdjustment *, gpointer); static void open_file_cb(GtkWidget *, gpointer); static void playlist_cb(GtkWidget *, guint); static void playlist_op(GtkWidget *, guint); static void file_list_cb(GtkWidget *, gint, gint, GdkEventButton *, gpointer); static void clear_all_cb(GtkWidget *, gpointer); static void filer_cb(GtkWidget *, gpointer); static void tt_toggle_cb(GtkWidget *, gpointer); static void locate_update_cb(GtkWidget *, GdkEventButton *, gpointer); static void my_adjustment_set_value(GtkAdjustment *, gint); static void set_icon_pixmap(GtkWidget *, gchar **); static GtkWidget *window, *clist, *text, *vol_scale, *locator; static GtkWidget *filesel = NULL, *plfilesel = NULL; static GtkWidget *tot_lbl, *cnt_lbl, *auto_next, *ttshow; static GtkTooltips *ttip; static int file_number_to_play; /* Number of the file we're playing in the list */ static int max_sec, is_quitting = 0, locating = 0, local_adjust = 0; static GtkItemFactoryEntry ife[] = { {"/File/Open", "O", open_file_cb, 0, NULL}, {"/File/sep", NULL, NULL, 0, ""}, {"/File/Load Playlist", "L", playlist_cb, 'l', NULL}, {"/File/Save Playlist", "S", playlist_cb, 's', NULL}, {"/File/sep", NULL, NULL, 0, ""}, {"/File/Quit", "Q", generic_cb, GTK_QUIT, NULL}, {"/Options/Auto next", "A", NULL, 0, ""}, {"/Options/Show tooltips", "T", tt_toggle_cb, 0, ""}, {"/Options/Clear All", "C", clear_all_cb, 0, NULL} }; #ifdef HAVE_GTK_2 static GtkTextBuffer *textbuf; static GtkTextIter iter, start_iter, end_iter; static GtkTextMark *mark; #endif /*----------------------------------------------------------------------*/ static void generic_cb(GtkWidget *widget, gpointer data) { gtk_pipe_int_write((int)data); if((int)data == GTK_PAUSE) { gtk_label_set(GTK_LABEL(cnt_lbl), "Pause"); } } static void tt_toggle_cb(GtkWidget *widget, gpointer data) { if( GTK_CHECK_MENU_ITEM(ttshow)->active ) { gtk_tooltips_enable(ttip); } else { gtk_tooltips_disable(ttip); } } static void open_file_cb(GtkWidget *widget, gpointer data) { if( ! filesel ) { filesel = gtk_file_selection_new("Open File"); gtk_file_selection_hide_fileop_buttons(GTK_FILE_SELECTION(filesel)); #ifdef HAVE_GTK_2 gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(filesel)->ok_button), "clicked", G_CALLBACK (filer_cb), (gpointer)1); #else gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(filesel)->ok_button), "clicked", GTK_SIGNAL_FUNC (filer_cb), (gpointer)1); #endif #ifdef HAVE_GTK_2 gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(filesel)->cancel_button), "clicked", G_CALLBACK (filer_cb), (gpointer)0); #else gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(filesel)->cancel_button), "clicked", GTK_SIGNAL_FUNC (filer_cb), (gpointer)0); #endif } gtk_widget_show(GTK_WIDGET(filesel)); } static void filer_cb(GtkWidget *widget, gpointer data) { gchar *filenames[2]; #ifdef GLOB_BRACE int i; #ifdef HAVE_GTK_2 const gchar *patt; #else gchar *patt; #endif glob_t pglob; if((int)data == 1) { patt = gtk_file_selection_get_filename(GTK_FILE_SELECTION(filesel)); if(glob(patt, GLOB_BRACE|GLOB_NOMAGIC|GLOB_TILDE, NULL, &pglob)) return; for( i = 0; i < pglob.gl_pathc; i++) { filenames[0] = pglob.gl_pathv[i]; filenames[1] = NULL; gtk_clist_append(GTK_CLIST(clist), filenames); } globfree(&pglob); } #else if((int)data == 1) { filenames[0] = gtk_file_selection_get_filename(GTK_FILE_SELECTION(filesel)); filenames[1] = NULL; gtk_clist_append(GTK_CLIST(clist), filenames); } #endif gtk_widget_hide(filesel); gtk_clist_columns_autosize(GTK_CLIST(clist)); } static void generic_scale_cb(GtkAdjustment *adj, gpointer data) { if(local_adjust) return; gtk_pipe_int_write((int)data); /* This is a bit of a hack as the volume scale (a GtkVScale) seems to have it's minimum at the top which is counter-intuitive. */ if((int)data == GTK_CHANGE_VOLUME) { gtk_pipe_int_write(MAX_AMPLIFICATION - adj->value); } else { gtk_pipe_int_write((int)adj->value*100); } } static void file_list_cb(GtkWidget *widget, gint row, gint column, GdkEventButton *event, gpointer data) { gint retval; gchar *fname; if(event && (event->button == 3)) { if(event->type == GDK_2BUTTON_PRESS) { gtk_clist_remove(GTK_CLIST(clist), row); } else { return; } } retval = gtk_clist_get_text(GTK_CLIST(widget), row, 0, &fname); if(retval) { gtk_pipe_int_write(GTK_PLAY_FILE); gtk_pipe_string_write(fname); file_number_to_play=row; } } static void playlist_cb(GtkWidget *widget, guint data) { const gchar *pldir; gchar *plpatt; if( ! plfilesel ) { plfilesel = gtk_file_selection_new(""); gtk_file_selection_hide_fileop_buttons(GTK_FILE_SELECTION(plfilesel)); pldir = g_getenv("TIMIDITY_PLAYLIST_DIR"); if(pldir != NULL) { plpatt = g_strconcat(pldir, "/*.tpl", NULL); gtk_file_selection_set_filename(GTK_FILE_SELECTION(plfilesel), plpatt); g_free(plpatt); } gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(plfilesel)->ok_button), "clicked", GTK_SIGNAL_FUNC (playlist_op), (gpointer)1); gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(plfilesel)->cancel_button), "clicked", GTK_SIGNAL_FUNC (playlist_op), NULL); } gtk_window_set_title(GTK_WINDOW(plfilesel), ((char)data == 'l')? "Load Playlist": "Save Playlist"); gtk_object_set_user_data(GTK_OBJECT(plfilesel), (gpointer)data); gtk_file_selection_complete(GTK_FILE_SELECTION(plfilesel), "*.tpl"); gtk_widget_show(plfilesel); } /* playlist_cb */ static void playlist_op(GtkWidget *widget, guint data) { int i; gchar *filename[2], action, *rowdata, fname[BUFSIZ], *tmp; FILE *plfp; gtk_widget_hide(plfilesel); if(!data) return; action = (gchar)(int)gtk_object_get_user_data(GTK_OBJECT(plfilesel)); filename[0] = gtk_file_selection_get_filename(GTK_FILE_SELECTION(plfilesel)); if(action == 'l') { if((plfp = fopen(filename[0], "r")) == NULL) { g_error("Can't open %s for reading.", filename[0]); return; } while(fgets(fname, BUFSIZ, plfp) != NULL) { if(fname[strlen(fname) - 1] == '\n') fname[strlen(fname) - 1] = '\0'; filename[0] = fname; filename[1] = NULL; gtk_clist_append(GTK_CLIST(clist), filename); } fclose(plfp); gtk_clist_columns_autosize(GTK_CLIST(clist)); } else if(action == 's') { if((plfp = fopen(filename[0], "w")) == NULL) { g_error("Can't open %s for writing.", filename[0]); return; } for(i = 0; i < GTK_CLIST(clist)->rows; i++) { gtk_clist_get_text(GTK_CLIST(clist), i, 0, &rowdata); /* Make sure we have an absolute path. */ if(*rowdata != '/') { tmp = g_get_current_dir(); rowdata = g_strconcat(tmp, "/", rowdata, NULL); fprintf(plfp, "%s\n", rowdata); g_free(rowdata); g_free(tmp); } else { fprintf(plfp, "%s\n", rowdata); } } fclose(plfp); } else { g_error("Invalid playlist action!."); } } /* playlist_op */ static void clear_all_cb(GtkWidget *widget, gpointer data) { gtk_clist_clear(GTK_CLIST(clist)); } /* clear_all_cb */ static gint delete_event(GtkWidget *widget, GdkEvent *event, gpointer data) { return (FALSE); } static void destroy (GtkWidget *widget, gpointer data) { is_quitting = 1; gtk_pipe_int_write(GTK_QUIT); } static void locate_update_cb (GtkWidget *widget, GdkEventButton *ev, gpointer data) { if( (ev->button == 1) || (ev->button == 2)) { if( ev->type == GDK_BUTTON_RELEASE ) { locating = 0; } else { locating = 1; } } } static void my_adjustment_set_value(GtkAdjustment *adj, gint value) { local_adjust = 1; gtk_adjustment_set_value(adj, (gfloat)value); local_adjust = 0; } void Launch_Gtk_Process(int pipe_number) { int argc = 0; GtkWidget *button, *mbar, *swin; GtkWidget *table, *align, *handlebox; GtkWidget *vbox, *hbox, *vbox2, *scrolled_win; GtkObject *adj; /* enable locale */ gtk_set_locale (); gtk_init (&argc, NULL); ttip = create_yellow_tooltips(); window = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_widget_set_name(window, "TiMidity"); gtk_window_set_title(GTK_WINDOW(window), "TiMidity - MIDI Player"); gtk_window_set_wmclass(GTK_WINDOW(window), "timidity", "TiMidity"); gtk_signal_connect(GTK_OBJECT(window), "delete_event", GTK_SIGNAL_FUNC (delete_event), NULL); gtk_signal_connect(GTK_OBJECT(window), "destroy", GTK_SIGNAL_FUNC (destroy), NULL); vbox = gtk_vbox_new(FALSE, 0); gtk_container_add(GTK_CONTAINER(window), vbox); mbar = create_menubar(); gtk_box_pack_start(GTK_BOX(vbox), mbar, FALSE, FALSE, 0); scrolled_win = gtk_scrolled_window_new(NULL, NULL); gtk_box_pack_start(GTK_BOX(vbox), scrolled_win, TRUE, TRUE ,0); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled_win),GTK_POLICY_NEVER, GTK_POLICY_ALWAYS); gtk_widget_show(scrolled_win); #ifdef HAVE_GTK_2 text = gtk_text_view_new(); gtk_text_view_set_editable(GTK_TEXT_VIEW(text), FALSE); gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(text), GTK_WRAP_WORD); #else text = gtk_text_new(NULL, NULL); #endif gtk_widget_show(text); gtk_container_add(GTK_CONTAINER(scrolled_win), text); hbox = gtk_hbox_new(FALSE, 4); gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 4); gtk_widget_show(hbox); adj = gtk_adjustment_new(0., 0., 100., 1., 20., 0.); locator = gtk_hscale_new(GTK_ADJUSTMENT(adj)); gtk_scale_set_draw_value(GTK_SCALE(locator), TRUE); gtk_signal_connect(GTK_OBJECT(adj), "value_changed", GTK_SIGNAL_FUNC(generic_scale_cb), (gpointer)GTK_CHANGE_LOCATOR); gtk_signal_connect(GTK_OBJECT(locator), "button_press_event", GTK_SIGNAL_FUNC(locate_update_cb), NULL); gtk_signal_connect(GTK_OBJECT(locator), "button_release_event", GTK_SIGNAL_FUNC(locate_update_cb), NULL); gtk_range_set_update_policy(GTK_RANGE(locator), GTK_UPDATE_DISCONTINUOUS); gtk_scale_set_digits(GTK_SCALE(locator), 0); gtk_widget_show(locator); gtk_box_pack_start(GTK_BOX(hbox), locator, TRUE, TRUE, 4); align = gtk_alignment_new(0., 1., 1., 0.); gtk_widget_show(align); cnt_lbl = gtk_label_new("00:00"); gtk_widget_show(cnt_lbl); gtk_container_add(GTK_CONTAINER(align), cnt_lbl); gtk_box_pack_start(GTK_BOX(hbox), align, FALSE, TRUE, 0); align = gtk_alignment_new(0., 1., 1., 0.); gtk_widget_show(align); tot_lbl = gtk_label_new("/00:00"); gtk_widget_show(tot_lbl); gtk_container_add(GTK_CONTAINER(align), tot_lbl); gtk_box_pack_start(GTK_BOX(hbox), align, FALSE, TRUE, 0); hbox = gtk_hbox_new(FALSE, 4); gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, TRUE, 4); swin = gtk_scrolled_window_new(NULL, NULL); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(swin), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); clist = gtk_clist_new(1); gtk_container_add(GTK_CONTAINER(swin), clist); gtk_widget_show(swin); gtk_widget_show(clist); gtk_widget_set_usize(clist, 200, 10); gtk_clist_set_reorderable(GTK_CLIST(clist), TRUE); gtk_clist_set_button_actions(GTK_CLIST(clist), 0, GTK_BUTTON_SELECTS); gtk_clist_set_button_actions(GTK_CLIST(clist), 1, GTK_BUTTON_DRAGS); gtk_clist_set_button_actions(GTK_CLIST(clist), 2, GTK_BUTTON_SELECTS); gtk_clist_set_selection_mode(GTK_CLIST(clist), GTK_SELECTION_SINGLE); gtk_clist_set_column_auto_resize(GTK_CLIST(clist), 1, TRUE); gtk_signal_connect(GTK_OBJECT(clist), "select_row", GTK_SIGNAL_FUNC(file_list_cb), NULL); gtk_box_pack_start(GTK_BOX(hbox), swin, TRUE, TRUE, 0); vbox2 = gtk_vbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(hbox), vbox2, FALSE, FALSE, 0); gtk_widget_show(vbox2); /* This is so the pixmap creation works properly. */ gtk_widget_realize(window); set_icon_pixmap(window, timidity_xpm); gtk_box_pack_start(GTK_BOX(vbox2), create_pixmap_label(window, loud_xpm), FALSE, FALSE, 0); adj = gtk_adjustment_new(30., 0., (gfloat)MAX_AMPLIFICATION, 1., 20., 0.); vol_scale = gtk_vscale_new(GTK_ADJUSTMENT(adj)); gtk_scale_set_draw_value(GTK_SCALE(vol_scale), FALSE); gtk_signal_connect (GTK_OBJECT(adj), "value_changed", GTK_SIGNAL_FUNC(generic_scale_cb), (gpointer)GTK_CHANGE_VOLUME); gtk_range_set_update_policy(GTK_RANGE(vol_scale), GTK_UPDATE_DELAYED); gtk_widget_show(vol_scale); gtk_tooltips_set_tip(ttip, vol_scale, "Volume control", NULL); gtk_box_pack_start(GTK_BOX(vbox2), vol_scale, TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(vbox2), create_pixmap_label(window, quiet_xpm), FALSE, FALSE, 0); handlebox = gtk_handle_box_new(); gtk_box_pack_start(GTK_BOX(hbox), handlebox, FALSE, FALSE, 0); table = gtk_table_new(7, 2, TRUE); gtk_container_add(GTK_CONTAINER(handlebox), table); button = create_button_with_pixmap(window, playpaus_xpm, GTK_PAUSE, "Play/Pause"); gtk_table_attach_defaults(GTK_TABLE(table), button, 0, 2, 0, 1); button = create_button_with_pixmap(window, prevtrk_xpm, GTK_PREV, "Previous file"); gtk_table_attach_defaults(GTK_TABLE(table), button, 0, 1, 1, 2); button = create_button_with_pixmap(window, nexttrk_xpm, GTK_NEXT, "Next file"); gtk_table_attach_defaults(GTK_TABLE(table), button, 1, 2, 1, 2); button = create_button_with_pixmap(window, rew_xpm, GTK_RWD, "Rewind"); gtk_table_attach_defaults(GTK_TABLE(table), button, 0, 1, 2, 3); button = create_button_with_pixmap(window, ff_xpm, GTK_FWD, "Fast forward"); gtk_table_attach_defaults(GTK_TABLE(table), button, 1, 2, 2, 3); button = create_button_with_pixmap(window, keydown_xpm, GTK_KEYDOWN, "Lower pitch"); gtk_table_attach_defaults(GTK_TABLE(table), button, 0, 1, 3, 4); button = create_button_with_pixmap(window, keyup_xpm, GTK_KEYUP, "Raise pitch"); gtk_table_attach_defaults(GTK_TABLE(table), button, 1, 2, 3, 4); button = create_button_with_pixmap(window, slow_xpm, GTK_SLOWER, "Decrease tempo"); gtk_table_attach_defaults(GTK_TABLE(table), button, 0, 1, 4, 5); button = create_button_with_pixmap(window, fast_xpm, GTK_FASTER, "Increase tempo"); gtk_table_attach_defaults(GTK_TABLE(table), button, 1, 2, 4, 5); button = create_button_with_pixmap(window, restart_xpm, GTK_RESTART, "Restart"); gtk_table_attach_defaults(GTK_TABLE(table), button, 0, 1, 5, 6); button = create_button_with_pixmap(window, open_xpm, 0, "Open"); #ifdef HAVE_GTK_2 gtk_signal_disconnect_by_func(GTK_OBJECT(button), G_CALLBACK(generic_cb), 0); #else gtk_signal_disconnect_by_func(GTK_OBJECT(button), generic_cb, 0); #endif gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(open_file_cb), 0); gtk_table_attach_defaults(GTK_TABLE(table), button, 1, 2, 5, 6); button = create_button_with_pixmap(window, quit_xpm, GTK_QUIT, "Quit"); gtk_table_attach_defaults(GTK_TABLE(table), button, 0, 2, 6, 7); gtk_widget_show(hbox); gtk_widget_show(vbox); gtk_widget_show(table); gtk_widget_show(handlebox); gtk_widget_show(window); gdk_input_add(pipe_number, GDK_INPUT_READ, handle_input, NULL); gtk_main(); } static GtkWidget * create_button_with_pixmap(GtkWidget *window, gchar **bits, gint data, gchar *thelp) { GtkWidget *pw, *button; GdkPixmap *pixmap; GdkBitmap *mask; GtkStyle *style; style = gtk_widget_get_style(window); pixmap = gdk_pixmap_create_from_xpm_d(window->window, &mask, &style->bg[GTK_STATE_NORMAL], bits); pw = gtk_pixmap_new(pixmap, mask); gtk_widget_show(pw); button = gtk_button_new(); gtk_container_add(GTK_CONTAINER(button), pw); gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(generic_cb), (gpointer)data); gtk_widget_show(button); gtk_tooltips_set_tip(ttip, button, thelp, NULL); return button; } static GtkWidget * create_pixmap_label(GtkWidget *window, gchar **bits) { GtkWidget *pw; GdkPixmap *pixmap; GdkBitmap *mask; GtkStyle *style; style = gtk_widget_get_style(window); pixmap = gdk_pixmap_create_from_xpm_d(window->window, &mask, &style->bg[GTK_STATE_NORMAL], bits); pw = gtk_pixmap_new(pixmap, mask); gtk_widget_show(pw); return pw; } static void set_icon_pixmap(GtkWidget *window, gchar **bits) { GdkPixmap *pixmap; GdkBitmap *mask; GtkStyle *style; style = gtk_widget_get_style(window); pixmap = gdk_pixmap_create_from_xpm_d(window->window, &mask, &style->bg[GTK_STATE_NORMAL], bits); gdk_window_set_icon(window->window, NULL, pixmap, mask); gdk_window_set_icon_name(window->window, "TiMidity"); } static GtkWidget * create_menubar(void) { GtkItemFactory *ifactory; GtkAccelGroup *ag; #ifdef HAVE_GTK_2 ag = gtk_accel_group_new(); #else ag = gtk_accel_group_get_default(); #endif ifactory = gtk_item_factory_new(GTK_TYPE_MENU_BAR, "
", ag); gtk_item_factory_create_items(ifactory, sizeof(ife) / sizeof(GtkItemFactoryEntry), ife, NULL); gtk_widget_show(ifactory->widget); auto_next = gtk_item_factory_get_widget(ifactory, "/Options/Auto next"); gtk_check_menu_item_set_state(GTK_CHECK_MENU_ITEM(auto_next), TRUE); ttshow = gtk_item_factory_get_widget(ifactory, "/Options/Show tooltips"); gtk_check_menu_item_set_state(GTK_CHECK_MENU_ITEM(ttshow), TRUE); return ifactory->widget; } /* Following function curtesy of the gtk mailing list. */ static GtkTooltips * create_yellow_tooltips() { GdkColor *t_back; GtkTooltips *tip; t_back = (GdkColor*)g_malloc( sizeof(GdkColor)); /* First create a default Tooltip */ tip = gtk_tooltips_new(); #ifndef HAVE_GTK_2 /* Try to get the colors */ if ( gdk_color_parse("linen", t_back)){ if(gdk_colormap_alloc_color(gdk_colormap_get_system(), t_back, FALSE, TRUE)) { gtk_tooltips_set_colors(tip, t_back, NULL); } } #endif return tip; } /* Receive DATA sent by the application on the pipe */ static void handle_input(gpointer client_data, gint source, GdkInputCondition ic) { int message; gtk_pipe_int_read(&message); switch (message) { case REFRESH_MESSAGE: g_warning("REFRESH MESSAGE IS OBSOLETE !!!"); break; case TOTALTIME_MESSAGE: { int tt; int minutes,seconds; char local_string[20]; GtkObject *adj; gtk_pipe_int_read(&tt); seconds=max_sec=tt/play_mode->rate; minutes=seconds/60; seconds-=minutes*60; sprintf(local_string,"/ %i:%02i",minutes,seconds); gtk_label_set(GTK_LABEL(tot_lbl), local_string); /* Readjust the time scale */ adj = gtk_adjustment_new(0., 0., (gfloat)max_sec, 1., 10., 0.); gtk_signal_connect(GTK_OBJECT(adj), "value_changed", GTK_SIGNAL_FUNC(generic_scale_cb), (gpointer)GTK_CHANGE_LOCATOR); gtk_range_set_adjustment(GTK_RANGE(locator), GTK_ADJUSTMENT(adj)); } break; case MASTERVOL_MESSAGE: { int volume; GtkAdjustment *adj; gtk_pipe_int_read(&volume); adj = gtk_range_get_adjustment(GTK_RANGE(vol_scale)); my_adjustment_set_value(adj, MAX_AMPLIFICATION - volume); } break; case FILENAME_MESSAGE: { char filename[255], title[255]; char *pc; gtk_pipe_string_read(filename); /* Extract basename of the file */ pc = strrchr(filename, '/'); if (pc == NULL) pc = filename; else pc++; sprintf(title, "Timidity %s - %s", timidity_version, pc); gtk_window_set_title(GTK_WINDOW(window), title); /* Clear the text area. */ #ifdef HAVE_GTK_2 textbuf = gtk_text_view_get_buffer(GTK_TEXT_VIEW(text)); gtk_text_buffer_get_start_iter(textbuf, &start_iter); gtk_text_buffer_get_end_iter(textbuf, &end_iter); iter = start_iter; #else gtk_text_freeze(GTK_TEXT(text)); gtk_text_set_point(GTK_TEXT(text), 0); gtk_text_forward_delete(GTK_TEXT(text), gtk_text_get_length(GTK_TEXT(text))); gtk_text_thaw(GTK_TEXT(text)); #endif } break; case FILE_LIST_MESSAGE: { gchar filename[255], *fnames[2]; gint i, number_of_files, row; /* reset the playing list : play from the start */ file_number_to_play = -1; gtk_pipe_int_read(&number_of_files); for (i = 0; i < number_of_files; i++) { gtk_pipe_string_read(filename); fnames[0] = filename; fnames[1] = NULL; row = gtk_clist_append(GTK_CLIST(clist), fnames); } gtk_clist_columns_autosize(GTK_CLIST(clist)); } break; case NEXT_FILE_MESSAGE: case PREV_FILE_MESSAGE: case TUNE_END_MESSAGE: { int nbfile; /* When a file ends, launch next if auto_next toggle */ if ( (message==TUNE_END_MESSAGE) && !GTK_CHECK_MENU_ITEM(auto_next)->active ) return; /* Total number of file to play in the list */ nbfile = GTK_CLIST(clist)->rows; if (message == PREV_FILE_MESSAGE) file_number_to_play--; else file_number_to_play++; /* Do nothing if requested file is before first one */ if (file_number_to_play < 0) { file_number_to_play = 0; return; } /* Stop after playing the last file */ if (file_number_to_play >= nbfile) { file_number_to_play = nbfile - 1; return; } if(gtk_clist_row_is_visible(GTK_CLIST(clist), file_number_to_play) != GTK_VISIBILITY_FULL) { gtk_clist_moveto(GTK_CLIST(clist), file_number_to_play, -1, 1.0, 0.0); } gtk_clist_select_row(GTK_CLIST(clist), file_number_to_play, 0); } break; case CURTIME_MESSAGE: { int seconds, minutes; int nbvoice; char local_string[20]; gtk_pipe_int_read(&seconds); gtk_pipe_int_read(&nbvoice); if( is_quitting ) return; minutes=seconds/60; sprintf(local_string,"%2d:%02d", minutes, (int)(seconds % 60)); gtk_label_set(GTK_LABEL(cnt_lbl), local_string); /* Readjust the time scale if not dragging the scale */ if( !locating && (seconds <= max_sec)) { GtkAdjustment *adj; adj = gtk_range_get_adjustment(GTK_RANGE(locator)); my_adjustment_set_value(adj, (gfloat)seconds); } } break; case NOTE_MESSAGE: { int channel; int note; gtk_pipe_int_read(&channel); gtk_pipe_int_read(¬e); g_warning("NOTE chn%i %i", channel, note); } break; case PROGRAM_MESSAGE: { int channel; int pgm; gtk_pipe_int_read(&channel); gtk_pipe_int_read(&pgm); g_warning("NOTE chn%i %i", channel, pgm); } break; case VOLUME_MESSAGE: { int channel; int volume; gtk_pipe_int_read(&channel); gtk_pipe_int_read(&volume); g_warning("VOLUME= chn%i %i", channel, volume); } break; case EXPRESSION_MESSAGE: { int channel; int express; gtk_pipe_int_read(&channel); gtk_pipe_int_read(&express); g_warning("EXPRESSION= chn%i %i", channel, express); } break; case PANNING_MESSAGE: { int channel; int pan; gtk_pipe_int_read(&channel); gtk_pipe_int_read(&pan); g_warning("PANNING= chn%i %i", channel, pan); } break; case SUSTAIN_MESSAGE: { int channel; int sust; gtk_pipe_int_read(&channel); gtk_pipe_int_read(&sust); g_warning("SUSTAIN= chn%i %i", channel, sust); } break; case PITCH_MESSAGE: { int channel; int bend; gtk_pipe_int_read(&channel); gtk_pipe_int_read(&bend); g_warning("PITCH BEND= chn%i %i", channel, bend); } break; case RESET_MESSAGE: g_warning("RESET_MESSAGE"); break; case CLOSE_MESSAGE: gtk_exit(0); break; case CMSG_MESSAGE: { int type; char message[1000]; #ifdef HAVE_GTK_2 gchar *message_u8; #endif gtk_pipe_int_read(&type); gtk_pipe_string_read(message); #ifdef HAVE_GTK_2 message_u8 = g_locale_to_utf8( message, -1, NULL, NULL, NULL ); gtk_text_buffer_get_bounds(textbuf, &start_iter, &end_iter); gtk_text_buffer_insert(textbuf, &end_iter, message_u8, -1); gtk_text_buffer_insert(textbuf, &end_iter, "\n", 1); gtk_text_buffer_get_bounds(textbuf, &start_iter, &end_iter); mark = gtk_text_buffer_create_mark(textbuf, NULL, &end_iter, 1); gtk_text_view_scroll_to_mark(GTK_TEXT_VIEW(text), mark, 0.0, 0, 0.0, 1.0); gtk_text_buffer_delete_mark(textbuf, mark); g_free( message_u8 ); #else gtk_text_insert(GTK_TEXT(text), NULL, NULL, NULL, message, -1); gtk_text_insert(GTK_TEXT(text), NULL, NULL, NULL, "\n", 1); #endif } break; case LYRIC_MESSAGE: { char message[1000]; #ifdef HAVE_GTK_2 gchar *message_u8; #endif gtk_pipe_string_read(message); #ifdef HAVE_GTK_2 message_u8 = g_locale_to_utf8( message, -1, NULL, NULL, NULL ); gtk_text_buffer_get_bounds(textbuf, &start_iter, &end_iter); gtk_text_buffer_insert(textbuf, &iter, message_u8, -1); gtk_text_buffer_get_bounds(textbuf, &start_iter, &end_iter); mark = gtk_text_buffer_create_mark(textbuf, NULL, &end_iter, 1); gtk_text_view_scroll_to_mark(GTK_TEXT_VIEW(text), mark, 0.0, 0, 0.0, 1.0); gtk_text_buffer_delete_mark(textbuf, mark); #else gtk_text_insert(GTK_TEXT(text), NULL, NULL, NULL, message, -1); #endif } break; default: g_warning("UNKNOWN Gtk+ MESSAGE %i", message); } } TiMidity++-2.13.2/interface/gtk_p.c0100644004711200001440000001167107421005040016103 0ustar tamukiusers/* TiMidity++ -- MIDI to WAVE converter and player Copyright (C) 1999-2002 Masanao Izumo Copyright (C) 1995 Tuukka Toivonen 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA motif_pipe.c: written by Vincent Pagel (pagel@loria.fr) 10/4/95 pipe communication between motif interface and sound generator Copied from the motif_p source. - Glenn Trigg, 29 Oct 1998 */ #ifdef HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H*/ #include #include #include #include #include #include #ifdef SOLARIS #include #endif #ifndef NO_STRING_H #include #else #include #endif #include #include #include "timidity.h" #include "controls.h" #include "gtk_h.h" int pipeAppli[2],pipeGtk[2]; /* Pipe for communication with Gtk+ process */ int fpip_in, fpip_out; /* in and out depends in which process we are */ int pid; /* Pid for child process */ /* DATA VALIDITY CHECK */ #define INT_CODE 214 #define STRING_CODE 216 #define DEBUGPIPE /***********************************************************************/ /* PIPE COMUNICATION */ /***********************************************************************/ static void pipe_error(char *st) { fprintf(stderr,"CONNECTION PROBLEM WITH Gtk+ PROCESS IN %s BECAUSE:%s\n", st, strerror(errno)); exit(1); } /***************************************** * INT * *****************************************/ void gtk_pipe_int_write(int c) { int len; int code=INT_CODE; #ifdef DEBUGPIPE len = write(fpip_out,&code,sizeof(code)); if (len!=sizeof(code)) pipe_error("PIPE_INT_WRITE"); #endif len = write(fpip_out,&c,sizeof(c)); if (len!=sizeof(int)) pipe_error("PIPE_INT_WRITE"); } void gtk_pipe_int_read(int *c) { int len; #ifdef DEBUGPIPE int code; len = read(fpip_in,&code,sizeof(code)); if (len!=sizeof(code)) pipe_error("PIPE_INT_READ"); if (code!=INT_CODE) fprintf(stderr,"BUG ALERT ON INT PIPE %i\n",code); #endif len = read(fpip_in,c, sizeof(int)); if (len!=sizeof(int)) pipe_error("PIPE_INT_READ"); } /***************************************** * STRINGS * *****************************************/ void gtk_pipe_string_write(char *str) { int len, slen; #ifdef DEBUGPIPE int code=STRING_CODE; len = write(fpip_out,&code,sizeof(code)); if (len!=sizeof(code)) pipe_error("PIPE_STRING_WRITE"); #endif slen=strlen(str); len = write(fpip_out,&slen,sizeof(slen)); if (len!=sizeof(slen)) pipe_error("PIPE_STRING_WRITE"); len = write(fpip_out,str,slen); if (len!=slen) pipe_error("PIPE_STRING_WRITE on string part"); } void gtk_pipe_string_read(char *str) { int len, slen; #ifdef DEBUGPIPE int code; len = read(fpip_in,&code,sizeof(code)); if (len!=sizeof(code)) pipe_error("PIPE_STRING_READ"); if (code!=STRING_CODE) fprintf(stderr,"BUG ALERT ON STRING PIPE %i\n",code); #endif len = read(fpip_in,&slen,sizeof(slen)); if (len!=sizeof(slen)) pipe_error("PIPE_STRING_READ"); len = read(fpip_in,str,slen); if (len!=slen) pipe_error("PIPE_STRING_READ on string part"); str[slen]='\0'; /* Append a terminal 0 */ } int gtk_pipe_read_ready(void) { fd_set fds; int cnt; struct timeval timeout; FD_ZERO(&fds); FD_SET(fpip_in, &fds); timeout.tv_sec = timeout.tv_usec = 0; if((cnt = select(fpip_in + 1, &fds, NULL, NULL, &timeout)) < 0) { perror("select"); return -1; } return cnt > 0 && FD_ISSET(fpip_in, &fds) != 0; } void gtk_pipe_open(void) { int res; res=pipe(pipeAppli); if (res!=0) pipe_error("PIPE_APPLI CREATION"); res=pipe(pipeGtk); if (res!=0) pipe_error("PIPE_GTK CREATION"); if ((pid=fork())==0) { /*child*/ close(pipeGtk[1]); close(pipeAppli[0]); fpip_in=pipeGtk[0]; fpip_out= pipeAppli[1]; Launch_Gtk_Process(fpip_in); /* Won't come back from here */ fprintf(stderr,"WARNING: come back from Gtk+\n"); exit(0); } close(pipeGtk[0]); close(pipeAppli[1]); fpip_in= pipeAppli[0]; fpip_out= pipeGtk[1]; } TiMidity++-2.13.2/interface/soundspec.c0100644004711200001440000004006710014435412017005 0ustar tamukiusers/* TiMidity++ -- MIDI to WAVE converter and player Copyright (C) 1999-2002 Masanao Izumo Copyright (C) 1995 Tuukka Toivonen 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ #include #include #include #include #include #include #include #include #ifndef NO_STRING_H #include #else #include #endif #define DEBUG 1 #include "timidity.h" #include "common.h" #include "instrum.h" #include "playmidi.h" #include "output.h" #include "controls.h" #include "soundspec.h" #include "fft.h" #include "miditrace.h" #define FFTSIZE 1024 /* Power of 2 */ #define SCOPE_HEIGHT 512 /* You can specified any positive value */ #define SCOPE_WIDTH 512 /* You can specified any positive value */ #define SCROLL_THRESHOLD 256 /* 1 <= SCROLL_THRESHOLD <= SCOPE_WIDTH */ #define NCOLOR 64 /* 1 <= NCOLOR <= 255 */ #define AMP 1.0 #define AMP2 1.5 #define DEFAULT_ZOOM (44100.0/1024.0*2.0) /* ~86Hz */ #define MIN_ZOOM 15.0 /* 15Hz is the lowest bound that human can be heard. */ #define MAX_ZOOM 440.0 #define DEFAULT_UPDATE 0.05 static int32 *ring_buffer = NULL; #define ring_buffer_len (8 * AUDIO_BUFFER_SIZE) static int ring_index; static int32 outcnt; static double exp_hz_table[SCOPE_HEIGHT+1]; int view_soundspec_flag = 0; int ctl_speana_flag = 0; int32 soundspec_update_interval = 0; static int32 next_wakeup_samples; static double soundspec_zoom = DEFAULT_ZOOM; static Display *disp = NULL; static Window win; static GC gc; static int depth; static Pixmap offscr; static XImage *img; static Atom wm_delete_window; static unsigned long color_ring[NCOLOR]; #define XCMAP(disp) XDefaultColormap(disp, DefaultScreen(disp)) typedef struct _rgb_t { double r, g, b; } rgb_t; static void hsv_to_rgb(double h, double s, double v, rgb_t *rgb) { double f; double i; double p1, p2, p3; if (s < 0) s = 0; if (v < 0) v = 0; if (s > 1) s = 1; if (v > 1) v = 1; h = fmod(h, 360.0); if (h < 0) h += 360; h /= 60; f = modf(h, &i); p1 = v * (1 - s); p2 = v * (1 - s * f); p3 = v * (1 - s * (1 - f)); switch ((int)i) { case 0: rgb->r = v; rgb->g = p3; rgb->b = p1; return; case 1: rgb->r = p2; rgb->g = v; rgb->b = p1; return; case 2: rgb->r = p1; rgb->g = v; rgb->b = p3; return; case 3: rgb->r = p1; rgb->g = p2; rgb->b = v; return; case 4: rgb->r = p3; rgb->g = p1; rgb->b = v; return; case 5: rgb->r = v; rgb->g = p1; rgb->b = p2; return; } return; } static double calc_color_diff(int r1, int g1, int b1, int r2, int g2, int b2) { double rd, gd, bd; rd = r2 - r1; gd = g2 - g1; bd = b2 - b1; return rd * rd + gd * gd + bd * bd; } static long search_near_color(Display *disp, int r, int g, int b) { double d, mind; int scr; static XColor *xc = NULL; static int xc_size = 0; long i, k; scr = DefaultScreen(disp); if(depth == 1) /* black or white */ { d = (double)r * r + (double)g * g + (double)b * b; if(d > 3.0 * 32768.0 * 32768.0) return (long)WhitePixel(disp, scr); return (long)BlackPixel(disp, scr); } if(xc_size == 0) { xc_size = DisplayCells(disp, scr); if(xc_size > 256) return 0; /* Colormap size is too large */ xc = (XColor *)safe_malloc(sizeof(XColor) * xc_size); for(i = 0; i < xc_size; i++) xc[i].pixel = i; } XQueryColors(disp, DefaultColormap(disp, scr), xc, xc_size); mind = calc_color_diff(r, g, b, xc[0].red, xc[0].green, xc[0].blue); k = 0; for(i = 1; i < xc_size; i++) { d = calc_color_diff(r, g, b, xc[i].red, xc[i].green, xc[i].blue); if(d < mind) { mind = d; k = i; if(mind == 0.0) break; } } #ifdef DEBUG printf("color [%04x %04x %04x]->[%04x %04x %04x] (d^2=%f, k=%d)\n", r, g, b, xc[k].red, xc[k].green, xc[k].blue, mind, (int)k); #endif return k; } #if 0 static int highbit(unsigned long ul) { int i; unsigned long hb; hb = 0x80000000UL; for(i = 31; ((ul & hb) == 0) && i >= 0; i--, ul<<=1) ; return i; } #endif static unsigned long AllocRGBColor( Display *disp, double red, /* [0, 1] */ double green, /* [0, 1] */ double blue) /* [0, 1] */ { XColor c; c.red = (unsigned short)(red * 0xffff); c.green = (unsigned short)(green * 0xffff); c.blue = (unsigned short)(blue * 0xffff); if(!XAllocColor(disp, XCMAP(disp), &c)) { ctl->cmsg(CMSG_INFO, VERB_NOISY, "Warning: Can't allocate color: " "r = %04x, g = %04x, b = %04x", c.red, c.green, c.blue); return search_near_color(disp, c.red, c.green, c.blue); } return c.pixel; } static void set_color_ring(void) { int i; /*i = 0 ... NCOLOR * Blue -> Green -> Red -> White */ for(i = 0; i < NCOLOR; i++) { rgb_t rgb; double h = 240 - 360 * sqrt((1.0/NCOLOR) * i); double s, v; if(h >= 0) s = 0.9; else { s = 0.9 + h / 120.0 * 0.9; h = 0.0; } /* v = sqrt(i * (1.0/NCOLOR) * 0.6 + 0.4); */ v = 1.0; hsv_to_rgb(h, s, v, &rgb); color_ring[i] = AllocRGBColor(disp, rgb.r, rgb.g, rgb.b); } } static void set_draw_pixel(double *val, char *pixels) { int i; unsigned v; for(i = 0; i < SCOPE_HEIGHT; i++) { v = (unsigned)(val[i] * AMP2); if(v > NCOLOR - 1) val[i] = NCOLOR - 1; else val[i] = v; } switch(depth) { case 32: case 24: for(i = 0; i < SCOPE_HEIGHT; i++) ((uint32 *)pixels)[i] = (uint32)color_ring[(int)val[SCOPE_HEIGHT - i - 1]]; break; case 16: for(i = 0; i < SCOPE_HEIGHT; i++) ((uint16 *)pixels)[i] = (uint16)color_ring[(int)val[SCOPE_HEIGHT - i - 1]]; break; default: for(i = 0; i < SCOPE_HEIGHT; i++) ((uint8 *)pixels)[i] = (uint8)color_ring[(int)val[SCOPE_HEIGHT - i - 1]]; break; } } static void make_logspectrogram(double *from, double *to) { double px; int i; to[0] = from[0]; px = 0.0; for(i = 1; i < SCOPE_HEIGHT - 1; i++) { double tx, s; int x1, n; tx = exp_hz_table[i]; x1 = (int)px; n = 0; s = 0.0; do { double a; a = from[x1]; s += a + (tx - x1) * (from[x1 + 1] - a); n++; x1++; } while(x1 < tx); to[i] = s / n; px = tx; } to[SCOPE_HEIGHT - 1] = from[FFTSIZE / 2 - 1]; for(i = 0; i < SCOPE_HEIGHT; i++) if(to[i] <= -0.0) to[i] = 0.0; } static void initialize_exp_hz_table(double zoom) { int i; double r, x, w; if(zoom < MIN_ZOOM) soundspec_zoom = MIN_ZOOM; else if(zoom > MAX_ZOOM) soundspec_zoom = MAX_ZOOM; else soundspec_zoom = zoom; w = (double)play_mode->rate * 0.5 / zoom; r = exp(log(w) * (1.0/SCOPE_HEIGHT)); w = (FFTSIZE/2.0) / (w - 1.0); for(i = 0, x = 1.0; i <= SCOPE_HEIGHT; i++, x *= r) exp_hz_table[i] = (x - 1.0) * w; } static KeySym xlookup_key(XKeyEvent *e) { char str[10]; KeySym key; XLookupString(e, str, 10, &key, NULL); return key; } static void draw_scope(double *values) { static int32 call_cnt; int offset, expose; XEvent e; char pixels[SCOPE_HEIGHT*32]; double work[SCOPE_HEIGHT]; int nze; char *mname; KeySym k; make_logspectrogram(values, work); set_draw_pixel(work, pixels); expose = 0; nze = 0; while(QLength(disp) || XPending(disp)) { XNextEvent(disp, &e); switch(e.type) { case Expose: expose++; break; case KeyPress: k = xlookup_key(&e.xkey); switch(k) { #ifdef XK_Down case XK_Up: #endif /* XK_Up */ #ifdef XK_KP_Up case XK_KP_Up: #endif /* XK_KP_Up */ nze++; break; #ifdef XK_Down case XK_Down: #endif /* XK_Down */ #ifdef XK_KP_Down case XK_KP_Down: #endif /* XK_KP_Down */ nze--; break; #ifdef XK_Left case XK_Left: #endif /* XK_Left */ #ifdef XK_KP_Left case XK_KP_Left: #endif /* XK_KP_Left */ soundspec_update_interval = (int32)(soundspec_update_interval*1.1); break; #ifdef XK_Right case XK_Right: #endif /* XK_Right */ #ifdef XK_KP_Right case XK_KP_Right: #endif /* XK_KP_Right */ soundspec_update_interval = (int32)(soundspec_update_interval/1.1); if(soundspec_update_interval < 0.01 * play_mode->rate) soundspec_update_interval = (int32)(0.01 * play_mode->rate); break; } break; case ClientMessage: if(wm_delete_window == e.xclient.data.l[0]) { mname = XGetAtomName(disp, e.xclient.message_type); if(mname != NULL && strcmp(mname, "WM_PROTOCOLS") == 0) { /* Delete message from WM */ ctl->cmsg(CMSG_INFO, VERB_VERBOSE, "Sound Spectrogram Window is closed"); close_soundspec(); XCloseDisplay(disp); disp = NULL; return; } } break; } } offset = call_cnt % SCROLL_THRESHOLD; if(offset == 0) { XCopyArea(disp, offscr, offscr, gc, SCROLL_THRESHOLD, 0, SCOPE_WIDTH - SCROLL_THRESHOLD, SCOPE_HEIGHT, 0, 0); XSetForeground(disp, gc, BlackPixel(disp, DefaultScreen(disp))); XFillRectangle(disp, offscr, gc, SCOPE_WIDTH - SCROLL_THRESHOLD, 0, SCROLL_THRESHOLD, SCOPE_HEIGHT); XCopyArea(disp, offscr, win, gc, 0, 0, SCOPE_WIDTH, SCOPE_HEIGHT, 0, 0); } img->data = (char *)pixels; XPutImage(disp, offscr, gc, img, 0, 0, SCOPE_WIDTH - SCROLL_THRESHOLD + offset, 0, 1, SCOPE_HEIGHT); if(!expose) XCopyArea(disp, offscr, win, gc, SCOPE_WIDTH - SCROLL_THRESHOLD + offset, 0, 1, SCOPE_HEIGHT, SCOPE_WIDTH - SCROLL_THRESHOLD + offset, 0); else { XCopyArea(disp, offscr, win, gc, 0, 0, SCOPE_WIDTH, SCOPE_HEIGHT, 0, 0); } XSync(disp, False); if(nze) initialize_exp_hz_table(soundspec_zoom - 4 * nze); call_cnt++; } struct drawing_queue { double values[FFTSIZE/2 + 1]; struct drawing_queue *next; }; static struct drawing_queue *free_queue_list = NULL; static struct drawing_queue *new_queue(void) { struct drawing_queue *p; if(free_queue_list) { p = free_queue_list; free_queue_list = free_queue_list->next; } else p = (struct drawing_queue *)safe_malloc(sizeof(struct drawing_queue)); p->next = NULL; return p; } static void free_queue(struct drawing_queue *p) { p->next = free_queue_list; free_queue_list = p; } static void trace_draw_scope(void *vp) { struct drawing_queue *q; q = (struct drawing_queue *)vp; if(!midi_trace.flush_flag) { if(view_soundspec_flag) draw_scope(q->values); if(ctl_speana_flag) { CtlEvent e; e.type = CTLE_SPEANA; e.v1 = (long)q->values; e.v2 = FFTSIZE/2; ctl->event(&e); } } free_queue(q); } static void decibelspec(double *from, double *to) { double p, hr; int i, j; static double *w_table = NULL; if(w_table == NULL) { double t; w_table = (double *)safe_malloc(FFTSIZE * sizeof(double)); t = -M_PI; for(i = 0; i < FFTSIZE; i++) { w_table[i] = 0.50 + 0.50 * cos(t); t += 2.0 * M_PI / FFTSIZE; } } for(i = 0; i < FFTSIZE; i++) from[i] *= w_table[i]; realfft(from, FFTSIZE); hr = AMP * NCOLOR; if(from[0] >= 0) p = from[0]; else p = -from[0]; to[0] = log(1.0 + (128.0 / FFTSIZE) * p) * hr; for(i = 1, j = FFTSIZE - 1; i < FFTSIZE/2; i++, j--) { double t, u; t = from[i]; u = from[j]; to[i] = log(1.0 + (128.0 / FFTSIZE) * sqrt(t*t + u*u)) * hr; } p = from[FFTSIZE/2]; to[FFTSIZE/2] = log(1.0 + (128.0 / FFTSIZE) * sqrt(2 * p*p)) * hr; } void close_soundspec(void) { XUnmapWindow(disp, win); XSync(disp, True); /* Discard all remained X Events */ view_soundspec_flag = 0; } void open_soundspec(void) { int scr; XGCValues gcv; if(disp != NULL) { XMapWindow(disp, win); XSync(disp, False); view_soundspec_flag = 1; return; } if((disp = XOpenDisplay(NULL)) == NULL) { ctl->cmsg(CMSG_FATAL, VERB_NORMAL, "Can't open display"); ctl->close(); exit(1); } set_color_ring(); scr = DefaultScreen(disp); depth = DefaultDepth(disp, scr); win = XCreateSimpleWindow(disp, DefaultRootWindow(disp), 0, 0, SCOPE_WIDTH, SCOPE_HEIGHT, 0, 0, BlackPixel(disp, scr)); wm_delete_window = XInternAtom(disp, "WM_DELETE_WINDOW", False); XSetWMProtocols(disp, win, &wm_delete_window, 1); XSelectInput(disp, win, ExposureMask | KeyPressMask); XStoreName(disp, win, "Sound Spectrogram"); XSetIconName(disp, win, "Sound Spectrogram"); gcv.graphics_exposures = False; gc = XCreateGC(disp, win, GCGraphicsExposures, &gcv); offscr = XCreatePixmap(disp, win, SCOPE_WIDTH, SCOPE_HEIGHT, depth); XSetForeground(disp, gc, BlackPixel(disp, scr)); XFillRectangle(disp, offscr, gc, 0, 0, SCOPE_WIDTH, SCOPE_HEIGHT); img = XCreateImage(disp, DefaultVisual(disp, scr), depth, ZPixmap, 0, 0, 1, SCOPE_HEIGHT, 8, 0); XMapWindow(disp, win); XSync(disp, False); view_soundspec_flag = 1; } void soundspec_setinterval(double sec) { soundspec_update_interval = (int32)(sec * play_mode->rate); } static void ringsamples(double *x, int pos, int n) { int i, upper; double r; upper = ring_buffer_len; r = 1.0 / pow(2.0, 32.0); for(i = 0; i < n; i++, pos++) { if(pos >= upper) pos = 0; x[i] = (double)ring_buffer[pos] * r; } } void soundspec_update_wave(int32 *buff, int samples) { int i; if(buff == NULL) /* Initialize */ { ring_index = 0; if(samples == 0) { outcnt = 0; next_wakeup_samples = 0; } if(ring_buffer != NULL) memset(ring_buffer, 0, sizeof(int32)); return; } if(!view_soundspec_flag && !ctl_speana_flag) { outcnt += samples; return; } if(ring_buffer == NULL) { ring_buffer = safe_malloc(ring_buffer_len * sizeof(int32)); memset(ring_buffer, 0, sizeof(int32)); if(soundspec_update_interval == 0) soundspec_update_interval = (int32)(DEFAULT_UPDATE * play_mode->rate); realfft(NULL, FFTSIZE); initialize_exp_hz_table(soundspec_zoom); } if(ring_index + samples > ring_buffer_len) { int d; d = ring_buffer_len - ring_index; if(play_mode->encoding & PE_MONO) memcpy(ring_buffer + ring_index, buff, d * 4); else { int32 *p; int n; p = ring_buffer + ring_index; n = d * 2; for(i = 0; i < n; i += 2) *p++ = (buff[i] + buff[i + 1]) / 2; } ring_index = 0; outcnt += d; samples -= d; } if(play_mode->encoding & PE_MONO) memcpy(ring_buffer + ring_index, buff, samples * 4); else { int32 *p; int n; p = ring_buffer + ring_index; n = samples * 2; for(i = 0; i < n; i += 2) *p++ = (buff[i] + buff[i + 1]) / 2; } ring_index += samples; outcnt += samples; if(ring_index == ring_buffer_len) ring_index = 0; if(next_wakeup_samples < outcnt - (ring_buffer_len - FFTSIZE)) { /* next_wakeup_samples is too small */ next_wakeup_samples = outcnt - (ring_buffer_len - FFTSIZE); } while(next_wakeup_samples < outcnt - FFTSIZE) { double x[FFTSIZE]; struct drawing_queue *q; ringsamples(x, next_wakeup_samples % ring_buffer_len, FFTSIZE); q = new_queue(); decibelspec(x, q->values); push_midi_time_vp(midi_trace.offset + next_wakeup_samples, trace_draw_scope, q); next_wakeup_samples += soundspec_update_interval; } } /* Re-initialize something */ void soundspec_reinit(void) { initialize_exp_hz_table(soundspec_zoom); } TiMidity++-2.13.2/interface/soundspec.h0100644004711200001440000000234407421005040017004 0ustar tamukiusers/* TiMidity++ -- MIDI to WAVE converter and player Copyright (C) 1999-2002 Masanao Izumo Copyright (C) 1995 Tuukka Toivonen 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef ___SOUNDSPEC_H_ #define ___SOUNDSPEC_H_ extern void open_soundspec(void); extern void close_soundspec(void); extern void soundspec_setinterval(double interval_sec); extern void soundspec_update_wave(int32 *buff, int samples); extern void soundspec_reinit(void); extern int view_soundspec_flag; extern int ctl_speana_flag; #endif /* ___SOUNDSPEC_H_ */ TiMidity++-2.13.2/interface/check.xbm0100644004711200001440000000034007421005040016407 0ustar tamukiusers#define check_width 11 #define check_height 11 static unsigned char check_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x0e, 0x06, 0x0c, 0x03, 0x8c, 0x03, 0xcc, 0x01, 0xec, 0x00, 0x7c, 0x00, 0x3c, 0x00, 0x18, 0x00, 0x00, 0x00}; TiMidity++-2.13.2/interface/arrow.xbm0100644004711200001440000000066207421005040016473 0ustar tamukiusers#define arrow_width 32 #define arrow_height 14 static unsigned char arrow_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x00, 0x88, 0x01, 0x00, 0x00, 0x08, 0x06, 0x00, 0x00, 0x88, 0x1f, 0x00, 0x00, 0xe8, 0x07, 0x00, 0x00, 0xf8, 0x01, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; TiMidity++-2.13.2/interface/on.xbm0100644004711200001440000000073307421005040015754 0ustar tamukiusers#define on_width 32 #define on_height 16 static unsigned char on_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1e, 0xe7, 0x00, 0x00, 0x33, 0x4e, 0x00, 0x80, 0x61, 0x4e, 0x00, 0x80, 0x61, 0x5a, 0x00, 0x80, 0x61, 0x5a, 0x00, 0x80, 0x61, 0x72, 0x00, 0x80, 0x61, 0x72, 0x00, 0x00, 0x33, 0x62, 0x00, 0x00, 0x1e, 0x47, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; TiMidity++-2.13.2/interface/off.xbm0100644004711200001440000000073607421005040016115 0ustar tamukiusers#define off_width 32 #define off_height 16 static unsigned char off_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xe3, 0xef, 0x0f, 0x60, 0xc6, 0xcc, 0x0c, 0x30, 0xcc, 0xc8, 0x08, 0x30, 0xcc, 0xc2, 0x02, 0x30, 0xcc, 0xc3, 0x03, 0x30, 0xcc, 0xc2, 0x02, 0x30, 0xcc, 0xc0, 0x00, 0x60, 0xc6, 0xc0, 0x00, 0xc0, 0xe3, 0xe1, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; TiMidity++-2.13.2/interface/server_c.c0100644004711200001440000010245610125651535016624 0ustar tamukiusers/* TiMidity++ -- MIDI to WAVE converter and player Copyright (C) 1999-2004 Masanao Izumo Copyright (C) 1995 Tuukka Toivonen 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA server_c.c - TiMidity server written by Masanao Izumo Mon Apr 5 1999: Initial created. Launch TiMidity server: (example) % timidity -ir 7777 Protcol note: The protocol is based on OSS interface. TiMidity server has 2 TCP/IP connection. They are control port and data port. Control port: ASCII text protocol like FTP control port. See command_help for control protocol in this source code. Data port: One way Binary stream data from client to server. The format of stream is same as OSS sequencer stream. TODO: Protocol specification to be documented. */ #ifdef HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ #include #include #include #include #include #include #include #include #ifndef NO_STRING_H #include #else #include #endif #include #ifdef HAVE_SYS_SOUNDCARD_H #include #else #include "server_defs.h" #endif /* HAVE_SYS_SOUNDCARD_H */ #include "timidity.h" #include "common.h" #include "controls.h" #include "instrum.h" #include "playmidi.h" #include "readmidi.h" #include "recache.h" #include "output.h" #include "aq.h" #include "timer.h" /* #define DEBUG_DUMP_SEQ 1 */ #define MIDI_COMMAND_PER_SEC 100 #define DEFAULT_LOW_TIMEAT 0.4 #define DEFAULT_HIGH_TIMEAT 0.6 #define DONT_STOP_AUDIO 1 #define DEFAULT_TIMEBASE 100 /* HZ? */ #define MAXTICKDIFF 150 #define SIG_TIMEOUT_SEC 3 static int cmd_help(int argc, char **argv); static int cmd_open(int argc, char **argv); static int cmd_close(int argc, char **argv); static int cmd_timebase(int argc, char **argv); static int cmd_reset(int argc, char **argv); static int cmd_patch(int argc, char **argv); static int cmd_quit(int argc, char **argv); static int cmd_queue(int argc, char **argv); static int cmd_maxqueue(int argc, char **argv); static int cmd_time(int argc, char **argv); static int cmd_nop(int argc, char **argv); static int cmd_autoreduce(int argc, char **argv); static int cmd_setbuf(int argc, char **argv); struct { char *cmd, *help; int minarg, maxarg; int (* proc)(int argc, char **argv); /* argv[0] is command name * argv[1..argc-1] is the arg. * return: 0=success, -1=fatal-error, * 1=connection-closed */ } cmd_table[] = { {"HELP", "HELP\tDisplay this message", 1, 1, cmd_help}, {"OPEN", "OPEN {lsb|msb}\n" "\tOpen data connection\n" "\tlsb: The byte order of data stream is LSB\n" "\tmsb: The byte order of data stream is MSB", 2, 2, cmd_open}, {"CLOSE", "CLOSE\tShutdown current data connection", 1, 1, cmd_close}, {"TIMEBASE", "TIMEBASE [timebase]\n\tSet time base", 1, 2, cmd_timebase}, {"RESET", "RESET\tInitialize all of MIDI status", 1, 1, cmd_reset}, {"PATCH", "PATCH {drumset|bank} \n\tLoad specified patch", 4, 4, cmd_patch}, {"QUIT", "QUIT\tClose control connection", 1, 1, cmd_quit}, {"QUEUE", "QUEUE\tTiMidity tells the time of audio buffer queue in second", 1, 1, cmd_queue}, {"MAXQUEUE", "MAXQUEUE\n" "\tTiMidity tells the maxmum time of audio buffer queue in second", 1, 1, cmd_maxqueue}, {"TIME", "TIME\tTiMidity tells the current playing time in second", 1, 1, cmd_time}, {"NOP", "NOP\tDo nothing", 1, 1, cmd_nop}, {"AUTOREDUCE", "AUTOREDUCE {on|off} [msec]\n\tEnable/Disable auto voice reduction", 2, 3, cmd_autoreduce}, {"SETBUF", "SETBUF low hi\n\tSpecify low/hi sec of buffer queue", 3, 3, cmd_setbuf}, {NULL, NULL, 0, 0, NULL} /* terminate */ }; /* TEMPO []\n\ Change the tempo. If the argument is omitted, TiMidity tells the\n\ current tempo.\n\ KEYSHIFT <{+|-}offs>\n\ Change the base key. (0 to reset)\n\ SPEED <{+|-}offs>\n\ Change the play speed. (0 to reset)\n\ MODE {gs|xg|gm}\n\ Specify default MIDI system mode\n\ SYNTH [gus|awe]\n\ Specify Synth type emulation. (no argument to default)\n\ */ static int ctl_open(int using_stdin, int using_stdout); static void ctl_close(void); static int ctl_read(int32 *valp); static int cmsg(int type, int verbosity_level, char *fmt, ...); static void ctl_event(CtlEvent *e); static void ctl_pass_playing_list(int n, char *args[]); /**********************************/ /* export the interface functions */ #define ctl server_control_mode ControlMode ctl= { "remote interface", 'r', 1,0,0, 0, ctl_open, ctl_close, ctl_pass_playing_list, ctl_read, cmsg, ctl_event }; struct fd_read_buffer { char buff[BUFSIZ]; /* count: beginning of read pointer * size: end of read pointer * fd: file descripter for input */ int count, size, fd; }; static int fdgets(char *buff, size_t buff_size, struct fd_read_buffer *p); static int fdputs(char *s, int fd); static uint32 data2long(uint8* data); static uint16 data2short(uint8* data); static int do_control_command_nonblock(void); static struct fd_read_buffer control_fd_buffer; static int data_fd = -1, control_fd = -1; static int data_port, control_port; static int is_lsb_data = 1; static int curr_timebase = DEFAULT_TIMEBASE; static int32 sample_correction; static int32 sample_increment; static int32 sample_correction; static int32 sample_cum; static int32 curr_event_samples, event_time_offset; static int32 curr_tick, tick_offs; static double start_time; static int tmr_running; static int is_system_prefix = 0; static struct sockaddr_in control_client; static double low_time_at = 0.3; static double high_time_at = 0.5; static FILE *outfp; /*ARGSUSED*/ static int ctl_open(int using_stdin, int using_stdout) { ctl.opened = 1; ctl.flags &= ~(CTLF_LIST_RANDOM|CTLF_LIST_SORT); if(using_stdout) outfp = stderr; else outfp = stdout; return 0; } static void ctl_close(void) { if(!ctl.opened) return; if(data_fd != -1) { close(data_fd); data_fd = -1; } if(control_fd != -1) { close(control_fd); control_fd = -1; } } /*ARGSUSED*/ static int ctl_read(int32 *valp) { if(data_fd != -1) do_control_command_nonblock(); return RC_NONE; } static int cmsg(int type, int verbosity_level, char *fmt, ...) { va_list ap; if((type==CMSG_TEXT || type==CMSG_INFO || type==CMSG_WARNING) && ctl.verbosity < verbosity_level) return 0; if(outfp == NULL) outfp = stderr; va_start(ap, fmt); vfprintf(outfp, fmt, ap); fputs(NLS, outfp); fflush(outfp); va_end(ap); return 0; } static void ctl_event(CtlEvent *e) { } static int pasv_open(int *port) { int sfd; struct sockaddr_in server; if((sfd = socket(AF_INET, SOCK_STREAM, 0)) < 0) { perror("socket"); return -1; } memset(&server, 0, sizeof(server)); server.sin_port = htons(*port); server.sin_family = AF_INET; server.sin_addr.s_addr = htonl(INADDR_ANY); #ifdef SO_REUSEADDR { int on = 1; setsockopt(sfd, SOL_SOCKET, SO_REUSEADDR, (caddr_t)&on, sizeof(on)); } #endif /* SO_REUSEADDR */ ctl.cmsg(CMSG_INFO, VERB_DEBUG, "Bind TCP/IP port=%d", *port); if(bind(sfd, (struct sockaddr *)&server, sizeof(server)) < 0) { perror("bind"); close(sfd); return -1; } if(*port == 0) { int len = sizeof(server); if(getsockname(sfd, (struct sockaddr *)&server, &len) < 0) { perror("getsockname"); close(sfd); return -1; } *port = ntohs(server.sin_port); } /* Set it up to wait for connections. */ if(listen(sfd, 1) < 0) { perror("listen"); close(sfd); return -1; } return sfd; } static RETSIGTYPE sig_timeout(int sig) { signal(SIGALRM, sig_timeout); /* For SysV base */ /* Expect EINTR */ } static void doit(void); static int send_status(int status, char *message, ...); static void compute_sample_increment(void); static void server_reset(void); static void ctl_pass_playing_list(int n, char *args[]) { int sock; if(n != 2 && n != 1) { fprintf(stderr, "Usage: timidity -ir control-port [data-port]\n"); return; } #ifdef SIGPIPE signal(SIGPIPE, SIG_IGN); /* Handle broken pipe */ #endif /* SIGPIPE */ control_port = atoi(args[0]); if(n == 2) data_port = atoi(args[1]); else data_port = 0; if (control_port) { sock = pasv_open(&control_port); if(sock == -1) return; } opt_realtime_playing = 1; /* Enable loading patch while playing */ allocate_cache_size = 0; /* Don't use pre-calclated samples */ /* aq_set_soft_queue(-1.0, 0.0); */ alarm(0); signal(SIGALRM, sig_timeout); play_mode->close_output(); while(1) { int addrlen; addrlen = sizeof(control_client); memset(&control_client, 0, addrlen); if (control_port) { if((control_fd = accept(sock, (struct sockaddr *)&control_client, &addrlen)) < 0) { if(errno == EINTR) continue; perror("accept"); close(sock); return; } } else control_fd = 0; if(play_mode->open_output() < 0) { ctl.cmsg(CMSG_FATAL, VERB_NORMAL, "Couldn't open %s (`%c')", play_mode->id_name, play_mode->id_character); send_status(510, "Couldn't open %s (`%c')", play_mode->id_name, play_mode->id_character); if (control_port) { close(control_fd); control_fd = 1; } continue; } server_reset(); ctl.cmsg(CMSG_INFO, VERB_NOISY, "Connected"); doit(); ctl.cmsg(CMSG_INFO, VERB_NOISY, "Connection closed"); play_mode->close_output(); if(control_fd != -1 && control_port) { close(control_fd); control_fd = -1; } if(data_fd != -1) { close(data_fd); data_fd = -1; } free_instruments(0); free_global_mblock(); if (!control_port) break; } } #define MAX_GETCMD_PARAMS 8 /* return: * 0: success * 1: error *-1: fatal error (will be close the connection) */ static int control_getcmd(char **params, int *nparams) { static char buff[BUFSIZ]; int n; /* read line */ n = fdgets(buff, sizeof(buff), &control_fd_buffer); if(n == -1) { perror("read"); return -1; } if(n == 0) return 1; if((params[0] = strtok(buff, " \t\r\n\240")) == NULL) return 0; *nparams = 0; while(params[*nparams] && *nparams < MAX_GETCMD_PARAMS) params[++(*nparams)] = strtok(NULL," \t\r\n\240"); return 0; } static int send_status(int status, char *message, ...) { va_list ap; char buff[BUFSIZ]; va_start(ap, message); sprintf(buff, "%03d ", status); vsnprintf(buff + 4, sizeof(buff) - 5, message, ap); va_end(ap); strncat(buff, "\n", BUFSIZ - strlen(buff) - 1); buff[BUFSIZ-1] = '\0'; /* force terminate */ if(write(control_fd, buff, strlen(buff)) == -1) return -1; return 0; } static void seq_play_event(MidiEvent *ev) { if(tmr_running) ev->time = curr_event_samples; else { if(IS_STREAM_TRACE) { event_time_offset += play_mode->rate / MIDI_COMMAND_PER_SEC; ev->time = curr_event_samples; } else { double past_time = get_current_calender_time() - start_time; if(play_mode->flag & PF_PCM_STREAM) past_time += high_time_at; ev->time = (int32)(past_time * play_mode->rate); } } ev->time += event_time_offset; play_event(ev); } static void tmr_reset(void) { curr_event_samples = event_time_offset = sample_cum = 0; playmidi_tmr_reset(); curr_timebase = DEFAULT_TIMEBASE; curr_tick = tick_offs = 0; start_time = get_current_calender_time(); } static void compute_sample_increment(void) { double a; a = (double)current_play_tempo * (double)play_mode->rate * (65536.0/500000.0) / (double)curr_timebase, sample_correction = (int32)(a) & 0xFFFF; sample_increment = (int32)(a) >> 16; } static void add_tick(int tick) { int32 samples_to_do; MidiEvent ev; samples_to_do = sample_increment * tick; sample_cum += sample_correction * tick; if(sample_cum & 0xFFFF0000) { samples_to_do += ((sample_cum >> 16) & 0xFFFF); sample_cum &= 0x0000FFFF; } curr_event_samples += samples_to_do; curr_tick += tick; ev.type = ME_NONE; seq_play_event(&ev); } static int tick2sample(int tick) { int32 samples, cum; samples = sample_increment * tick; cum = sample_correction * tick; if(cum & 0xFFFF0000) samples += ((sample_cum >> 16) & 0xFFFF); return samples; } int time2tick(double sec) { return (int)(sec * curr_timebase); } static void stop_playing(void) { if(upper_voices) { MidiEvent ev; ev.type = ME_EOT; ev.a = 0; ev.b = 0; seq_play_event(&ev); aq_flush(0); } } static int do_control_command(void); static int do_control_command_nonblock(void); static int do_sequencer(void); static void do_chn_voice(uint8 *); static void do_chn_common(uint8 *); static void do_timing(uint8 *); static void do_sysex(uint8 *, int len); static void do_extended(uint8 *); static void do_timeout(void); static void server_seq_sync(double tm); static uint8 data_buffer[BUFSIZ]; static int data_buffer_len; static void doit(void) { memset(&control_fd_buffer, 0, sizeof(control_fd_buffer)); control_fd_buffer.fd = control_fd; send_status(220, "TiMidity++ %s%s ready", (strcmp(timidity_version, "current")) ? "v" : "", timidity_version); /* while(data_fd != -1 && control_fd != -1) */ while(control_fd != -1) { fd_set fds; int n, maxfd; if(data_fd == -1) { if(do_control_command()) break; } else { long usec; FD_ZERO(&fds); FD_SET(control_fd, &fds); FD_SET(data_fd, &fds); if(control_fd > data_fd) maxfd = control_fd; else maxfd = data_fd; if(data_fd != -1) { double wait_time; int32 filled; filled = aq_filled(); if(!tmr_running && filled <= 0) usec = -1; else { wait_time = (double)filled / play_mode->rate - low_time_at; if(wait_time <= 0) usec = 0; else usec = (long)(wait_time * 1000000); } } else usec = -1; if(usec >= 0) { struct timeval timeout; timeout.tv_sec = usec / 1000000; timeout.tv_usec = usec % 1000000; n = select(maxfd + 1, &fds, NULL, NULL, &timeout); } else n = select(maxfd + 1, &fds, NULL, NULL, NULL); if(n < 0) { perror("select"); break; } if(n == 0) { if(ctl.verbosity >= VERB_DEBUG) { putchar(','); fflush(stdout); } do_timeout(); continue; } if(control_fd != -1 && FD_ISSET(control_fd, &fds)) { if(do_control_command()) { close(control_fd); control_fd = -1; } } else if(data_fd != -1 && FD_ISSET(data_fd, &fds)) { if(do_sequencer()) { close(data_fd); data_fd = -1; send_status(403, "Data connection is closed"); } } } } if(data_fd != -1) stop_playing(); } static void do_timeout(void) { double fill_time; if(data_fd == -1 || !IS_STREAM_TRACE) return; aq_add(NULL, 0); fill_time = high_time_at - (double)aq_filled() / play_mode->rate; if(fill_time <= 0) return; if(tmr_running) add_tick(time2tick(fill_time)); else { MidiEvent ev; event_time_offset += (int32)(fill_time * play_mode->rate); ev.time = curr_event_samples + event_time_offset; ev.type = ME_NONE; play_event(&ev); } } /* -1=error, 0=success, 1=connection-closed */ static int data_flush(int discard) { fd_set fds; char buff[BUFSIZ]; struct timeval timeout; int n; while(1) { FD_ZERO(&fds); FD_SET(data_fd, &fds); timeout.tv_sec = 0; if(discard) timeout.tv_usec = 100000; else timeout.tv_usec = 0; if((n = select(data_fd + 1, &fds, NULL, NULL, &timeout)) < 0) { perror("select"); return -1; } if(n == 0) break; if(discard) { if((n = read(data_fd, buff, sizeof(buff))) < 0) { perror("read"); return -1; } if(n == 0) return 1; } else { int status; if((status = do_sequencer()) != 0) return status; } } return 0; } static void server_seq_sync(double tm) { double t; aq_soft_flush(); t = (double)aq_filled() / play_mode->rate; if(t > tm) usleep((unsigned long)((t - tm) * 1000000)); } static void server_reset(void) { playmidi_stream_init(); if(free_instruments_afterwards) free_instruments(0); data_buffer_len = 0; do_sysex(NULL, 0); /* Initialize SysEx buffer */ low_time_at = DEFAULT_LOW_TIMEAT; high_time_at = DEFAULT_HIGH_TIMEAT; reduce_voice_threshold = 0; /* Disable auto reduction voice */ compute_sample_increment(); tmr_reset(); tmr_running = 0; start_time = get_current_calender_time(); } /* -1=error, 0=success, 1=connection-closed */ static int do_control_command(void) { int status; char *params[MAX_GETCMD_PARAMS]; int nparams; int i; if((status = control_getcmd(params, &nparams)) == -1) return -1; if(status == 1) { send_status(500, "Error"); return 1; } if(nparams == 0 || *params == NULL || **params == '\0') return 0; for(i = 0; cmd_table[i].cmd; i++) if(strcasecmp(params[0], cmd_table[i].cmd) == 0) { if(nparams < cmd_table[i].minarg) return send_status(501, "'%s': Arguments is too few", params[0]); if(nparams > cmd_table[i].maxarg) return send_status(501, "'%s': Arguments is too many", params[0]); return cmd_table[i].proc(nparams, params); } return send_status(500, "'%s': command not understood.", params[0]); } static int cmd_help(int argc, char **argv) { int i; if(send_status(200, "Help ok")) return -1; for(i = 0; cmd_table[i].cmd; i++) { if(fdputs(cmd_table[i].help, control_fd)) return -1; if(fdputs("\n", control_fd)) return -1; } return fdputs(".\n", control_fd); } static int cmd_open(int argc, char **argv) { int sock; struct sockaddr_in in; int addrlen; int port; if(data_fd != -1) return send_status(125, "Data connection is already opened"); if(strcasecmp(argv[1], "lsb") == 0) is_lsb_data = 1; else if(strcasecmp(argv[1], "msb") == 0) is_lsb_data = 0; else return send_status(502, "OPEN: Invalid argument: %s", argv[1]); port = data_port; if((sock = pasv_open(&port)) == -1) return send_status(511, "Can't open data connection"); addrlen = sizeof(in); memset(&in, 0, addrlen); send_status(200, "%d is ready acceptable", port); alarm(SIG_TIMEOUT_SEC); data_fd = accept(sock, (struct sockaddr *)&in, &addrlen); alarm(0); if(data_fd < 0) { send_status(512, "Accept error"); close(sock); return 0; } close(sock); if(control_client.sin_addr.s_addr != in.sin_addr.s_addr) return send_status(513, "Security violation: Address mismatch"); send_status(200, "Ready data connection"); data_buffer_len = 0; do_sysex(NULL, 0); /* Initialize SysEx buffer */ tmr_reset(); return 0; } static int cmd_close(int argc, char **argv) { if(data_fd != -1) { close(data_fd); data_fd = -1; return send_status(302, "Data connection is closed"); } return send_status(302, "Data connection is already closed"); } static int cmd_queue(int argc, char **argv) { int32 qsamples; aq_add(NULL, 0); /* Update software queue */ if(!aq_fill_buffer_flag) qsamples = aq_soft_filled() + aq_filled(); else qsamples = 0; return send_status(200, "%f sec", (double)qsamples / play_mode->rate); } static int cmd_maxqueue(int argc, char **argv) { return send_status(200, "%f sec", (double)aq_get_dev_queuesize() / play_mode->rate); } static int cmd_time(int argc, char **argv) { return send_status(200, "%f sec", (double)aq_samples()); } static int cmd_quit(int argc, char **argv) { send_status(200, "Bye"); return 1; } static int cmd_timebase(int argc, char **argv) { int i; if(argc == 1) return send_status(200, "%d OK", curr_timebase); i = atoi(argv[1]); if(i < 1) i = 1; else if(i > 1000) i = 1000; if(i != curr_timebase) { curr_timebase = i; compute_sample_increment(); tick_offs = curr_tick; start_time = get_current_calender_time(); } return send_status(200, "OK"); } static int cmd_patch(int argc, char **argv) { int dr, bank, prog; if(strcasecmp(argv[1], "drumset") == 0) dr = 1; else if(strcasecmp(argv[1], "bank") == 0) dr = 0; else return send_status(502, "PATCH: Invalid argument: %s", argv[1]); bank = atoi(argv[2]); prog = atoi(argv[3]); if(bank < 0 || bank > 127 || prog < 0 || prog > 127) return send_status(502, "PATCH: Invalid argument"); if(play_midi_load_instrument(dr, bank, prog) == NULL) return send_status(514, "PATCH: Can't load the patch"); return send_status(200, "OK"); } static int cmd_reset(int argc, char **argv) { int status; if(data_fd >= 0) { stop_playing(); if((status = data_flush(1)) != 0) return status; } server_reset(); return send_status(200, "OK"); } static int cmd_autoreduce(int argc, char **argv) { if(strcasecmp(argv[1], "on") == 0) { if(argc == 3) reduce_voice_threshold = atoi(argv[2]); else reduce_voice_threshold = -1; } else if(strcasecmp(argv[1], "off") == 0) reduce_voice_threshold = 0; else return send_status(502, "AUTOREDUCE: Invalid argument: %s", argv[1]); return send_status(200, "OK"); } static int cmd_setbuf(int argc, char **argv) { low_time_at = atof(argv[1]); high_time_at = atof(argv[1]); return send_status(200, "OK"); } static int cmd_nop(int argc, char **argv) { return send_status(200, "NOP OK"); } static int do_control_command_nonblock(void) { struct timeval timeout; int n; fd_set fds; if(control_fd == -1) return 1; FD_ZERO(&fds); FD_SET(control_fd, &fds); timeout.tv_sec = 0; timeout.tv_usec = 0; n = select(control_fd + 1, &fds, NULL, NULL, &timeout); if(n > 0 && FD_ISSET(control_fd, &fds)) return do_control_command(); return 0; } static int fdgets(char *buff, size_t buff_size, struct fd_read_buffer *p) { int n, len, count, size, fd; char *buff_endp = buff + buff_size - 1, *pbuff, *beg; fd = p->fd; if(buff_size == 0) return 0; else if(buff_size == 1) /* buff == buff_endp */ { *buff = '\0'; return 0; } len = 0; count = p->count; size = p->size; pbuff = p->buff; beg = buff; do { if(count == size) { if((n = read(fd, pbuff, BUFSIZ)) <= 0) { *buff = '\0'; if(n == 0) { p->count = p->size = 0; return buff - beg; } return -1; /* < 0 error */ } count = p->count = 0; size = p->size = n; } *buff++ = pbuff[count++]; } while(*(buff - 1) != '\n' && buff != buff_endp); *buff = '\0'; p->count = count; return buff - beg; } static int fdputs(char *s, int fd) { if(write(fd, s, strlen(s)) == -1) return -1; return 0; } #ifdef LITTLE_ENDIAN static uint32 data2long(uint8* data) { uint32 x; memcpy(&x, data, sizeof(x)); if(!is_lsb_data) x = XCHG_LONG(x); return x; } static uint16 data2short(uint8* data) { uint16 x; memcpy(&x, data, sizeof(x)); if(!is_lsb_data) x = XCHG_SHORT(x); return x; } #else static uint32 data2long(uint8* data) { uint32 x; memcpy(&x, data, sizeof(x)); if(is_lsb_data) x = XCHG_LONG(x); return x; } static uint16 data2short(uint8* data) { uint16 x; memcpy(&x, data, sizeof(x)); if(is_lsb_data) x = XCHG_SHORT(x); return x; } #endif static int do_sequencer(void) { int n, offset; MidiEvent ev; n = read(data_fd, data_buffer + data_buffer_len, sizeof(data_buffer) - data_buffer_len); if(n <= 0) { stop_playing(); return n; } #ifdef DEBUG_DUMP_SEQ { int i; for(i = 0; i < n; i++) printf("%02x", data_buffer[data_buffer_len + i]); putchar('\n'); } #endif /* DEBUG_DUMP_SEQ */ data_buffer_len += n; offset = 0; while(offset < data_buffer_len) { int cmd; cmd = data_buffer[offset]; #define READ_NEEDBUF(x) if(offset + x > data_buffer_len) goto done; #define READ_ADVBUF(x) offset += x; switch(cmd) { case EV_CHN_VOICE: READ_NEEDBUF(8); do_chn_voice(data_buffer + offset); READ_ADVBUF(8); break; case EV_CHN_COMMON: READ_NEEDBUF(8); do_chn_common(data_buffer + offset); READ_ADVBUF(8); break; case EV_TIMING: READ_NEEDBUF(8); do_timing(data_buffer + offset); READ_ADVBUF(8); break; case EV_SYSEX: READ_NEEDBUF(8); do_sysex(data_buffer + offset + 2, 6); READ_ADVBUF(8); break; case SEQ_MIDIPUTC: if(is_system_prefix) { READ_NEEDBUF(4); do_sysex(data_buffer + offset + 1, 1); if(data_buffer[offset + 1] == 0xf7) is_system_prefix = 0; /* End SysEX */ READ_ADVBUF(4); break; } READ_NEEDBUF(2); switch(data_buffer[offset + 1] & 0xf0) { case MIDI_NOTEON: READ_NEEDBUF(12); ev.channel = data_buffer[offset + 1] & 0x0f; ev.a = data_buffer[offset + 5] & 0x7f; ev.b = data_buffer[offset + 9] & 0x7f; if(ev.b != 0) ev.type = ME_NOTEON; else ev.type = ME_NOTEOFF; seq_play_event(&ev); READ_ADVBUF(12); break; case MIDI_NOTEOFF: READ_NEEDBUF(12); ev.type = ME_NOTEOFF; ev.channel = data_buffer[offset + 1] & 0x0f; ev.a = data_buffer[offset + 5] & 0x7f; ev.b = data_buffer[offset + 9] & 0x7f; seq_play_event(&ev); READ_ADVBUF(12); break; case MIDI_KEY_PRESSURE: READ_NEEDBUF(12); ev.type = ME_KEYPRESSURE; ev.channel = data_buffer[offset + 1] & 0x0f; ev.a = data_buffer[offset + 5] & 0x7f; ev.b = data_buffer[offset + 9] & 0x7f; seq_play_event(&ev); READ_ADVBUF(12); break; case MIDI_CTL_CHANGE: READ_NEEDBUF(12); if(convert_midi_control_change(data_buffer[offset + 1] & 0x0f, data_buffer[offset + 5], data_buffer[offset + 9], &ev)) seq_play_event(&ev); READ_ADVBUF(12); break; case MIDI_PGM_CHANGE: READ_NEEDBUF(8); ev.type = ME_PROGRAM; ev.channel = data_buffer[offset + 1] & 0x0f; ev.a = data_buffer[offset + 5] & 0x7f; ev.b = 0; seq_play_event(&ev); READ_ADVBUF(8); break; case MIDI_CHN_PRESSURE: READ_NEEDBUF(8); ev.type = ME_CHANNEL_PRESSURE; ev.channel = data_buffer[offset + 1] & 0x0f; ev.a = data_buffer[offset + 5] & 0x7f; ev.b = 0; seq_play_event(&ev); READ_ADVBUF(8); break; case MIDI_PITCH_BEND: READ_NEEDBUF(12); ev.type = ME_PITCHWHEEL; ev.channel = data_buffer[offset + 1] & 0x0f; ev.a = data_buffer[offset + 5] & 0x7f; ev.b = data_buffer[offset + 9] & 0x7f; seq_play_event(&ev); READ_ADVBUF(12); break; case MIDI_SYSTEM_PREFIX: READ_NEEDBUF(4); do_sysex(data_buffer + offset + 1, 1); is_system_prefix = 1; /* Start SysEX */ READ_ADVBUF(4); break; default: ctl.cmsg(CMSG_ERROR, VERB_NORMAL, "Undefined SEQ_MIDIPUTC 0x%02x", data_buffer[offset + 1]); send_status(402, "Undefined SEQ_MIDIPUTC 0x%02x", data_buffer[offset + 1]); return 1; } break; case SEQ_FULLSIZE: /* WARNING: This data may be devided into some socket fragments. */ offset = data_buffer_len; ctl.cmsg(CMSG_WARNING, VERB_NORMAL, "SEQ_FULLSIZE is received. This command is not safety."); break; case SEQ_EXTENDED: READ_NEEDBUF(8); do_extended(data_buffer + offset); READ_ADVBUF(8); break; case EV_SEQ_LOCAL: case SEQ_PRIVATE: READ_NEEDBUF(8); /* Ignore */ READ_ADVBUF(8); break; default: ctl.cmsg(CMSG_ERROR, VERB_NORMAL, "Undefined data 0x%02x", data_buffer[offset - 1]); send_status(401, "Wrong data is recieved (seqcmd=0x%02x)", cmd); stop_playing(); return 1; } #undef READ_NEEDBUF #undef READ_ADVBUF } done: if(offset) { data_buffer_len -= offset; memmove(data_buffer, data_buffer + offset, data_buffer_len); } return 0; } static void do_chn_voice(uint8 *data) { int type, chn, note, parm; MidiEvent ev; type = data[2]; chn = data[3] % MAX_CHANNELS; note = data[4] & 0x7f; parm = data[5] & 0x7f; ev.channel = chn; ev.a = note; ev.b = parm; switch(type) { case MIDI_NOTEON: if(parm > 0) { ev.type = ME_NOTEON; seq_play_event(&ev); break; } /* FALLTHROUGH */ case MIDI_NOTEOFF: ev.type = ME_NOTEOFF; seq_play_event(&ev); break; case MIDI_KEY_PRESSURE: ev.type = ME_KEYPRESSURE; seq_play_event(&ev); break; } } static void do_chn_common(uint8 *data) { int type, chn, p1, p2, w14; MidiEvent ev; type = data[2]; chn = data[3] % MAX_CHANNELS; p1 = data[4] & 0x7f; p2 = data[5] & 0x7f; w14 = data2short(data + 6) & 0x3fff; if(type == 0xff) /* Meta event */ { /* This event is special event for timidity. (not OSS compatible) */ switch(data[3]) { case 0x2f: /* End of midi */ stop_playing(); tmr_reset(); break; case 0x7f: /* Sequencer-Specific Meta-Event */ switch(data[4]) { case 0x01: /* MIDI Reset */ ev.type = ME_RESET; ev.a = DEFAULT_SYSTEM_MODE; ev.b = 0; seq_play_event(&ev); break; case 0x02: { /* Used to sync. */ double target_time, queue_time, sleep_time; if(w14 == 0) { aq_flush(0); /* wait until playout */ send_status(301, "0 Sync OK"); break; } aq_soft_flush(); target_time = (double)w14 / curr_timebase; queue_time = (double)aq_filled() / play_mode->rate; sleep_time = queue_time - target_time; if(sleep_time > 0) { send_status(301, "%g Sync OK", sleep_time); usleep((unsigned long)(sleep_time * 1000000)); } else send_status(301, "0 Sync OK"); } break; } } return; } ev.channel = chn; switch(type) { case MIDI_CTL_CHANGE: if(convert_midi_control_change(chn, p1, w14, &ev)) seq_play_event(&ev); break; case MIDI_PGM_CHANGE: ev.type = ME_PROGRAM; ev.a = p1; ev.b = 0; seq_play_event(&ev); break; case MIDI_CHN_PRESSURE: ev.type = ME_CHANNEL_PRESSURE; ev.a = p1; ev.b = p2; seq_play_event(&ev); break; case MIDI_PITCH_BEND: ev.type = ME_PITCHWHEEL; ev.a = w14 & 0x7f; ev.b = (w14>>7) & 0x7f; seq_play_event(&ev); break; } } static void do_timing(uint8 *data) { int32 val; val = data2long(data + 4); switch(data[1]) { case TMR_START: tmr_running = 1; tmr_reset(); event_time_offset = (int32)(play_mode->rate * high_time_at); break; case TMR_STOP: tmr_running = 0; break; case TMR_CONTINUE: if(!tmr_running) { tmr_running = 1; tick_offs = curr_tick; start_time = get_current_calender_time(); } break; case TMR_TEMPO: #if 0 /* What should TMR_TEMPO work ? */ if(val < 8) val = 8; else if(val > 250) val = 250; current_play_tempo = 60 * 1000000 / val; compute_sample_increment(); #endif break; case TMR_WAIT_ABS: /* printf("## TMR_WAIT_ABS: %d %d %d %g\n", curr_tick, curr_tick - (time2tick(get_current_calender_time() - start_time) + tick_offs), event_time_offset, (double)aq_filled() / play_mode->rate); */ val -= curr_tick; /*FALLTHROUGH*/ case TMR_WAIT_REL: if(val <= 0) break; add_tick(val); break; #if 0 case TMR_ECHO: case TMR_SPP: #endif default: /* printf("## TMR=0x%02x is not supported\n", data[1]); */ break; } } static void do_sysex(uint8 *data, int n) { static uint8 sysexbuf[BUFSIZ]; static int buflen; static int fillflag; int i; if(data == NULL) { buflen = fillflag = 0; is_system_prefix = 0; return; } for(i = 0; i < n; i++) { /* SysEx := /\xf0([^\xf7]*\xf7)/ */ if(!fillflag) { if(data[i] == 0xf0) { fillflag = 1; continue; } } if(fillflag) { if(buflen < sizeof(sysexbuf)) sysexbuf[buflen++] = data[i]; if(data[i] == 0xf7) { MidiEvent ev; if(parse_sysex_event(sysexbuf, buflen, &ev)) seq_play_event(&ev); buflen = 0; fillflag = 0; } } } } static void do_extended(uint8 *data) { int value; MidiEvent ev; value = data[5] | data[6] * 256; switch(data[1]) { case SEQ_CONTROLLER: switch(data[4]) { case CTRL_PITCH_BENDER: /* ?? */ break; case CTRL_PITCH_BENDER_RANGE: /* ?? */ ev.channel = data[3] % MAX_CHANNELS; ev.b = 0; ev.a = 0; /* LSB */ ev.type = ME_NRPN_LSB; seq_play_event(&ev); /* MSB */ ev.type = ME_NRPN_MSB; seq_play_event(&ev); /* Data entry */ ev.type = ME_DATA_ENTRY_MSB; ev.a = value / 100; /* ?? */ seq_play_event(&ev); break; default: break; } break; default: break; } } /* * interface__loader(); */ ControlMode *interface_r_loader(void) { return &ctl; } TiMidity++-2.13.2/interface/server_defs.h0100644004711200001440000001443407421005040017313 0ustar tamukiusers/* TiMidity++ -- MIDI to WAVE converter and player Copyright (C) 1999-2002 Masanao Izumo Copyright (C) 1995 Tuukka Toivonen 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA remote_def.c - written by Masanao Izumo Define some macros */ #ifndef ___REMOTE_DEFS_H_ #define ___REMOTE_DEFS_H_ /* * /dev/sequencer input events. * * The data written to the /dev/sequencer is a stream of events. Events * are records of 4 or 8 bytes. The first byte defines the size. * Any number of events can be written with a write call. There * is a set of macros for sending these events. Use these macros if you * want to maximize portability of your program. * * Events SEQ_WAIT, SEQ_MIDIPUTC and SEQ_ECHO. Are also input events. * (All input events are currently 4 bytes long. Be prepared to support * 8 byte events also. If you receive any event having first byte >= 128, * it's a 8 byte event. * * The events are documented at the end of this file. * * Normal events (4 bytes) * There is also a 8 byte version of most of the 4 byte events. The * 8 byte one is recommended. */ #define SEQ_NOTEOFF 0 #define SEQ_NOTEON 1 #define SEQ_WAIT TMR_WAIT_ABS #define SEQ_PGMCHANGE 3 #define SEQ_SYNCTIMER TMR_START #define SEQ_MIDIPUTC 5 #define SEQ_DRUMON 6 /*** OBSOLETE ***/ #define SEQ_DRUMOFF 7 /*** OBSOLETE ***/ #define SEQ_ECHO TMR_ECHO /* For synching programs with output */ #define SEQ_AFTERTOUCH 9 #define SEQ_CONTROLLER 10 #define SEQ_FULLSIZE 0xfd #define SEQ_PRIVATE 0xfe #define SEQ_EXTENDED 0xff /******************************************* * Midi controller numbers ******************************************* * Controllers 0 to 31 (0x00 to 0x1f) and * 32 to 63 (0x20 to 0x3f) are continuous * controllers. * In the MIDI 1.0 these controllers are sent using * two messages. Controller numbers 0 to 31 are used * to send the MSB and the controller numbers 32 to 63 * are for the LSB. Note that just 7 bits are used in MIDI bytes. */ #define CTL_BANK_SELECT 0x00 #define CTL_MODWHEEL 0x01 #define CTL_BREATH 0x02 /* undefined 0x03 */ #define CTL_FOOT 0x04 #define CTL_PORTAMENTO_TIME 0x05 #define CTL_DATA_ENTRY 0x06 #define CTL_MAIN_VOLUME 0x07 #define CTL_BALANCE 0x08 /* undefined 0x09 */ #define CTL_PAN 0x0a #define CTL_EXPRESSION 0x0b /* undefined 0x0c */ /* undefined 0x0d */ /* undefined 0x0e */ /* undefined 0x0f */ #define CTL_GENERAL_PURPOSE1 0x10 #define CTL_GENERAL_PURPOSE2 0x11 #define CTL_GENERAL_PURPOSE3 0x12 #define CTL_GENERAL_PURPOSE4 0x13 /* undefined 0x14 - 0x1f */ /* undefined 0x20 */ /* The controller numbers 0x21 to 0x3f are reserved for the */ /* least significant bytes of the controllers 0x00 to 0x1f. */ /* These controllers are not recognised by the driver. */ /* Controllers 64 to 69 (0x40 to 0x45) are on/off switches. */ /* 0=OFF and 127=ON (intermediate values are possible) */ #define CTL_DAMPER_PEDAL 0x40 #define CTL_SUSTAIN 0x40 /* Alias */ #define CTL_HOLD 0x40 /* Alias */ #define CTL_PORTAMENTO 0x41 #define CTL_SOSTENUTO 0x42 #define CTL_SOFT_PEDAL 0x43 /* undefined 0x44 */ #define CTL_HOLD2 0x45 /* undefined 0x46 - 0x4f */ #define CTL_GENERAL_PURPOSE5 0x50 #define CTL_GENERAL_PURPOSE6 0x51 #define CTL_GENERAL_PURPOSE7 0x52 #define CTL_GENERAL_PURPOSE8 0x53 /* undefined 0x54 - 0x5a */ #define CTL_EXT_EFF_DEPTH 0x5b #define CTL_TREMOLO_DEPTH 0x5c #define CTL_CHORUS_DEPTH 0x5d #define CTL_DETUNE_DEPTH 0x5e #define CTL_CELESTE_DEPTH 0x5e /* Alias for the above one */ #define CTL_PHASER_DEPTH 0x5f #define CTL_DATA_INCREMENT 0x60 #define CTL_DATA_DECREMENT 0x61 #define CTL_NONREG_PARM_NUM_LSB 0x62 #define CTL_NONREG_PARM_NUM_MSB 0x63 #define CTL_REGIST_PARM_NUM_LSB 0x64 #define CTL_REGIST_PARM_NUM_MSB 0x65 /* undefined 0x66 - 0x78 */ /* reserved 0x79 - 0x7f */ /* Pseudo controllers (not midi compatible) */ #define CTRL_PITCH_BENDER 255 #define CTRL_PITCH_BENDER_RANGE 254 #define CTRL_EXPRESSION 253 /* Obsolete */ #define CTRL_MAIN_VOLUME 252 /* Obsolete */ #define SEQ_BALANCE 11 #define SEQ_VOLMODE 12 /* * Level 2 event types for /dev/sequencer */ /* * The 4 most significant bits of byte 0 specify the class of * the event: * * 0x8X = system level events, * 0x9X = device/port specific events, event[1] = device/port, * The last 4 bits give the subtype: * 0x02 = Channel event (event[3] = chn). * 0x01 = note event (event[4] = note). * (0x01 is not used alone but always with bit 0x02). * event[2] = MIDI message code (0x80=note off etc.) * */ #define EV_SEQ_LOCAL 0x80 #define EV_TIMING 0x81 #define EV_CHN_COMMON 0x92 #define EV_CHN_VOICE 0x93 #define EV_SYSEX 0x94 /* * Event types 200 to 220 are reserved for application use. * These numbers will not be used by the driver. */ /* * Events for event type EV_CHN_VOICE */ #define MIDI_NOTEOFF 0x80 #define MIDI_NOTEON 0x90 #define MIDI_KEY_PRESSURE 0xA0 /* * Events for event type EV_CHN_COMMON */ #define MIDI_CTL_CHANGE 0xB0 #define MIDI_PGM_CHANGE 0xC0 #define MIDI_CHN_PRESSURE 0xD0 #define MIDI_PITCH_BEND 0xE0 #define MIDI_SYSTEM_PREFIX 0xF0 /* * Timer event types */ #define TMR_WAIT_REL 1 /* Time relative to the prev time */ #define TMR_WAIT_ABS 2 /* Absolute time since TMR_START */ #define TMR_STOP 3 #define TMR_START 4 #define TMR_CONTINUE 5 #define TMR_TEMPO 6 #define TMR_ECHO 8 #define TMR_CLOCK 9 /* MIDI clock */ #define TMR_SPP 10 /* Song position pointer */ #define TMR_TIMESIG 11 /* Time signature */ #endif /* ___REMOTE_DEFS_H_ */ TiMidity++-2.13.2/interface/alsaseq_c.c0100644004711200001440000004604310073674564016757 0ustar tamukiusers/* TiMidity++ -- MIDI to WAVE converter and player Copyright (C) 1999-2004 Masanao Izumo Copyright (C) 1995 Tuukka Toivonen 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA alsaseq_c.c - ALSA sequencer server interface Copyright (c) 2000 Takashi Iwai This interface provides an ALSA sequencer client which receives events and plays it in real-time. On this mode, TiMidity works as a software (quasi-)real-time MIDI synth engine. See doc/C/README.alsaseq for more details. */ #ifdef HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ #include #include #include #include #include #include #include #ifndef NO_STRING_H #include #else #include #endif #include #include #if HAVE_ALSA_ASOUNDLIB_H #include #else #include #endif #include "timidity.h" #include "common.h" #include "controls.h" #include "instrum.h" #include "playmidi.h" #include "readmidi.h" #include "recache.h" #include "output.h" #include "aq.h" #include "timer.h" void readmidi_read_init(void); #define MAX_PORTS 16 #define TICKTIME_HZ 100 struct seq_context { snd_seq_t *handle; /* The snd_seq handle to /dev/snd/seq */ int client; /* The client associated with this context */ int num_ports; /* number of ports */ int port[MAX_PORTS]; /* created sequencer ports */ int fd; /* The file descriptor */ int used; /* number of current connection */ int active; /* */ int queue; snd_seq_queue_status_t *q_status; }; static struct seq_context alsactx; #if SND_LIB_MAJOR > 0 || SND_LIB_MINOR >= 6 /* !! this is a dirty hack. not sure to work in future !! */ static int snd_seq_file_descriptor(snd_seq_t *handle) { int pfds = snd_seq_poll_descriptors_count(handle, POLLIN); if (pfds > 0) { struct pollfd pfd; if (snd_seq_poll_descriptors(handle, &pfd, 1, POLLIN) >= 0) return pfd.fd; } return -ENXIO; } static int alsa_seq_open(snd_seq_t **seqp) { return snd_seq_open(seqp, "hw", SND_SEQ_OPEN_DUPLEX, 0); } static int alsa_create_port(snd_seq_t *seq, int index) { char name[32]; int port; sprintf(name, "TiMidity port %d", index); port = snd_seq_create_simple_port(seq, name, SND_SEQ_PORT_CAP_WRITE|SND_SEQ_PORT_CAP_SUBS_WRITE, SND_SEQ_PORT_TYPE_MIDI_GENERIC); if (port < 0) { fprintf(stderr, "error in snd_seq_create_simple_port\n"); return -1; } return port; } #else static int alsa_seq_open(snd_seq_t **seqp) { return snd_seq_open(seqp, SND_SEQ_OPEN_IN); } static int alsa_create_port(snd_seq_t *seq, int index) { snd_seq_port_info_t pinfo; memset(&pinfo, 0, sizeof(pinfo)); sprintf(pinfo.name, "TiMidity port %d", index); pinfo.capability = SND_SEQ_PORT_CAP_WRITE|SND_SEQ_PORT_CAP_SUBS_WRITE; pinfo.type = SND_SEQ_PORT_TYPE_MIDI_GENERIC; strcpy(pinfo.group, SND_SEQ_GROUP_DEVICE); if (snd_seq_create_port(alsactx.handle, &pinfo) < 0) { fprintf(stderr, "error in snd_seq_create_simple_port\n"); return -1; } return pinfo.port; } #endif static void alsa_set_timestamping(struct seq_context *ctxp, int port) { #if HAVE_SND_SEQ_PORT_INFO_SET_TIMESTAMPING int q = 0; snd_seq_port_info_t *pinfo; if (ctxp->queue < 0) { q = snd_seq_alloc_queue(ctxp->handle); ctxp->queue = q; if (q < 0) return; if (snd_seq_queue_status_malloc(&ctxp->q_status) < 0) { fprintf(stderr, "no memory!\n"); exit(1); } } snd_seq_port_info_alloca(&pinfo); if (snd_seq_get_port_info(ctxp->handle, port, pinfo) < 0) return; snd_seq_port_info_set_timestamping(pinfo, 1); snd_seq_port_info_set_timestamp_real(pinfo, 1); snd_seq_port_info_set_timestamp_queue(pinfo, q); if (snd_seq_set_port_info(ctxp->handle, port, pinfo) < 0) return; #endif } static int ctl_open(int using_stdin, int using_stdout); static void ctl_close(void); static int ctl_read(int32 *valp); static int cmsg(int type, int verbosity_level, char *fmt, ...); static void ctl_event(CtlEvent *e); static void ctl_pass_playing_list(int n, char *args[]); /**********************************/ /* export the interface functions */ #define ctl alsaseq_control_mode ControlMode ctl= { "ALSA sequencer interface", 'A', 1,0,0, 0, ctl_open, ctl_close, ctl_pass_playing_list, ctl_read, cmsg, ctl_event }; /* options */ int opt_realtime_priority = 0; int opt_sequencer_ports = 4; static int buffer_time_advance; static long buffer_time_offset; static long start_time_base; static long cur_time_offset; static long last_queue_offset; static double rate_frac, rate_frac_nsec; static FILE *outfp; /*ARGSUSED*/ static int ctl_open(int using_stdin, int using_stdout) { ctl.opened = 1; ctl.flags &= ~(CTLF_LIST_RANDOM|CTLF_LIST_SORT); if (using_stdout) outfp = stderr; else outfp = stdout; return 0; } static void ctl_close(void) { if (!ctl.opened) return; } static int ctl_read(int32 *valp) { return RC_NONE; } static int cmsg(int type, int verbosity_level, char *fmt, ...) { va_list ap; if((type==CMSG_TEXT || type==CMSG_INFO || type==CMSG_WARNING) && ctl.verbosity < verbosity_level) return 0; if(outfp == NULL) outfp = stderr; va_start(ap, fmt); vfprintf(outfp, fmt, ap); fputs(NLS, outfp); fflush(outfp); va_end(ap); return 0; } static void ctl_event(CtlEvent *e) { } static RETSIGTYPE sig_timeout(int sig) { signal(SIGALRM, sig_timeout); /* For SysV base */ /* Expect EINTR */ } static void doit(struct seq_context *ctxp); static int do_sequencer(struct seq_context *ctxp); static int start_sequencer(struct seq_context *ctxp); static void stop_sequencer(struct seq_context *ctxp); static void server_reset(void); /* reset all when SIGHUP is received */ static RETSIGTYPE sig_reset(int sig) { if (alsactx.active) { stop_sequencer(&alsactx); server_reset(); } signal(SIGHUP, sig_reset); } /* * set the process to realtime privs */ static int set_realtime_priority(void) { struct sched_param schp; int max_prio; if (opt_realtime_priority <= 0) return 0; memset(&schp, 0, sizeof(schp)); max_prio = sched_get_priority_max(SCHED_FIFO); if (max_prio < opt_realtime_priority) opt_realtime_priority = max_prio; schp.sched_priority = opt_realtime_priority; if (sched_setscheduler(0, SCHED_FIFO, &schp) != 0) { printf("can't set sched_setscheduler - using normal priority\n"); return -1; } /* drop root priv. */ if (! geteuid() && getuid() != geteuid()) { if (setuid(getuid())) perror("dropping root priv"); } printf("set SCHED_FIFO(%d)\n", opt_realtime_priority); return 0; } static void ctl_pass_playing_list(int n, char *args[]) { double btime; int i, j; #ifdef SIGPIPE signal(SIGPIPE, SIG_IGN); /* Handle broken pipe */ #endif /* SIGPIPE */ printf("TiMidity starting in ALSA server mode\n"); set_realtime_priority(); if (alsa_seq_open(&alsactx.handle) < 0) { fprintf(stderr, "error in snd_seq_open\n"); return; } alsactx.queue = -1; alsactx.client = snd_seq_client_id(alsactx.handle); alsactx.fd = snd_seq_file_descriptor(alsactx.handle); snd_seq_set_client_name(alsactx.handle, "TiMidity"); snd_seq_set_client_pool_input(alsactx.handle, 1000); /* enough? */ if (opt_sequencer_ports < 1) alsactx.num_ports = 1; else if (opt_sequencer_ports > MAX_PORTS) alsactx.num_ports = MAX_PORTS; else alsactx.num_ports = opt_sequencer_ports; printf("Opening sequencer port:"); for (i = 0; i < alsactx.num_ports; i++) { int port; port = alsa_create_port(alsactx.handle, i); if (port < 0) return; alsactx.port[i] = port; alsa_set_timestamping(&alsactx, port); printf(" %d:%d", alsactx.client, alsactx.port[i]); } printf("\n"); alsactx.used = 0; alsactx.active = 0; opt_realtime_playing = 1; /* Enable loading patch while playing */ allocate_cache_size = 0; /* Don't use pre-calclated samples */ current_keysig = (opt_init_keysig == 8) ? 0 : opt_init_keysig; note_key_offset = key_adjust; if (IS_STREAM_TRACE) { /* set the audio queue size as minimum as possible, since * we don't have to use audio queue.. */ play_mode->acntl(PM_REQ_GETFRAGSIZ, &buffer_time_advance); if (!(play_mode->encoding & PE_MONO)) buffer_time_advance >>= 1; if (play_mode->encoding & PE_16BIT) buffer_time_advance >>= 1; btime = (double)buffer_time_advance / play_mode->rate; btime *= 1.01; /* to be sure */ aq_set_soft_queue(btime, 0.0); } else { buffer_time_advance = 0; } rate_frac = (double)play_mode->rate / 1000000.0; rate_frac_nsec = (double)play_mode->rate / 1000000000.0; alarm(0); signal(SIGALRM, sig_timeout); signal(SIGINT, safe_exit); signal(SIGTERM, safe_exit); signal(SIGHUP, sig_reset); i = current_keysig + ((current_keysig < 8) ? 7 : -9), j = 0; while (i != 7) i += (i < 7) ? 5 : -7, j++; j += note_key_offset, j -= floor(j / 12.0) * 12; current_freq_table = j; play_mode->close_output(); if (ctl.flags & CTLF_DAEMONIZE) { int pid = fork(); FILE *pidf; switch (pid) { case 0: // child is the daemon break; case -1: // error status return exit(7); default: // no error, doing well if ((pidf = fopen( "/var/run/timidity.pid", "w" )) != NULL ) fprintf( pidf, "%d\n", pid ); exit(0); } } for (;;) { server_reset(); doit(&alsactx); } } /* * get the current time in usec from gettimeofday() */ static long get_current_time(void) { struct timeval tv; long t; gettimeofday(&tv, NULL); t = tv.tv_sec * 1000000L + tv.tv_usec; return t - start_time_base; } /* * convert from snd_seq_real_time_t to sample count */ inline static long queue_time_to_position(const snd_seq_real_time_t *t) { return (long)t->tv_sec * play_mode->rate + (long)(t->tv_nsec * rate_frac_nsec); } /* * get the current queue position in sample count */ static long get_current_queue_position(struct seq_context *ctxp) { #if HAVE_SND_SEQ_PORT_INFO_SET_TIMESTAMPING snd_seq_get_queue_status(ctxp->handle, ctxp->queue, ctxp->q_status); return queue_time_to_position(snd_seq_queue_status_get_real_time(ctxp->q_status)); #else return 0; #endif } /* * update the current position from the event timestamp */ static void update_timestamp_from_event(snd_seq_event_t *ev) { long t = queue_time_to_position(&ev->time.time) - last_queue_offset; if (t < 0) { // fprintf(stderr, "timestamp underflow! (delta=%d)\n", (int)t); t = 0; } else if (buffer_time_advance > 0 && t >= buffer_time_advance) { // fprintf(stderr, "timestamp overflow! (delta=%d)\n", (int)t); t = buffer_time_advance - 1; } t += buffer_time_offset; if (t >= cur_time_offset) cur_time_offset = t; } /* * update the current position from system time */ static void update_timestamp(void) { cur_time_offset = (long)(get_current_time() * rate_frac); } static void seq_play_event(MidiEvent *ev) { //JAVE make channel -Q channels quiet, modified some code from readmidi.c int gch; gch = GLOBAL_CHANNEL_EVENT_TYPE(ev->type); if (gch || !IS_SET_CHANNELMASK(quietchannels, ev->channel)){ //if its a global event or not a masked event ev->time = cur_time_offset; play_event(ev); } } static void stop_playing(void) { if(upper_voices) { MidiEvent ev; ev.type = ME_EOT; ev.a = 0; ev.b = 0; seq_play_event(&ev); aq_flush(0); } } static void doit(struct seq_context *ctxp) { for (;;) { while (snd_seq_event_input_pending(ctxp->handle, 1)) { if (do_sequencer(ctxp)) goto __done; } if (ctxp->active) { MidiEvent ev; if (IS_STREAM_TRACE) { /* remember the last update position */ if (ctxp->queue >= 0) last_queue_offset = get_current_queue_position(ctxp); /* advance the buffer position */ buffer_time_offset += buffer_time_advance; ev.time = buffer_time_offset; } else { /* update the current position */ if (ctxp->queue >= 0) cur_time_offset = get_current_queue_position(ctxp); else update_timestamp(); ev.time = cur_time_offset; } ev.type = ME_NONE; play_event(&ev); aq_fill_nonblocking(); } if (! ctxp->active || ! IS_STREAM_TRACE) { fd_set rfds; struct timeval timeout; FD_ZERO(&rfds); FD_SET(ctxp->fd, &rfds); timeout.tv_sec = 0; timeout.tv_usec = 10000; /* 10ms */ if (select(ctxp->fd + 1, &rfds, NULL, NULL, &timeout) < 0) goto __done; } } __done: if (ctxp->active) { stop_sequencer(ctxp); } } static void server_reset(void) { readmidi_read_init(); playmidi_stream_init(); if (free_instruments_afterwards) free_instruments(0); reduce_voice_threshold = 0; /* Disable auto reduction voice */ buffer_time_offset = 0; } static int start_sequencer(struct seq_context *ctxp) { if (play_mode->open_output() < 0) { ctl.cmsg(CMSG_FATAL, VERB_NORMAL, "Couldn't open %s (`%c')", play_mode->id_name, play_mode->id_character); return 0; } ctxp->active = 1; buffer_time_offset = 0; last_queue_offset = 0; cur_time_offset = 0; if (ctxp->queue >= 0) { if (snd_seq_start_queue(ctxp->handle, ctxp->queue, NULL) < 0) ctxp->queue = -1; else snd_seq_drain_output(ctxp->handle); } if (ctxp->queue < 0) { start_time_base = 0; start_time_base = get_current_time(); } return 1; } static void stop_sequencer(struct seq_context *ctxp) { stop_playing(); if (ctxp->queue >= 0) { snd_seq_stop_queue(ctxp->handle, ctxp->queue, NULL); snd_seq_drain_output(ctxp->handle); } play_mode->close_output(); free_instruments(0); free_global_mblock(); ctxp->used = 0; ctxp->active = 0; } #define NOTE_CHAN(ev) ((ev)->dest.port * 16 + (ev)->data.note.channel) #define CTRL_CHAN(ev) ((ev)->dest.port * 16 + (ev)->data.control.channel) static int do_sequencer(struct seq_context *ctxp) { int n, ne, i; MidiEvent ev, evm[260]; snd_seq_event_t *aevp; n = snd_seq_event_input(ctxp->handle, &aevp); if (n < 0 || aevp == NULL) return 0; if (ctxp->active && ctxp->queue >= 0) update_timestamp_from_event(aevp); else if (IS_STREAM_TRACE) cur_time_offset = buffer_time_offset; else update_timestamp(); switch(aevp->type) { case SND_SEQ_EVENT_NOTEON: ev.channel = NOTE_CHAN(aevp); ev.a = aevp->data.note.note; ev.b = aevp->data.note.velocity; if (ev.b == 0) ev.type = ME_NOTEOFF; else ev.type = ME_NOTEON; seq_play_event(&ev); break; case SND_SEQ_EVENT_NOTEOFF: ev.channel = NOTE_CHAN(aevp); ev.a = aevp->data.note.note; ev.b = aevp->data.note.velocity; ev.type = ME_NOTEOFF; seq_play_event(&ev); break; case SND_SEQ_EVENT_KEYPRESS: ev.channel = NOTE_CHAN(aevp); ev.a = aevp->data.note.note; ev.b = aevp->data.note.velocity; ev.type = ME_KEYPRESSURE; seq_play_event(&ev); break; case SND_SEQ_EVENT_PGMCHANGE: ev.channel = CTRL_CHAN(aevp); ev.a = aevp->data.control.value; ev.type = ME_PROGRAM; seq_play_event(&ev); break; case SND_SEQ_EVENT_CONTROLLER: if(convert_midi_control_change(CTRL_CHAN(aevp), aevp->data.control.param, aevp->data.control.value, &ev)) seq_play_event(&ev); break; case SND_SEQ_EVENT_CONTROL14: if (aevp->data.control.param < 0 || aevp->data.control.param >= 32) break; if (! convert_midi_control_change(CTRL_CHAN(aevp), aevp->data.control.param, (aevp->data.control.value >> 7) & 0x7f, &ev)) break; seq_play_event(&ev); if (! convert_midi_control_change(CTRL_CHAN(aevp), aevp->data.control.param + 32, aevp->data.control.value & 0x7f, &ev)) break; seq_play_event(&ev); break; case SND_SEQ_EVENT_PITCHBEND: ev.type = ME_PITCHWHEEL; ev.channel = CTRL_CHAN(aevp); aevp->data.control.value += 0x2000; ev.a = (aevp->data.control.value) & 0x7f; ev.b = (aevp->data.control.value>>7) & 0x7f; seq_play_event(&ev); break; case SND_SEQ_EVENT_CHANPRESS: ev.type = ME_CHANNEL_PRESSURE; ev.channel = CTRL_CHAN(aevp); ev.a = aevp->data.control.value; seq_play_event(&ev); break; case SND_SEQ_EVENT_NONREGPARAM: /* Break it back into its controler values */ ev.type = ME_NRPN_MSB; ev.channel = CTRL_CHAN(aevp); ev.a = (aevp->data.control.param >> 7) & 0x7f; seq_play_event(&ev); ev.type = ME_NRPN_LSB; ev.channel = CTRL_CHAN(aevp); ev.a = aevp->data.control.param & 0x7f; seq_play_event(&ev); ev.type = ME_DATA_ENTRY_MSB; ev.channel = CTRL_CHAN(aevp); ev.a = (aevp->data.control.value >> 7) & 0x7f; seq_play_event(&ev); ev.type = ME_DATA_ENTRY_LSB; ev.channel = CTRL_CHAN(aevp); ev.a = aevp->data.control.value & 0x7f; seq_play_event(&ev); break; case SND_SEQ_EVENT_REGPARAM: /* Break it back into its controler values */ ev.type = ME_RPN_MSB; ev.channel = CTRL_CHAN(aevp); ev.a = (aevp->data.control.param >> 7) & 0x7f; seq_play_event(&ev); ev.type = ME_RPN_LSB; ev.channel = CTRL_CHAN(aevp); ev.a = aevp->data.control.param & 0x7f; seq_play_event(&ev); ev.type = ME_DATA_ENTRY_MSB; ev.channel = CTRL_CHAN(aevp); ev.a = (aevp->data.control.value >> 7) & 0x7f; seq_play_event(&ev); ev.type = ME_DATA_ENTRY_LSB; ev.channel = CTRL_CHAN(aevp); ev.a = aevp->data.control.value & 0x7f; seq_play_event(&ev); break; case SND_SEQ_EVENT_SYSEX: if (parse_sysex_event(aevp->data.ext.ptr + 1, aevp->data.ext.len - 1, &ev)) seq_play_event(&ev); if ((ne = parse_sysex_event_multi(aevp->data.ext.ptr + 1, aevp->data.ext.len - 1, evm)) > 0) for (i = 0; i < ne; i++) seq_play_event(&evm[i]); break; #if SND_LIB_MAJOR > 0 || SND_LIB_MINOR >= 6 #define snd_seq_addr_equal(a,b) ((a)->client == (b)->client && (a)->port == (b)->port) case SND_SEQ_EVENT_PORT_SUBSCRIBED: if (snd_seq_addr_equal(&aevp->data.connect.dest, &aevp->dest)) { if (! ctxp->active) { if (! start_sequencer(ctxp)) { snd_seq_free_event(aevp); return 0; } } ctxp->used++; } break; case SND_SEQ_EVENT_PORT_UNSUBSCRIBED: if (snd_seq_addr_equal(&aevp->data.connect.dest, &aevp->dest)) { if (ctxp->active) { ctxp->used--; if (ctxp->used <= 0) { snd_seq_free_event(aevp); return 1; /* quit now */ } } } break; #else case SND_SEQ_EVENT_PORT_USED: if (! ctxp->active) { if (! start_sequencer(ctxp)) { snd_seq_free_event(aevp); return 0; } } ctxp->used++; break; case SND_SEQ_EVENT_PORT_UNUSED: if (ctxp->active) { ctxp->used--; if (ctxp->used <= 0) { snd_seq_free_event(aevp); return 1; /* quit now */ } } break; #endif default: /*printf("Unsupported event %d\n", aevp->type);*/ break; } snd_seq_free_event(aevp); return 0; } /* * interface__loader(); */ ControlMode *interface_A_loader(void) { return &ctl; } TiMidity++-2.13.2/interface/w32g.h0100644004711200001440000002554110056417274015605 0ustar tamukiusers/* TiMidity++ -- MIDI to WAVE converter and player Copyright (C) 1999-2002 Masanao Izumo Copyright (C) 1995 Tuukka Toivonen 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef ___W32G_H_ #define ___W32G_H_ #include #ifdef RC_NONE #undef RC_NONE #endif #include #ifdef RC_NONE #undef RC_NONE #endif #define RC_NONE 0 #define LANGUAGE_JAPANESE 0x0001 #define LANGUAGE_ENGLISH 0x0002 extern int PlayerLanguage; extern int PlayerMode; #ifndef MAXPATH #define MAXPATH 256 #endif /* MAXPATH */ typedef struct argc_argv_t_ { int argc; char **argv; } argc_argv_t; #if defined(_MSC_VER) || defined(__WATCOMC__) //typedef void (__cdecl *MSVC_BEGINTHREAD_START_ADDRESS)(void *); typedef LPTHREAD_START_ROUTINE MSVC_BEGINTHREAD_START_ADDRESS; #elif defined(_BORLANDC_) // typedef _USERENTRY (*BCC_BEGINTHREAD_START_ADDRESS)(void *); typedef LPTHREAD_START_ROUTINE BCC_BEGINTHREAD_START_ADDRESS; #endif // beginthread for C RUNTIME LIBRARY // HANDLE crt_beginthread(LPTHREAD_START_ROUTINE start_address, DWORD stack_size, LPVOID arglist); #if defined(_MSC_VER) || defined(__WATCOMC__) #define crt_beginthread(start_address,stack_size,arglist) \ (HANDLE)_beginthread((MSVC_BEGINTHREAD_START_ADDRESS)start_address,(unsigned)stack_size,(void *)arglist) #elif defined(_BORLANDC_) #define crt_beginthread(start_address,stack_size,arglist) \ (HANDLE)_beginthread((BCC_BEGINTHREAD_START_ADDRESS)start_address,(unsigned)stack_size,(void *)arglist) #else #define crt_beginthread(start_address,stack_size,arglist) \ (HANDLE)CreateThread(NULL,(DWORD)stack_size,(LPTHREAD_START_ROUTINE)start_address,(LPVOID)arglist,0,&dwTmp) #endif // (HANDLE)crt_beginthreadex(LPSECURITY_ATTRIBUTES security, DWORD stack_size, LPTHREAD_START_ROUTINE start_address, LPVOID arglist, DWORD initflag, LPDWORD thrdaddr ); #if defined(_MSC_VER) || defined(__WATCOMC__) #define crt_beginthreadex(security,stack_size,start_address,arglist,initflag,thrdaddr ) \ (HANDLE)_beginthreadex((void *)security,(unsigned)stack_size,(MSVC_BEGINTHREAD_START_ADDRESS)start_address,(void *)arglist,(unsigned)initflag,(unsigned *)thrdaddr) #elif defined(_BORLANDC_) #define crt_beginthreadex(security,stack_size,start_address,arglist,initflag,thrdaddr ) \ (HANDLE)_beginthreadNT((BCC_BEGINTHREAD_START_ADDRESS)start_address,(unsigned)stack_size,(void *)arglist,(void *)security_attrib,(unsigned long)create_flags,(unsigned long *)thread_id) #else #define crt_beginthreadex(security,stack_size,start_address,arglist,initflag,thrdaddr ) \ (HANDLE)CreateThread((LPSECURITY_ATTRIBUTES)security,(DWORD)stack_size,(LPTHREAD_START_ROUTINE)start_address,(LPVOID)arglist,(DWORD)initflag,(LPDWORD)thrdaddr) #endif #if defined(_MSC_VER) || defined(__WATCOMC__) #define crt_endthread() _endthread() #elif defined(_BORLANDC_) #define crt_endthread() _endthread() #else #define crt_endthread() ExitThread(0); #endif #define RANGE(x,min,max) (((x)<(min))?((x)=(min)):(((x)>(max))?((x)=(max)):(x))) #define RC_EXT_BASE 1000 enum { RC_EXT_DROP = RC_EXT_BASE, RC_EXT_LOAD_FILE, RC_EXT_LOAD_PLAYLIST, RC_EXT_SAVE_PLAYLIST, RC_EXT_MODE_CHANGE, RC_EXT_APPLY_SETTING, RC_EXT_DELETE_PLAYLIST, RC_EXT_UPDATE_PLAYLIST, RC_EXT_UNIQ_PLAYLIST, RC_EXT_REFINE_PLAYLIST, RC_EXT_JUMP_FILE, RC_EXT_ROTATE_PLAYLIST, RC_EXT_CLEAR_PLAYLIST, RC_EXT_OPEN_DOC, RC_EXT_RESTART_GUI, RC_EXT_LOAD_FILES_AND_PLAY }; #define MAX_W32G_MIDI_CHANNELS 32 // Toolbar Macros #define IDM_STOP 2501 #define IDM_PAUSE 2502 #define IDM_PREV 2503 #define IDM_FOREWARD 2504 #define IDM_PLAY 2505 #define IDM_BACKWARD 2506 #define IDM_NEXT 2507 #define IDM_CONSOLE 2511 #define IDM_LIST 2512 #define IDM_TRACER 2513 #define IDM_DOC 2514 #define IDM_WRD 2515 #define IDM_SOUNDSPEC 2516 #define FLAG_NOTE_OFF 1 #define FLAG_NOTE_ON 2 #define FLAG_BANK 0x0001 #define FLAG_PROG 0x0002 #define FLAG_PAN 0x0004 #define FLAG_SUST 0x0008 #define FLAG_NOTE_OFF 1 #define FLAG_NOTE_ON 2 #define FLAG_BANK 0x0001 #define FLAG_PROG 0x0002 #define FLAG_PAN 0x0004 #define FLAG_SUST 0x0008 typedef struct { int reset_panel; int wait_reset; int multi_part; char v_flags[MAX_W32G_MIDI_CHANNELS]; int16 cnote[MAX_W32G_MIDI_CHANNELS]; int16 cvel[MAX_W32G_MIDI_CHANNELS]; int16 ctotal[MAX_W32G_MIDI_CHANNELS]; char c_flags[MAX_W32G_MIDI_CHANNELS]; Channel channel[MAX_W32G_MIDI_CHANNELS]; int32 total_time; int total_time_h; int total_time_m; int total_time_s; int total_time_ss; int32 cur_time; int cur_time_h; int cur_time_m; int cur_time_s; int cur_time_ss; int cur_voices; int voices; int upper_voices; char filename[MAXPATH + 64]; char titlename[MAXPATH + 64]; int filename_setflag; int titlename_setflag; int32 master_volume; int32 master_volume_max; int meas; int beat; char keysig[7]; int key_offset; int tempo; int tempo_ratio; int invalid_flag; int32 xnote[MAX_W32G_MIDI_CHANNELS][4]; int aq_ratio; int changed; char dummy[1024]; int8 GSLCD[16][16]; double gslcd_last_display_time; int8 gslcd_displayed_flag; } PanelInfo; extern PanelInfo *Panel; #define PANELRESET_TIME 0x0001 #define PANELRESET_CHANNEL 0x0002 #define PANELRESET_MIDIINFO 0x0004 #define PANELRESET_MISC 0x0008 #define PANELRESET_EFFECT 0x0010 #define CANVAS_MODE_GSLCD 0x0001 #define CANVAS_MODE_MAP16 0x0002 #define CANVAS_MODE_MAP32 0x0003 #define CANVAS_MODE_KBD_A 0x0004 #define CANVAS_MODE_KBD_B 0x0005 #define CANVAS_MODE_SLEEP 0x0006 #if 0 #define TMCCC_BLACK RGB(0x00,0x00,0x00) #define TMCCC_WHITE RGB(0xff,0xff,0xff) #define TMCCC_RED RGB(0xff,0x00,0x00) #define TMCCC_FORE TMCCC_BLACK // Aliased #define TMCCC_BACK RGB(0x00, 0xf0, 0x00) #define TMCCC_LOW RGB(0x80, 0xd0, 0x00) #define TMCCC_MIDDLE RGB(0xb0, 0xb0, 0x00) #define TMCCC_HIGH RGB(0xe0, 0x00, 0x00) enum { TMCC_BLACK, // Aliased FORE TMCC_WHITE, TMCC_RED, TMCC_BACK, TMCC_LOW, TMCC_MIDDLE, TMCC_HIGH, TMCC_FORE_HALF, TMCC_LOW_HALF, TMCC_MIDDLE_HALF, TMCC_HIGH_HALF, TMCC_FORE_WEAKHALF, TMCC_SIZE }; #define TMCC_FORE TMCC_BLACK // Aliased typedef struct _TmColors { COLORREF color; HPEN pen; HBRUSH brush; } TmColors; #endif /* w32g_i.c */ extern int w32g_open(void); extern void w32g_close(void); extern void w32g_send_rc(int rc, int32 value); extern int w32g_get_rc(int32 *value, int wait_if_empty); extern void w32g_lock(void); extern void w32g_unlock(void); extern void MainWndScrollbarProgressUpdate(int sec); extern void PutsConsoleWnd(char *str); extern void w32g_ctle_play_start(int sec); extern void SettingWndApply(void); extern int w32g_lock_open_file; extern void w32g_i_init(); extern void CanvasChange(int mode); extern HINSTANCE hInst; extern void w32g_show_console(); extern void MPanelStartLoad(char *filename); /* w32g_utl.c */ /* w32g_playlist.c */ extern int w32g_add_playlist(int nfiles, char **files, int expand_flag, int autouniq, int autorefine); extern char *w32g_get_playlist(int idx); extern int w32g_next_playlist(int skip_invalid_file); extern int w32g_prev_playlist(int skip_invalid_file); extern int w32g_random_playlist(int skip_invalid_file); extern int w32g_shuffle_playlist_reset(int preserve); extern int w32g_shuffle_playlist_next(int skip_invalid_file); extern void w32g_first_playlist(int skip_invalid_file); extern int w32g_isempty_playlist(void); extern char *w32g_curr_playlist(void); extern void w32g_update_playlist(void); extern void w32g_get_playlist_index(int *selected, int *nfiles, int *cursel); extern int w32g_goto_playlist(int num, int skip_invalid_file); extern int w32g_delete_playlist(int pos); extern int w32g_nvalid_playlist(void); extern int w32g_ismidi_playlist(int n); extern void w32g_setcur_playlist(void); extern int w32g_refine_playlist(int *is_selected_removed); extern int w32g_uniq_playlist(int *is_selected_removed); extern void w32g_clear_playlist(void); extern void w32g_rotate_playlist(int dest); #if 0 /* w32g_panel.c */ extern void w32g_init_panel(HWND hwnd); extern void TmPanelStartToLoad(char *filename); extern void TmPanelStartToPlay(int total_sec); extern void TmPanelSetVoices(int v); //extern void TmPanelInit(HWND hwnd); extern void TmPanelRefresh(void); extern void TmPanelSetTime(int sec); extern void TmPanelSetMasterVol(int v); extern void TmPanelUpdateList(void); /* w32g_canvas.c */ extern void w32g_init_canvas(HWND hwnd); extern void TmCanvasRefresh(void); extern void TmCanvasReset(void); extern void TmCanvasNote(int status, int ch, int note, int vel); extern int TmCanvasChange(void); extern void TmCanvasUpdateInterval(); extern int TmCanvasMode; #endif /* w32g_c.c */ extern volatile int w32g_play_active; extern int w32g_current_volume[/* MAX_CHANNELS */]; extern int w32g_current_expression[/* MAX_CHANNELS */]; extern volatile int w32g_restart_gui_flag; void PrefSettingApplyReally(void); // flags extern int InitMinimizeFlag; extern int DebugWndStartFlag; extern int ConsoleWndStartFlag; extern int ListWndStartFlag; extern int TracerWndStartFlag; extern int DocWndStartFlag; extern int WrdWndStartFlag; extern int DebugWndFlag; extern int ConsoleWndFlag; extern int ListWndFlag; extern int TracerWndFlag; extern int DocWndFlag; extern int WrdWndFlag; extern int SoundSpecWndFlag; extern int SubWindowMax; extern char *IniFile; extern char *ConfigFile; extern char *PlaylistFile; extern char *PlaylistHistoryFile; extern char *MidiFileOpenDir; extern char *ConfigFileOpenDir; extern char *PlaylistFileOpenDir; extern int PlayerThreadPriority; extern int GUIThreadPriority; extern int WrdGraphicFlag; extern int TraceGraphicFlag; extern int DocMaxSize; extern char *DocFileExt; extern int w32g_has_ini_file; extern char *w32g_output_dir; extern int w32g_auto_output_mode; // HWND extern HWND hMainWnd; extern HWND hDebugWnd; extern HWND hConsoleWnd; extern HWND hTracerWnd; extern HWND hDocWnd; extern HWND hListWnd; extern HWND hWrdWnd; extern HWND hSoundSpecWnd; extern HWND hDebugEditWnd; extern HWND hDocEditWnd; // gdi_lock extern int gdi_lock(void); extern int gdi_unlock(void); #define GDI_SAFETY(command) (gdi_lock(),(command),gdi_unlock); #define W32G_RANDOM_IS_SHUFFLE #ifndef BELOW_NORMAL_PRIORITY_CLASS /* VC6.0 doesn't support them. */ #define BELOW_NORMAL_PRIORITY_CLASS 0x4000 #define ABOVE_NORMAL_PRIORITY_CLASS 0x8000 #endif /* BELOW_NORMAL_PRIORITY_CLASS */ #endif TiMidity++-2.13.2/interface/w32g_c.c0100644004711200001440000006650410125651535016103 0ustar tamukiusers/* TiMidity -- MIDI to WAVE converter and player Copyright (C) 1999-2002 Masanao Izumo Copyright (C) 1995 Tuukka Toivonen 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA w32g_c.c: written by Daisuke Aoki Masanao Izumo */ #ifdef HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ #include #include #include #ifndef NO_STRING_H #include #else #include #endif #include "timidity.h" #include "common.h" #include "output.h" #include "instrum.h" #include "playmidi.h" #include "readmidi.h" #include "controls.h" #include "miditrace.h" #include "strtab.h" #include "aq.h" #include "timer.h" #include "w32g.h" #include "w32g_subwin.h" extern int CanvasGetMode(void); extern void CanvasUpdate(int flag); extern void CanvasReadPanelInfo(int flag); extern void CanvasPaint(void); extern void CanvasPaintAll(void); extern void CanvasReset(void); extern void CanvasClear(void); extern void MPanelPaintAll(void); extern void MPanelReadPanelInfo(int flag); extern void MPanelReset(void); extern void MPanelUpdate(void); extern void MPanelUpdateAll(void); extern void MPanelPaint(void); extern int is_directory(char *path); extern int directory_form(char *buffer); volatile int w32g_play_active; volatile int w32g_restart_gui_flag = 0; int w32g_current_volume[MAX_CHANNELS]; int w32g_current_expression[MAX_CHANNELS]; static int mark_apply_setting = 0; PanelInfo *Panel = NULL; static void CanvasUpdateInterval(void); static void ctl_panel_refresh(void); char *w32g_output_dir = NULL; int w32g_auto_output_mode = 0; extern void MPanelMessageAdd(char *message, int msec, int mode); extern void MPanelMessageClearAll(void); extern int w32g_msg_box(char *message, char *title, int type); //****************************************************************************/ // Control funcitons static int ctl_open(int using_stdin, int using_stdout); static void ctl_close(void); static void ctl_pass_playing_list(int number_of_files, char *list_of_files[]); static void ctl_event(CtlEvent *e); static int ctl_read(int32 *valp); static int cmsg(int type, int verbosity_level, char *fmt, ...); #define ctl w32gui_control_mode #define CTL_STATUS_UPDATE -98 ControlMode ctl= { "Win32 GUI interface", 'w', 1,1,0, CTLF_AUTOSTART | CTLF_DRAG_START, ctl_open, ctl_close, ctl_pass_playing_list, ctl_read, cmsg, ctl_event }; #define FORCE_TIME_PERIOD #ifdef FORCE_TIME_PERIOD static TIMECAPS tcaps; #endif static int ctl_open(int using_stdin, int using_stdout) { if(ctl.opened) return 0; ctl.opened = 1; set_trace_loop_hook(CanvasUpdateInterval); /* Initialize Panel */ Panel = (PanelInfo *)safe_malloc(sizeof(PanelInfo)); memset((void *)Panel,0,sizeof(PanelInfo)); Panel->changed = 1; #ifdef FORCE_TIME_PERIOD timeGetDevCaps(&tcaps, sizeof(TIMECAPS)); timeBeginPeriod(tcaps.wPeriodMin); #endif return w32g_open(); } static void ctl_close(void) { if(ctl.opened) { w32g_close(); ctl.opened = 0; free(Panel); #ifdef FORCE_TIME_PERIOD timeEndPeriod(tcaps.wPeriodMin); #endif } } static void PanelReset(void) { int i, j; Panel->reset_panel = 0; Panel->multi_part = 0; Panel->wait_reset = 0; Panel->cur_time = 0; Panel->cur_time_h = 0; Panel->cur_time_m = 0; Panel->cur_time_s = 0; Panel->cur_time_ss = 0; for(i = 0; i < MAX_W32G_MIDI_CHANNELS; i++) { Panel->v_flags[i] = 0; Panel->cnote[i] = 0; Panel->cvel[i] = 0; Panel->ctotal[i] = 0; Panel->c_flags[i] = 0; for(j = 0; j < 4; j++) Panel->xnote[i][j] = 0; // Panel->channel[i].panning = 64; Panel->channel[i].panning = -1; Panel->channel[i].sustain = 0; Panel->channel[i].expression = 0; Panel->channel[i].volume = 0; // Panel->channel[i].pitchbend = 0x2000; Panel->channel[i].pitchbend = -2; } Panel->titlename[0] = '\0'; Panel->filename[0] = '\0'; Panel->titlename_setflag = 0; Panel->filename_setflag = 0; Panel->cur_voices = 0; Panel->voices = voices; Panel->upper_voices = 0; // Panel->master_volume = 0; Panel->meas = 0; Panel->beat = 0; Panel->keysig[0] = '\0'; Panel->key_offset = 0; Panel->tempo = 0; Panel->tempo_ratio = 0; Panel->aq_ratio = 0; for (i = 0; i < 16; i++) { for (j = 0; j < 16; j++) { Panel->GSLCD[i][j] = 0; } } Panel->gslcd_displayed_flag = 0; Panel->changed = 1; } #define GS_LCD_CLEAR_TIME 2.88 static void ctl_gslcd_update(void) { double t; int i, j; t = get_current_calender_time(); if(t - Panel->gslcd_last_display_time > GS_LCD_CLEAR_TIME && Panel->gslcd_displayed_flag) { for (i = 0; i < 16; i++) { for (j = 0; j < 16; j++) { Panel->GSLCD[i][j] = 0; } } CanvasClear(); Panel->gslcd_displayed_flag = 0; } } static void CanvasUpdateInterval(void) { static double lasttime; double t; if (CanvasGetMode() == CANVAS_MODE_MAP16 || CanvasGetMode() == CANVAS_MODE_MAP32) { t = get_current_calender_time(); if (t - lasttime > 0.05) { CanvasReadPanelInfo(0); CanvasUpdate(0); CanvasPaint(); lasttime = t; } } else if (CanvasGetMode() == CANVAS_MODE_GSLCD) ctl_gslcd_update(); } static int ctl_drop_file(HDROP hDrop) { StringTable st; int i, n, len; char buffer[BUFSIZ]; char **files; int prevnfiles; w32g_get_playlist_index(NULL, &prevnfiles, NULL); init_string_table(&st); n = DragQueryFile(hDrop,0xffffffffL, NULL, 0); for(i = 0; i < n; i++) { DragQueryFile(hDrop, i, buffer, sizeof(buffer)); if(is_directory(buffer)) directory_form(buffer); len = strlen(buffer); put_string_table(&st, buffer, strlen(buffer)); } DragFinish(hDrop); if((files = make_string_array(&st)) == NULL) n = 0; else { n = w32g_add_playlist(n, files, 1, ctl.flags & CTLF_AUTOUNIQ, ctl.flags & CTLF_AUTOREFINE); free(files[0]); free(files); } if(n > 0) { ctl_panel_refresh(); if(ctl.flags & CTLF_DRAG_START) { w32g_goto_playlist(prevnfiles, !(ctl.flags & CTLF_NOT_CONTINUE)); return RC_LOAD_FILE; } } return RC_NONE; } static int ctl_load_file(char *fileptr) { StringTable st; int len, n; char **files; char buffer[BUFSIZ]; char *basedir; init_string_table(&st); n = 0; basedir = fileptr; fileptr += strlen(fileptr) + 1; while(*fileptr) { snprintf(buffer, sizeof(buffer), "%s\\%s", basedir, fileptr); if(is_directory(buffer)) directory_form(buffer); len = strlen(buffer); put_string_table(&st, buffer, len); n++; fileptr += strlen(fileptr) + 1; } if(n == 0) { put_string_table(&st, basedir, strlen(basedir)); n++; } files = make_string_array(&st); n = w32g_add_playlist(n, files, 1, ctl.flags & CTLF_AUTOUNIQ, ctl.flags & CTLF_AUTOREFINE); free(files[0]); free(files); if(n > 0) ctl_panel_refresh(); w32g_lock_open_file = 0; return RC_NONE; } static int ctl_load_files_and_play(argc_argv_t *argc_argv, int playflag) { StringTable st; int i, n, len; char buffer[BUFSIZ]; char **files; int prevnfiles; if(argc_argv==NULL) return RC_NONE; w32g_get_playlist_index(NULL, &prevnfiles, NULL); init_string_table(&st); n = argc_argv->argc; for(i = 0; i < n; i++) { strncpy(buffer,(argc_argv->argv)[i],BUFSIZ-1); buffer[BUFSIZ-1] = '\0'; if(is_directory(buffer)) directory_form(buffer); len = strlen(buffer); put_string_table(&st, buffer, strlen(buffer)); } #if 1 for(i=0;iargc;i++){ free(argc_argv->argv[i]); } free(argc_argv->argv); argc_argv->argv = NULL; argc_argv->argc = 0; #endif if((files = make_string_array(&st)) == NULL) n = 0; else { n = w32g_add_playlist(n, files, 1, ctl.flags & CTLF_AUTOUNIQ, ctl.flags & CTLF_AUTOREFINE); free(files[0]); free(files); } if(n > 0) { ctl_panel_refresh(); if(playflag) { w32g_goto_playlist(prevnfiles, !(ctl.flags & CTLF_NOT_CONTINUE)); return RC_LOAD_FILE; } } return RC_NONE; } static int ctl_load_playlist(char *fileptr) { StringTable st; int n; char **files; char buffer[BUFSIZ]; char *basedir; init_string_table(&st); n = 0; basedir = fileptr; fileptr += strlen(fileptr) + 1; while(*fileptr) { snprintf(buffer, sizeof(buffer), "@%s\\%s", basedir, fileptr); put_string_table(&st, buffer, strlen(buffer)); n++; fileptr += strlen(fileptr) + 1; } if(n == 0) { buffer[0] = '@'; strncpy(buffer + 1, basedir, sizeof(buffer) - 1); put_string_table(&st, buffer, strlen(buffer)); n++; } files = make_string_array(&st); n = w32g_add_playlist(n, files, 1, ctl.flags & CTLF_AUTOUNIQ, ctl.flags & CTLF_AUTOREFINE); free(files[0]); free(files); if(n > 0) ctl_panel_refresh(); w32g_lock_open_file = 0; return RC_NONE; } static int ctl_save_playlist(char *fileptr) { FILE *fp; int i, nfiles; if((fp = fopen(fileptr, "w")) == NULL) { w32g_lock_open_file = 0; cmsg(CMSG_FATAL, VERB_NORMAL, "%s: %s", fileptr, strerror(errno)); w32g_lock_open_file = 0; return RC_NONE; } w32g_get_playlist_index(NULL, &nfiles, NULL); for(i = 0; i < nfiles; i++) { fputs(w32g_get_playlist(i), fp); fputs("\n", fp); } fclose(fp); w32g_lock_open_file = 0; return RC_NONE; } static int ctl_delete_playlist(int offset) { int selected, nfiles, cur, pos; w32g_get_playlist_index(&selected, &nfiles, &cur); pos = cur + offset; if(pos < 0 || pos >= nfiles) return RC_NONE; if(w32g_delete_playlist(pos)) { w32g_update_playlist(); ctl_panel_refresh(); if(w32g_play_active && selected == pos) { w32g_update_playlist(); return RC_LOAD_FILE; } } return RC_NONE; } static int ctl_uniq_playlist(void) { int n, stop; n = w32g_uniq_playlist(&stop); if(n > 0) { ctl_panel_refresh(); if(stop) return RC_STOP; } return RC_NONE; } static int ctl_refine_playlist(void) { int n, stop; n = w32g_refine_playlist(&stop); if(n > 0) { ctl_panel_refresh(); if(stop) return RC_STOP; } return RC_NONE; } static int w32g_ext_control(int rc, int32 value) { switch(rc) { case RC_EXT_DROP: return ctl_drop_file((HDROP)value); case RC_EXT_LOAD_FILE: return ctl_load_file((char *)value); case RC_EXT_LOAD_FILES_AND_PLAY: return ctl_load_files_and_play((argc_argv_t *)value, 1); case RC_EXT_LOAD_PLAYLIST: return ctl_load_playlist((char *)value); case RC_EXT_SAVE_PLAYLIST: return ctl_save_playlist((char *)value); case RC_EXT_MODE_CHANGE: CanvasChange(value); break; case RC_EXT_APPLY_SETTING: if(w32g_play_active) { mark_apply_setting = 1; return RC_STOP; } PrefSettingApplyReally(); mark_apply_setting = 0; break; case RC_EXT_DELETE_PLAYLIST: return ctl_delete_playlist(value); case RC_EXT_UPDATE_PLAYLIST: w32g_update_playlist(); break; case RC_EXT_UNIQ_PLAYLIST: return ctl_uniq_playlist(); case RC_EXT_REFINE_PLAYLIST: return ctl_refine_playlist(); case RC_EXT_JUMP_FILE: if(w32g_goto_playlist(value, !(ctl.flags & CTLF_NOT_CONTINUE))) return RC_LOAD_FILE; case RC_EXT_ROTATE_PLAYLIST: w32g_rotate_playlist(value); ctl_panel_refresh(); break; case RC_EXT_CLEAR_PLAYLIST: w32g_clear_playlist(); ctl_panel_refresh(); return RC_STOP; case RC_EXT_OPEN_DOC: w32g_setup_doc(value); w32g_open_doc(0); break; } return RC_NONE; } static int ctl_read(int32 *valp) { int rc; rc = w32g_get_rc(valp, play_pause_flag); if(rc >= RC_EXT_BASE) return w32g_ext_control(rc, *valp); return rc; } static int cmsg(int type, int verbosity_level, char *fmt, ...) { char buffer[BUFSIZ]; va_list ap; va_start(ap, fmt); vsnprintf(buffer, sizeof(buffer), fmt, ap); va_end(ap); if( type==CMSG_TEXT ) { MPanelMessageClearAll(); MPanelMessageAdd(buffer,2000,0); } if((type==CMSG_TEXT || type==CMSG_INFO || type==CMSG_WARNING) && ctl.verbositymaster_volume = mv; Panel->changed = 1; ctl_panel_refresh(); } static void ctl_metronome(int meas, int beat) { static int lastmeas = CTL_STATUS_UPDATE; static int lastbeat = CTL_STATUS_UPDATE; if (meas == CTL_STATUS_UPDATE) meas = lastmeas; else lastmeas = meas; if (beat == CTL_STATUS_UPDATE) beat = lastbeat; else lastbeat = beat; Panel->meas = meas; Panel->beat = beat; Panel->changed = 1; ctl_panel_refresh(); } static void ctl_keysig(int8 k, int ko) { static int8 lastkeysig = CTL_STATUS_UPDATE; static int lastoffset = CTL_STATUS_UPDATE; static const char *keysig_name[] = { "Cb", "Gb", "Db", "Ab", "Eb", "Bb", "F ", "C ", "G ", "D ", "A ", "E ", "B ", "F#", "C#", "G#", "D#", "A#" }; int i, j; if (k == CTL_STATUS_UPDATE) k = lastkeysig; else lastkeysig = k; if (ko == CTL_STATUS_UPDATE) ko = lastoffset; else lastoffset = ko; i = k + ((k < 8) ? 7 : -6); if (ko > 0) for (j = 0; j < ko; j++) i += (i > 10) ? -5 : 7; else for (j = 0; j < abs(ko); j++) i += (i < 7) ? 5 : -7; sprintf(Panel->keysig, "%s %s", keysig_name[i], (k < 8) ? "Maj" : "Min"); Panel->key_offset = ko; Panel->changed = 1; ctl_panel_refresh(); } static void ctl_tempo(int t, int tr) { static int lasttempo = CTL_STATUS_UPDATE; static int lastratio = CTL_STATUS_UPDATE; if (t == CTL_STATUS_UPDATE) t = lasttempo; else lasttempo = t; if (tr == CTL_STATUS_UPDATE) tr = lastratio; else lastratio = tr; t = (int) (500000 / (double) t * 120 * (double) tr / 100 + 0.5); Panel->tempo = t; Panel->tempo_ratio = tr; Panel->changed = 1; ctl_panel_refresh(); } extern BOOL SetWrdWndActive(void); static void ctl_pass_playing_list(int number_of_files, char *list_of_files[]) { static int init_flag = 1; int rc; int32 value; extern void timidity_init_aq_buff(void); int errcnt; w32g_add_playlist(number_of_files, list_of_files, 0, ctl.flags & CTLF_AUTOUNIQ, ctl.flags & CTLF_AUTOREFINE); w32g_play_active = 0; errcnt = 0; if(init_flag && w32g_nvalid_playlist() && (ctl.flags & CTLF_AUTOSTART)) // if(play_mode->fd != -1 && // w32g_nvalid_playlist() && (ctl.flags & CTLF_AUTOSTART)) rc = RC_LOAD_FILE; else rc = RC_NONE; init_flag = 0; #ifdef W32G_RANDOM_IS_SHUFFLE w32g_shuffle_playlist_reset(0); #endif while(1) { if(rc == RC_NONE) { if(play_mode->fd != -1) { aq_flush(1); play_mode->close_output(); } rc = w32g_get_rc(&value, 1); } redo: switch(rc) { case RC_NONE: Sleep(1000); break; case RC_LOAD_FILE: /* Play playlist.selected */ if(w32g_nvalid_playlist()) { int selected; w32g_get_playlist_index(&selected, NULL, NULL); w32g_play_active = 1; if(play_mode->fd == -1) { if(play_mode->open_output() == -1) { ctl.cmsg(CMSG_FATAL, VERB_NORMAL, "Couldn't open %s (`%c') %s", play_mode->id_name, play_mode->id_character, play_mode->name ? play_mode->name : ""); break; } aq_setup(); timidity_init_aq_buff(); } if(play_mode->id_character == 'l') w32g_show_console(); if(!DocWndIndependent){ w32g_setup_doc(selected); if(DocWndAutoPopup) w32g_open_doc(1); else w32g_open_doc(2); } { char *p = w32g_get_playlist(selected); if(Panel!=NULL && p!=NULL) strncpy(Panel->filename,p,sizeof(Panel->filename)); } SetWrdWndActive(); rc = play_midi_file(w32g_get_playlist(selected)); if(ctl.flags & CTLF_NOT_CONTINUE) w32g_update_playlist(); /* Update mark of error */ if(rc == RC_ERROR) { int nfiles; errcnt++; w32g_get_playlist_index(NULL, &nfiles, NULL); if(errcnt >= nfiles) w32g_msg_box("No MIDI file to play", "TiMidity Warning", MB_OK); } else errcnt = 0; w32g_play_active = 0; goto redo; } break; case RC_ERROR: case RC_TUNE_END: #if 0 if(play_mode->id_character != 'd' || (ctl.flags & CTLF_NOT_CONTINUE)) { #else if(ctl.flags & CTLF_NOT_CONTINUE) { #endif break; } /* FALLTHROUGH */ case RC_NEXT: if(!w32g_nvalid_playlist()) { if(ctl.flags & CTLF_AUTOEXIT) { if(play_mode->fd != -1) aq_flush(0); return; } break; } if(ctl.flags & CTLF_LIST_RANDOM) { #ifdef W32G_RANDOM_IS_SHUFFLE if(w32g_shuffle_playlist_next(!(ctl.flags & CTLF_NOT_CONTINUE))) { #else if(w32g_random_playlist(!(ctl.flags & CTLF_NOT_CONTINUE))) { #endif rc = RC_LOAD_FILE; goto redo; } } else { if(w32g_next_playlist(!(ctl.flags & CTLF_NOT_CONTINUE))) { rc = RC_LOAD_FILE; goto redo; } } { /* end of list */ if(ctl.flags & CTLF_AUTOEXIT){ if(play_mode->fd != -1) aq_flush(0); return; } if((ctl.flags & CTLF_LIST_LOOP) && w32g_nvalid_playlist()) { #ifdef W32G_RANDOM_IS_SHUFFLE if(ctl.flags & CTLF_LIST_RANDOM) { w32g_shuffle_playlist_reset(0); w32g_shuffle_playlist_next(!(ctl.flags & CTLF_NOT_CONTINUE)); } else { #endif w32g_first_playlist(!(ctl.flags & CTLF_NOT_CONTINUE)); #ifdef W32G_RANDOM_IS_SHUFFLE } #endif rc = RC_LOAD_FILE; goto redo; } if((ctl.flags & CTLF_LIST_RANDOM) && w32g_nvalid_playlist()) w32g_shuffle_playlist_reset(0); } break; case RC_REALLY_PREVIOUS: #ifdef W32G_RANDOM_IS_SHUFFLE w32g_shuffle_playlist_reset(0); #endif if(w32g_prev_playlist(!(ctl.flags & CTLF_NOT_CONTINUE))) { rc = RC_LOAD_FILE; goto redo; } break; case RC_QUIT: if(play_mode->fd != -1) aq_flush(1); return; case RC_CHANGE_VOLUME: amplification += value; ctl_master_volume(amplification); break; case RC_TOGGLE_PAUSE: play_pause_flag = !play_pause_flag; break; default: if(rc == RC_STOP) #ifdef W32G_RANDOM_IS_SHUFFLE w32g_shuffle_playlist_reset(0); #endif if(rc >= RC_EXT_BASE) { rc = w32g_ext_control(rc, value); if(rc != RC_NONE) goto redo; } break; } if(mark_apply_setting) PrefSettingApplyReally(); rc = RC_NONE; } } static void ctl_lcd_mark(int flag, int x, int y) { Panel->GSLCD[x][y] = flag; } static void ctl_gslcd(int id) { char *lcd; int i, j, k, data, mask; char tmp[3]; if((lcd = event2string(id)) == NULL) return; if(lcd[0] != ME_GSLCD) return; lcd++; for(i = 0; i < 16; i++) { for(j = 0; j < 4; j++) { tmp[0]= lcd[2 * (j * 16 + i)]; tmp[1]= lcd[2 * (j * 16 + i) + 1]; if(sscanf(tmp, "%02X", &data) != 1) { /* Invalid format */ return; } mask = 0x10; for(k = 0; k < 5; k++) { if(data & mask) {ctl_lcd_mark(1, j * 5 + k, i);} else {ctl_lcd_mark(0, j * 5 + k, i);} mask >>= 1; } } } Panel->gslcd_displayed_flag = 1; Panel->gslcd_last_display_time = get_current_calender_time(); Panel->changed = 1; } static void ctl_channel_note(int ch, int note, int vel) { if (vel == 0) { if (note == Panel->cnote[ch]) Panel->v_flags[ch] = FLAG_NOTE_OFF; Panel->cvel[ch] = 0; } else if (vel > Panel->cvel[ch]) { Panel->cvel[ch] = vel; Panel->cnote[ch] = note; Panel->ctotal[ch] = ( vel * Panel->channel[ch].volume * Panel->channel[ch].expression ) >> 14; // Panel->channel[ch].expression / (127*127); Panel->v_flags[ch] = FLAG_NOTE_ON; } Panel->changed = 1; } static void ctl_note(int status, int ch, int note, int vel) { int32 i, n; if(!ctl.trace_playing) return; if(ch < 0 || ch >= MAX_W32G_MIDI_CHANNELS) return; if(status != VOICE_ON) vel = 0; switch(status) { case VOICE_SUSTAINED: case VOICE_DIE: case VOICE_FREE: case VOICE_OFF: n = note; i = 0; if(n<0) n = 0; if(n>127) n = 127; while(n >= 32){ n -= 32; i++; } Panel->xnote[ch][i] &= ~(((int32)1) << n); break; case VOICE_ON: n = note; i = 0; if(n<0) n = 0; if(n>127) n = 127; while(n >= 32){ n -= 32; i++; } Panel->xnote[ch][i] |= ((int32)1) << n; break; } ctl_channel_note(ch, note, vel); } static void ctl_volume(int ch, int val) { if(ch >= MAX_W32G_MIDI_CHANNELS) return; if(!ctl.trace_playing) return; Panel->channel[ch].volume = val; ctl_channel_note(ch, Panel->cnote[ch], Panel->cvel[ch]); } static void ctl_expression(int ch, int val) { if(ch >= MAX_W32G_MIDI_CHANNELS) return; if(!ctl.trace_playing) return; Panel->channel[ch].expression = val; ctl_channel_note(ch, Panel->cnote[ch], Panel->cvel[ch]); } static void ctl_current_time(int secs, int nvoices) { int32 centisecs = secs * 100; Panel->cur_time = centisecs; Panel->cur_time_h = centisecs/100/60/60; centisecs %= 100*60*60; Panel->cur_time_m = centisecs/100/60; centisecs %= 100*60; Panel->cur_time_s = centisecs/100; centisecs %= 100; Panel->cur_time_ss = centisecs; Panel->cur_voices = nvoices; Panel->changed = 1; } static void display_aq_ratio(void) { static int last_rate = -1; int rate, devsiz; if((devsiz = aq_get_dev_queuesize()) == 0) return; rate = (int)(((double)(aq_filled() + aq_soft_filled()) / devsiz) * 100 + 0.5); if(rate > 999) rate = 1000; Panel->aq_ratio = rate; if(last_rate != rate) { last_rate = Panel->aq_ratio = rate; Panel->changed = 1; } } static void ctl_total_time(int tt) { int32 centisecs = tt/(play_mode->rate/100); Panel->total_time = centisecs; Panel->total_time_h = centisecs/100/60/60; centisecs %= 100*60*60; Panel->total_time_m = centisecs/100/60; centisecs %= 100*60; Panel->total_time_s = centisecs/100; centisecs %= 100; Panel->total_time_ss = centisecs; Panel->changed = 1; ctl_current_time(0, 0); } static void ctl_program(int ch, int val) { if(ch < 0 || ch >= MAX_W32G_MIDI_CHANNELS) return; if(!ctl.trace_playing) return; if(!IS_CURRENT_MOD_FILE) val += progbase; Panel->channel[ch].program = val; Panel->c_flags[ch] |= FLAG_PROG; Panel->changed = 1; } static void ctl_panning(int ch, int val) { if(ch >= MAX_W32G_MIDI_CHANNELS) return; if(!ctl.trace_playing) return; Panel->channel[ch].panning = val; Panel->c_flags[ch] |= FLAG_PAN; Panel->changed = 1; } static void ctl_sustain(int ch, int val) { if(ch >= MAX_W32G_MIDI_CHANNELS) return; if(!ctl.trace_playing) return; Panel->channel[ch].sustain = val; Panel->c_flags[ch] |= FLAG_SUST; Panel->changed = 1; } static void ctl_pitch_bend(int ch, int val) { if(ch >= MAX_W32G_MIDI_CHANNELS) return; if(!ctl.trace_playing) return; Panel->channel[ch].pitchbend = val; // Panel->c_flags[ch] |= FLAG_BENDT; Panel->changed = 1; } static void ctl_reset(void) { int i; if(!ctl.trace_playing) return; PanelReset(); CanvasReadPanelInfo(0); CanvasUpdate(0); CanvasPaint(); for(i = 0; i < MAX_W32G_MIDI_CHANNELS; i++) { if(ISDRUMCHANNEL(i)) ctl_program(i, channel[i].bank); else ctl_program(i, channel[i].program); ctl_volume(i, channel[i].volume); ctl_expression(i, channel[i].expression); ctl_panning(i, channel[i].panning); ctl_sustain(i, channel[i].sustain); if(channel[i].pitchbend == 0x2000 && channel[i].mod.val > 0) ctl_pitch_bend(i, -1); else ctl_pitch_bend(i, channel[i].pitchbend); ctl_channel_note(i, Panel->cnote[i], 0); } Panel->changed = 1; } static void ctl_maxvoices(int v) { Panel->voices = v; Panel->changed = 1; } extern void w32_wrd_ctl_event(CtlEvent *e); extern void w32_tracer_ctl_event(CtlEvent *e); static void ctl_event(CtlEvent *e) { w32_wrd_ctl_event(e); w32_tracer_ctl_event(e); switch(e->type) { case CTLE_NOW_LOADING: PanelReset(); CanvasReset(); CanvasClear(); CanvasReadPanelInfo(1); CanvasUpdate(1); CanvasPaintAll(); MPanelReset(); MPanelReadPanelInfo(1); MPanelUpdateAll(); MPanelPaintAll(); MPanelStartLoad((char *)e->v1); break; case CTLE_LOADING_DONE: break; case CTLE_PLAY_START: w32g_ctle_play_start((int)e->v1 / play_mode->rate); break; case CTLE_PLAY_END: MainWndScrollbarProgressUpdate(-1); break; case CTLE_CURRENT_TIME: { int sec; if(midi_trace.flush_flag) return; if(ctl.trace_playing) sec = (int)e->v1; else { sec = current_trace_samples(); if(sec < 0) sec = (int)e->v1; else sec = sec / play_mode->rate; } ctl_current_time(sec, (int)e->v2); display_aq_ratio(); MainWndScrollbarProgressUpdate(sec); ctl_panel_refresh(); } break; case CTLE_NOTE: ctl_note((int)e->v1, (int)e->v2, (int)e->v3, (int)e->v4); break; case CTLE_GSLCD: ctl_gslcd((int)e->v1); CanvasReadPanelInfo(0); CanvasUpdate(0); CanvasPaint(); break; case CTLE_MASTER_VOLUME: ctl_master_volume((int)e->v1); break; case CTLE_METRONOME: ctl_metronome((int) e->v1, (int) e->v2); break; case CTLE_KEYSIG: ctl_keysig((int8) e->v1, CTL_STATUS_UPDATE); break; case CTLE_KEY_OFFSET: ctl_keysig(CTL_STATUS_UPDATE, (int) e->v1); break; case CTLE_TEMPO: ctl_tempo((int) e->v1, CTL_STATUS_UPDATE); break; case CTLE_TIME_RATIO: ctl_tempo(CTL_STATUS_UPDATE, (int) e->v1); break; case CTLE_PROGRAM: // ctl_program((int)e->v1, (int)e->v2, (char *)e->v3); ctl_program((int)e->v1, (int)e->v2); break; case CTLE_VOLUME: ctl_volume((int)e->v1, (int)e->v2); break; case CTLE_EXPRESSION: ctl_expression((int)e->v1, (int)e->v2); break; case CTLE_PANNING: ctl_panning((int)e->v1, (int)e->v2); break; case CTLE_SUSTAIN: ctl_sustain((int)e->v1, (int)e->v2); break; case CTLE_PITCH_BEND: ctl_pitch_bend((int)e->v1, (int)e->v2); break; case CTLE_MOD_WHEEL: ctl_pitch_bend((int)e->v1, e->v2 ? -2 : 0x2000); break; case CTLE_CHORUS_EFFECT: break; case CTLE_REVERB_EFFECT: break; #if 1 case CTLE_LYRIC: { char *lyric; lyric = event2string((uint16)e->v1); if(lyric != NULL){ MPanelMessageClearAll(); MPanelMessageAdd(lyric+1,20000,1); } } #else default_ctl_lyric((uint16)e->v1); #endif break; case CTLE_REFRESH: if (CanvasGetMode() == CANVAS_MODE_KBD_A || CanvasGetMode() == CANVAS_MODE_KBD_B) { CanvasReadPanelInfo(0); CanvasUpdate(0); CanvasPaint(); } break; case CTLE_RESET: ctl_reset(); break; case CTLE_SPEANA: break; case CTLE_PAUSE: if(w32g_play_active) { MainWndScrollbarProgressUpdate((int)e->v2); if(!(int)e->v1) ctl_reset(); ctl_current_time((int)e->v2, 0); ctl_panel_refresh(); } break; case CTLE_MAXVOICES: ctl_maxvoices((int)e->v1); break; } } TiMidity++-2.13.2/interface/w32g_ini.c0100644004711200001440000005332010012633344016421 0ustar tamukiusers/* TiMidity++ -- MIDI to WAVE converter and player Copyright (C) 1999-2002 Masanao Izumo Copyright (C) 1995 Tuukka Toivonen 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA w32g_ini.c: written by Daisuke Aoki Masanao Izumo */ #include #include #ifdef HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ #include "interface.h" #include "timidity.h" #include "common.h" #include "output.h" #include "instrum.h" #include "playmidi.h" #include "w32g.h" #include "w32g_utl.h" #if MAX_CHANNELS > 32 /* FIXME */ #error "MAX_CHANNELS > 32 is not supported Windows GUI version" #endif extern void IniFlush(void); int w32g_has_ini_file; static int32 str2size(char *str) { int len = strlen(str); if(str[len - 1] == 'k' || str[len - 1] == 'K') return (int32)(1024.0 * atof(str)); if(str[len - 1] == 'm' || str[len - 1] == 'M') return (int32)(1024 * 1024 * atof(str)); return atoi(str); } void LoadIniFile(SETTING_PLAYER *sp, SETTING_TIMIDITY *st) { char buff[1024]; /* [PLAYER] */ IniGetKeyInt(INI_SEC_PLAYER,"InitMinimizeFlag",&(sp->InitMinimizeFlag)); IniGetKeyInt(INI_SEC_PLAYER,"DebugWndStartFlag",&(sp->DebugWndStartFlag)); IniGetKeyInt(INI_SEC_PLAYER,"ConsoleWndStartFlag",&(sp->ConsoleWndStartFlag)); IniGetKeyInt(INI_SEC_PLAYER,"ListWndStartFlag",&(sp->ListWndStartFlag)); IniGetKeyInt(INI_SEC_PLAYER,"TracerWndStartFlag",&(sp->TracerWndStartFlag)); IniGetKeyInt(INI_SEC_PLAYER,"DocWndStartFlag",&(sp->DocWndStartFlag)); IniGetKeyInt(INI_SEC_PLAYER,"WrdWndStartFlag",&(sp->WrdWndStartFlag)); IniGetKeyInt(INI_SEC_PLAYER,"DebugWndFlag",&(sp->DebugWndFlag)); IniGetKeyInt(INI_SEC_PLAYER,"ConsoleWndFlag",&(sp->ConsoleWndFlag)); IniGetKeyInt(INI_SEC_PLAYER,"ListWndFlag",&(sp->ListWndFlag)); IniGetKeyInt(INI_SEC_PLAYER,"TracerWndFlag",&(sp->TracerWndFlag)); IniGetKeyInt(INI_SEC_PLAYER,"DocWndFlag",&(sp->DocWndFlag)); IniGetKeyInt(INI_SEC_PLAYER,"WrdWndFlag",&(sp->WrdWndFlag)); IniGetKeyInt(INI_SEC_PLAYER,"SoundSpecWndFlag",&(sp->SoundSpecWndFlag)); IniGetKeyInt(INI_SEC_PLAYER,"SubWindowMax",&(sp->SubWindowMax)); IniGetKeyStringN(INI_SEC_PLAYER,"ConfigFile",sp->ConfigFile,MAXPATH + 32); if(!sp->ConfigFile[0]) { GetWindowsDirectory(sp->ConfigFile, sizeof(sp->ConfigFile) - 14); strcat(sp->ConfigFile, "\\TIMIDITY.CFG"); } IniGetKeyStringN(INI_SEC_PLAYER,"PlaylistFile",sp->PlaylistFile,MAXPATH + 32); IniGetKeyStringN(INI_SEC_PLAYER,"PlaylistHistoryFile",sp->PlaylistHistoryFile,MAXPATH + 32); IniGetKeyStringN(INI_SEC_PLAYER,"MidiFileOpenDir",sp->MidiFileOpenDir,MAXPATH + 32); IniGetKeyStringN(INI_SEC_PLAYER,"ConfigFileOpenDir",sp->ConfigFileOpenDir,MAXPATH + 32); IniGetKeyStringN(INI_SEC_PLAYER,"PlaylistFileOpenDir",sp->PlaylistFileOpenDir,MAXPATH + 32); IniGetKeyInt(INI_SEC_PLAYER,"PlayerThreadPriority",&(sp->PlayerThreadPriority)); IniGetKeyInt(INI_SEC_PLAYER,"GUIThreadPriority",&(sp->GUIThreadPriority)); IniGetKeyStringN(INI_SEC_PLAYER,"SystemFont",sp->SystemFont,256); IniGetKeyStringN(INI_SEC_PLAYER,"PlayerFont",sp->PlayerFont,256); IniGetKeyStringN(INI_SEC_PLAYER,"WrdFont",sp->WrdFont,256); IniGetKeyStringN(INI_SEC_PLAYER,"DocFont",sp->DocFont,256); IniGetKeyStringN(INI_SEC_PLAYER,"ListFont",sp->ListFont,256); IniGetKeyStringN(INI_SEC_PLAYER,"TracerFont",sp->TracerFont,256); IniGetKeyInt(INI_SEC_PLAYER,"SystemFontSize",&(sp->SystemFontSize)); IniGetKeyInt(INI_SEC_PLAYER,"PlayerFontSize",&(sp->PlayerFontSize)); IniGetKeyInt(INI_SEC_PLAYER,"WrdFontSize",&(sp->WrdFontSize)); IniGetKeyInt(INI_SEC_PLAYER,"DocFontSize",&(sp->DocFontSize)); IniGetKeyInt(INI_SEC_PLAYER,"ListFontSize",&(sp->ListFontSize)); IniGetKeyInt(INI_SEC_PLAYER,"TracerFontSize",&(sp->TracerFontSize)); IniGetKeyInt(INI_SEC_PLAYER,"WrdGraphicFlag",&(sp->WrdGraphicFlag)); IniGetKeyInt(INI_SEC_PLAYER,"TraceGraphicFlag",&(sp->TraceGraphicFlag)); IniGetKeyInt(INI_SEC_PLAYER,"DocMaxSize",&(sp->DocMaxSize)); IniGetKeyStringN(INI_SEC_PLAYER,"DocFileExt",sp->DocFileExt,256); IniGetKeyInt(INI_SEC_PLAYER,"PlayerLanguage",&(sp->PlayerLanguage)); IniGetKeyInt(INI_SEC_PLAYER,"DocWndIndependent",&(sp->DocWndIndependent)); IniGetKeyInt(INI_SEC_PLAYER,"DocWndAutoPopup",&(sp->DocWndAutoPopup)); IniGetKeyInt(INI_SEC_PLAYER,"SeachDirRecursive",&(sp->SeachDirRecursive)); IniGetKeyInt(INI_SEC_PLAYER,"IniFileAutoSave",&(sp->IniFileAutoSave)); IniGetKeyInt(INI_SEC_PLAYER,"SecondMode",&(sp->SecondMode)); IniGetKeyInt(INI_SEC_PLAYER,"AutoloadPlaylist",&(sp->AutoloadPlaylist)); IniGetKeyInt(INI_SEC_PLAYER,"AutosavePlaylist",&(sp->AutosavePlaylist)); IniGetKeyInt(INI_SEC_PLAYER,"PosSizeSave",&(sp->PosSizeSave)); /* [TIMIDITY] */ IniGetKeyInt32(INI_SEC_TIMIDITY,"amplification",&(st->amplification)); IniGetKeyInt(INI_SEC_TIMIDITY,"antialiasing_allowed",&(st->antialiasing_allowed)); IniGetKeyInt(INI_SEC_TIMIDITY,"buffer_fragments",&(st->buffer_fragments)); IniGetKeyInt32(INI_SEC_TIMIDITY,"control_ratio",&(st->control_ratio)); IniGetKeyInt32(INI_SEC_TIMIDITY,"default_drumchannels",(int32 *)&(st->default_drumchannels)); IniGetKeyInt32(INI_SEC_TIMIDITY,"default_drumchannel_mask",(int32 *)&(st->default_drumchannel_mask)); IniGetKeyInt(INI_SEC_TIMIDITY,"opt_modulation_wheel",&(st->opt_modulation_wheel)); IniGetKeyInt(INI_SEC_TIMIDITY,"opt_portamento",&(st->opt_portamento)); IniGetKeyInt(INI_SEC_TIMIDITY,"opt_nrpn_vibrato",&(st->opt_nrpn_vibrato)); IniGetKeyInt(INI_SEC_TIMIDITY,"opt_channel_pressure",&(st->opt_channel_pressure)); IniGetKeyInt(INI_SEC_TIMIDITY,"opt_trace_text_meta_event",&(st->opt_trace_text_meta_event)); IniGetKeyInt(INI_SEC_TIMIDITY,"opt_overlap_voice_allow",&(st->opt_overlap_voice_allow)); IniGetKeyStringN(INI_SEC_TIMIDITY,"opt_default_mid",buff,sizeof(buff)-1); // st->opt_default_mid = str2mID(buff); st->opt_default_mid = atoi(buff); IniGetKeyInt(INI_SEC_TIMIDITY,"default_tonebank",&(st->default_tonebank)); IniGetKeyInt(INI_SEC_TIMIDITY,"special_tonebank",&(st->special_tonebank)); IniGetKeyInt(INI_SEC_TIMIDITY,"effect_lr_mode",&(st->effect_lr_mode)); IniGetKeyInt(INI_SEC_TIMIDITY,"effect_lr_delay_msec",&(st->effect_lr_delay_msec)); IniGetKeyInt(INI_SEC_TIMIDITY,"opt_reverb_control",&(st->opt_reverb_control)); IniGetKeyInt(INI_SEC_TIMIDITY,"opt_chorus_control",&(st->opt_chorus_control)); IniGetKeyInt(INI_SEC_TIMIDITY,"opt_surround_chorus",&(st->opt_surround_chorus)); IniGetKeyInt(INI_SEC_TIMIDITY,"opt_tva_attack",&(st->opt_tva_attack)); IniGetKeyInt(INI_SEC_TIMIDITY,"opt_tva_decay",&(st->opt_tva_decay)); IniGetKeyInt(INI_SEC_TIMIDITY,"opt_tva_release",&(st->opt_tva_release)); IniGetKeyInt(INI_SEC_TIMIDITY,"opt_delay_control",&(st->opt_delay_control)); IniGetKeyInt(INI_SEC_TIMIDITY,"opt_default_module",&(st->opt_default_module)); IniGetKeyInt(INI_SEC_TIMIDITY,"opt_lpf_def",&(st->opt_lpf_def)); IniGetKeyInt(INI_SEC_TIMIDITY,"opt_drum_effect",&(st->opt_drum_effect)); IniGetKeyInt(INI_SEC_TIMIDITY,"opt_modulation_envelope",&(st->opt_modulation_envelope)); IniGetKeyInt(INI_SEC_TIMIDITY,"opt_pan_delay",&(st->opt_pan_delay)); IniGetKeyInt(INI_SEC_TIMIDITY,"opt_eq_control",&(st->opt_eq_control)); IniGetKeyInt(INI_SEC_TIMIDITY,"opt_insertion_effect",&(st->opt_insertion_effect)); IniGetKeyInt(INI_SEC_TIMIDITY,"noise_sharp_type",&(st->noise_sharp_type)); IniGetKeyInt(INI_SEC_TIMIDITY,"opt_evil_mode",&(st->opt_evil_mode)); IniGetKeyInt(INI_SEC_TIMIDITY,"adjust_panning_immediately",&(st->adjust_panning_immediately)); IniGetKeyInt(INI_SEC_TIMIDITY,"fast_decay",&(st->fast_decay)); #ifdef SUPPORT_SOUNDSPEC IniGetKeyInt(INI_SEC_TIMIDITY,"view_soundspec_flag",&(st->view_soundspec_flag)); IniGetKeyFloat(INI_SEC_TIMIDITY,"spectrogram_update_sec",&v_float); st->spectrogram_update_sec = v_float; #endif IniGetKeyIntArray(INI_SEC_TIMIDITY,"default_program",st->default_program,MAX_CHANNELS); IniGetKeyStringN(INI_SEC_TIMIDITY,"opt_ctl",st->opt_ctl,sizeof(st->opt_ctl)-1); IniGetKeyInt32(INI_SEC_TIMIDITY,"opt_drum_power",&(st->opt_drum_power)); IniGetKeyInt(INI_SEC_TIMIDITY,"opt_amp_compensation",&(st->opt_amp_compensation)); IniGetKeyInt(INI_SEC_TIMIDITY,"opt_realtime_playing",&(st->opt_realtime_playing)); IniGetKeyInt(INI_SEC_TIMIDITY,"reduce_voice_threshold",&(st->reduce_voice_threshold)); IniGetKeyStringN(INI_SEC_TIMIDITY,"opt_playmode",st->opt_playmode,sizeof(st->opt_playmode)-1); IniGetKeyStringN(INI_SEC_TIMIDITY,"OutputName",st->OutputName,sizeof(st->OutputName)-1); IniGetKeyStringN(INI_SEC_TIMIDITY,"OutputDirName",st->OutputDirName,sizeof(st->OutputDirName)-1); IniGetKeyInt(INI_SEC_TIMIDITY,"auto_output_mode",&(st->auto_output_mode)); IniGetKeyInt(INI_SEC_TIMIDITY,"voices",&(st->voices)); IniGetKeyInt(INI_SEC_TIMIDITY,"auto_reduce_polyphony",&(st->auto_reduce_polyphony)); IniGetKeyInt32(INI_SEC_TIMIDITY,"quietchannels",(int32 *)&(st->quietchannels)); IniGetKeyInt(INI_SEC_TIMIDITY,"temper_type_mute",&(st->temper_type_mute)); IniGetKeyStringN(INI_SEC_TIMIDITY,"opt_qsize",st->opt_qsize,sizeof(st->opt_qsize)-1); IniGetKeyInt32(INI_SEC_TIMIDITY,"modify_release",&(st->modify_release)); IniGetKeyStringN(INI_SEC_TIMIDITY,"allocate_cache_size",buff,sizeof(buff)-1); st->allocate_cache_size = str2size(buff); IniGetKeyInt(INI_SEC_TIMIDITY,"key_adjust",&(st->key_adjust)); IniGetKeyInt8(INI_SEC_TIMIDITY,"opt_force_keysig",&(st->opt_force_keysig)); IniGetKeyInt(INI_SEC_TIMIDITY,"opt_pure_intonation",&(st->opt_pure_intonation)); IniGetKeyInt8(INI_SEC_TIMIDITY,"opt_init_keysig",&(st->opt_init_keysig)); IniGetKeyInt(INI_SEC_TIMIDITY,"output_rate",&(st->output_rate)); IniGetKeyStringN(INI_SEC_TIMIDITY,"output_text_code",st->output_text_code,sizeof(st->output_text_code)-1); IniGetKeyInt(INI_SEC_TIMIDITY,"free_instruments_afterwards",&(st->free_instruments_afterwards)); IniGetKeyStringN(INI_SEC_TIMIDITY,"out_wrd",st->opt_wrd,sizeof(st->opt_wrd)-1); #if defined(__W32__) && defined(SMFCONV) IniGetKeyInt(INI_SEC_TIMIDITY,"opt_rcpcv_dll",&(st->opt_rcpcv_dll)); #endif IniGetKeyInt(INI_SEC_TIMIDITY,"data_block_bits",&(st->data_block_bits)); if(st->data_block_bits > AUDIO_BUFFER_BITS) st->data_block_bits = AUDIO_BUFFER_BITS; IniGetKeyInt(INI_SEC_TIMIDITY,"data_block_num",&(st->data_block_num)); #ifdef IA_W32G_SYN IniGetKeyIntArray(INI_SEC_TIMIDITY,"SynIDPort",st->SynIDPort,MAX_PORT); IniGetKeyInt(INI_SEC_TIMIDITY,"syn_AutoStart",&(st->syn_AutoStart)); IniGetKeyInt(INI_SEC_TIMIDITY,"processPriority",&(st->processPriority)); IniGetKeyInt(INI_SEC_TIMIDITY,"syn_ThreadPriority",&(st->syn_ThreadPriority)); IniGetKeyInt(INI_SEC_TIMIDITY,"SynPortNum",&(st->SynPortNum)); IniGetKeyInt(INI_SEC_TIMIDITY,"SynShTime",&(st->SynShTime)); if ( st->SynShTime < 0 ) st->SynShTime = 0; #endif } void SaveIniFile(SETTING_PLAYER *sp, SETTING_TIMIDITY *st) { /* [PLAYER] */ IniPutKeyString(INI_SEC_PLAYER,"IniVersion",IniVersion); IniPutKeyInt(INI_SEC_PLAYER,"InitMinimizeFlag",&(sp->InitMinimizeFlag)); IniPutKeyInt(INI_SEC_PLAYER,"DebugWndStartFlag",&(sp->DebugWndStartFlag)); IniPutKeyInt(INI_SEC_PLAYER,"ConsoleWndStartFlag",&(sp->ConsoleWndStartFlag)); IniPutKeyInt(INI_SEC_PLAYER,"ListWndStartFlag",&(sp->ListWndStartFlag)); IniPutKeyInt(INI_SEC_PLAYER,"TracerWndStartFlag",&(sp->TracerWndStartFlag)); IniPutKeyInt(INI_SEC_PLAYER,"DocWndStartFlag",&(sp->DocWndStartFlag)); IniPutKeyInt(INI_SEC_PLAYER,"WrdWndStartFlag",&(sp->WrdWndStartFlag)); IniPutKeyInt(INI_SEC_PLAYER,"DebugWndFlag",&(sp->DebugWndFlag)); IniPutKeyInt(INI_SEC_PLAYER,"ConsoleWndFlag",&(sp->ConsoleWndFlag)); IniPutKeyInt(INI_SEC_PLAYER,"ListWndFlag",&(sp->ListWndFlag)); IniPutKeyInt(INI_SEC_PLAYER,"TracerWndFlag",&(sp->TracerWndFlag)); IniPutKeyInt(INI_SEC_PLAYER,"DocWndFlag",&(sp->DocWndFlag)); IniPutKeyInt(INI_SEC_PLAYER,"WrdWndFlag",&(sp->WrdWndFlag)); IniPutKeyInt(INI_SEC_PLAYER,"SoundSpecWndFlag",&(sp->SoundSpecWndFlag)); IniPutKeyInt(INI_SEC_PLAYER,"SubWindowMax",&(sp->SubWindowMax)); IniPutKeyStringN(INI_SEC_PLAYER,"ConfigFile",sp->ConfigFile,MAXPATH + 32); IniPutKeyStringN(INI_SEC_PLAYER,"PlaylistFile",sp->PlaylistFile,MAXPATH + 32); IniPutKeyStringN(INI_SEC_PLAYER,"PlaylistHistoryFile",sp->PlaylistHistoryFile,MAXPATH + 32); IniPutKeyStringN(INI_SEC_PLAYER,"MidiFileOpenDir",sp->MidiFileOpenDir,MAXPATH + 32); IniPutKeyStringN(INI_SEC_PLAYER,"ConfigFileOpenDir",sp->ConfigFileOpenDir,MAXPATH + 32); IniPutKeyStringN(INI_SEC_PLAYER,"PlaylistFileOpenDir",sp->PlaylistFileOpenDir,MAXPATH + 32); IniPutKeyInt(INI_SEC_PLAYER,"PlayerThreadPriority",&(sp->PlayerThreadPriority)); IniPutKeyInt(INI_SEC_PLAYER,"GUIThreadPriority",&(sp->GUIThreadPriority)); IniPutKeyStringN(INI_SEC_PLAYER,"SystemFont",sp->SystemFont,256); IniPutKeyStringN(INI_SEC_PLAYER,"PlayerFont",sp->PlayerFont,256); IniPutKeyStringN(INI_SEC_PLAYER,"WrdFont",sp->WrdFont,256); IniPutKeyStringN(INI_SEC_PLAYER,"DocFont",sp->DocFont,256); IniPutKeyStringN(INI_SEC_PLAYER,"ListFont",sp->ListFont,256); IniPutKeyStringN(INI_SEC_PLAYER,"TracerFont",sp->TracerFont,256); IniPutKeyInt(INI_SEC_PLAYER,"SystemFontSize",&(sp->SystemFontSize)); IniPutKeyInt(INI_SEC_PLAYER,"PlayerFontSize",&(sp->PlayerFontSize)); IniPutKeyInt(INI_SEC_PLAYER,"WrdFontSize",&(sp->WrdFontSize)); IniPutKeyInt(INI_SEC_PLAYER,"DocFontSize",&(sp->DocFontSize)); IniPutKeyInt(INI_SEC_PLAYER,"ListFontSize",&(sp->ListFontSize)); IniPutKeyInt(INI_SEC_PLAYER,"TracerFontSize",&(sp->TracerFontSize)); IniPutKeyInt(INI_SEC_PLAYER,"WrdGraphicFlag",&(sp->WrdGraphicFlag)); IniPutKeyInt(INI_SEC_PLAYER,"TraceGraphicFlag",&(sp->TraceGraphicFlag)); IniPutKeyInt(INI_SEC_PLAYER,"DocMaxSize",&(sp->DocMaxSize)); IniPutKeyStringN(INI_SEC_PLAYER,"DocFileExt",sp->DocFileExt,256); IniPutKeyInt(INI_SEC_PLAYER,"PlayerLanguage",&(sp->PlayerLanguage)); IniPutKeyInt(INI_SEC_PLAYER,"DocWndIndependent",&(sp->DocWndIndependent)); IniPutKeyInt(INI_SEC_PLAYER,"DocWndAutoPopup",&(sp->DocWndAutoPopup)); IniPutKeyInt(INI_SEC_PLAYER,"SeachDirRecursive",&(sp->SeachDirRecursive)); IniPutKeyInt(INI_SEC_PLAYER,"IniFileAutoSave",&(sp->IniFileAutoSave)); IniPutKeyInt(INI_SEC_PLAYER,"SecondMode",&(sp->SecondMode)); IniPutKeyInt(INI_SEC_PLAYER,"AutoloadPlaylist",&(sp->AutoloadPlaylist)); IniPutKeyInt(INI_SEC_PLAYER,"AutosavePlaylist",&(sp->AutosavePlaylist)); IniPutKeyInt(INI_SEC_PLAYER,"PosSizeSave",&(sp->PosSizeSave)); /* [TIMIDITY] */ IniPutKeyInt32(INI_SEC_TIMIDITY,"amplification",&(st->amplification)); IniPutKeyInt(INI_SEC_TIMIDITY,"antialiasing_allowed",&(st->antialiasing_allowed)); IniPutKeyInt(INI_SEC_TIMIDITY,"buffer_fragments",&(st->buffer_fragments)); IniPutKeyInt32(INI_SEC_TIMIDITY,"control_ratio",&(st->control_ratio)); IniPutKeyInt32(INI_SEC_TIMIDITY,"default_drumchannels",(int32 *)&(st->default_drumchannels)); IniPutKeyInt32(INI_SEC_TIMIDITY,"default_drumchannel_mask",(int32 *)&(st->default_drumchannel_mask)); IniPutKeyInt(INI_SEC_TIMIDITY,"opt_modulation_wheel",&(st->opt_modulation_wheel)); IniPutKeyInt(INI_SEC_TIMIDITY,"opt_portamento",&(st->opt_portamento)); IniPutKeyInt(INI_SEC_TIMIDITY,"opt_nrpn_vibrato",&(st->opt_nrpn_vibrato)); IniPutKeyInt(INI_SEC_TIMIDITY,"opt_channel_pressure",&(st->opt_channel_pressure)); IniPutKeyInt(INI_SEC_TIMIDITY,"opt_trace_text_meta_event",&(st->opt_trace_text_meta_event)); IniPutKeyInt(INI_SEC_TIMIDITY,"opt_overlap_voice_allow",&(st->opt_overlap_voice_allow)); IniPutKeyInt(INI_SEC_TIMIDITY,"opt_default_mid",&(st->opt_default_mid)); IniPutKeyInt(INI_SEC_TIMIDITY,"default_tonebank",&(st->default_tonebank)); IniPutKeyInt(INI_SEC_TIMIDITY,"special_tonebank",&(st->special_tonebank)); IniPutKeyInt(INI_SEC_TIMIDITY,"effect_lr_mode",&(st->effect_lr_mode)); IniPutKeyInt(INI_SEC_TIMIDITY,"effect_lr_delay_msec",&(st->effect_lr_delay_msec)); IniPutKeyInt(INI_SEC_TIMIDITY,"opt_reverb_control",&(st->opt_reverb_control)); IniPutKeyInt(INI_SEC_TIMIDITY,"opt_chorus_control",&(st->opt_chorus_control)); IniPutKeyInt(INI_SEC_TIMIDITY,"opt_surround_chorus",&(st->opt_surround_chorus)); IniPutKeyInt(INI_SEC_TIMIDITY,"opt_tva_attack",&(st->opt_tva_attack)); IniPutKeyInt(INI_SEC_TIMIDITY,"opt_tva_decay",&(st->opt_tva_decay)); IniPutKeyInt(INI_SEC_TIMIDITY,"opt_tva_release",&(st->opt_tva_release)); IniPutKeyInt(INI_SEC_TIMIDITY,"opt_delay_control",&(st->opt_delay_control)); IniPutKeyInt(INI_SEC_TIMIDITY,"opt_default_module",&(st->opt_default_module)); IniPutKeyInt(INI_SEC_TIMIDITY,"opt_lpf_def",&(st->opt_lpf_def)); IniPutKeyInt(INI_SEC_TIMIDITY,"opt_drum_effect",&(st->opt_drum_effect)); IniPutKeyInt(INI_SEC_TIMIDITY,"opt_modulation_envelope",&(st->opt_modulation_envelope)); IniPutKeyInt(INI_SEC_TIMIDITY,"opt_pan_delay",&(st->opt_pan_delay)); IniPutKeyInt(INI_SEC_TIMIDITY,"opt_eq_control",&(st->opt_eq_control)); IniPutKeyInt(INI_SEC_TIMIDITY,"opt_insertion_effect",&(st->opt_insertion_effect)); IniPutKeyInt(INI_SEC_TIMIDITY,"noise_sharp_type",&(st->noise_sharp_type)); IniPutKeyInt(INI_SEC_TIMIDITY,"opt_evil_mode",&(st->opt_evil_mode)); IniPutKeyInt(INI_SEC_TIMIDITY,"adjust_panning_immediately",&(st->adjust_panning_immediately)); IniPutKeyInt(INI_SEC_TIMIDITY,"fast_decay",&(st->fast_decay)); #ifdef SUPPORT_SOUNDSPEC IniPutKeyInt(INI_SEC_TIMIDITY,"view_soundspec_flag",&(st->view_soundspec_flag)); v_float = st->spectrogram_update_sec; IniPutKeyFloat(INI_SEC_TIMIDITY,"spectrogram_update_sec",&v_float); #endif IniPutKeyIntArray(INI_SEC_TIMIDITY,"default_program",st->default_program,MAX_CHANNELS); IniPutKeyStringN(INI_SEC_TIMIDITY,"opt_ctl",st->opt_ctl,sizeof(st->opt_ctl)); IniPutKeyInt32(INI_SEC_TIMIDITY,"opt_drum_power",&(st->opt_drum_power)); IniPutKeyInt(INI_SEC_TIMIDITY,"opt_amp_compensation",&(st->opt_amp_compensation)); IniPutKeyInt(INI_SEC_TIMIDITY,"opt_realtime_playing",&(st->opt_realtime_playing)); IniPutKeyInt(INI_SEC_TIMIDITY,"reduce_voice_threshold",&(st->reduce_voice_threshold)); IniPutKeyStringN(INI_SEC_TIMIDITY,"opt_playmode",st->opt_playmode,sizeof(st->opt_playmode)); IniPutKeyStringN(INI_SEC_TIMIDITY,"OutputName",st->OutputName,sizeof(st->OutputName)); IniPutKeyStringN(INI_SEC_TIMIDITY,"OutputDirName",st->OutputDirName,sizeof(st->OutputDirName)); IniPutKeyInt(INI_SEC_TIMIDITY,"auto_output_mode",&(st->auto_output_mode)); IniPutKeyInt(INI_SEC_TIMIDITY,"voices",&(st->voices)); IniPutKeyInt(INI_SEC_TIMIDITY,"auto_reduce_polyphony",&(st->auto_reduce_polyphony)); IniPutKeyInt32(INI_SEC_TIMIDITY,"quietchannels",(int32 *)&(st->quietchannels)); IniPutKeyInt(INI_SEC_TIMIDITY,"temper_type_mute",&(st->temper_type_mute)); IniPutKeyStringN(INI_SEC_TIMIDITY,"opt_qsize",st->opt_qsize,sizeof(st->opt_qsize)); IniPutKeyInt32(INI_SEC_TIMIDITY,"modify_release",&(st->modify_release)); IniPutKeyInt32(INI_SEC_TIMIDITY,"allocate_cache_size",&(st->allocate_cache_size)); IniPutKeyInt(INI_SEC_TIMIDITY,"key_adjust",&(st->key_adjust)); IniPutKeyInt8(INI_SEC_TIMIDITY,"opt_force_keysig",&(st->opt_force_keysig)); IniPutKeyInt(INI_SEC_TIMIDITY,"opt_pure_intonation",&(st->opt_pure_intonation)); IniPutKeyInt8(INI_SEC_TIMIDITY,"opt_init_keysig",&(st->opt_init_keysig)); IniPutKeyInt(INI_SEC_TIMIDITY,"output_rate",&(st->output_rate)); if(st->output_rate == 0) st->output_rate = play_mode->rate; IniPutKeyStringN(INI_SEC_TIMIDITY,"output_text_code",st->output_text_code,sizeof(st->output_text_code)); IniPutKeyInt(INI_SEC_TIMIDITY,"free_instruments_afterwards",&(st->free_instruments_afterwards)); IniPutKeyStringN(INI_SEC_TIMIDITY,"out_wrd",st->opt_wrd,sizeof(st->opt_wrd)); #if defined(__W32__) && defined(SMFCONV) IniPutKeyInt(INI_SEC_TIMIDITY,"opt_rcpcv_dll",&(st->opt_rcpcv_dll)); #endif IniPutKeyInt(INI_SEC_TIMIDITY,"data_block_bits",&(st->data_block_bits)); IniPutKeyInt(INI_SEC_TIMIDITY,"data_block_num",&(st->data_block_num)); #ifdef IA_W32G_SYN IniPutKeyIntArray(INI_SEC_TIMIDITY,"SynIDPort",st->SynIDPort,MAX_PORT); IniPutKeyInt(INI_SEC_TIMIDITY,"syn_AutoStart",&(st->syn_AutoStart)); IniPutKeyInt(INI_SEC_TIMIDITY,"processPriority",&(st->processPriority)); IniPutKeyInt(INI_SEC_TIMIDITY,"syn_ThreadPriority",&(st->syn_ThreadPriority)); IniPutKeyInt(INI_SEC_TIMIDITY,"SynPortNum",&(st->SynPortNum)); IniPutKeyInt(INI_SEC_TIMIDITY,"SynShTime",&(st->SynShTime)); #endif IniFlush(); w32g_has_ini_file = 1; } // When Start TiMidity in WinMain() extern int SecondMode; static char S_IniFile[MAXPATH + 32]; void FirstLoadIniFile(void) { char buffer[1024]; char *prevIniFile = IniFile; char *p; IniFile = S_IniFile; if(GetModuleFileName(GetModuleHandle(0), buffer, MAXPATH)) { if((p = pathsep_strrchr(buffer)) != NULL) { p++; *p = '\0'; } else { buffer[0] = '.'; buffer[1] = PATH_SEP; buffer[2] = '\0'; } } else { buffer[0] = '.'; buffer[1] = PATH_SEP; buffer[2] = '\0'; } strncpy(IniFile, buffer, MAXPATH); IniFile[MAXPATH] = '\0'; strcat(IniFile,"timpp32g.ini"); IniGetKeyInt(INI_SEC_PLAYER,"SecondMode",&(SecondMode)); IniFile = prevIniFile; } TiMidity++-2.13.2/interface/w32g_rec.h0100644004711200001440000000252407421005040016414 0ustar tamukiusers// TiMidity++ -- MIDI to WAVE converter and player // Copyright (C) 1999-2002 Masanao Izumo // Copyright (C) 1995 Tuukka Toivonen // // 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA //{{NO_DEPENDENCIES}} // Microsoft Developer Studio generated include file. // Used by w32g_res.rc // // Next default values for new objects // #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NO_MFC 1 #define _APS_NEXT_RESOURCE_VALUE 2000 #define _APS_NEXT_COMMAND_VALUE 3000 #define _APS_NEXT_CONTROL_VALUE 4000 #define _APS_NEXT_SYMED_VALUE 5000 #endif #endif TiMidity++-2.13.2/interface/w32g_res.h0100644004711200001440000003606610023122107016440 0ustar tamukiusers//{{NO_DEPENDENCIES}} // Microsoft Developer Studio generated include file. // Used by w32g_res.rc // #define IDD_DIALOG_SEARCHBOX 102 #define IDD_DIALOG_VORBIS 103 #define IDD_DIALOG_GOGO 104 #define IDD_PREF_PLAYER_EN 106 #define IDD_PREF_TIMIDITY1_EN 107 #define IDD_PREF_TIMIDITY2_EN 108 #define IDD_PREF_TIMIDITY3_EN 109 #define IDD_PREF_TIMIDITY4_EN 110 #define IDD_DIALOG_MAIN_EN 111 #define IDM_MENU_MAIN_EN 112 #define IDD_DIALOG_VORBIS_EN 113 #define IDD_DIALOG_GOGO_EN 114 #define IDD_DIALOG_ONE_LINE_EN 118 #define IDD_DIALOG_ONE_LINE 119 #define IDB_BITMAP_KEYBORD42x20 122 #define IDB_BITMAP_TRACER 125 #define IDD_PREF_SYN1 127 #define IDD_PREF_SYN1_EN 128 #define IDD_DIALOG_PREF 132 #define IDC_CHECK_SEACHDIRRECURSIVE 1001 #define IDC_CHECK_DOCWNDINDEPENDENT 1002 #define IDC_CHECK_INIFILE_AUTOSAVE 1003 #define IDD_DIALOG_WAVEFORM 1004 #define IDC_CHECK_DOCWNDAUTOPOPUP 1004 #define IDC_CHECKBOX_CHORUS_LEVEL 1005 #define IDC_CHECKBOX_GLOBAL_REVERB 1006 #define IDC_CHECKBOX_REVERB_LEVEL 1007 #define IDC_CHECKBOX_CH01 1008 #define IDC_CHECKBOX_SRCHORUS 1008 #define IDC_CHECKBOX_CH02 1009 #define IDC_CHECKBOX_RESONANCE 1009 #define IDC_CHECKBOX_CH03 1010 #define IDC_CHECKBOX_SF_LPF 1010 #define IDC_CHECKBOX_CH04 1011 #define IDC_CHECKBOX_DRUM_EFFECT 1011 #define IDC_CHECKBOX_CH05 1012 #define IDC_CHECKBOX_PURE_INTONATION 1012 #define IDC_CHECKBOX_LPF_DEF 1012 #define IDC_CHECKBOX_CH06 1013 #define IDC_CHECKBOX_INIT_MI 1013 #define IDC_CHECKBOX_MOD_ENV 1013 #define IDC_CHECKBOX_CH07 1014 #define IDC_CHECKBOX_PAN_DELAY 1014 #define IDC_CHECKBOX_CH08 1015 #define IDC_CHECKBOX_CH09 1016 #define IDC_CHECKBOX_CH10 1017 #define IDC_CHECKBOX_CH11 1018 #define IDC_CHECKBOX_CH12 1019 #define IDC_CHECKBOX_CH13 1020 #define IDC_CHECKBOX_CH14 1021 #define IDC_CHECKBOX_CH15 1022 #define IDC_CHECKBOX_CH16 1023 #define IDC_CHECKBOX_CH17 1024 #define IDC_CHECKBOX_CH18 1025 #define IDC_CHECKBOX_CH19 1026 #define IDC_CHECKBOX_CH20 1027 #define IDC_CHECKBOX_CH21 1028 #define IDC_CHECKBOX_CH22 1029 #define IDC_CHECKBOX_CH23 1030 #define IDC_CHECKBOX_CH24 1031 #define IDC_CHECKBOX_CH25 1032 #define IDC_CHECKBOX_CH26 1033 #define IDC_CHECKBOX_CH27 1034 #define IDC_CHECKBOX_CH28 1035 #define IDC_CHECKBOX_CH29 1036 #define IDC_CHECKBOX_CH30 1037 #define IDC_CHECKBOX_CH31 1038 #define IDC_CHECKBOX_CH32 1039 #define IDD_PREF_PLAYER 1040 #define IDC_CHECKBOX_NOT_DRAG_START 1041 #define IDC_CHECKBOX_NOT_CONTINUE 1042 #define IDC_CHECKBOX_AUTOREFINE 1043 #define IDC_CHECKBOX_AUTOUNIQ 1044 #define IDC_CHECKBOX_AUTOQUIT 1045 #define IDC_GROUPBOX_PLAYERMODE 1046 #define IDC_RADIOBUTTON_JAPANESE 1047 #define IDC_RADIOBUTTON_ENGLISH 1048 #define IDC_GROUPBOX_LANGUAGE 1049 #define IDC_EDIT_CONFIG_FILE 1050 #define IDC_BUTTON_CONFIG_FILE 1051 #define IDD_PREF_TIMIDITY1 1052 #define IDC_BUTTON_CFG_EDIT 1052 #define IDD_PREF_TIMIDITY2 1053 #define IDC_CHECKBOX_REDUCE_VOICE 1054 #define IDC_CHECKBOX_SPECIAL_TONEBANK 1055 #define IDC_GROUPBOX_DEFAULT_MIDI_TYPE 1058 #define IDC_EDIT_OUTPUT_FILE 1059 #define IDC_CHECKBOX_DRUM_CHANNEL_MASK 1060 #define IDC_CHECKBOX_CTL_TRACE_PLAYING 1061 #define IDD_PREF_TIMIDITY3 1062 #define IDC_CHECKBOX_FORCE_KEYSIG 1062 #define IDC_BUTTON_4 1063 #define IDC_CHECKBOX_AMP_COMPENSATION 1063 #define IDC_BUTTON_8 1064 #define IDC_BUTTON_16 1065 #define IDC_BUTTON_24 1066 #define IDC_BUTTON_32 1067 #define IDC_BUTTON_40 1068 #define IDC_BUTTON_48 1069 #define IDC_BUTTON_OUTPUT_FILE_DEL 1070 #define IDC_CHECKBOX_LINEAR 1071 #define IDC_CHECKBOX_BYTESWAP 1072 #define IDC_CHECKBOX_UNSIGNED 1073 #define IDC_CHECKBOX_SIGNED 1074 #define IDC_CHECKBOX_ALAW 1075 #define IDC_CHECKBOX_ULAW 1076 #define IDC_CHECKBOX_16BITS 1077 #define IDC_CHECKBOX_8BITS 1078 #define IDC_BUTTON_HIGH 1079 #define IDC_BUTTON_MIDDLE 1080 #define IDC_BUTTON_LOW 1081 #define IDC_BUTTON_OUTPUT_FILE 1082 #define IDC_RADIOBUTTON_WIN32AUDIO 1083 #define IDC_RADIOBUTTON_RIFF_WAVE 1084 #define IDC_RADIOBUTTON_LIST_MIDI_EVENT 1085 #define IDC_RADIOBUTTON_RAW_WAVEFORM 1086 #define IDC_RADIOBUTTON_SUN_AUDIO 1087 #define IDC_RADIOBUTTON_AIFF 1088 #define IDC_GROUPBOX_OUTPUT 1089 #define IDD_PREF_TIMIDITY4 1090 #define IDC_CHECKBOX_DRUM_CHANNEL 1091 #define IDC_EDIT_CONTROL_RATIO 1092 #define IDC_EDIT_MODIFY_RELEASE 1093 #define IDC_EDIT_AMPLIFICATION 1094 #define IDC_EDIT_ENV_ATTACK 1094 #define IDC_EDIT_CACHE_SIZE 1095 #define IDC_EDIT_AUTOMAXIMIZE 1095 #define IDC_EDIT_VELOCITYTABLE 1095 #define IDC_EDIT_KEY_ADJUST 1096 #define IDC_EDIT_SPECIAL_TONEBANK 1097 #define IDC_CHECKBOX_NOT_LOOPING 1097 #define IDC_EDIT_DEFAULT_TONEBANK 1098 #define IDC_CHECKBOX_AUTOSTART 1098 #define IDC_EDIT_REDUCE_VOICE 1099 #define IDC_CHECKBOX_RANDOM 1099 #define IDC_EDIT_DRUM_POWER 1099 #define IDC_EDIT_CTL_VEBOSITY 1100 #define IDC_EDIT_DELAY 1101 #define IDC_RADIOBUTTON_DELAY_LEFT 1102 #define IDC_RADIOBUTTON_DELAY_RIGHT 1103 #define IDC_RADIOBUTTON_DELAY_CENTER 1104 #define IDC_CHECKBOX_TRACETEXT 1105 #define IDC_EDIT_REVERB 1106 #define IDC_EDIT_CHORUS 1107 #define IDC_BUTTON_UNIQ 1108 #define IDC_BUTTON_REFINE 1109 #define IDC_BUTTON_CLEAR 1110 #define IDC_BUTTON_DOC 1111 #define IDB_BITMAP_SLEEP 1112 #define IDM_MENU_MAIN 1113 #define IDC_CHECKBOX_QUIET_CHANNEL 1114 #define IDM_MHTIMIDITY 1115 #define IDDEFAULT 1116 #define IDD_DIALOG_MAIN 1117 #define IDC_EDIT_INFO 1118 #define IDD_DIALOG_DEBUG 1119 #define IDC_BUTTON_VARIABLES_CHECK 1120 #define IDC_BUTTON_HEAP_CHECK 1121 #define IDC_BUTTON_EXITPROCESS 1122 #define IDC_BUTTON_EXIT 1123 #define IDD_DIALOG_CONSOLE 1124 #define IDD_DIALOG_CONSOLE_EN 1125 #define IDD_DIALOG_TRACER 1126 #define IDD_DIALOG_DOC 1127 #define IDD_DIALOG_DOC_EN 1128 #define IDD_DIALOG_SETTING 1129 #define IDD_DIALOG_SIMPLE_LIST 1130 #define IDD_DIALOG_SIMPLE_LIST_EN 1131 #define IDC_TOOLBARWINDOW_SUBWND 1132 #define IDC_TOOLBARWINDOW_MAIN 1133 #define IDC_RECT_PANEL 1134 #define IDC_RECT_CANVAS 1135 #define IDC_BUTTON_DEC 1136 #define IDC_BUTTON_INC 1137 #define IDC_EDIT_VERBOSITY 1138 #define IDC_BUTTON_VERBOSITY 1139 #define IDC_EDIT 1140 #define IDD_DIALOG_WRD 1141 #define IDD_DIALOG_SOUNDSPEC 1142 #define IDFLUSH 1143 #define IDD_DIALOG_PREF_EN 1143 #define IDCLEAR 1144 #define IDC_BUTTON_PREV 1145 #define IDC_BUTTON_NEXT 1146 #define IDC_CHECKBOX_VALID 1147 #define IDC_CHECKBOX_DEBUG_WND 1148 #define IDC_CHECKBOX_DEBUG_WND_VALID 1149 #define IDC_EDIT_FILENAME 1150 #define IDC_LISTBOX_PLAYLIST 1151 #define IDM_MFOPENFILE 1152 #define IDM_MFOPENDIR 1153 #define IDM_MFLOADPLAYLIST 1154 #define IDM_MFSAVEPLAYLISTAS 1155 #define IDM_MFEXIT 1156 #define IDM_MCLOADINIFILE 1157 #define IDM_MCSAVEINIFILE 1158 #define IDM_MWPLAYLIST 1159 #define IDM_MWTRACER 1160 #define IDM_MWDOCUMENT 1161 #define IDM_MWWRDTRACER 1162 #define IDM_MWSOUNDSPEC 1163 #define IDM_MWCONSOLE 1164 #define IDM_MWDEBUG 1165 #define IDM_MHTOPIC 1166 #define IDM_MHHELP 1167 #define IDM_MHVERSION 1168 #define IDC_SCROLLBAR_PROGRESS 1169 #define IDC_SCROLLBAR_VOLUME 1170 #define IDI_ICON_TIMIDITY 1171 #define IDB_BITMAP_MAIN_BUTTON 1172 #define IDB_BITMAP_SUBWND_BUTTON 1173 #define IDC_CHECK_DOC 1174 #define IDM_SETTING 1175 #define IDC_CHECKBOX_CHORUS 1176 #define IDC_CHECKBOX_REVERB 1177 #define IDC_CHECKBOX_DELAY 1178 #define IDC_CHECKBOX_FREE_INST 1179 #define IDC_CHECKBOX_ANTIALIAS 1180 #define IDC_EDIT_VOICES 1181 #define IDC_RADIO_16BITS 1182 #define IDC_RADIO_8BITS 1183 #define IDC_RADIO_STEREO 1184 #define IDC_RADIO_MONO 1185 #define IDC_EDIT_SAMPLE_RATE 1186 #define IDC_EDIT_NOISESHARPING 1187 #define IDC_CHECKBOX_MODWHEEL 1188 #define IDC_CHECKBOX_PORTAMENTO 1189 #define IDC_CHECKBOX_NRPNVIB 1190 #define IDC_CHECKBOX_CHPRESS 1191 #define IDC_CHECKBOX_OVOICE 1192 #define IDC_CHECKBOX_LOADINST_PLAYING 1193 #define IDC_EDIT_EFFECT_QUALITY 1193 #define IDC_RADIOBUTTON_GM 1194 #define IDC_RADIOBUTTON_GS 1195 #define IDC_RADIOBUTTON_XG 1196 #define IDC_EDIT1 2000 #define IDC_EDIT2 2001 #define IDC_EDIT_NUM 2002 #define IDC_EDIT3 2002 #define IDC_BUTTON_REVERSE 2003 #define IDC_COMBO_OUTPUT 2004 #define IDC_BUTTON_OUTPUT_OPTIONS 2005 #define IDC_COMBO_BANDWIDTH 2006 #define IDC_CHECK_DEFAULT 2007 #define IDC_COMBO_SAMPLE_RATE 2007 #define IDC_COMBO_MODE 2008 #define IDC_CHECK_USE_TAG 2009 #define IDC_COMBO_OUTPUT_FORMAT 2013 #define IDC_CHECK_COMMANDLINE_OPTS 2015 #define IDC_EDIT_COMMANDLINE_OPTION 2016 #define IDC_COMBO_MPEG1_AUDIO_BITRATE 2017 #define IDC_COMBO_MPEG2_AUDIO_BITRATE 2018 #define IDC_COMBO_VBR_BITRATE_LOW 2019 #define IDC_COMBO_VBR_BITRATE_HIGH 2020 #define IDC_CHECK_16KHZ_LOW_PASS_FILTER 2021 #define IDC_CHECK_ENHANCED_LOW_PASS_FILTER 2022 #define IDC_EDIT_LPF_PARA1 2023 #define IDC_EDIT_LPF_PARA2 2024 #define IDC_COMBO_ENCODE_MODE 2025 #define IDC_CHECK_USEPSY 2026 #define IDC_CHECK_CPUMMX 2027 #define IDC_CHECK_CPUSSE 2028 #define IDC_CHECK_CPU3DNOW 2029 #define IDC_CHECK_CPUE3DNOW 2030 #define IDC_COMBO_EMPHASIS_TYPE 2031 #define IDC_CHECK_CPUCMOV 2032 #define IDC_COMBO_VBR 2033 #define IDC_CHECK_VBR 2034 #define IDC_CHECK_OUTFREQ 2035 #define IDC_EDIT_OUTFREQ 2036 #define IDC_CHECK_MSTHRESHOLD 2037 #define IDC_EDIT_MSTHRESHOLD_THRESHOLD 2038 #define IDC_EDIT_MSTHRESHOLD_MSPOWER 2039 #define IDC_CHECK_VERIFY 2040 #define IDC_BUTTON_APPLY 2041 #define IDC_COMBO_OUTPUT_MODE 2042 #define IDC_CHECK_USE_CPU_OPTS 2043 #define IDC_CHECK_CPUSSE2 2044 #define IDC_CHECK_MPEG1AUDIOBITRATE 2045 #define IDC_CHECK_MPEG2AUDIOBITRATE 2046 #define IDC_CHECK_VBR_BITRATE 2047 #define IDC_CHECK_OUTPUT_FORMAT 2048 #define IDC_CHECK_ENCODE_MODE 2049 #define IDC_CHECK_EMPHASIS_TYPE 2050 #define IDC_CHECK_CPUEMMX 2051 #define IDC_CHECKBOX_TVAA 2057 #define IDC_CHECKBOX_TVAD 2058 #define IDC_CHECKBOX_TVAR 2059 #define IDC_CHECKBOX_PDELAY 2060 #define IDC_CHECKBOX_EQ 2061 #define IDC_CHECK_AUTOLOAD_PLAYLIST 2061 #define IDC_CHECKBOX_IEFFECT 2062 #define IDC_CHECK_AUTOSAVE_PLAYLIST 2062 #define IDC_STATIC_HEAD 2063 #define IDC_STATIC_TAIL 2064 #define IDC_BUTTON_1 2065 #define IDC_BUTTON_2 2066 #define IDC_BUTTON_3 2067 #define IDC_EDIT_ONE_LINE 2068 #define IDC_EDIT_SUBWINDOW_MAX 2069 #define IDC_CHECK_POS_SIZE_SAVE 2070 #define IDC_COMBO_FORCE_KEYSIG 2072 #define IDC_COMBO_INIT_KEYSIG 2073 #define IDC_COMBO_IDPORT0 2085 #define IDC_COMBO_IDPORT1 2086 #define IDC_COMBO_IDPORT2 2087 #define IDC_COMBO_IDPORT3 2088 #define IDC_COMBO_SYN_THREAD_PRIORITY 2089 #define IDC_COMBO_PORT_NUM 2090 #define IDC_EDIT_SYN_SH_TIME 2091 #define IDC_COMBO_PROCESS_PRIORITY 2092 #define IDC_TAB_MAIN 2093 #define IDC_CHECKBOX_TEMPER_EQUAL 2094 #define IDC_CHECKBOX_TEMPER_PYTHA 2095 #define IDC_BUTTON_CFG_RELOAD 2095 #define IDC_CHECKBOX_TEMPER_MEANTONE 2096 #define IDC_CHECKBOX_TEMPER_PUREINT 2097 #define IDC_CHECKBOX_TEMPER_USER0 2098 #define IDC_CHECKBOX_TEMPER_USER1 2099 #define IDC_CHECKBOX_TEMPER_USER2 2100 #define IDC_CHECKBOX_TEMPER_USER3 2101 #define IDC_COMBO_REVERB 2103 #define IDC_COMBO_MODULE 2104 #define IDC_CHECK_SYN_AUTOSTART 2104 #define IDC_COMBO_CHORUS 2105 #define IDC_COMBO_DELAY 2106 #define IDC_COMBO_LPF 2107 #define IDC_CHECKBOX_INIT_KEYSIG 2108 #define IDM_MHSUPPLEMENT 40002 #define IDM_FORCE_RELOAD 40003 #define IDM_MHONLINEHELP 40004 #define IDM_MHONLINEHELPCFG 40005 #define IDM_MHBTS 40006 #define IDC_STATIC -1 // Next default values for new objects // #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NEXT_RESOURCE_VALUE 157 #define _APS_NEXT_COMMAND_VALUE 40007 #define _APS_NEXT_CONTROL_VALUE 2109 #define _APS_NEXT_SYMED_VALUE 101 #endif #endif TiMidity++-2.13.2/interface/w32g_res.rc0100644004711200001440000023327210026542503016624 0ustar tamukiusers//Microsoft Developer Studio generated resource script. // #include "w32g_res.h" #define APSTUDIO_READONLY_SYMBOLS ///////////////////////////////////////////////////////////////////////////// // // Generated from the TEXTINCLUDE 2 resource. // #define APSTUDIO_HIDDEN_SYMBOLS #include "windows.h" #undef APSTUDIO_HIDDEN_SYMBOLS #include "commctrl.h" #include "w32g_rec.h" ///////////////////////////////////////////////////////////////////////////// #undef APSTUDIO_READONLY_SYMBOLS ///////////////////////////////////////////////////////////////////////////// // ƭ resources #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_NEU) #ifdef _WIN32 LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL #pragma code_page(932) #endif //_WIN32 ///////////////////////////////////////////////////////////////////////////// // // Dialog // IDD_DIALOG_MAIN DIALOGEX 0, 0, 308, 64 STYLE DS_MODALFRAME | DS_3DLOOK | DS_CENTER | WS_MINIMIZEBOX | WS_VISIBLE | WS_CLIPCHILDREN | WS_CAPTION | WS_SYSMENU EXSTYLE WS_EX_DLGMODALFRAME | WS_EX_ACCEPTFILES | WS_EX_APPWINDOW CAPTION "TiMidity++ Win32GUI" MENU IDM_MENU_MAIN FONT 8, "MS Sans Serif", 0, 0, 0x1 BEGIN CONTROL "",IDC_RECT_PANEL,"Static",SS_GRAYFRAME | SS_SUNKEN | WS_TABSTOP,0,0,220,44 CONTROL "",IDC_RECT_CANVAS,"Static",SS_GRAYFRAME,220,0,68,44 CONTROL "ToolBarMain",IDC_TOOLBARWINDOW_MAIN,"ToolbarWindow32", 0x14c,2,46,112,17 CONTROL "ToolBarSubWnd",IDC_TOOLBARWINDOW_SUBWND,"ToolbarWindow32", 0x44,112,46,80,16 SCROLLBAR IDC_SCROLLBAR_PROGRESS,190,48,100,12,WS_DISABLED SCROLLBAR IDC_SCROLLBAR_VOLUME,292,0,12,60,SBS_VERT END IDD_DIALOG_MAIN_EN DIALOGEX 0, 0, 308, 64 STYLE DS_MODALFRAME | DS_3DLOOK | DS_CENTER | WS_MINIMIZEBOX | WS_VISIBLE | WS_CLIPCHILDREN | WS_CAPTION | WS_SYSMENU EXSTYLE WS_EX_DLGMODALFRAME | WS_EX_NOPARENTNOTIFY | WS_EX_ACCEPTFILES | WS_EX_APPWINDOW CAPTION "TiMidity++ Win32GUI" MENU IDM_MENU_MAIN_EN FONT 8, "MS Sans Serif", 0, 0, 0x1 BEGIN CONTROL "",IDC_RECT_PANEL,"Static",SS_GRAYFRAME | SS_SUNKEN | WS_TABSTOP,0,0,220,44 CONTROL "",IDC_RECT_CANVAS,"Static",SS_GRAYFRAME,220,0,68,44 CONTROL "ToolBarMain",IDC_TOOLBARWINDOW_MAIN,"ToolbarWindow32", 0x14c,2,46,112,17 CONTROL "ToolBarSubWnd",IDC_TOOLBARWINDOW_SUBWND,"ToolbarWindow32", 0x44,112,46,80,16 SCROLLBAR IDC_SCROLLBAR_PROGRESS,190,48,100,12,WS_DISABLED SCROLLBAR IDC_SCROLLBAR_VOLUME,292,0,12,60,SBS_VERT END IDD_DIALOG_DEBUG DIALOG DISCARDABLE 0, 0, 240, 240 STYLE DS_3DLOOK | WS_CAPTION | WS_SYSMENU CAPTION "Debug Window (TiMidity Win32GUI)" FONT 9, "Times New Roman" BEGIN PUSHBUTTON "C L E A R",IDCLEAR,72,164,68,16,BS_CENTER CONTROL "VALID",IDC_CHECKBOX_DEBUG_WND_VALID,"Button", BS_AUTOCHECKBOX | BS_LEFTTEXT | WS_TABSTOP,20,164,36,16 CONTROL "",-1,"Static",SS_ETCHEDFRAME,16,164,44,16 PUSHBUTTON "E X I T",IDC_BUTTON_EXIT,144,164,48,16,BS_CENTER | WS_DISABLED PUSHBUTTON "ExitProcess",IDC_BUTTON_EXITPROCESS,196,164,40,16, BS_CENTER CONTROL "",-1,"Static",SS_ETCHEDHORZ,0,184,240,1 PUSHBUTTON "Heaps Check",IDC_BUTTON_HEAP_CHECK,4,188,50,16, BS_CENTER PUSHBUTTON "Variables Check",IDC_BUTTON_VARIABLES_CHECK,60,188,50, 16,BS_CENTER EDITTEXT IDC_EDIT,0,0,240,160,ES_MULTILINE | ES_AUTOVSCROLL | ES_AUTOHSCROLL | ES_READONLY | ES_WANTRETURN | WS_VSCROLL | WS_HSCROLL END IDD_DIALOG_CONSOLE_EN DIALOGEX 0, 0, 271, 181 STYLE DS_MODALFRAME | DS_3DLOOK | WS_MAXIMIZEBOX | WS_CAPTION | WS_SYSMENU CAPTION "Console Window (TiMidity Win32GUI)" FONT 8, "Times New Roman", 0, 0, 0x1 BEGIN PUSHBUTTON "C L E A R",IDCLEAR,174,165,90,15,BS_CENTER EDITTEXT IDC_EDIT_VERBOSITY,50,165,21,15,ES_OEMCONVERT CONTROL "VALID",IDC_CHECKBOX_VALID,"Button",BS_AUTOCHECKBOX | BS_LEFTTEXT | WS_TABSTOP,126,165,32,15 CONTROL "",-1,"Static",SS_ETCHEDFRAME,5,165,96,16 EDITTEXT IDC_EDIT,0,0,270,160,ES_MULTILINE | ES_AUTOVSCROLL | ES_AUTOHSCROLL | ES_READONLY | ES_WANTRETURN | WS_VSCROLL | WS_HSCROLL,WS_EX_STATICEDGE PUSHBUTTON "VERBOSITY",IDC_BUTTON_VERBOSITY,4,165,46,15,BS_CENTER, WS_EX_CLIENTEDGE PUSHBUTTON "<<",IDC_BUTTON_DEC,70,165,15,16,BS_CENTER PUSHBUTTON ">>",IDC_BUTTON_INC,85,165,15,16,BS_CENTER CONTROL "",-1,"Static",SS_ETCHEDFRAME,123,165,40,16 END IDD_DIALOG_DOC_EN DIALOGEX 0, 0, 241, 180 STYLE DS_3DLOOK | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME EXSTYLE WS_EX_ACCEPTFILES CAPTION "Document Window (TiMidity Win32GUI)" FONT 9, "Times New Roman", 0, 0, 0x1 BEGIN EDITTEXT IDC_EDIT_FILENAME,60,168,140,12,ES_CENTER | ES_READONLY PUSHBUTTON "<<",IDC_BUTTON_PREV,204,168,16,12,BS_CENTER PUSHBUTTON ">>",IDC_BUTTON_NEXT,220,168,16,12,BS_CENTER EDITTEXT IDC_EDIT,0,0,236,160,ES_MULTILINE | ES_AUTOVSCROLL | ES_AUTOHSCROLL | ES_READONLY | ES_WANTRETURN | WS_VSCROLL | WS_HSCROLL EDITTEXT IDC_EDIT_INFO,0,168,56,12,ES_READONLY END IDD_DIALOG_TRACER DIALOGEX 0, 0, 319, 221 STYLE DS_3DLOOK | WS_CAPTION | WS_SYSMENU EXSTYLE WS_EX_ACCEPTFILES CAPTION "Tracer Window (TiMidity Win32GUI)" FONT 9, "Times New Roman", 0, 0, 0x1 BEGIN END IDD_DIALOG_SIMPLE_LIST_EN DIALOGEX 0, 0, 242, 187 STYLE DS_3DLOOK | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME EXSTYLE WS_EX_DLGMODALFRAME | WS_EX_ACCEPTFILES | WS_EX_CONTROLPARENT CAPTION "List Window (TiMidity Win32GUI)" FONT 9, "Times New Roman", 0, 0, 0x1 BEGIN LISTBOX IDC_LISTBOX_PLAYLIST,0,0,241,170,LBS_HASSTRINGS | LBS_WANTKEYBOARDINPUT | LBS_DISABLENOSCROLL | WS_VSCROLL | WS_HSCROLL | WS_GROUP | WS_TABSTOP PUSHBUTTON "DOC",IDC_BUTTON_DOC,55,175,45,10,BS_CENTER PUSHBUTTON "UNIQ",IDC_BUTTON_UNIQ,114,175,31,10,BS_CENTER PUSHBUTTON "REFINE",IDC_BUTTON_REFINE,146,175,29,10,BS_CENTER PUSHBUTTON "CLEAR",IDC_BUTTON_CLEAR,190,175,46,10,BS_CENTER | WS_GROUP EDITTEXT IDC_EDIT_NUM,5,175,45,12,ES_READONLY END IDD_PREF_PLAYER_EN DIALOGEX 0, 0, 211, 187 STYLE DS_SYSMODAL | DS_3DLOOK | DS_CONTROL | WS_CHILD | WS_VISIBLE | WS_CAPTION FONT 9, "Times New Roman" BEGIN PUSHBUTTON "Config File",IDC_BUTTON_CONFIG_FILE,3,11,52,11, BS_CENTER EDITTEXT IDC_EDIT_CONFIG_FILE,56,10,133,14,ES_AUTOHSCROLL | ES_OEMCONVERT GROUPBOX "Player",IDC_GROUPBOX_PLAYERMODE,2,45,106,60,WS_GROUP CONTROL "Not Continue",IDC_CHECKBOX_NOT_CONTINUE,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,10,57,97,8 CONTROL "Not Drag Start",IDC_CHECKBOX_NOT_DRAG_START,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,10,69,97,8 CONTROL "Not Looping",IDC_CHECKBOX_NOT_LOOPING,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,10,81,97,8 CONTROL "Auto Start",IDC_CHECKBOX_AUTOSTART,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,10,93,97,8 GROUPBOX "PlayList",IDC_STATIC,114,45,84,64 CONTROL "Auto Quit",IDC_CHECKBOX_AUTOQUIT,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,118,53,77,8 CONTROL "Auto Uniq",IDC_CHECKBOX_AUTOUNIQ,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,118,61,76,8 CONTROL "Auto Refine",IDC_CHECKBOX_AUTOREFINE,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,118,69,75,8 CONTROL "Random Mode",IDC_CHECKBOX_RANDOM,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,118,77,75,8 CONTROL "Auto Load",IDC_CHECK_AUTOLOAD_PLAYLIST,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,118,89,75,8 CONTROL "Auto Save",IDC_CHECK_AUTOSAVE_PLAYLIST,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,118,97,75,8 GROUPBOX "Document",IDC_STATIC,6,109,68,38 CONTROL "Not Auto Display",IDC_CHECK_DOCWNDINDEPENDENT,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,10,121,63,8 CONTROL "Popup",IDC_CHECK_DOCWNDAUTOPOPUP,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,10,133,59,10 GROUPBOX "Directory",IDC_STATIC,6,149,67,20 CONTROL "Recursive walk",IDC_CHECK_SEACHDIRRECURSIVE,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,10,157,57,10 GROUPBOX "Sub Window",IDC_STATIC,78,113,60,28 LTEXT "MAX",IDC_STATIC,82,125,18,8 EDITTEXT IDC_EDIT_SUBWINDOW_MAX,102,125,24,12,ES_CENTER, WS_EX_RIGHT GROUPBOX "INI File",IDC_STATIC,78,145,60,24 CONTROL "Auto Save",IDC_CHECK_INIFILE_AUTOSAVE,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,82,153,48,10 GROUPBOX "Language",IDC_GROUPBOX_LANGUAGE,142,113,56,28,WS_GROUP CONTROL "Japanese",IDC_RADIOBUTTON_JAPANESE,"Button", BS_AUTORADIOBUTTON | WS_TABSTOP,146,121,42,8 CONTROL "English",IDC_RADIOBUTTON_ENGLISH,"Button", BS_AUTORADIOBUTTON | WS_TABSTOP,146,129,43,8 GROUPBOX "Window",IDC_STATIC,142,145,56,24 CONTROL "save pos,size",IDC_CHECK_POS_SIZE_SAVE,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,146,155,48,10 PUSHBUTTON "Reload Config File",IDC_BUTTON_CFG_RELOAD,3,29,73,12, BS_MULTILINE PUSHBUTTON "Edit",IDC_BUTTON_CFG_EDIT,191,11,19,11,BS_CENTER END IDD_PREF_TIMIDITY1_EN DIALOG DISCARDABLE 0, 0, 219, 173 STYLE DS_SYSMODAL | DS_3DLOOK | DS_CONTROL | WS_CHILD | WS_VISIBLE | WS_CAPTION FONT 9, "Times New Roman" BEGIN CONTROL "Modulation Wheel",IDC_CHECKBOX_MODWHEEL,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,6,60,67,10 CONTROL "Portament",IDC_CHECKBOX_PORTAMENTO,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,6,70,45,10 CONTROL "NRPN Vibrato",IDC_CHECKBOX_NRPNVIB,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,6,100,57,10 CONTROL "MIDI Controllers",IDC_CHECKBOX_CHPRESS,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,6,80,82,10 CONTROL "Trace Text Meta Event",IDC_CHECKBOX_TRACETEXT,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,104,45,85,10 CONTROL "Overlapped same voce",IDC_CHECKBOX_OVOICE,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,104,35,84,10 CONTROL "Attack Time Control",IDC_CHECKBOX_TVAA,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,6,110,74,10 CONTROL "Decay Time Control",IDC_CHECKBOX_TVAD,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,6,120,73,10 CONTROL "Release Time Control",IDC_CHECKBOX_TVAR,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,6,130,81,10 CONTROL "EQ Control",IDC_CHECKBOX_EQ,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,140,55,10 CONTROL "Insertion Effect Control",IDC_CHECKBOX_IEFFECT,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,6,150,82,10 CONTROL "Static Chorus Level",IDC_CHECKBOX_CHORUS_LEVEL,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,104,12,70,10 EDITTEXT IDC_EDIT_CHORUS,184,11,24,12,ES_NUMBER CONTROL "Static Reverb Level",IDC_CHECKBOX_REVERB_LEVEL,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,104,24,69,10 EDITTEXT IDC_EDIT_REVERB,184,23,24,12,ES_NUMBER CONTROL "L&&R Delay",IDC_CHECKBOX_DELAY,"Button",BS_AUTOCHECKBOX | BS_LEFT | BS_TOP | WS_TABSTOP,104,88,55,10 CONTROL "Left",IDC_RADIOBUTTON_DELAY_LEFT,"Button", BS_AUTORADIOBUTTON | WS_TABSTOP,108,99,27,10 CONTROL "Right",IDC_RADIOBUTTON_DELAY_RIGHT,"Button", BS_AUTORADIOBUTTON | WS_TABSTOP,138,99,31,10 CONTROL "Rotate",IDC_RADIOBUTTON_DELAY_CENTER,"Button", BS_AUTORADIOBUTTON | WS_TABSTOP,171,99,38,10 LTEXT "Delay(msec)",IDC_STATIC,115,110,36,8,NOT WS_GROUP | WS_TABSTOP EDITTEXT IDC_EDIT_DELAY,151,109,32,12,ES_NUMBER LTEXT "Pseudo Reverb(0..1000)",IDC_STATIC,103,124,67,8,NOT WS_GROUP | WS_TABSTOP EDITTEXT IDC_EDIT_MODIFY_RELEASE,184,122,28,12 LTEXT "Noise Shaping (0..6)",IDC_STATIC,104,67,57,8,NOT WS_GROUP | WS_TABSTOP EDITTEXT IDC_EDIT_NOISESHARPING,165,65,28,12,ES_NUMBER CONTROL "NRPN Drumpart Effect",IDC_CHECKBOX_DRUM_EFFECT,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,6,90,82,10 GROUPBOX "GM/GS/XG",IDC_STATIC,1,3,93,160 GROUPBOX "Special",IDC_STATIC,100,3,116,132 CONTROL "Modulation Envelope",IDC_CHECKBOX_MOD_ENV,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,104,55,76,10 COMBOBOX IDC_COMBO_REVERB,6,12,84,78,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP COMBOBOX IDC_COMBO_CHORUS,6,24,84,54,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP COMBOBOX IDC_COMBO_DELAY,6,36,84,78,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP COMBOBOX IDC_COMBO_LPF,6,48,84,78,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP COMBOBOX IDC_COMBO_MODULE,106,148,103,78,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP GROUPBOX "Emulate specific module",IDC_STATIC,100,138,116,25 CONTROL "Surround",IDC_CHECKBOX_PAN_DELAY,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,104,77,41,10 END IDD_PREF_TIMIDITY2_EN DIALOG DISCARDABLE 0, 0, 223, 186 STYLE DS_SYSMODAL | DS_3DLOOK | DS_CONTROL | WS_CHILD | WS_VISIBLE | WS_CAPTION FONT 9, "Times New Roman" BEGIN GROUPBOX "Play",IDC_STATIC,1,3,117,114 LTEXT "Maxmum Voices",IDC_STATIC,6,15,50,8,NOT WS_GROUP EDITTEXT IDC_EDIT_VOICES,63,14,24,12,ES_NUMBER LTEXT "Amplification(%)",IDC_STATIC,6,31,53,8,NOT WS_GROUP EDITTEXT IDC_EDIT_AMPLIFICATION,63,29,24,12 CONTROL "Antialiasing instrument",IDC_CHECKBOX_ANTIALIAS,"Button", BS_AUTOCHECKBOX | BS_LEFT | BS_TOP | WS_TABSTOP,6,46,78, 10 CONTROL "Load Instruments While Playing", IDC_CHECKBOX_LOADINST_PLAYING,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,56,101,10 CONTROL "Unload Instruments between files", IDC_CHECKBOX_FREE_INST,"Button",BS_AUTOCHECKBOX | BS_LEFT | BS_TOP | WS_TABSTOP,6,66,107,10 CONTROL "Auto Reduction Voice",IDC_CHECKBOX_REDUCE_VOICE,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,6,76,75,8 GROUPBOX "Default MIDI Type",IDC_GROUPBOX_DEFAULT_MIDI_TYPE,6,87, 87,27 CONTROL "GM",IDC_RADIOBUTTON_GM,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,14,99,22,8 CONTROL "GS",IDC_RADIOBUTTON_GS,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,39,99,20,8 CONTROL "XG",IDC_RADIOBUTTON_XG,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,63,99,20,8 GROUPBOX "Others",IDC_STATIC,121,3,100,114 LTEXT "Resample Cache",IDC_STATIC,127,15,50,8,NOT WS_GROUP EDITTEXT IDC_EDIT_CACHE_SIZE,179,13,36,12 LTEXT "Default tonebank",IDC_STATIC,127,28,50,8,NOT WS_GROUP EDITTEXT IDC_EDIT_DEFAULT_TONEBANK,183,26,24,12 CONTROL "All tonebank",IDC_CHECKBOX_SPECIAL_TONEBANK,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,127,42,54,8 EDITTEXT IDC_EDIT_SPECIAL_TONEBANK,183,40,24,12 LTEXT "Control Ratio",IDC_STATIC,127,56,40,8,NOT WS_GROUP EDITTEXT IDC_EDIT_CONTROL_RATIO,183,54,24,12 CONTROL "Trace Playing",IDC_CHECKBOX_CTL_TRACE_PLAYING,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,127,68,53,8 LTEXT "Console Verbosity",IDC_STATIC,127,79,55,8,NOT WS_GROUP EDITTEXT IDC_EDIT_CTL_VEBOSITY,185,77,20,12 LTEXT "Drum Power(%)",IDC_STATIC,127,93,47,10,NOT WS_GROUP EDITTEXT IDC_EDIT_DRUM_POWER,185,92,21,12 CONTROL "Amplitude Compensation",IDC_CHECKBOX_AMP_COMPENSATION, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,127,107,86,6 GROUPBOX "Musical grammar",IDC_STATIC,1,118,198,66 CONTROL "Pure intonation(-Zpure)",IDC_CHECKBOX_PURE_INTONATION, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,126,90,8 CONTROL "Initial tonality",IDC_CHECKBOX_INIT_KEYSIG,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,11,138,51,8 COMBOBOX IDC_COMBO_INIT_KEYSIG,64,137,80,53,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP CONTROL "Minor key",IDC_CHECKBOX_INIT_MI,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,148,138,44,8 LTEXT "Key shift(-Kn)",IDC_STATIC,6,153,45,8,NOT WS_GROUP EDITTEXT IDC_EDIT_KEY_ADJUST,53,152,21,11 CONTROL "Fix key signature(-Hn)",IDC_CHECKBOX_FORCE_KEYSIG, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,169,76,8 COMBOBOX IDC_COMBO_FORCE_KEYSIG,84,168,80,53,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP END IDD_PREF_TIMIDITY3_EN DIALOG DISCARDABLE 0, 0, 210, 190 STYLE DS_SYSMODAL | DS_3DLOOK | DS_CONTROL | WS_CHILD | WS_VISIBLE | WS_CAPTION | WS_TABSTOP FONT 9, "Times New Roman" BEGIN GROUPBOX "Output Encoding",IDC_STATIC,0,0,203,140,WS_GROUP | WS_TABSTOP GROUPBOX "Precision",IDC_STATIC,4,7,192,30,WS_GROUP | WS_TABSTOP CONTROL "uLaw",IDC_CHECKBOX_ULAW,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,65,15,31,8 CONTROL "ALaw",IDC_CHECKBOX_ALAW,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,65,25,31,8 CONTROL "Signed",IDC_CHECKBOX_SIGNED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,101,15,37,8 CONTROL "Unsigned",IDC_CHECKBOX_UNSIGNED,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,101,25,37,8 CONTROL "Byteswap",IDC_CHECKBOX_BYTESWAP,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,143,15,43,8 CONTROL "Linear PCM",IDC_CHECKBOX_LINEAR,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,143,25,45,8 GROUPBOX "Channels",IDC_STATIC,4,41,45,33,WS_GROUP | WS_TABSTOP CONTROL "Stereo",IDC_RADIO_STEREO,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,8,51,36,10 CONTROL "Mono",IDC_RADIO_MONO,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,8,63,35,8 GROUPBOX "Output",IDC_GROUPBOX_OUTPUT,4,78,193,41,WS_GROUP | WS_TABSTOP COMBOBOX IDC_COMBO_OUTPUT,8,87,151,64,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP PUSHBUTTON "Option",IDC_BUTTON_OUTPUT_OPTIONS,160,86,34,14 COMBOBOX IDC_COMBO_OUTPUT_MODE,8,103,186,72,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP PUSHBUTTON "Output File",IDC_BUTTON_OUTPUT_FILE,4,121,42,14, BS_CENTER | WS_GROUP EDITTEXT IDC_EDIT_OUTPUT_FILE,47,121,130,15,ES_AUTOHSCROLL | ES_OEMCONVERT | WS_GROUP PUSHBUTTON "DEL",IDC_BUTTON_OUTPUT_FILE_DEL,178,121,19,14,BS_CENTER COMBOBOX IDC_COMBO_BANDWIDTH,8,19,48,64,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP COMBOBOX IDC_COMBO_SAMPLE_RATE,58,54,36,64,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP GROUPBOX "Sample rate",IDC_STATIC,54,41,61,33,WS_GROUP | WS_TABSTOP LTEXT "Hz",IDC_STATIC,98,56,10,8 END IDD_PREF_TIMIDITY4_EN DIALOG DISCARDABLE 0, 0, 211, 206 STYLE DS_SYSMODAL | DS_3DLOOK | DS_CONTROL | WS_CHILD | WS_VISIBLE | WS_CAPTION FONT 9, "Times New Roman" BEGIN CONTROL "Ch01",IDC_CHECKBOX_CH01,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,16,28,8 CONTROL "Ch02",IDC_CHECKBOX_CH02,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,24,28,8 CONTROL "Ch03",IDC_CHECKBOX_CH03,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,32,28,8 CONTROL "Ch04",IDC_CHECKBOX_CH04,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,40,28,8 CONTROL "Ch05",IDC_CHECKBOX_CH05,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,48,28,8 CONTROL "Ch06",IDC_CHECKBOX_CH06,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,56,28,8 CONTROL "Ch07",IDC_CHECKBOX_CH07,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,64,28,8 CONTROL "Ch08",IDC_CHECKBOX_CH08,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,72,28,8 CONTROL "Ch09",IDC_CHECKBOX_CH09,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,41,16,28,8 CONTROL "Ch10",IDC_CHECKBOX_CH10,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,41,24,28,8 CONTROL "Ch11",IDC_CHECKBOX_CH11,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,41,32,28,8 CONTROL "Ch12",IDC_CHECKBOX_CH12,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,41,40,28,8 CONTROL "Ch13",IDC_CHECKBOX_CH13,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,41,48,28,8 CONTROL "Ch14",IDC_CHECKBOX_CH14,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,41,56,28,8 CONTROL "Ch15",IDC_CHECKBOX_CH15,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,41,64,28,8 CONTROL "Ch16",IDC_CHECKBOX_CH16,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,41,72,28,8 CONTROL "Ch17",IDC_CHECKBOX_CH17,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,73,16,28,8 CONTROL "Ch18",IDC_CHECKBOX_CH18,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,73,24,28,8 CONTROL "Ch19",IDC_CHECKBOX_CH19,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,73,32,28,8 CONTROL "Ch20",IDC_CHECKBOX_CH20,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,73,40,28,8 CONTROL "Ch21",IDC_CHECKBOX_CH21,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,73,48,28,8 CONTROL "Ch22",IDC_CHECKBOX_CH22,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,73,56,28,8 CONTROL "Ch23",IDC_CHECKBOX_CH23,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,73,64,28,8 CONTROL "Ch24",IDC_CHECKBOX_CH24,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,73,72,28,8 CONTROL "Ch25",IDC_CHECKBOX_CH25,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,106,16,28,8 CONTROL "Ch26",IDC_CHECKBOX_CH26,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,106,24,28,8 CONTROL "Ch27",IDC_CHECKBOX_CH27,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,106,32,28,8 CONTROL "Ch28",IDC_CHECKBOX_CH28,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,106,40,28,8 CONTROL "Ch29",IDC_CHECKBOX_CH29,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,106,48,28,8 CONTROL "Ch30",IDC_CHECKBOX_CH30,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,106,56,28,8 CONTROL "Ch31",IDC_CHECKBOX_CH31,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,106,64,28,8 CONTROL "Ch32",IDC_CHECKBOX_CH32,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,106,72,28,8 CONTROL "Default Drum Channel",IDC_CHECKBOX_DRUM_CHANNEL,"Button", BS_AUTOCHECKBOX | BS_PUSHLIKE | WS_TABSTOP,9,87,95,13 CONTROL "Ignore Auto Detect Channel", IDC_CHECKBOX_DRUM_CHANNEL_MASK,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | WS_TABSTOP,9,105,95,14 CONTROL "Mute Channel",IDC_CHECKBOX_QUIET_CHANNEL,"Button", BS_AUTOCHECKBOX | BS_PUSHLIKE | WS_TABSTOP,9,124,95,13 PUSHBUTTON "Reverse",IDC_BUTTON_REVERSE,141,18,31,61 GROUPBOX "Channel",IDC_STATIC,1,3,179,138 GROUPBOX "Mute temperament type",IDC_STATIC,1,144,195,39 CONTROL "Equal",IDC_CHECKBOX_TEMPER_EQUAL,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,5,155,37,8 CONTROL "Pythagoras",IDC_CHECKBOX_TEMPER_PYTHA,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,55,155,46,8 CONTROL "Mean-tone",IDC_CHECKBOX_TEMPER_MEANTONE,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,105,155,45,8 CONTROL "Pure int.",IDC_CHECKBOX_TEMPER_PUREINT,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,155,155,35,8 CONTROL "User #0",IDC_CHECKBOX_TEMPER_USER0,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,5,168,45,8 CONTROL "User #1",IDC_CHECKBOX_TEMPER_USER1,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,55,168,45,8 CONTROL "User #2",IDC_CHECKBOX_TEMPER_USER2,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,105,168,45,8 CONTROL "User #3",IDC_CHECKBOX_TEMPER_USER3,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,155,168,36,8 END IDD_DIALOG_VORBIS_EN DIALOG DISCARDABLE 0, 0, 197, 93 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Ogg Vorbis Configurations" FONT 9, "Times New Roman" BEGIN CONTROL "Default",IDC_CHECK_DEFAULT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,4,0,56,10 COMBOBOX IDC_COMBO_MODE,25,13,123,56,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP LTEXT "Title",IDC_STATIC,4,49,14,8 EDITTEXT IDC_EDIT1,41,48,152,14,ES_AUTOHSCROLL | WS_DISABLED LTEXT "Artist",IDC_STATIC,4,63,18,8 EDITTEXT IDC_EDIT2,41,76,152,14,ES_AUTOHSCROLL | WS_DISABLED LTEXT "Arbum",IDC_STATIC,4,77,27,8 EDITTEXT IDC_EDIT3,41,62,152,14,ES_AUTOHSCROLL | WS_DISABLED CONTROL "Store follows information",IDC_CHECK_USE_TAG,"Button", BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,4,32,73,10 LTEXT "Mode",IDC_STATIC,4,16,18,8 PUSHBUTTON "OK",IDOK,152,2,40,12 PUSHBUTTON "Cancel",IDCANCEL,152,30,40,12 PUSHBUTTON "Apply",IDC_BUTTON_APPLY,152,14,40,11 END IDD_DIALOG_GOGO_EN DIALOG DISCARDABLE 0, 0, 346, 196 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "MP3 (gogo) Configuration" FONT 8, "Times New Roman" BEGIN DEFPUSHBUTTON "OK",IDOK,173,179,50,14 PUSHBUTTON "Cancel",IDCANCEL,285,179,50,14 COMBOBOX IDC_COMBO_OUTPUT_FORMAT,4,36,72,64,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP CONTROL "Default",IDC_CHECK_DEFAULT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,4,0,80,10 CONTROL "Command line option",IDC_CHECK_COMMANDLINE_OPTS,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,4,12,86,10 EDITTEXT IDC_EDIT_COMMANDLINE_OPTION,91,10,232,14,ES_AUTOHSCROLL COMBOBOX IDC_COMBO_MPEG1_AUDIO_BITRATE,6,72,76,76, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP COMBOBOX IDC_COMBO_MPEG2_AUDIO_BITRATE,87,72,76,76, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP COMBOBOX IDC_COMBO_VBR_BITRATE_LOW,6,119,76,64,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP LTEXT "VBR - Maximum",IDC_STATIC,86,110,55,8 COMBOBOX IDC_COMBO_VBR_BITRATE_HIGH,86,119,76,64,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP CONTROL "16KHz Lowpath filter",IDC_CHECK_16KHZ_LOW_PASS_FILTER, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,176,57,89,8 CONTROL "Enhanced Lowpath Filter", IDC_CHECK_ENHANCED_LOW_PASS_FILTER,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,176,68,104,8 EDITTEXT IDC_EDIT_LPF_PARA1,200,77,28,12 EDITTEXT IDC_EDIT_LPF_PARA2,251,77,28,12 LTEXT "para1",IDC_STATIC,183,79,16,8 LTEXT "para2",IDC_STATIC,233,79,16,8 COMBOBOX IDC_COMBO_ENCODE_MODE,172,36,84,60,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP CONTROL "Use Psy",IDC_CHECK_USEPSY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,176,90,42,10 CONTROL "MMX",IDC_CHECK_CPUMMX,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,193,151,29,10 CONTROL "SSE",IDC_CHECK_CPUSSE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,193,163,27,10 CONTROL "3DNOW",IDC_CHECK_CPU3DNOW,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,228,152,39,10 CONTROL "E3DNOW",IDC_CHECK_CPUE3DNOW,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,227,163,45,10 COMBOBOX IDC_COMBO_EMPHASIS_TYPE,268,36,76,64,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP COMBOBOX IDC_COMBO_VBR,37,92,124,72,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP CONTROL "VBR",IDC_CHECK_VBR,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,94,29,10 CONTROL "Output Frequency",IDC_CHECK_OUTFREQ,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,88,28,75,8 EDITTEXT IDC_EDIT_OUTFREQ,88,36,72,12 CONTROL "J-Stereo Stereo/MS-Stereo Control", IDC_CHECK_MSTHRESHOLD,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,176,103,167,8 EDITTEXT IDC_EDIT_MSTHRESHOLD_THRESHOLD,200,112,28,12 EDITTEXT IDC_EDIT_MSTHRESHOLD_MSPOWER,252,112,28,12 LTEXT "para1",IDC_STATIC,183,114,16,8 LTEXT "para2",IDC_STATIC,233,114,16,8 CONTROL "Verify",IDC_CHECK_VERIFY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,176,127,34,10 PUSHBUTTON "Apply",IDC_BUTTON_APPLY,229,179,50,14 CONTROL "Use follow options",IDC_CHECK_USE_CPU_OPTS,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,176,140,68,8 CONTROL "MPEG1Audio",IDC_CHECK_MPEG1AUDIOBITRATE,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,6,64,80,8 CONTROL "MPEG2Audio",IDC_CHECK_MPEG2AUDIOBITRATE,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,87,64,80,8 CONTROL "VBR - Minimum",IDC_CHECK_VBR_BITRATE,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,6,110,67,8 CONTROL "Output format",IDC_CHECK_OUTPUT_FORMAT,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,4,28,64,8 CONTROL "Encode Mode",IDC_CHECK_ENCODE_MODE,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,172,28,63,8 CONTROL "Emphasis type",IDC_CHECK_EMPHASIS_TYPE,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,268,28,62,8 GROUPBOX "Bitrate",IDC_STATIC,2,55,167,86 CONTROL "CMOV",IDC_CHECK_CPUCMOV,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,280,140,39,10 CONTROL "EMMX",IDC_CHECK_CPUEMMX,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,280,152,39,10 CONTROL "SSE2",IDC_CHECK_CPUSSE2,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,280,164,39,10 END IDD_DIALOG_ONE_LINE_EN DIALOGEX 0, 0, 187, 63 STYLE DS_MODALFRAME | DS_3DLOOK | WS_POPUP | WS_CAPTION | WS_SYSMENU EXSTYLE WS_EX_CONTROLPARENT FONT 10, "Times New Roman", 0, 0, 0x1 BEGIN EDITTEXT IDC_EDIT_ONE_LINE,4,16,180,14,ES_AUTOHSCROLL | WS_GROUP DEFPUSHBUTTON "",IDC_BUTTON_1,32,48,50,14 DEFPUSHBUTTON "",IDC_BUTTON_2,84,48,50,14 DEFPUSHBUTTON "",IDC_BUTTON_3,136,48,50,14 LTEXT "",IDC_STATIC_TAIL,4,32,180,12 LTEXT "",IDC_STATIC_HEAD,4,0,180,12 END IDD_PREF_SYN1_EN DIALOGEX 0, 0, 207, 166 STYLE DS_CONTROL | WS_CHILD | WS_CAPTION FONT 9, "Times New Roman", 0, 0, 0x1 BEGIN LTEXT "Port 0",IDC_STATIC,6,27,24,10 LTEXT "Port 1",IDC_STATIC,6,42,24,10 LTEXT "Port 2",IDC_STATIC,6,57,24,10 LTEXT "Port 3",IDC_STATIC,6,72,24,10 GROUPBOX "MIDI IN Device",IDC_STATIC,3,0,168,90 COMBOBOX IDC_COMBO_IDPORT0,33,27,132,56,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP COMBOBOX IDC_COMBO_IDPORT1,33,42,132,56,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP COMBOBOX IDC_COMBO_IDPORT2,33,57,132,56,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP COMBOBOX IDC_COMBO_IDPORT3,33,72,132,56,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP LTEXT "Synth thread priority",IDC_STATIC,7,123,62,10 COMBOBOX IDC_COMBO_SYN_THREAD_PRIORITY,70,121,102,63, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP LTEXT "Port max",IDC_STATIC,6,12,36,10 COMBOBOX IDC_COMBO_PORT_NUM,45,12,39,81,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP LTEXT "Compute max time msec(default 500ms)",IDC_STATIC,7,137, 114,9 EDITTEXT IDC_EDIT_SYN_SH_TIME,127,137,54,12,ES_AUTOHSCROLL LTEXT "Process priority",IDC_STATIC,7,109,62,10 COMBOBOX IDC_COMBO_PROCESS_PRIORITY,70,107,102,63, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP CONTROL "Automatically start synthesize",IDC_CHECK_SYN_AUTOSTART, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,96,115,8 END IDD_DIALOG_PREF_EN DIALOG DISCARDABLE 0, 0, 235, 229 STYLE DS_MODALFRAME | WS_MAXIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "TiMidity++ Win32GUI Preference" FONT 9, "Times New Roman" BEGIN DEFPUSHBUTTON "OK",IDOK,57,213,50,14 PUSHBUTTON "Cancel",IDCANCEL,117,213,50,14 PUSHBUTTON "Apply",IDC_BUTTON_APPLY,174,213,50,14 CONTROL "Tab1",IDC_TAB_MAIN,"SysTabControl32",0x0,0,0,234,210 END ///////////////////////////////////////////////////////////////////////////// // // Menu // IDM_MENU_MAIN_EN MENU DISCARDABLE BEGIN POPUP "File(&F)" BEGIN MENUITEM "Open File(&F)", IDM_MFOPENFILE MENUITEM "Open Directory(&D)", IDM_MFOPENDIR MENUITEM SEPARATOR MENUITEM "Load Playlist(&P)", IDM_MFLOADPLAYLIST MENUITEM "Save Playlist as(&S)", IDM_MFSAVEPLAYLISTAS MENUITEM SEPARATOR MENUITEM "Exit(&X)", IDM_MFEXIT END POPUP "Config(&C)" BEGIN MENUITEM "Preference(&P)", IDM_SETTING MENUITEM SEPARATOR MENUITEM "Load ini file(&L)", IDM_MCLOADINIFILE MENUITEM "Save ini file(&S)", IDM_MCSAVEINIFILE MENUITEM SEPARATOR MENUITEM "Reload cfg file(&F)", IDM_FORCE_RELOAD END POPUP "Window(&W)" BEGIN MENUITEM "Play List(&L)", IDM_MWPLAYLIST MENUITEM "Tracer(&T)", IDM_MWTRACER MENUITEM "Document(&D)", IDM_MWDOCUMENT MENUITEM "Wrd tracer(&W)", IDM_MWWRDTRACER MENUITEM "Console(&C)", IDM_MWCONSOLE END POPUP "Help(&H)" BEGIN MENUITEM "Online Help(&O)", IDM_MHONLINEHELP MENUITEM "Bug Tracking System(&B)", IDM_MHBTS MENUITEM SEPARATOR MENUITEM "TiMidity++(&T)", IDM_MHTIMIDITY MENUITEM "Version(&V)", IDM_MHVERSION MENUITEM SEPARATOR MENUITEM "Supplement(&S)", IDM_MHSUPPLEMENT END END ///////////////////////////////////////////////////////////////////////////// // // Bitmap // IDB_BITMAP_MAIN_BUTTON BITMAP MOVEABLE PURE "w32g_btn.bmp" IDB_BITMAP_SUBWND_BUTTON BITMAP MOVEABLE PURE "w32g_subbtn.bmp" IDB_BITMAP_SLEEP BITMAP MOVEABLE PURE "w32g_sleep.bmp" IDB_BITMAP_TRACER BITMAP MOVEABLE PURE "w32g_tracer.bmp" ///////////////////////////////////////////////////////////////////////////// // // DESIGNINFO // #ifdef APSTUDIO_INVOKED GUIDELINES DESIGNINFO MOVEABLE PURE BEGIN IDD_DIALOG_CONSOLE_EN, DIALOG BEGIN RIGHTMARGIN, 247 END IDD_DIALOG_TRACER, DIALOG BEGIN BOTTOMMARGIN, 220 END IDD_DIALOG_SIMPLE_LIST_EN, DIALOG BEGIN RIGHTMARGIN, 241 BOTTOMMARGIN, 179 END IDD_PREF_TIMIDITY1_EN, DIALOG BEGIN RIGHTMARGIN, 218 BOTTOMMARGIN, 164 END IDD_DIALOG_ONE_LINE_EN, DIALOG BEGIN LEFTMARGIN, 7 RIGHTMARGIN, 180 TOPMARGIN, 7 BOTTOMMARGIN, 56 END IDD_PREF_SYN1_EN, DIALOG BEGIN LEFTMARGIN, 7 RIGHTMARGIN, 200 TOPMARGIN, 7 BOTTOMMARGIN, 159 END IDD_DIALOG_PREF_EN, DIALOG BEGIN LEFTMARGIN, 7 RIGHTMARGIN, 228 TOPMARGIN, 7 BOTTOMMARGIN, 222 END END #endif // APSTUDIO_INVOKED #endif // ƭ resources ///////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////// // { resources #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_JPN) #ifdef _WIN32 LANGUAGE LANG_JAPANESE, SUBLANG_DEFAULT #pragma code_page(932) #endif //_WIN32 ///////////////////////////////////////////////////////////////////////////// // // Dialog // IDD_DIALOG_CONSOLE DIALOGEX 0, 0, 243, 184 STYLE DS_MODALFRAME | DS_3DLOOK | WS_CAPTION | WS_SYSMENU CAPTION "R\[ (TiMidity++ Win32GUI)" FONT 9, "lr oSVbN", 0, 0, 0x1 BEGIN PUSHBUTTON "NA",IDCLEAR,140,167,96,16,BS_CENTER EDITTEXT IDC_EDIT_VERBOSITY,44,167,16,16,ES_OEMCONVERT CONTROL "L",IDC_CHECKBOX_VALID,"Button",BS_AUTOCHECKBOX | BS_LEFTTEXT | WS_TABSTOP,97,167,27,16 CONTROL "",-1,"Static",SS_ETCHEDFRAME,4,167,80,16 EDITTEXT IDC_EDIT,0,0,242,160,ES_MULTILINE | ES_AUTOVSCROLL | ES_AUTOHSCROLL | ES_READONLY | ES_WANTRETURN | WS_VSCROLL | WS_HSCROLL,WS_EX_STATICEDGE PUSHBUTTON "x",IDC_BUTTON_VERBOSITY,4,167,40,16,BS_CENTER, WS_EX_CLIENTEDGE PUSHBUTTON "<<",IDC_BUTTON_DEC,60,167,12,16,BS_CENTER PUSHBUTTON ">>",IDC_BUTTON_INC,72,167,12,16,BS_CENTER CONTROL "",-1,"Static",SS_ETCHEDFRAME,93,167,38,16 END IDD_DIALOG_DOC DIALOGEX 0, 0, 302, 257 STYLE DS_3DLOOK | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME EXSTYLE WS_EX_ACCEPTFILES CAPTION "hLg (TiMidity++ Win32GUI)" FONT 9, "lr oSVbN", 0, 0, 0x1 BEGIN EDITTEXT IDC_EDIT_FILENAME,100,240,150,16,ES_CENTER | ES_READONLY PUSHBUTTON "<<",IDC_BUTTON_PREV,255,240,20,16,BS_CENTER PUSHBUTTON ">>",IDC_BUTTON_NEXT,275,240,20,16,BS_CENTER EDITTEXT IDC_EDIT,0,0,295,220,ES_MULTILINE | ES_AUTOVSCROLL | ES_AUTOHSCROLL | ES_READONLY | ES_WANTRETURN | WS_VSCROLL | WS_HSCROLL EDITTEXT IDC_EDIT_INFO,0,240,95,16,ES_READONLY END IDD_DIALOG_WRD DIALOGEX 0, 0, 366, 215 STYLE DS_3DLOOK | WS_CAPTION | WS_SYSMENU EXSTYLE WS_EX_ACCEPTFILES CAPTION "Wrd Tracer Window (TiMidity Win32GUI)" FONT 9, "Times New Roman", 400, 0, 0x1 BEGIN END IDD_DIALOG_SOUNDSPEC DIALOG DISCARDABLE 0, 0, 240, 180 STYLE DS_3DLOOK | WS_CAPTION | WS_SYSMENU CAPTION "Sound Spec Window (TiMidity Win32GUI)" FONT 9, "Times New Roman" BEGIN PUSHBUTTON "C L E A R",IDCLEAR,136,164,96,16,BS_CENTER CONTROL "VALID",IDC_CHECKBOX_DEBUG_WND_VALID,"Button", BS_AUTOCHECKBOX | BS_LEFTTEXT | WS_TABSTOP,20,164,36,16 CONTROL "",-1,"Static",SS_ETCHEDFRAME,16,164,44,16 END IDD_DIALOG_SIMPLE_LIST DIALOGEX 0, 0, 242, 189 STYLE DS_3DLOOK | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME EXSTYLE WS_EX_DLGMODALFRAME | WS_EX_ACCEPTFILES | WS_EX_CONTROLPARENT CAPTION "vCXg (TiMidity++ Win32GUI)" FONT 9, "lr oSVbN", 0, 0, 0x1 BEGIN LISTBOX IDC_LISTBOX_PLAYLIST,0,0,241,172,LBS_HASSTRINGS | LBS_WANTKEYBOARDINPUT | LBS_DISABLENOSCROLL | WS_VSCROLL | WS_HSCROLL | WS_GROUP | WS_TABSTOP PUSHBUTTON "hLg",IDC_BUTTON_DOC,54,175,36,12,BS_CENTER PUSHBUTTON "d폜",IDC_BUTTON_UNIQ,117,175,31,12,BS_CENTER PUSHBUTTON "|",IDC_BUTTON_REFINE,150,175,22,12,BS_CENTER PUSHBUTTON "NA",IDC_BUTTON_CLEAR,200,175,42,12,BS_CENTER | WS_GROUP EDITTEXT IDC_EDIT_NUM,5,175,45,12,ES_READONLY END IDD_PREF_PLAYER DIALOGEX 0, 0, 211, 215 STYLE DS_SYSMODAL | DS_3DLOOK | DS_CONTROL | WS_CHILD | WS_VISIBLE | WS_CAPTION FONT 9, "lr oSVbN" BEGIN PUSHBUTTON "ݒt@C",IDC_BUTTON_CONFIG_FILE,3,11,52,14, BS_CENTER EDITTEXT IDC_EDIT_CONFIG_FILE,56,11,127,15,ES_AUTOHSCROLL | ES_OEMCONVERT GROUPBOX "vC[",IDC_GROUPBOX_PLAYERMODE,2,52,106,61, WS_GROUP CONTROL "ȉtĒ~",IDC_CHECKBOX_NOT_CONTINUE,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,7,64,64,8 CONTROL "hbO&&hbvōĐȂ", IDC_CHECKBOX_NOT_DRAG_START,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,76,97,8 CONTROL "s[gȂ",IDC_CHECKBOX_NOT_LOOPING,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,7,88,51,8 CONTROL "I[gX^[g",IDC_CHECKBOX_AUTOSTART,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,7,100,56,8 GROUPBOX "vCXg",IDC_STATIC,112,52,88,85 CONTROL "SȉtI",IDC_CHECKBOX_AUTOQUIT,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,117,64,61,8 CONTROL "do^h~",IDC_CHECKBOX_AUTOUNIQ,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,117,76,59,8 CONTROL "tt@Ĉݓo^",IDC_CHECKBOX_AUTOREFINE,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,117,88,75,8 CONTROL "_Đ",IDC_CHECKBOX_RANDOM,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,117,100,50,8 CONTROL "Ǎ",IDC_CHECK_AUTOLOAD_PLAYLIST,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,117,111,50,8 CONTROL "ۑ",IDC_CHECK_AUTOSAVE_PLAYLIST,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,117,124,50,8 GROUPBOX "TuEChE",IDC_STATIC,4,116,104,25 LTEXT "ő吔",IDC_STATIC,8,128,24,8 EDITTEXT IDC_EDIT_SUBWINDOW_MAX,32,125,24,12,ES_CENTER, WS_EX_RIGHT GROUPBOX "hLg",IDC_STATIC,2,142,75,38 CONTROL "\Ȃ",IDC_CHECK_DOCWNDINDEPENDENT,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,6,153,56,8 CONTROL "|bvAbv",IDC_CHECK_DOCWNDAUTOPOPUP,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,6,165,59,10 GROUPBOX "EChE",IDC_STATIC,3,183,72,28 CONTROL "ʒuETCYۑ",IDC_CHECK_POS_SIZE_SAVE,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,8,196,64,10 GROUPBOX "tH_",IDC_STATIC,83,142,70,23 CONTROL "ċA",IDC_CHECK_SEACHDIRRECURSIVE,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,88,152,41,10 GROUPBOX "ݒ",IDC_STATIC,83,170,70,25 CONTROL "ݒ̎ۑ",IDC_CHECK_INIFILE_AUTOSAVE,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,88,181,59,10 GROUPBOX "Language",IDC_GROUPBOX_LANGUAGE,160,142,43,38,WS_GROUP CONTROL "{",IDC_RADIOBUTTON_JAPANESE,"Button", BS_AUTORADIOBUTTON | WS_TABSTOP,163,154,30,8 CONTROL "English",IDC_RADIOBUTTON_ENGLISH,"Button", BS_AUTORADIOBUTTON | WS_TABSTOP,163,167,36,8 PUSHBUTTON "ݒt@C̋ēǍ",IDC_BUTTON_CFG_RELOAD,3,31,96, 15,BS_MULTILINE PUSHBUTTON "ҏW",IDC_BUTTON_CFG_EDIT,184,11,25,14,BS_CENTER END IDD_PREF_TIMIDITY1 DIALOG DISCARDABLE 0, 0, 211, 207 STYLE DS_SYSMODAL | DS_3DLOOK | DS_CONTROL | WS_CHILD | WS_VISIBLE | WS_CAPTION FONT 9, "lr oSVbN" BEGIN CONTROL "W[VzC[",IDC_CHECKBOX_MODWHEEL,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,6,75,85,10 CONTROL "|^g",IDC_CHECKBOX_PORTAMENTO,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,6,88,50,10 CONTROL "NRPN ru[g",IDC_CHECKBOX_NRPNVIB,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,6,127,65,10 CONTROL "ėpRg[",IDC_CHECKBOX_CHPRESS,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,6,101,80,10 CONTROL "eLXg^Cxg",IDC_CHECKBOX_TRACETEXT,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,101,59,73,10 CONTROL "A",IDC_CHECKBOX_OVOICE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,101,45,43,10 CONTROL "A^bNE^C",IDC_CHECKBOX_TVAA,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,6,140,59,10 CONTROL "fBPCE^C",IDC_CHECKBOX_TVAD,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,6,153,61,10 CONTROL "[XE^C",IDC_CHECKBOX_TVAR,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,6,166,61,10 CONTROL "EQ",IDC_CHECKBOX_EQ,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,179,25,10 CONTROL "CT[VEGtFNg",IDC_CHECKBOX_IEFFECT,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,6,192,84,10 CONTROL "R[XEx",IDC_CHECKBOX_CHORUS_LEVEL,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,101,17,63,10 EDITTEXT IDC_EDIT_CHORUS,167,16,24,10,ES_NUMBER CONTROL "o[uEx",IDC_CHECKBOX_REVERB_LEVEL,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,101,31,63,10 EDITTEXT IDC_EDIT_REVERB,167,30,24,10,ES_NUMBER CONTROL "L&&R fBC",IDC_CHECKBOX_DELAY,"Button", BS_AUTOCHECKBOX | BS_LEFT | BS_TOP | WS_TABSTOP,101,112, 57,10 CONTROL "",IDC_RADIOBUTTON_DELAY_LEFT,"Button", BS_AUTORADIOBUTTON | WS_TABSTOP,109,127,23,10 CONTROL "E",IDC_RADIOBUTTON_DELAY_RIGHT,"Button", BS_AUTORADIOBUTTON | WS_TABSTOP,135,127,23,10 CONTROL "]",IDC_RADIOBUTTON_DELAY_CENTER,"Button", BS_AUTORADIOBUTTON | WS_TABSTOP,161,127,30,10 LTEXT "fBC^C(ms)",IDC_STATIC,113,141,55,8,NOT WS_GROUP | WS_TABSTOP EDITTEXT IDC_EDIT_DELAY,171,139,32,10,ES_NUMBER LTEXT "^o[u(0..1000)",IDC_STATIC,101,155,64,8,NOT WS_GROUP | WS_TABSTOP EDITTEXT IDC_EDIT_MODIFY_RELEASE,167,153,28,10 LTEXT "mCYVFCsO (0..6)",IDC_STATIC,101,87,70,8,NOT WS_GROUP | WS_TABSTOP EDITTEXT IDC_EDIT_NOISESHARPING,176,85,16,10,ES_NUMBER CONTROL "NRPN hEGtFNg",IDC_CHECKBOX_DRUM_EFFECT, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,114,81,10 GROUPBOX "GM/GS/XG",IDC_STATIC,1,3,94,204 GROUPBOX "",IDC_STATIC,97,3,113,163 CONTROL "W[VEGx[v",IDC_CHECKBOX_MOD_ENV, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,101,73,100,10 COMBOBOX IDC_COMBO_REVERB,6,15,84,78,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP COMBOBOX IDC_COMBO_CHORUS,6,30,84,54,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP COMBOBOX IDC_COMBO_DELAY,6,45,84,78,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP COMBOBOX IDC_COMBO_LPF,6,60,84,78,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP COMBOBOX IDC_COMBO_MODULE,101,188,103,78,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP GROUPBOX "[h",IDC_STATIC,97,176,113,31 CONTROL "TEh",IDC_CHECKBOX_PAN_DELAY,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,101,97,41,13 END IDD_PREF_TIMIDITY2 DIALOG DISCARDABLE 0, 0, 211, 217 STYLE DS_SYSMODAL | DS_3DLOOK | DS_CONTROL | WS_CHILD | WS_VISIBLE | WS_CAPTION FONT 9, "lr oSVbN" BEGIN GROUPBOX "Đ",IDC_STATIC,1,3,107,133 LTEXT "{CX",IDC_STATIC,6,19,20,8,NOT WS_GROUP EDITTEXT IDC_EDIT_VOICES,31,17,24,12,ES_NUMBER LTEXT "(%)",IDC_STATIC,6,33,23,8,NOT WS_GROUP EDITTEXT IDC_EDIT_AMPLIFICATION,31,31,24,12 CONTROL "A`GCAX",IDC_CHECKBOX_ANTIALIAS,"Button", BS_AUTOCHECKBOX | BS_LEFT | BS_TOP | WS_TABSTOP,6,49,64, 10 CONTROL "tɉFǍ",IDC_CHECKBOX_LOADINST_PLAYING,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,6,62,67,10 CONTROL "tɉFj",IDC_CHECKBOX_FREE_INST,"Button", BS_AUTOCHECKBOX | BS_LEFT | BS_TOP | WS_TABSTOP,6,75,66, 10 CONTROL "׎Ƀ{CX팸",IDC_CHECKBOX_REDUCE_VOICE,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,6,89,82,8 GROUPBOX "ftHgKi",IDC_GROUPBOX_DEFAULT_MIDI_TYPE,6,105,87, 27 CONTROL "GM",IDC_RADIOBUTTON_GM,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,14,117,22,8 CONTROL "GS",IDC_RADIOBUTTON_GS,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,39,117,20,8 CONTROL "XG",IDC_RADIOBUTTON_XG,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,63,117,20,8 GROUPBOX "xȐݒ",IDC_STATIC,111,3,100,133 LTEXT "LbV",IDC_STATIC,117,19,31,8,NOT WS_GROUP EDITTEXT IDC_EDIT_CACHE_SIZE,149,17,39,12 LTEXT "ftHgoN",IDC_STATIC,117,34,49,8,NOT WS_GROUP EDITTEXT IDC_EDIT_DEFAULT_TONEBANK,169,32,24,12 CONTROL "oNŒ",IDC_CHECKBOX_SPECIAL_TONEBANK,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,117,49,43,8 EDITTEXT IDC_EDIT_SPECIAL_TONEBANK,164,47,24,12 LTEXT "䃌VI",IDC_STATIC,117,65,33,8,NOT WS_GROUP EDITTEXT IDC_EDIT_CONTROL_RATIO,153,63,24,12 CONTROL "g[X[h",IDC_CHECKBOX_CTL_TRACE_PLAYING,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,117,80,54,8 LTEXT "R\[x",IDC_STATIC,117,93,51,8,NOT WS_GROUP EDITTEXT IDC_EDIT_CTL_VEBOSITY,170,91,20,12 LTEXT "hʕ␳(%)",IDC_STATIC,117,108,54,8,NOT WS_GROUP EDITTEXT IDC_EDIT_DRUM_POWER,175,106,21,12 CONTROL "ʎ␳",IDC_CHECKBOX_AMP_COMPENSATION,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,117,123,54,8 GROUPBOX "yT",IDC_STATIC,1,137,209,80 CONTROL "ʼnt(-Zpure)",IDC_CHECKBOX_PURE_INTONATION, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,148,90,10 CONTROL "",IDC_CHECKBOX_INIT_KEYSIG,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,11,164,37,8 COMBOBOX IDC_COMBO_INIT_KEYSIG,51,161,80,53,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP CONTROL "Z",IDC_CHECKBOX_INIT_MI,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,137,164,28,10 LTEXT "Vtg(-Kn)",IDC_STATIC,6,184,47,8,NOT WS_GROUP EDITTEXT IDC_EDIT_KEY_ADJUST,56,181,21,12 CONTROL "̐Œ肵ĉt(-Hn)", IDC_CHECKBOX_FORCE_KEYSIG,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,203,113,8 COMBOBOX IDC_COMBO_FORCE_KEYSIG,122,200,80,53,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP END IDD_PREF_TIMIDITY3 DIALOG DISCARDABLE 0, 0, 210, 181 STYLE DS_SYSMODAL | DS_3DLOOK | DS_CONTROL | WS_CHILD | WS_VISIBLE | WS_CAPTION FONT 9, "lr oSVbN" BEGIN GROUPBOX "o",IDC_STATIC,1,0,203,173,WS_GROUP | WS_TABSTOP GROUPBOX "o̓[h",IDC_STATIC,4,14,193,33,WS_GROUP | WS_TABSTOP CONTROL "U-Law",IDC_CHECKBOX_ULAW,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,62,23,31,8 CONTROL "A-Law",IDC_CHECKBOX_ALAW,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,62,35,31,8 CONTROL "Signed",IDC_CHECKBOX_SIGNED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,98,23,37,8 CONTROL "Unsigned",IDC_CHECKBOX_UNSIGNED,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,98,35,37,8 CONTROL "oCgXbv",IDC_CHECKBOX_BYTESWAP,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,140,23,52,8 CONTROL "jAPCM",IDC_CHECKBOX_LINEAR,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,140,35,45,8 GROUPBOX "`l",IDC_STATIC,4,55,45,33,WS_GROUP | WS_TABSTOP CONTROL "XeI",IDC_RADIO_STEREO,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,8,65,36,10 CONTROL "m",IDC_RADIO_MONO,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,8,77,35,8 LTEXT "Hz",IDC_STATIC,103,72,8,8,WS_TABSTOP GROUPBOX "o͕@",IDC_GROUPBOX_OUTPUT,4,97,193,49,WS_GROUP | WS_TABSTOP COMBOBOX IDC_COMBO_OUTPUT,8,111,151,64,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP PUSHBUTTON "IvV",IDC_BUTTON_OUTPUT_OPTIONS,160,110,34,14 COMBOBOX IDC_COMBO_OUTPUT_MODE,8,129,186,72,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP PUSHBUTTON "o̓t@C",IDC_BUTTON_OUTPUT_FILE,4,151,42,14, BS_CENTER | WS_GROUP EDITTEXT IDC_EDIT_OUTPUT_FILE,47,151,130,15,ES_AUTOHSCROLL | ES_OEMCONVERT | WS_GROUP PUSHBUTTON "폜",IDC_BUTTON_OUTPUT_FILE_DEL,178,151,19,14, BS_CENTER COMBOBOX IDC_COMBO_BANDWIDTH,8,27,48,64,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP COMBOBOX IDC_COMBO_SAMPLE_RATE,63,69,36,64,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP GROUPBOX "Tv[g",IDC_STATIC,56,55,60,33 END IDD_PREF_TIMIDITY4 DIALOG DISCARDABLE 0, 0, 211, 195 STYLE DS_SYSMODAL | DS_3DLOOK | DS_CONTROL | WS_CHILD | WS_VISIBLE | WS_CAPTION FONT 9, "lr oSVbN" BEGIN CONTROL "Ch01",IDC_CHECKBOX_CH01,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,16,28,8 CONTROL "Ch02",IDC_CHECKBOX_CH02,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,24,28,8 CONTROL "Ch03",IDC_CHECKBOX_CH03,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,32,28,8 CONTROL "Ch04",IDC_CHECKBOX_CH04,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,40,28,8 CONTROL "Ch05",IDC_CHECKBOX_CH05,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,48,28,8 CONTROL "Ch06",IDC_CHECKBOX_CH06,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,56,28,8 CONTROL "Ch07",IDC_CHECKBOX_CH07,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,64,28,8 CONTROL "Ch08",IDC_CHECKBOX_CH08,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,72,28,8 CONTROL "Ch09",IDC_CHECKBOX_CH09,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,41,16,28,8 CONTROL "Ch10",IDC_CHECKBOX_CH10,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,41,24,28,8 CONTROL "Ch11",IDC_CHECKBOX_CH11,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,41,32,28,8 CONTROL "Ch12",IDC_CHECKBOX_CH12,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,41,40,28,8 CONTROL "Ch13",IDC_CHECKBOX_CH13,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,41,48,28,8 CONTROL "Ch14",IDC_CHECKBOX_CH14,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,41,56,28,8 CONTROL "Ch15",IDC_CHECKBOX_CH15,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,41,64,28,8 CONTROL "Ch16",IDC_CHECKBOX_CH16,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,41,72,28,8 CONTROL "Ch17",IDC_CHECKBOX_CH17,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,73,16,28,8 CONTROL "Ch18",IDC_CHECKBOX_CH18,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,73,24,28,8 CONTROL "Ch19",IDC_CHECKBOX_CH19,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,73,32,28,8 CONTROL "Ch20",IDC_CHECKBOX_CH20,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,73,40,28,8 CONTROL "Ch21",IDC_CHECKBOX_CH21,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,73,48,28,8 CONTROL "Ch22",IDC_CHECKBOX_CH22,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,73,56,28,8 CONTROL "Ch23",IDC_CHECKBOX_CH23,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,73,64,28,8 CONTROL "Ch24",IDC_CHECKBOX_CH24,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,73,72,28,8 CONTROL "Ch25",IDC_CHECKBOX_CH25,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,106,16,28,8 CONTROL "Ch26",IDC_CHECKBOX_CH26,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,106,24,28,8 CONTROL "Ch27",IDC_CHECKBOX_CH27,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,106,32,28,8 CONTROL "Ch28",IDC_CHECKBOX_CH28,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,106,40,28,8 CONTROL "Ch29",IDC_CHECKBOX_CH29,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,106,48,28,8 CONTROL "Ch30",IDC_CHECKBOX_CH30,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,106,56,28,8 CONTROL "Ch31",IDC_CHECKBOX_CH31,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,106,64,28,8 CONTROL "Ch32",IDC_CHECKBOX_CH32,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,106,72,28,8 CONTROL "ftHg̃h`l",IDC_CHECKBOX_DRUM_CHANNEL, "Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | WS_TABSTOP,9,87, 95,13 CONTROL "hp[gF𖳎`l", IDC_CHECKBOX_DRUM_CHANNEL_MASK,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | WS_TABSTOP,9,105,137,14 CONTROL "~[g`l",IDC_CHECKBOX_QUIET_CHANNEL, "Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | WS_TABSTOP,9, 124,76,13 PUSHBUTTON "SĔ]",IDC_BUTTON_REVERSE,141,18,31,61 GROUPBOX "`l",IDC_STATIC,1,3,179,138 GROUPBOX "~[g鉹",IDC_STATIC,1,143,197,49 CONTROL "ϗ",IDC_CHECKBOX_TEMPER_EQUAL,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,5,157,37,10 CONTROL "s^SX",IDC_CHECKBOX_TEMPER_PYTHA,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,48,157,59,10 CONTROL "S",IDC_CHECKBOX_TEMPER_MEANTONE,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,108,157,43,10 CONTROL "",IDC_CHECKBOX_TEMPER_PUREINT,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,154,157,37,10 CONTROL "[U#0",IDC_CHECKBOX_TEMPER_USER0,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,5,173,43,10 CONTROL "[U#1",IDC_CHECKBOX_TEMPER_USER1,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,48,173,43,10 CONTROL "[U#2",IDC_CHECKBOX_TEMPER_USER2,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,108,173,43,10 CONTROL "[U#3",IDC_CHECKBOX_TEMPER_USER3,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,154,173,43,10 END IDD_DIALOG_WAVEFORM DIALOGEX 0, 0, 240, 120 STYLE DS_MODALFRAME | DS_3DLOOK | WS_VISIBLE | WS_CAPTION EXSTYLE WS_EX_DLGMODALFRAME FONT 9, "Times New Roman", 400, 0, 0x1 BEGIN END IDD_DIALOG_SEARCHBOX DIALOG DISCARDABLE 0, 0, 183, 54 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Seach" FONT 9, "Times New Roman" BEGIN DEFPUSHBUTTON "OK",IDOK,70,33,50,14 PUSHBUTTON "Cancel",IDCANCEL,126,33,50,14 EDITTEXT IDC_EDIT1,7,7,169,24,ES_AUTOHSCROLL | ES_OEMCONVERT END IDD_DIALOG_VORBIS DIALOG DISCARDABLE 0, 0, 197, 93 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Ogg Vorbis ݒ_CAO" FONT 9, "lr oSVbN" BEGIN CONTROL "ftHgݒ",IDC_CHECK_DEFAULT,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,4,0,56,10 COMBOBOX IDC_COMBO_MODE,25,13,123,56,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP LTEXT "^Cg",IDC_STATIC,4,49,23,8 EDITTEXT IDC_EDIT1,41,48,152,14,ES_AUTOHSCROLL | WS_DISABLED LTEXT "A[eBXg",IDC_STATIC,4,63,36,8 EDITTEXT IDC_EDIT2,41,76,152,14,ES_AUTOHSCROLL | WS_DISABLED LTEXT "Ao",IDC_STATIC,4,77,27,8 EDITTEXT IDC_EDIT3,41,62,152,14,ES_AUTOHSCROLL | WS_DISABLED CONTROL "̏",IDC_CHECK_USE_TAG,"Button", BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,4,32,73,10 LTEXT "[h",IDC_STATIC,4,16,18,8 PUSHBUTTON "OK",IDOK,152,2,40,12 PUSHBUTTON "LZ",IDCANCEL,152,30,40,12 PUSHBUTTON "Kp",IDC_BUTTON_APPLY,152,14,40,11 END IDD_DIALOG_GOGO DIALOG DISCARDABLE 0, 0, 346, 196 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "MP3(ߌ̂`) ݒ_CAO" FONT 8, "lr oSVbN" BEGIN DEFPUSHBUTTON "OK",IDOK,173,179,50,14 PUSHBUTTON "LZ",IDCANCEL,285,179,50,14 COMBOBOX IDC_COMBO_OUTPUT_FORMAT,4,36,72,64,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP CONTROL "ftHgݒ",IDC_CHECK_DEFAULT,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,4,0,80,10 CONTROL "R}hCIvV",IDC_CHECK_COMMANDLINE_OPTS, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,4,12,86,10 EDITTEXT IDC_EDIT_COMMANDLINE_OPTION,91,10,232,14,ES_AUTOHSCROLL COMBOBOX IDC_COMBO_MPEG1_AUDIO_BITRATE,6,72,76,76, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP COMBOBOX IDC_COMBO_MPEG2_AUDIO_BITRATE,87,72,76,76, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP COMBOBOX IDC_COMBO_VBR_BITRATE_LOW,6,119,76,64,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP LTEXT "VBR - ō",IDC_STATIC,86,110,55,8 COMBOBOX IDC_COMBO_VBR_BITRATE_HIGH,86,119,76,64,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP CONTROL "16KHz [pXtB^",IDC_CHECK_16KHZ_LOW_PASS_FILTER, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,176,57,89,8 CONTROL "GnXg[pXtB^", IDC_CHECK_ENHANCED_LOW_PASS_FILTER,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,176,68,104,8 EDITTEXT IDC_EDIT_LPF_PARA1,200,77,28,12 EDITTEXT IDC_EDIT_LPF_PARA2,251,77,28,12 LTEXT "para1",IDC_STATIC,183,79,16,8 LTEXT "para2",IDC_STATIC,233,79,16,8 COMBOBOX IDC_COMBO_ENCODE_MODE,172,36,84,60,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP CONTROL "S",IDC_CHECK_USEPSY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,176,90,42,10 CONTROL "MMX",IDC_CHECK_CPUMMX,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,193,151,29,10 CONTROL "SSE",IDC_CHECK_CPUSSE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,193,163,27,10 CONTROL "3DNOW",IDC_CHECK_CPU3DNOW,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,227,151,39,10 CONTROL "E3DNOW",IDC_CHECK_CPUE3DNOW,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,227,163,40,10 COMBOBOX IDC_COMBO_EMPHASIS_TYPE,268,36,76,64,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP COMBOBOX IDC_COMBO_VBR,37,92,124,72,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP CONTROL "VBR",IDC_CHECK_VBR,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,94,29,10 CONTROL "g",IDC_CHECK_OUTFREQ,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,88,28,35,8 EDITTEXT IDC_EDIT_OUTFREQ,88,36,72,12 CONTROL "J-Stereoł Stereo/MS-Stereo ̐ؑւ", IDC_CHECK_MSTHRESHOLD,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,176,103,167,8 EDITTEXT IDC_EDIT_MSTHRESHOLD_THRESHOLD,200,112,28,12 EDITTEXT IDC_EDIT_MSTHRESHOLD_MSPOWER,252,112,28,12 LTEXT "para1",IDC_STATIC,183,114,16,8 LTEXT "para2",IDC_STATIC,233,114,16,8 CONTROL "xt@C",IDC_CHECK_VERIFY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,176,127,45,10 PUSHBUTTON "Kp",IDC_BUTTON_APPLY,229,179,50,14 CONTROL "ȉ̖߂g",IDC_CHECK_USE_CPU_OPTS,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,176,140,68,8 CONTROL "MPEG1Audio",IDC_CHECK_MPEG1AUDIOBITRATE,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,6,64,80,8 CONTROL "MPEG2Audio",IDC_CHECK_MPEG2AUDIOBITRATE,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,87,64,80,8 CONTROL "VBR - Œ",IDC_CHECK_VBR_BITRATE,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,6,110,67,8 CONTROL "o̓tH[}bg",IDC_CHECK_OUTPUT_FORMAT,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,4,28,64,8 CONTROL "[h",IDC_CHECK_ENCODE_MODE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,172,28,34,8 CONTROL "Gt@VX",IDC_CHECK_EMPHASIS_TYPE,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,268,28,62,8 GROUPBOX "rbg[g",IDC_STATIC,2,55,167,86 CONTROL "CMOV",IDC_CHECK_CPUCMOV,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,276,140,39,9 CONTROL "EMMX",IDC_CHECK_CPUEMMX,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,276,152,39,9 CONTROL "SSE2",IDC_CHECK_CPUSSE2,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,276,164,39,8 END IDD_DIALOG_ONE_LINE DIALOGEX 0, 0, 187, 63 STYLE DS_MODALFRAME | DS_3DLOOK | WS_POPUP | WS_CAPTION | WS_SYSMENU EXSTYLE WS_EX_CONTROLPARENT FONT 10, "lr oSVbN", 0, 0, 0x1 BEGIN EDITTEXT IDC_EDIT_ONE_LINE,4,16,180,14,ES_AUTOHSCROLL | WS_GROUP DEFPUSHBUTTON "",IDC_BUTTON_1,32,48,50,14 DEFPUSHBUTTON "",IDC_BUTTON_2,84,48,50,14 DEFPUSHBUTTON "",IDC_BUTTON_3,136,48,50,14,WS_GROUP LTEXT "",IDC_STATIC_TAIL,4,32,180,12 LTEXT "",IDC_STATIC_HEAD,4,0,180,12 END IDD_PREF_SYN1 DIALOGEX 0, 0, 191, 177 STYLE DS_CONTROL | WS_CHILD | WS_CAPTION FONT 9, "lr oSVbN", 0, 0, 0x1 BEGIN LTEXT "|[g 0",IDC_STATIC,6,27,24,12 GROUPBOX "MIDI IN foCX",IDC_STATIC,0,0,174,102 LTEXT "|[g 1",IDC_STATIC,6,43,24,12 LTEXT "|[g 2",IDC_STATIC,6,57,24,12 LTEXT "|[g 3",IDC_STATIC,6,73,24,12 COMBOBOX IDC_COMBO_IDPORT0,36,27,132,56,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP COMBOBOX IDC_COMBO_IDPORT1,36,42,132,56,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP COMBOBOX IDC_COMBO_IDPORT2,36,57,132,56,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP COMBOBOX IDC_COMBO_IDPORT3,36,72,132,56,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP LTEXT "VZXbhDx",IDC_STATIC,0,138,62,8 COMBOBOX IDC_COMBO_SYN_THREAD_PRIORITY,70,135,102,69, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP LTEXT "|[g",IDC_STATIC,6,12,26,8 COMBOBOX IDC_COMBO_PORT_NUM,36,12,42,87,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP LTEXT "vZő~b( 500ms)",IDC_STATIC,0,156,87,8 EDITTEXT IDC_EDIT_SYN_SH_TIME,97,153,75,14,ES_AUTOHSCROLL LTEXT "vZXDx",IDC_STATIC,0,124,46,8 COMBOBOX IDC_COMBO_PROCESS_PRIORITY,70,121,102,69, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP CONTROL "VZŊJn",IDC_CHECK_SYN_AUTOSTART,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,3,108,99,10 END IDD_DIALOG_PREF DIALOG DISCARDABLE 0, 0, 231, 270 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "TiMidity++ Win32GUI ڍאݒ" FONT 9, "lr oSVbN" BEGIN DEFPUSHBUTTON "OK",IDOK,54,255,50,14 PUSHBUTTON "ݾ",IDCANCEL,114,255,50,14 PUSHBUTTON "Kp",IDC_BUTTON_APPLY,174,255,50,14 CONTROL "Tab1",IDC_TAB_MAIN,"SysTabControl32",0x0,0,0,231,252 END ///////////////////////////////////////////////////////////////////////////// // // Menu // IDM_MENU_MAIN MENU DISCARDABLE BEGIN POPUP "t@C(&F)" BEGIN MENUITEM "t@CJ(&F)", IDM_MFOPENFILE MENUITEM "tH_J(&D)", IDM_MFOPENDIR MENUITEM SEPARATOR MENUITEM "vCXgJ(&P)", IDM_MFLOADPLAYLIST MENUITEM "vCXgۑ(&S)", IDM_MFSAVEPLAYLISTAS MENUITEM SEPARATOR MENUITEM "I(&X)", IDM_MFEXIT END POPUP "ݒ(&C)" BEGIN MENUITEM "ڍאݒ(&P)", IDM_SETTING MENUITEM SEPARATOR MENUITEM "ݒǍ(&L)", IDM_MCLOADINIFILE MENUITEM "ݒۑ(&S)", IDM_MCSAVEINIFILE MENUITEM SEPARATOR MENUITEM "cfgēǍ(&F)", IDM_FORCE_RELOAD END POPUP "EBhE(&W)" BEGIN MENUITEM "vCXg(&L)", IDM_MWPLAYLIST MENUITEM "g[T(&T)", IDM_MWTRACER MENUITEM "hLg(&D)", IDM_MWDOCUMENT MENUITEM "WRD(&W)", IDM_MWWRDTRACER MENUITEM "R\[(&C)", IDM_MWCONSOLE END POPUP "wv(&H)" BEGIN MENUITEM "ICwv(&O)", IDM_MHONLINEHELP MENUITEM "RtBOt@Cډ(&C)", IDM_MHONLINEHELPCFG MENUITEM "oO񍐏(&B)", IDM_MHBTS MENUITEM SEPARATOR MENUITEM "TiMidity++ɂ‚(&T)", IDM_MHTIMIDITY MENUITEM "o[W(&V)", IDM_MHVERSION MENUITEM SEPARATOR MENUITEM "⑫(&S)", IDM_MHSUPPLEMENT END END ///////////////////////////////////////////////////////////////////////////// // // DESIGNINFO // #ifdef APSTUDIO_INVOKED GUIDELINES DESIGNINFO MOVEABLE PURE BEGIN IDD_DIALOG_CONSOLE, DIALOG BEGIN RIGHTMARGIN, 241 BOTTOMMARGIN, 181 END IDD_DIALOG_DOC, DIALOG BEGIN RIGHTMARGIN, 268 BOTTOMMARGIN, 255 END IDD_DIALOG_WRD, DIALOG BEGIN RIGHTMARGIN, 320 BOTTOMMARGIN, 192 END IDD_DIALOG_SIMPLE_LIST, DIALOG BEGIN RIGHTMARGIN, 241 BOTTOMMARGIN, 187 END IDD_PREF_PLAYER, DIALOG BEGIN BOTTOMMARGIN, 211 END IDD_PREF_TIMIDITY1, DIALOG BEGIN RIGHTMARGIN, 146 BOTTOMMARGIN, 164 END IDD_PREF_TIMIDITY2, DIALOG BEGIN RIGHTMARGIN, 210 BOTTOMMARGIN, 198 END IDD_PREF_TIMIDITY3, DIALOG BEGIN RIGHTMARGIN, 190 BOTTOMMARGIN, 138 END IDD_PREF_TIMIDITY4, DIALOG BEGIN RIGHTMARGIN, 169 BOTTOMMARGIN, 177 END IDD_DIALOG_SEARCHBOX, DIALOG BEGIN LEFTMARGIN, 7 RIGHTMARGIN, 176 TOPMARGIN, 7 BOTTOMMARGIN, 47 END IDD_DIALOG_VORBIS, DIALOG BEGIN LEFTMARGIN, 7 RIGHTMARGIN, 190 TOPMARGIN, 7 BOTTOMMARGIN, 86 END IDD_DIALOG_GOGO, DIALOG BEGIN LEFTMARGIN, 7 RIGHTMARGIN, 339 TOPMARGIN, 7 BOTTOMMARGIN, 189 END IDD_DIALOG_ONE_LINE, DIALOG BEGIN LEFTMARGIN, 7 RIGHTMARGIN, 180 TOPMARGIN, 7 END IDD_PREF_SYN1, DIALOG BEGIN RIGHTMARGIN, 184 TOPMARGIN, 7 BOTTOMMARGIN, 170 END IDD_DIALOG_PREF, DIALOG BEGIN LEFTMARGIN, 7 RIGHTMARGIN, 224 TOPMARGIN, 7 BOTTOMMARGIN, 263 END END #endif // APSTUDIO_INVOKED #ifdef APSTUDIO_INVOKED ///////////////////////////////////////////////////////////////////////////// // // TEXTINCLUDE // 1 TEXTINCLUDE MOVEABLE PURE BEGIN "w32g_res.h\0" END 2 TEXTINCLUDE MOVEABLE PURE BEGIN "#define APSTUDIO_HIDDEN_SYMBOLS\r\n" "#include ""windows.h""\r\n" "#undef APSTUDIO_HIDDEN_SYMBOLS\r\n" "#include ""commctrl.h""\r\n" "#include ""w32g_rec.h""\r\n" "\0" END 3 TEXTINCLUDE MOVEABLE PURE BEGIN "\r\n" "\0" END #endif // APSTUDIO_INVOKED #ifndef _MAC ///////////////////////////////////////////////////////////////////////////// // // Version // VS_VERSION_INFO VERSIONINFO FILEVERSION 2,13,0,0 PRODUCTVERSION 2,13,0,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L #else FILEFLAGS 0x0L #endif FILEOS 0x40004L FILETYPE 0x1L FILESUBTYPE 0x0L BEGIN BLOCK "StringFileInfo" BEGIN BLOCK "000004e4" BEGIN VALUE "Comments", "\0" VALUE "CompanyName", "\0" VALUE "FileDescription", "timw32g\0" VALUE "FileVersion", "2, 13, 0, 0\0" VALUE "InternalName", "timw32g\0" VALUE "LegalCopyright", "Copyright (C) 1999-2002 Masanao Izumo \r\nCopyright (C) 1995 Tuukka Toivonen \0" VALUE "LegalTrademarks", "\0" VALUE "OriginalFilename", "timw32g.exe\0" VALUE "PrivateBuild", "\0" VALUE "ProductName", "TiMidity++ Win32GUI Version\0" VALUE "ProductVersion", "2, 13, 0, 0\0" VALUE "SpecialBuild", "\0" END END BLOCK "VarFileInfo" BEGIN VALUE "Translation", 0x0, 1252 END END #endif // !_MAC ///////////////////////////////////////////////////////////////////////////// // // Icon // // Icon with lowest ID value placed first to ensure application icon // remains consistent on all systems. IDI_ICON_TIMIDITY ICON DISCARDABLE "w32g_icon.ico" ///////////////////////////////////////////////////////////////////////////// // // String Table // STRINGTABLE DISCARDABLE BEGIN IDM_MHVERSION "Version information of TiMidity++." IDM_SETTING "Open the dialog of the modification of TiMidity parameters." END STRINGTABLE DISCARDABLE BEGIN IDM_MFOPENFILE "Open midi files and add them to the playlist." IDM_MFOPENDIR "Not Supported." IDM_MFLOADPLAYLIST "Not Supported." IDM_MFSAVEPLAYLISTAS "Not Supported." IDM_MFEXIT "Exit TiMidity." IDM_MCLOADINIFILE "Load ini file to apply TiMidity parameters." IDM_MCSAVEINIFILE "Save ini file to save TiMidity parameters." IDM_MWPLAYLIST "Open/Close playlist window to select midi files." IDM_MWTRACER "Not Supported." IDM_MWDOCUMENT "Not Supported." IDM_MWWRDTRACER "Not Supported." IDM_MWSOUNDSPEC "Not Supported." IDM_MWCONSOLE "Open/Close Console Window." IDM_MWDEBUG "For debugging by developpers of TiMidity." IDM_MHTOPIC "Not Supported." IDM_MHHELP "Not Supported." END STRINGTABLE DISCARDABLE BEGIN IDM_MHTIMIDITY "Copying of TiMidity++." END #endif // { resources ///////////////////////////////////////////////////////////////////////////// #ifndef APSTUDIO_INVOKED ///////////////////////////////////////////////////////////////////////////// // // Generated from the TEXTINCLUDE 3 resource. // ///////////////////////////////////////////////////////////////////////////// #endif // not APSTUDIO_INVOKED TiMidity++-2.13.2/interface/w32g_utl.c0100644004711200001440000011362310012633345016452 0ustar tamukiusers/* TiMidity++ -- MIDI to WAVE converter and player Copyright (C) 1999-2002 Masanao Izumo Copyright (C) 1995 Tuukka Toivonen 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA w32g_utl.c: written by Daisuke Aoki Masanao Izumo */ #ifdef HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ #include "interface.h" #include #include #ifndef NO_STRING_H #include #else #include #endif #include #include "timidity.h" #include "common.h" #include "instrum.h" #include "playmidi.h" #include "readmidi.h" #include "reverb.h" #include "output.h" #include "controls.h" #include "recache.h" #include "tables.h" #ifdef SUPPORT_SOUNDSPEC #include "soundspec.h" #endif /* SUPPORT_SOUNDSPEC */ #include "wrd.h" #include "w32g.h" #include "w32g_utl.h" #include #include "strtab.h" #include "url.h" extern int opt_default_mid; extern int effect_lr_mode; extern int effect_lr_delay_msec; extern char def_instr_name[]; extern int opt_control_ratio; extern char *opt_aq_max_buff; extern char *opt_aq_fill_buff; extern int opt_evil_mode; extern int opt_buffer_fragments; extern int32 opt_output_rate; extern int PlayerLanguage; extern volatile int data_block_bits; extern volatile int data_block_num; extern int DocWndIndependent; extern int DocWndAutoPopup; extern int SeachDirRecursive; extern int IniFileAutoSave; extern int SecondMode; extern int AutoloadPlaylist; extern int AutosavePlaylist; char DefaultPlaylistName[] = "default.pls"; char DefaultPlaylistPath[1024]; extern int PosSizeSave; //*****************************************************************************/ // ini // INI file CHAR *INI_INVALID = "INVALID PARAMETER"; CHAR *INI_SEC_PLAYER = "PLAYER"; CHAR *INI_SEC_TIMIDITY = "TIMIDITY"; #define INI_MAXLEN 1024 int IniGetKeyInt32(char *section, char *key,int32 *n) { CHAR buffer[INI_MAXLEN]; GetPrivateProfileString (section,key,INI_INVALID,buffer,INI_MAXLEN-1,IniFile); if(strcasecmp(buffer,INI_INVALID)){ *n =atol(buffer); return 0; } else return 1; } int IniGetKeyInt(char *section, char *key,int *n) { CHAR buffer[INI_MAXLEN]; GetPrivateProfileString (section,key,INI_INVALID,buffer,INI_MAXLEN-1,IniFile); if(strcasecmp(buffer,INI_INVALID)){ *n =atoi(buffer); return 0; } else return 1; } int IniGetKeyInt8(char *section, char *key,int8 *n) { CHAR buffer[INI_MAXLEN]; GetPrivateProfileString (section,key,INI_INVALID,buffer,INI_MAXLEN-1,IniFile); if(strcasecmp(buffer,INI_INVALID)){ *n = (int8)atoi(buffer); return 0; } else return 1; } int IniGetKeyInt32Array(char *section, char *key, int32 *n, int arraysize) { int i; int ret = 0; CHAR buffer[INI_MAXLEN]; char keybuffer[INI_MAXLEN]; for(i=0;i max) v = max; return v; } void ApplySettingPlayer(SETTING_PLAYER *sp) { InitMinimizeFlag = SetFlag(sp->InitMinimizeFlag); DebugWndStartFlag = SetFlag(sp->DebugWndStartFlag); ConsoleWndStartFlag = SetFlag(sp->ConsoleWndStartFlag); ListWndStartFlag = SetFlag(sp->ListWndStartFlag); TracerWndStartFlag = SetFlag(sp->TracerWndStartFlag); DocWndStartFlag = SetFlag(sp->DocWndStartFlag); WrdWndStartFlag = SetFlag(sp->WrdWndStartFlag); DebugWndFlag = SetFlag(sp->DebugWndFlag); ConsoleWndFlag = SetFlag(sp->ConsoleWndFlag); ListWndFlag = SetFlag(sp->ListWndFlag); TracerWndFlag = SetFlag(sp->TracerWndFlag); DocWndFlag = SetFlag(sp->DocWndFlag); WrdWndFlag = SetFlag(sp->WrdWndFlag); SoundSpecWndFlag = SetFlag(sp->SoundSpecWndFlag); SubWindowMax = SetValue(sp->SubWindowMax,1,10); strncpy(ConfigFile,sp->ConfigFile,MAXPATH + 31); ConfigFile[MAXPATH + 31] = '\0'; strncpy(PlaylistFile,sp->PlaylistFile,MAXPATH + 31); PlaylistFile[MAXPATH + 31] = '\0'; strncpy(PlaylistHistoryFile,sp->PlaylistHistoryFile,MAXPATH + 31); PlaylistHistoryFile[MAXPATH + 31] = '\0'; strncpy(MidiFileOpenDir,sp->MidiFileOpenDir,MAXPATH + 31); MidiFileOpenDir[MAXPATH + 31] = '\0'; strncpy(ConfigFileOpenDir,sp->ConfigFileOpenDir,MAXPATH + 31); ConfigFileOpenDir[MAXPATH + 31] = '\0'; strncpy(PlaylistFileOpenDir,sp->PlaylistFileOpenDir,MAXPATH + 31); PlaylistFileOpenDir[MAXPATH + 31] = '\0'; PlayerThreadPriority = sp->PlayerThreadPriority; GUIThreadPriority = sp->GUIThreadPriority; TraceGraphicFlag = SetFlag(sp->TraceGraphicFlag); // fonts ... SystemFontSize = sp->SystemFontSize; PlayerFontSize = sp->PlayerFontSize; WrdFontSize = sp->WrdFontSize; DocFontSize = sp->DocFontSize; ListFontSize = sp->ListFontSize; TracerFontSize = sp->TracerFontSize; strncpy(SystemFont,sp->SystemFont,255); SystemFont[255] = '\0'; strncpy(PlayerFont,sp->PlayerFont,255); PlayerFont[255] = '\0'; strncpy(WrdFont,sp->WrdFont,255); WrdFont[255] = '\0'; strncpy(DocFont,sp->DocFont,255); DocFont[255] = '\0'; strncpy(ListFont,sp->ListFont,255); ListFont[255] = '\0'; strncpy(TracerFont,sp->TracerFont,255); TracerFont[255] = '\0'; // Apply font functions ... DocMaxSize = sp->DocMaxSize; strncpy(DocFileExt,sp->DocFileExt,255); DocFileExt[255] = '\0'; PlayerLanguage = sp->PlayerLanguage; DocWndIndependent = sp->DocWndIndependent; DocWndAutoPopup = sp->DocWndAutoPopup; SeachDirRecursive = sp->SeachDirRecursive; IniFileAutoSave = sp->IniFileAutoSave; SecondMode = sp->SecondMode; AutoloadPlaylist = sp->AutoloadPlaylist; AutosavePlaylist = sp->AutosavePlaylist; PosSizeSave = sp->PosSizeSave; } void SaveSettingPlayer(SETTING_PLAYER *sp) { sp->InitMinimizeFlag = SetFlag(InitMinimizeFlag); sp->DebugWndStartFlag = SetFlag(DebugWndStartFlag); sp->ConsoleWndStartFlag = SetFlag(ConsoleWndStartFlag); sp->ListWndStartFlag = SetFlag(ListWndStartFlag); sp->TracerWndStartFlag = SetFlag(TracerWndStartFlag); sp->DocWndStartFlag = SetFlag(DocWndStartFlag); sp->WrdWndStartFlag = SetFlag(WrdWndStartFlag); sp->DebugWndFlag = SetFlag(DebugWndFlag); sp->ConsoleWndFlag = SetFlag(ConsoleWndFlag); sp->ListWndFlag = SetFlag(ListWndFlag); sp->TracerWndFlag = SetFlag(TracerWndFlag); sp->DocWndFlag = SetFlag(DocWndFlag); sp->WrdWndFlag = SetFlag(WrdWndFlag); sp->SoundSpecWndFlag = SetFlag(SoundSpecWndFlag); sp->SubWindowMax = SetValue(SubWindowMax,1,10); strncpy(sp->ConfigFile,ConfigFile,MAXPATH + 31); (sp->ConfigFile)[MAXPATH + 31] = '\0'; strncpy(sp->PlaylistFile,PlaylistFile,MAXPATH + 31); (sp->PlaylistFile)[MAXPATH + 31] = '\0'; strncpy(sp->PlaylistHistoryFile,PlaylistHistoryFile,MAXPATH + 31); (sp->PlaylistHistoryFile)[MAXPATH + 31] = '\0'; strncpy(sp->MidiFileOpenDir,MidiFileOpenDir,MAXPATH + 31); (sp->MidiFileOpenDir)[MAXPATH + 31] = '\0'; strncpy(sp->ConfigFileOpenDir,ConfigFileOpenDir,MAXPATH + 31); (sp->ConfigFileOpenDir)[MAXPATH + 31] = '\0'; strncpy(sp->PlaylistFileOpenDir,PlaylistFileOpenDir,MAXPATH + 31); (sp->PlaylistFileOpenDir)[MAXPATH + 31] = '\0'; sp->PlayerThreadPriority = PlayerThreadPriority; sp->GUIThreadPriority = GUIThreadPriority; sp->WrdGraphicFlag = SetFlag(WrdGraphicFlag); sp->TraceGraphicFlag = SetFlag(TraceGraphicFlag); // fonts ... sp->SystemFontSize = SystemFontSize; sp->PlayerFontSize = PlayerFontSize; sp->WrdFontSize = WrdFontSize; sp->DocFontSize = DocFontSize; sp->ListFontSize = ListFontSize; sp->TracerFontSize = TracerFontSize; strncpy(sp->SystemFont,SystemFont,255); sp->SystemFont[255] = '\0'; strncpy(sp->PlayerFont,PlayerFont,255); sp->PlayerFont[255] = '\0'; strncpy(sp->WrdFont,WrdFont,255); sp->WrdFont[255] = '\0'; strncpy(sp->DocFont,DocFont,255); DocFont[255] = '\0'; strncpy(sp->ListFont,ListFont,255); sp->ListFont[255] = '\0'; strncpy(sp->TracerFont,TracerFont,255); sp->TracerFont[255] = '\0'; sp->DocMaxSize = DocMaxSize; strncpy(sp->DocFileExt,DocFileExt,255); sp->DocFileExt[255] = '\0'; sp->PlayerLanguage = PlayerLanguage; sp->DocWndIndependent = DocWndIndependent; sp->DocWndAutoPopup = DocWndAutoPopup; sp->SeachDirRecursive = SeachDirRecursive; sp->IniFileAutoSave = IniFileAutoSave; sp->SecondMode = SecondMode; sp->AutoloadPlaylist = AutoloadPlaylist; sp->AutosavePlaylist = AutosavePlaylist; sp->PosSizeSave = PosSizeSave; } extern int set_play_mode(char *cp); extern int set_tim_opt(int c, char *optarg); extern int set_ctl(char *cp); extern int set_wrd(char *w); #if defined(__W32__) && defined(SMFCONV) extern int opt_rcpcv_dll; #endif /* SMFCONV */ extern char *wrdt_open_opts; static int is_device_output_ID(int id) { return id == 'd' || id == 'n' || id == 'e'; } #ifdef IA_W32G_SYN extern int w32g_syn_id_port[]; extern int syn_AutoStart; extern DWORD processPriority; extern DWORD syn_ThreadPriority; extern int w32g_syn_port_num; extern int volatile stream_max_compute; #endif void ApplySettingTiMidity(SETTING_TIMIDITY *st) { int i; char buffer[INI_MAXLEN]; /* Player must be stopped. * DANGER to apply settings while playing. */ amplification = SetValue(st->amplification, 0, MAX_AMPLIFICATION); antialiasing_allowed = SetFlag(st->antialiasing_allowed); if(st->buffer_fragments == -1) opt_buffer_fragments = -1; else opt_buffer_fragments = SetValue(st->buffer_fragments, 3, 1000); default_drumchannels = st->default_drumchannels; default_drumchannel_mask = st->default_drumchannel_mask; opt_modulation_wheel = SetFlag(st->opt_modulation_wheel); opt_portamento = SetFlag(st->opt_portamento); opt_nrpn_vibrato = SetFlag(st->opt_nrpn_vibrato); opt_channel_pressure = SetFlag(st->opt_channel_pressure); opt_trace_text_meta_event = SetFlag(st->opt_trace_text_meta_event); opt_overlap_voice_allow = SetFlag(st->opt_overlap_voice_allow); opt_default_mid = st->opt_default_mid; default_tonebank = st->default_tonebank; special_tonebank = st->special_tonebank; effect_lr_mode = st->effect_lr_mode; effect_lr_delay_msec = st->effect_lr_delay_msec; opt_reverb_control = st->opt_reverb_control; opt_chorus_control = st->opt_chorus_control; opt_surround_chorus = st->opt_surround_chorus; noise_sharp_type = st->noise_sharp_type; opt_evil_mode = st->opt_evil_mode; opt_tva_attack = st->opt_tva_attack; opt_tva_decay = st->opt_tva_decay; opt_tva_release = st->opt_tva_release; opt_delay_control = st->opt_delay_control; opt_default_module = st->opt_default_module; opt_lpf_def = st->opt_lpf_def; opt_drum_effect = st->opt_drum_effect; opt_modulation_envelope = st->opt_modulation_envelope; opt_pan_delay = st->opt_pan_delay; opt_eq_control = st->opt_eq_control; opt_insertion_effect = st->opt_insertion_effect; adjust_panning_immediately = SetFlag(st->adjust_panning_immediately); fast_decay = SetFlag(st->fast_decay); #ifdef SUPPORT_SOUNDSPEC view_soundspec_flag = SetFlag(st->view_soundspec_flag); spectrigram_update_sec = st->spectrigram_update_sec; #endif for(i = 0; i < MAX_CHANNELS; i++) default_program[i] = st->default_program[i]; set_ctl(st->opt_ctl); opt_realtime_playing = SetFlag(st->opt_realtime_playing); reduce_voice_threshold = st->reduce_voice_threshold; set_play_mode(st->opt_playmode); strncpy(OutputName,st->OutputName,MAXPATH); #if 0 if(OutputName[0] && !is_device_output_ID(play_mode->id_character)) play_mode->name = strdup(OutputName); // [N邩ȁH ͂Ƃ߂B #else if(OutputName[0] && !is_device_output_ID(play_mode->id_character)) play_mode->name = OutputName; #endif strncpy(w32g_output_dir,st->OutputDirName,MAXPATH); w32g_output_dir[MAXPATH-1] = '\0'; w32g_auto_output_mode = st->auto_output_mode; opt_output_rate = st->output_rate; if(st->output_rate) play_mode->rate = SetValue(st->output_rate, MIN_OUTPUT_RATE, MAX_OUTPUT_RATE); else if(play_mode->rate == 0) play_mode->rate = DEFAULT_RATE; voices = st->voices; auto_reduce_polyphony = st->auto_reduce_polyphony; quietchannels = st->quietchannels; temper_type_mute = st->temper_type_mute; if(opt_aq_max_buff) free(opt_aq_max_buff); if(opt_aq_fill_buff) free(opt_aq_fill_buff); strcpy(buffer, st->opt_qsize); opt_aq_max_buff = buffer; opt_aq_fill_buff = strchr(opt_aq_max_buff, '/'); *opt_aq_fill_buff++ = '\0'; opt_aq_max_buff = safe_strdup(opt_aq_max_buff); opt_aq_fill_buff = safe_strdup(opt_aq_fill_buff); modify_release = SetValue(st->modify_release, 0, MAX_MREL); allocate_cache_size = st->allocate_cache_size; key_adjust = st->key_adjust; opt_force_keysig = st->opt_force_keysig; opt_pure_intonation = st->opt_pure_intonation; opt_init_keysig = st->opt_init_keysig; if(output_text_code) free(output_text_code); output_text_code = safe_strdup(st->output_text_code); free_instruments_afterwards = st->free_instruments_afterwards; set_wrd(st->opt_wrd); #if defined(__W32__) && defined(SMFCONV) opt_rcpcv_dll = st->opt_rcpcv_dll; #endif /* SMFCONV */ opt_control_ratio = st->control_ratio; if(opt_control_ratio) control_ratio = SetValue(opt_control_ratio, 1, MAX_CONTROL_RATIO); else { control_ratio = play_mode->rate / CONTROLS_PER_SECOND; control_ratio = SetValue(control_ratio, 1, MAX_CONTROL_RATIO); } opt_drum_power = SetValue(st->opt_drum_power, 0, MAX_AMPLIFICATION); opt_amp_compensation = st->opt_amp_compensation; data_block_bits = st->data_block_bits; data_block_num = st->data_block_num; #ifdef IA_W32G_SYN for ( i = 0; i < MAX_PORT; i ++ ) { w32g_syn_id_port[i] = st->SynIDPort[i]; } syn_AutoStart = st->syn_AutoStart; processPriority = st->processPriority; syn_ThreadPriority = st->syn_ThreadPriority; w32g_syn_port_num = st->SynPortNum; stream_max_compute = st->SynShTime; #endif } void SaveSettingTiMidity(SETTING_TIMIDITY *st) { int i, j; st->amplification = SetValue(amplification, 0, MAX_AMPLIFICATION); st->antialiasing_allowed = SetFlag(antialiasing_allowed); st->buffer_fragments = opt_buffer_fragments; st->control_ratio = SetValue(opt_control_ratio, 0, MAX_CONTROL_RATIO); st->default_drumchannels = default_drumchannels; st->default_drumchannel_mask = default_drumchannel_mask; st->opt_modulation_wheel = SetFlag(opt_modulation_wheel); st->opt_portamento = SetFlag(opt_portamento); st->opt_nrpn_vibrato = SetFlag(opt_nrpn_vibrato); st->opt_channel_pressure = SetFlag(opt_channel_pressure); st->opt_trace_text_meta_event = SetFlag(opt_trace_text_meta_event); st->opt_overlap_voice_allow = SetFlag(opt_overlap_voice_allow); st->opt_default_mid = opt_default_mid; st->default_tonebank = default_tonebank; st->special_tonebank = special_tonebank; st->effect_lr_mode = effect_lr_mode; st->effect_lr_delay_msec = effect_lr_delay_msec; st->opt_reverb_control = opt_reverb_control; st->opt_chorus_control = opt_chorus_control; st->opt_surround_chorus = opt_surround_chorus; st->opt_tva_attack = opt_tva_attack; st->opt_tva_decay = opt_tva_decay; st->opt_tva_release = opt_tva_release; st->opt_delay_control = opt_delay_control; st->opt_default_module = opt_default_module; st->opt_lpf_def = opt_lpf_def; st->opt_drum_effect = opt_drum_effect; st->opt_modulation_envelope = opt_modulation_envelope; st->opt_pan_delay = opt_pan_delay; st->opt_eq_control = opt_eq_control; st->opt_insertion_effect = opt_insertion_effect; st->noise_sharp_type = noise_sharp_type; st->opt_evil_mode = SetFlag(opt_evil_mode); st->adjust_panning_immediately = SetFlag(adjust_panning_immediately); st->fast_decay = SetFlag(fast_decay); #ifdef SUPPORT_SOUNDSPEC st->view_soundspec_flag = SetFlag(view_soundspec_flag); st->spectrigram_update_sec = spectrigram_update_sec; #endif for(i = 0; i < MAX_CHANNELS; i++) { if(def_instr_name[0]) st->default_program[i] = SPECIAL_PROGRAM; else st->default_program[i] = default_program[i]; } j = 0; st->opt_ctl[j++] = ctl->id_character; for(i = 1; i < ctl->verbosity; i++) st->opt_ctl[j++] = 'v'; for(i = 1; i > ctl->verbosity; i--) st->opt_ctl[j++] = 'q'; if(ctl->trace_playing) st->opt_ctl[j++] = 't'; if(ctl->flags & CTLF_LIST_LOOP) st->opt_ctl[j++] = 'l'; if(ctl->flags & CTLF_LIST_RANDOM) st->opt_ctl[j++] = 'r'; if(ctl->flags & CTLF_LIST_SORT) st->opt_ctl[j++] = 's'; if(ctl->flags & CTLF_AUTOSTART) st->opt_ctl[j++] = 'a'; if(ctl->flags & CTLF_AUTOEXIT) st->opt_ctl[j++] = 'x'; if(ctl->flags & CTLF_DRAG_START) st->opt_ctl[j++] = 'd'; if(ctl->flags & CTLF_AUTOUNIQ) st->opt_ctl[j++] = 'u'; if(ctl->flags & CTLF_AUTOREFINE) st->opt_ctl[j++] = 'R'; if(ctl->flags & CTLF_NOT_CONTINUE) st->opt_ctl[j++] = 'C'; st->opt_ctl[j] = '\0'; st->opt_realtime_playing = SetFlag(opt_realtime_playing); st->reduce_voice_threshold = reduce_voice_threshold; j = 0; st->opt_playmode[j++] = play_mode->id_character; st->opt_playmode[j++] = ((play_mode->encoding & PE_MONO) ? 'M' : 'S'); st->opt_playmode[j++] = ((play_mode->encoding & PE_SIGNED) ? 's' : 'u'); if (play_mode->encoding & PE_24BIT) {st->opt_playmode[j++] = '2';} else if (play_mode->encoding & PE_16BIT) {st->opt_playmode[j++] = '1';} else {st->opt_playmode[j++] = '8';} if(play_mode->encoding & PE_ULAW) st->opt_playmode[j++] = 'U'; else if(play_mode->encoding & PE_ALAW) st->opt_playmode[j++] = 'A'; else st->opt_playmode[j++] = 'l'; if(play_mode->encoding & PE_BYTESWAP) st->opt_playmode[j++] = 'x'; st->opt_playmode[j] = '\0'; strncpy(st->OutputName,OutputName,sizeof(st->OutputName)-1); strncpy(st->OutputDirName,w32g_output_dir,MAXPATH); st->OutputDirName[MAXPATH-1] = '\0'; st->auto_output_mode = w32g_auto_output_mode; st->voices = voices; st->auto_reduce_polyphony = auto_reduce_polyphony; st->quietchannels = quietchannels; st->temper_type_mute = temper_type_mute; snprintf(st->opt_qsize,sizeof(st->opt_qsize),"%s/%s", opt_aq_max_buff,opt_aq_fill_buff); st->modify_release = SetValue(modify_release, 0, MAX_MREL); st->allocate_cache_size = allocate_cache_size; st->opt_drum_power = SetValue(opt_drum_power, 0, MAX_AMPLIFICATION); st->opt_amp_compensation = opt_amp_compensation; st->key_adjust = key_adjust; st->opt_force_keysig = opt_force_keysig; st->opt_pure_intonation = opt_pure_intonation; st->opt_init_keysig = opt_init_keysig; st->output_rate = opt_output_rate; if(st->output_rate == 0) { st->output_rate = play_mode->rate; if(st->output_rate == 0) st->output_rate = DEFAULT_RATE; } st->output_rate = SetValue(st->output_rate,MIN_OUTPUT_RATE,MAX_OUTPUT_RATE); strncpy(st->output_text_code,output_text_code,sizeof(st->output_text_code)-1); st->free_instruments_afterwards = free_instruments_afterwards; st->opt_wrd[0] = wrdt->id; if(wrdt_open_opts) strncpy(st->opt_wrd + 1, wrdt_open_opts, sizeof(st->opt_wrd) - 2); else st->opt_wrd[1] = '\0'; #if defined(__W32__) && defined(SMFCONV) st->opt_rcpcv_dll = opt_rcpcv_dll; #endif /* SMFCONV */ st->data_block_bits = data_block_bits; st->data_block_num = data_block_num; #ifdef IA_W32G_SYN for ( i = 0; i < MAX_PORT; i ++ ) { st->SynIDPort[i] = w32g_syn_id_port[i]; } st->syn_AutoStart = syn_AutoStart; st->processPriority = processPriority; st->syn_ThreadPriority = syn_ThreadPriority; st->SynPortNum = w32g_syn_port_num; st->SynShTime = stream_max_compute; #endif } //****************************************************************************/ // ini & config static char S_IniFile[MAXPATH + 32]; static char S_timidity_window_inifile[MAXPATH + 32]; static char S_timidity_output_inifile[MAXPATH + 32]; static char S_ConfigFile[MAXPATH + 32]; static char S_PlaylistFile[MAXPATH + 32]; static char S_PlaylistHistoryFile[MAXPATH + 32]; static char S_MidiFileOpenDir[MAXPATH + 32]; static char S_ConfigFileOpenDir[MAXPATH + 32]; static char S_PlaylistFileOpenDir[MAXPATH + 32]; static char S_DocFileExt[256]; static char S_OutputName[MAXPATH + 32]; static char *OutputName; static char S_w32g_output_dir[1024 + 32]; static char S_SystemFont[256]; static char S_PlayerFont[256]; static char S_WrdFont[256]; static char S_DocFont[256]; static char S_ListFont[256]; static char S_TracerFont[256]; static char *SystemFont = S_SystemFont; char *PlayerFont = S_PlayerFont; static char *WrdFont = S_WrdFont; static char *DocFont = S_DocFont; static char *ListFont = S_ListFont; static char *TracerFont = S_TracerFont; //static HFONT hSystemFont = 0; //static HFONT hPlayerFont = 0; //static HFONT hWrdFont = 0; //static HFONT hDocFont = 0; //static HFONT hListFont = 0; //static HFONT hTracerFont = 0; static int SystemFontSize = 9; static int PlayerFontSize = 16; static int WrdFontSize = 16; static int DocFontSize = 16; static int ListFontSize = 16; static int TracerFontSize = 16; #define DEFAULT_DOCFILEEXT "doc;txt;hed" SETTING_PLAYER *sp_default, *sp_current, *sp_temp; SETTING_TIMIDITY *st_default, *st_current, *st_temp; char *timidity_window_inifile; char *timidity_output_inifile; #ifdef AU_GOGO extern int gogo_ConfigDialogInfoInit(void); extern int gogo_ConfigDialogInfoSaveINI(void); extern int gogo_ConfigDialogInfoLoadINI(void); #endif #ifdef AU_VORBIS extern int vorbis_ConfigDialogInfoInit(void); extern int vorbis_ConfigDialogInfoSaveINI(void); extern int vorbis_ConfigDialogInfoLoadINI(void); #endif void w32g_initialize(void) { char buffer[MAXPATH + 1024]; char *p; hInst = GetModuleHandle(0); IniFile = S_IniFile; ConfigFile = S_ConfigFile; PlaylistFile = S_PlaylistFile; PlaylistHistoryFile = S_PlaylistHistoryFile; MidiFileOpenDir = S_MidiFileOpenDir; ConfigFileOpenDir = S_ConfigFileOpenDir; PlaylistFileOpenDir = S_PlaylistFileOpenDir; DocFileExt = S_DocFileExt; OutputName = S_OutputName; w32g_output_dir = S_w32g_output_dir; IniFile[0] = '\0'; ConfigFile[0] = '\0'; PlaylistFile[0] = '\0'; PlaylistHistoryFile[0] = '\0'; MidiFileOpenDir[0] = '\0'; ConfigFileOpenDir[0] = '\0'; PlaylistFileOpenDir[0] = '\0'; OutputName[0] = '\0'; w32g_output_dir[0] = '\0'; strcpy(DocFileExt,DEFAULT_DOCFILEEXT); strcpy(SystemFont,"lr "); strcpy(PlayerFont,"lr "); strcpy(WrdFont,"lr "); strcpy(DocFont,"lr "); strcpy(ListFont,"lr "); strcpy(TracerFont,"lr "); if(GetModuleFileName(hInst, buffer, MAXPATH)) { if((p = pathsep_strrchr(buffer)) != NULL) { p++; *p = '\0'; } else { buffer[0] = '.'; buffer[1] = PATH_SEP; buffer[2] = '\0'; } } else { buffer[0] = '.'; buffer[1] = PATH_SEP; buffer[2] = '\0'; } // timpp32g.ini strncpy(IniFile, buffer, MAXPATH); IniFile[MAXPATH] = '\0'; strcat(IniFile,"timpp32g.ini"); // timidity_window.ini timidity_window_inifile = S_timidity_window_inifile; strncpy(timidity_window_inifile, buffer, 200); timidity_window_inifile[200] = '\0'; strcat(timidity_window_inifile,"timidity_window.ini"); // timidity_output.ini timidity_output_inifile = S_timidity_output_inifile; strncpy(timidity_output_inifile, buffer, 200); timidity_output_inifile[200] = '\0'; strcat(timidity_output_inifile,"timidity_output.ini"); // default playlist strncpy(DefaultPlaylistPath, buffer, 200); DefaultPlaylistPath[200] = '\0'; strcat(DefaultPlaylistPath,DefaultPlaylistName); // st_default = (SETTING_TIMIDITY *)safe_malloc(sizeof(SETTING_TIMIDITY)); sp_default = (SETTING_PLAYER *)safe_malloc(sizeof(SETTING_PLAYER)); st_current = (SETTING_TIMIDITY *)safe_malloc(sizeof(SETTING_TIMIDITY)); sp_current = (SETTING_PLAYER *)safe_malloc(sizeof(SETTING_PLAYER)); st_temp = (SETTING_TIMIDITY *)safe_malloc(sizeof(SETTING_TIMIDITY)); sp_temp = (SETTING_PLAYER *)safe_malloc(sizeof(SETTING_PLAYER)); { DWORD dwRes; #ifdef AU_GOGO gogo_ConfigDialogInfoInit(); #endif #ifdef AU_VORBIS vorbis_ConfigDialogInfoInit(); #endif dwRes = GetFileAttributes(timidity_output_inifile); if(dwRes==0xFFFFFFFF || dwRes & FILE_ATTRIBUTE_DIRECTORY){ #ifdef AU_GOGO gogo_ConfigDialogInfoSaveINI(); #endif #ifdef AU_VORBIS vorbis_ConfigDialogInfoSaveINI(); #endif } else { #ifdef AU_GOGO gogo_ConfigDialogInfoLoadINI(); #endif #ifdef AU_VORBIS vorbis_ConfigDialogInfoLoadINI(); #endif } } SaveSettingPlayer(sp_current); SaveSettingTiMidity(st_current); if(IniVersionCheck()) { LoadIniFile(sp_current, st_current); ApplySettingPlayer(sp_current); ApplySettingTiMidity(st_current); w32g_has_ini_file = 1; } else { sprintf(buffer, "Ini file is not found, or old format is found.\n" "Do you want to initialize the ini file?\n\n" "Ini file path: %s", IniFile); if(MessageBox(0, buffer, "TiMidity Notice", MB_YESNO) == IDYES) { SaveIniFile(sp_current, st_current); w32g_has_ini_file = 1; } else { w32g_has_ini_file = 0; } } memcpy(sp_default, sp_current, sizeof(SETTING_PLAYER)); memcpy(st_default, st_current, sizeof(SETTING_TIMIDITY)); memcpy(sp_temp, sp_current, sizeof(SETTING_PLAYER)); memcpy(st_temp, st_current, sizeof(SETTING_TIMIDITY)); wrdt=wrdt_list[0]; #ifndef IA_W32G_SYN w32g_i_init(); #endif } int IniVersionCheck(void) { char version[INI_MAXLEN]; if(IniGetKeyStringN(INI_SEC_PLAYER,"IniVersion",version,sizeof(version)-1) == 0 && strcmp(version, IniVersion) == 0) return 1; // UnChanged return 0; } void BitBltRect(HDC dst, HDC src, RECT *rc) { BitBlt(dst, rc->left, rc->top, rc->right - rc->left, rc->bottom - rc->top, src, rc->left, rc->top, SRCCOPY); } #if 0 /* * TmColor */ TmColors tm_colors[TMCC_SIZE]; static COLORREF WeakHalfColor(COLORREF fc, COLORREF bc) { return fc*1/3 + bc*2/3; } static COLORREF HalfColor(COLORREF fc, COLORREF bc) { return fc*1/6 + bc*5/6; } void TmInitColor(void) { int i; tm_colors[TMCC_BLACK].color = TMCCC_BLACK; tm_colors[TMCC_WHITE].color = TMCCC_WHITE; tm_colors[TMCC_RED].color = TMCCC_RED; tm_colors[TMCC_BACK].color = TMCCC_BACK; tm_colors[TMCC_LOW].color = TMCCC_LOW; tm_colors[TMCC_MIDDLE].color= TMCCC_MIDDLE; tm_colors[TMCC_HIGH].color = TMCCC_HIGH; tm_colors[TMCC_FORE_HALF].color = HalfColor(TMCCC_FORE,TMCCC_BACK); tm_colors[TMCC_FORE_WEAKHALF].color = WeakHalfColor(TMCCC_FORE,TMCCC_BACK); tm_colors[TMCC_LOW_HALF].color = HalfColor(TMCCC_LOW,TMCCC_BACK); tm_colors[TMCC_MIDDLE_HALF].color = HalfColor(TMCCC_MIDDLE,TMCCC_BACK); tm_colors[TMCC_HIGH_HALF].color = HalfColor(TMCCC_HIGH,TMCCC_BACK); for(i = 0; i < TMCC_SIZE; i++) { tm_colors[i].pen = CreatePen(PS_SOLID, 1, tm_colors[i].color); tm_colors[i].brush = CreateSolidBrush(tm_colors[i].color); } } void TmFreeColor(void) { int i; for(i = 0; i < TMCC_SIZE; i++) { if(tm_colors[i].pen != NULL) { DeleteObject(tm_colors[i].pen); DeleteObject(tm_colors[i].brush); tm_colors[i].pen = NULL; } } } void TmFillRect(HDC hdc, RECT *rc, int color) { HPEN hPen = tm_colors[color].pen; HBRUSH hBrush = tm_colors[color].brush; HGDIOBJ hgdiobj_hpen, hgdiobj_hbrush; hgdiobj_hpen = SelectObject(hdc, hPen); hgdiobj_hbrush = SelectObject(hdc, hBrush); Rectangle(hdc, rc->left, rc->top, rc->right, rc->bottom); SelectObject(hdc, hgdiobj_hpen); SelectObject(hdc, hgdiobj_hbrush); } #endif #ifndef S_ISDIR #define S_ISDIR(mode) (((mode)&0xF000) == 0x4000) #endif /* S_ISDIR */ int is_directory(char *path) { struct stat st; if(*path == '@') /* special identifire for playlist file */ return 0; if(stat(path, &st) != -1) return S_ISDIR(st.st_mode); return GetFileAttributes(path) == FILE_ATTRIBUTE_DIRECTORY; } /* Return: 0: - not modified * 1: - modified */ int directory_form(char *buffer) { int len; len = strlen(buffer); if(len == 0 || buffer[len - 1] == PATH_SEP) return 0; if(IS_PATH_SEP(buffer[len - 1])) len--; buffer[len++] = PATH_SEP; buffer[len] = '\0'; return 1; } /* Return: 0: - not modified * 1: - modified */ int nodirectory_form(char *buffer) { char *lastp = buffer + strlen(buffer); char *p = lastp; while(p > buffer && IS_PATH_SEP(*(p - 1))) p--; if(p == lastp) return 0; *p = '\0'; return 1; } void SettingCtlFlag(SETTING_TIMIDITY *st, int c, int onoff) { int n; char *opt; opt = st->opt_ctl + 1; n = strlen(opt); if(onoff) { if(strchr(opt, c) != NULL) return; /* Already set */ opt[n++] = c; opt[n] = '\0'; } else { char *p; if((p = strchr(opt, c)) == NULL) return; /* Already removed */ while(*(p + 1)) { *p = *(p + 1); p++; } *p = '\0'; } } int IsAvailableFilename(char *filename) { char *p = strrchr(filename,'.'); if(p == NULL) return 0; if( strcasecmp(p,".lzh")==0 || strcasecmp(p,".zip")==0 || strcasecmp(p,".gz")==0 || strcasecmp(p,".mid")==0 || strcasecmp(p,".rcp")==0 || strcasecmp(p,".r36")==0 || strcasecmp(p,".g18")==0 || strcasecmp(p,".g36")==0 || strcasecmp(p,".mod")==0 || // strcasecmp(p,".hqx")==0 || strcasecmp(p,".tar")==0 || strcasecmp(p,".tgz")==0 || strcasecmp(p,".lha")==0 || strcasecmp(p,".mime")==0 || strcasecmp(p,".smf")==0) return 1; // if(url_check_type(filename)!=-1) // return 1; return 0; } /* ScanDirectoryFiles() works like UNIX find. */ #define SCANDIR_MAX_DEPTH 32 void ScanDirectoryFiles(char *basedir, int (* file_proc)(char *pathname, /* (const) */ void *user_val), void *user_val) { char baselen; URL dir; static int depth = 0; static int stop_flag; /* Stop scanning if true */ static int error_disp; /* Whether error is displayed or not */ static char pathbuf[MAXPATH]; /* pathname buffer */ if(depth == 0) /* Initialize variables at first recursive */ { stop_flag = 0; error_disp = 0; strcpy(pathbuf, basedir); } else if(depth > SCANDIR_MAX_DEPTH) /* Avoid infinite recursive */ { if(!error_disp) { /* Display this message at once */ ctl->cmsg(CMSG_WARNING, VERB_NORMAL, "%s: Directory is too deep", basedir); error_disp = 1; } return; /* Skip scanning this directory */ } directory_form(pathbuf); baselen = strlen(pathbuf); if(baselen > sizeof(pathbuf) - 16) { /* Ignore too long file name */ return; } if((dir = url_dir_open(pathbuf)) == NULL) { ctl->cmsg(CMSG_ERROR, VERB_NORMAL, "%s: Can't open directory", pathbuf); return; } if(file_proc(pathbuf, user_val)) { stop_flag = 1; /* Terminate */ return; } while(!stop_flag && url_gets(dir, pathbuf + baselen, sizeof(pathbuf) - baselen - 1)) { if(strcmp(pathbuf + baselen, ".") == 0 || strcmp(pathbuf + baselen, "..") == 0) continue; if(file_proc(pathbuf, user_val)) { stop_flag = 1; /* Terminate */ break; } if(is_directory(pathbuf)) { /* into subdirectory */ depth++; ScanDirectoryFiles(pathbuf, file_proc, user_val); depth--; } } url_close(dir); } #define EXPANDDIR_MAX_SIZE 100000 /* Limit of total bytes of the file names */ static int expand_dir_proc(char *filename, void *v) { void **user_val = (void **)v; StringTable *st = (StringTable *)user_val[0]; int *total_size = (int *)user_val[1]; char *startdir = (char *)user_val[2]; if(IsAvailableFilename(filename)) { if(*total_size > EXPANDDIR_MAX_SIZE) { ctl->cmsg(CMSG_ERROR, VERB_NORMAL, "%s: There are too many files.", startdir); return 1; /* Terminate */ } put_string_table(st, filename, strlen(filename)); *total_size += strlen(filename); } return 0; } char **FilesExpandDir(int *p_nfiles, char **files) { StringTable st; int i; init_string_table(&st); for(i = 0; i < *p_nfiles; i++) { void *user_val[3]; int total_size; total_size = 0; user_val[0] = &st; user_val[1] = &total_size; user_val[2] = files[i]; if(is_directory(files[i])) ScanDirectoryFiles(files[i], expand_dir_proc, user_val); else { int len = strlen(files[i]); put_string_table(&st, files[i], len); } } *p_nfiles = st.nstring; return make_string_array(&st); } #ifndef IA_W32G_SYN int w32gLoadDefaultPlaylist(void) { if(AutoloadPlaylist) { w32g_lock_open_file = 1; w32g_send_rc(RC_EXT_LOAD_PLAYLIST, (int32)DefaultPlaylistPath); } return 0; } int w32gSaveDefaultPlaylist(void) { if(AutosavePlaylist) { w32g_lock_open_file = 1; w32g_send_rc(RC_EXT_SAVE_PLAYLIST, (int32)DefaultPlaylistPath); } return 0; } #endif #ifndef WIN32GCC static char *get_filename(char *src, char *dest) { char *p = src; char *start = NULL; int quot_flag = 0; if(p == NULL) return NULL; for(;;){ if(*p != ' ' && *p != '\0' && start == NULL) start = p; if(*p == '\'' || *p == '\"'){ if(quot_flag){ if(p - start != 0) strncpy(dest, start, p - start); dest[p-start] = '\0'; p++; return p; } else { quot_flag = !quot_flag; p++; start = p; continue; } } if(*p == '\0' || (*p == ' ' && !quot_flag)){ if(start == NULL) return NULL; if(p - start != 0) strncpy(dest, start, p - start); dest[p-start] = '\0'; if(*p != '\0') p++; return p; } p++; } } void CmdLineToArgv(LPSTR lpCmdLine, int *pArgc, CHAR ***pArgv) { LPSTR p = lpCmdLine , buffer, lpsRes; int i, max = -1, inc = 16; int buffer_size; *pArgv = NULL; buffer_size = strlen(lpCmdLine) + 1024; // buffer = safe_malloc(sizeof(CHAR) * buffer_size + 1); buffer = (LPSTR)malloc(sizeof(CHAR) * buffer_size + 1); strcpy(buffer, lpCmdLine); for(i=0;;i++) { if(i > max){ max += inc; // *pArgv = (CHAR **)safe_realloc(*pArgv, sizeof(CHAR *) * (max + 1)); *pArgv = (CHAR **)realloc(*pArgv, sizeof(CHAR *) * (max + 2)); } if(i==0){ GetModuleFileName(NULL,buffer,buffer_size); lpsRes = p; } else lpsRes = get_filename(p,buffer); if(lpsRes != NULL){ // (*pArgv)[i] = (CHAR *)safe_malloc(sizeof(CHAR) * strlen(buffer) + 1); (*pArgv)[i] = (CHAR *)malloc(sizeof(CHAR) * strlen(buffer) + 1); strcpy((*pArgv)[i],buffer); p = lpsRes; } else { *pArgc = i; free(buffer); return; } } } #endif /* !WIN32GCC */ TiMidity++-2.13.2/interface/w32g_utl.h0100644004711200001440000002006310012633345016452 0ustar tamukiusers/* TiMidity++ -- MIDI to WAVE converter and player Copyright (C) 1999-2002 Masanao Izumo Copyright (C) 1995 Tuukka Toivonen 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef ___W32G_UTL_H_ #define ___W32G_UTL_H_ #ifdef IA_W32G_SYN #ifndef MAX_PORT #define MAX_PORT 4 #endif #endif // ini & config #define IniVersion "2.2" typedef struct SETTING_PLAYER_ { // Main Window int InitMinimizeFlag; // SubWindow Starting Create Flag int DebugWndStartFlag; int ConsoleWndStartFlag; int ListWndStartFlag; int TracerWndStartFlag; int DocWndStartFlag; int WrdWndStartFlag; // SubWindow Starting Valid Flag int DebugWndFlag; int ConsoleWndFlag; int ListWndFlag; int TracerWndFlag; int DocWndFlag; int WrdWndFlag; int SoundSpecWndFlag; // SubWindow Max Numer int SubWindowMax; // Default File char ConfigFile[MAXPATH + 32]; char PlaylistFile[MAXPATH + 32]; char PlaylistHistoryFile[MAXPATH + 32]; // Default Dir char MidiFileOpenDir[MAXPATH + 32]; char ConfigFileOpenDir[MAXPATH + 32]; char PlaylistFileOpenDir[MAXPATH + 32]; // Thread Priority int PlayerThreadPriority; int GUIThreadPriority; // Font char SystemFont[256]; char PlayerFont[256]; char WrdFont[256]; char DocFont[256]; char ListFont[256]; char TracerFont[256]; int SystemFontSize; int PlayerFontSize; int WrdFontSize; int DocFontSize; int ListFontSize; int TracerFontSize; // Misc. int WrdGraphicFlag; int TraceGraphicFlag; int DocMaxSize; char DocFileExt[256]; // End. int PlayerLanguage; int DocWndIndependent; int DocWndAutoPopup; int SeachDirRecursive; int IniFileAutoSave; int SecondMode; int AutoloadPlaylist; int AutosavePlaylist; int PosSizeSave; char DefaultPlaylistName[256]; // End. } SETTING_PLAYER; typedef struct SETTING_TIMIDITY_ { // Parameter from command line options. int32 amplification; // A int antialiasing_allowed; // a int buffer_fragments; // B int32 control_ratio; // C // c (ignore) ChannelBitMask default_drumchannels, default_drumchannel_mask; // D // d (ignore) // E... int opt_modulation_wheel; // E w/W int opt_portamento; // E p/P int opt_nrpn_vibrato; // E v/V int opt_channel_pressure; // E s/S int opt_trace_text_meta_event; // E t/T int opt_overlap_voice_allow;// E o/O int opt_default_mid; // E mXX int default_tonebank; // E b int special_tonebank; // E B int effect_lr_mode; // E Fdelay int effect_lr_delay_msec; // E Fdelay int opt_reverb_control; // E Freverb int opt_chorus_control; // E Fchorus int noise_sharp_type; // E Fns int opt_surround_chorus; // E ? int opt_tva_attack; // E ? int opt_tva_decay; // E ? int opt_tva_release; // E ? int opt_delay_control; // E ? int opt_default_module; // --module int opt_lpf_def; // E ? int opt_drum_effect; // E ? int opt_modulation_envelope; // E ? int opt_pan_delay; // E ? int opt_eq_control; // E ? int opt_insertion_effect; // E ? int opt_evil_mode; // e int adjust_panning_immediately; // F int fast_decay; // f #ifdef SUPPORT_SOUNDSPEC int view_soundspec_flag; // g double spectrogram_update_sec; // g #endif // h (ignore) int default_program[MAX_CHANNELS]; // I char opt_ctl[30]; // i int opt_realtime_playing; // j int reduce_voice_threshold; // k // L (ignore) char opt_playmode[16]; // O char OutputName[MAXPATH + 32]; // o : string char OutputDirName[MAXPATH + 32]; // o : string int auto_output_mode; // P (ignore) int voices; // p int auto_reduce_polyphony; // pa ChannelBitMask quietchannels; // Q int temper_type_mute; // Q char opt_qsize[16]; // q int32 modify_release; // R int32 allocate_cache_size; // S int32 opt_drum_power; // ? int32 opt_amp_compensation; // ? int key_adjust; // K int8 opt_force_keysig; // H int opt_pure_intonation; // Z int8 opt_init_keysig; // Z int output_rate; // s char output_text_code[16]; // t int free_instruments_afterwards; // U char opt_wrd[16]; // W #if defined(__W32__) && defined(SMFCONV) int opt_rcpcv_dll; // wr, wR #endif // x (ignore) // Z (ignore) /* for w32g_a.c */ int data_block_bits; int data_block_num; //?? int waveout_data_block_size; #ifdef IA_W32G_SYN int SynIDPort[MAX_PORT]; int syn_AutoStart; DWORD processPriority; DWORD syn_ThreadPriority; int SynPortNum; int SynShTime; #endif } SETTING_TIMIDITY; // #### obsoleted #define PLAYERMODE_AUTOQUIT 0x0001 #define PLAYERMODE_AUTOREFINE 0x0002 #define PLAYERMODE_AUTOUNIQ 0x0004 #define PLAYERMODE_NOT_CONTINUE 0x0008 #define PLAYERMODE_NOT_DRAG_START 0x0010 extern char *OutputName; extern void LoadIniFile(SETTING_PLAYER *sp, SETTING_TIMIDITY *st); extern void SaveIniFile(SETTING_PLAYER *sp, SETTING_TIMIDITY *st); extern SETTING_PLAYER *sp_default, *sp_current, *sp_temp; extern SETTING_TIMIDITY *st_default, *st_current, *st_temp; extern CHAR *INI_INVALID; extern CHAR *INI_SEC_PLAYER; extern CHAR *INI_SEC_TIMIDITY; extern char *SystemFont; extern char *PlayerFont; extern char *WrdFont; extern char *DocFont; extern char *ListFont; extern char *TracerFont; extern HFONT hSystemFont; extern HFONT hPlayerFont; extern HFONT hWrdFont; extern HFONT hDocFont; extern HFONT hListFont; extern HFONT hTracerFont; extern int SystemFontSize; extern int PlayerFontSize; extern int WrdFontSize; extern int DocFontSize; extern int ListFontSize; extern int TracerFontSize; extern int IniGetKeyInt32(char *section, char *key,int32 *n); extern int IniGetKeyInt32Array(char *section, char *key, int32 *n, int arraysize); extern int IniGetKeyInt(char *section, char *key, int *n); extern int IniGetKeyInt8(char *section, char *key, int8 *n); extern int IniGetKeyChar(char *section, char *key, char *c); extern int IniGetKeyIntArray(char *section, char *key, int *n, int arraysize); extern int IniGetKeyString(char *section, char *key,char *str); extern int IniGetKeyStringN(char *section, char *key,char *str, int size); extern int IniGetKeyFloat(char *section, char *key, FLOAT_T *n); extern int IniPutKeyInt32(char *section, char *key,int32 *n); extern int IniPutKeyInt32Array(char *section, char *key, int32 *n, int arraysize); extern int IniPutKeyInt(char *section, char *key, int *n); extern int IniPutKeyInt8(char *section, char *key, int8 *n); extern int IniPutKeyChar(char *section, char *key, char *c); extern int IniPutKeyIntArray(char *section, char *key, int *n, int arraysize); extern int IniPutKeyString(char *section, char *key, char *str); extern int IniPutKeyStringN(char *section, char *key, char *str, int size); extern int IniPutKeyFloat(char *section, char *key, FLOAT_T n); extern void ApplySettingPlayer(SETTING_PLAYER *sp); extern void SaveSettingPlayer(SETTING_PLAYER *sp); extern void ApplySettingTiMidity(SETTING_TIMIDITY *st); extern void SaveSettingTiMidity(SETTING_TIMIDITY *st); extern void SettingCtlFlag(SETTING_TIMIDITY *st, int opt_id, int onoff); extern int IniVersionCheck(void); extern void BitBltRect(HDC dst, HDC src, RECT *rc); #if 0 extern TmColors tm_colors[ /* TMCC_SIZE */ ]; #define TmCc(c) (tm_colors[c].color) extern void TmInitColor(void); extern void TmFreeColor(void); extern void TmFillRect(HDC hdc, RECT *rc, int color); #endif extern void w32g_initialize(void); extern int is_directory(char *path); extern int directory_form(char *path_in_out); extern char *timidity_window_inifile; extern char *timidity_output_inifile; #endif /* ___W32G_UTL_H_ */ TiMidity++-2.13.2/interface/w32g_ut2.c0100644004711200001440000005756210026457501016374 0ustar tamukiusers/* TiMidity++ -- MIDI to WAVE converter and player Copyright (C) 1999-2002 Masanao Izumo Copyright (C) 1995 Tuukka Toivonen 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ #include #include #include #include #include #include "timidity.h" #include "common.h" #include "instrum.h" #include "playmidi.h" #include "readmidi.h" #include "output.h" #include "controls.h" #include "recache.h" #ifdef SUPPORT_SOUNDSPEC #include "soundspec.h" #endif /* SUPPORT_SOUNDSPEC */ #include "wrd.h" #include "w32g.h" #include "w32g_ut2.h" char *timidity_window_inifile; // **************************************************************************** // DlgChooseFont // hwnd: Owner Window of This Dialog // hwndFontChange: Window to Change Font // hFontPre: Previous Font of hwndFontChange (Call CloseHandle()) int DlgChooseFontAndApply(HWND hwnd, HWND hwndFontChange, HFONT hFontPre, char *fontname, int *fontheight, int *fontwidth) { LOGFONT lf; CHOOSEFONT cf; HFONT hFont; memset(&lf,0,sizeof(LOGFONT)); memset(&cf,0,sizeof(CHOOSEFONT)); // lf.lfHeight = 16; // lf.lfWidth = 8; strcpy(lf.lfFaceName,"lr "); cf.lStructSize = sizeof(CHOOSEFONT); cf.hwndOwner = hwnd; // cf.hDC = NULL; cf.lpLogFont = &lf; // cf.iPointSize = 16; // cf.Flags = CF_ANSIONLY | CF_FORCEFONTEXIST ; cf.Flags = CF_SCREENFONTS | CF_INITTOLOGFONTSTRUCT;; // cf.rgbColors = RGB(0,0,0); // cf.lCustData = NULL; // cf.lpfnHook = NULL; // cf.lpTemplateName = NULL; // cf.hInstance = 0; // cf.lpszStyle = NULL; cf.nFontType = SCREEN_FONTTYPE; // cf.nSizeMin = 4; // cf.nSizeMax = 72; ChooseFont(&cf); // if(ChooseFont(&cf)==TRUE) // return -1; if(hFontPre!=NULL) CloseHandle(hFontPre); hFont = CreateFontIndirect(&lf); SendMessage(hwndFontChange,WM_SETFONT,(WPARAM)hFont,(LPARAM)MAKELPARAM(TRUE,0)); if(fontname!=NULL) strcpy(fontname,lf.lfFaceName); if(fontheight!=NULL) *fontheight = lf.lfHeight; if(fontwidth!=NULL) *fontwidth = lf.lfWidth; return 0; } int DlgChooseFont(HWND hwnd, char *fontName, int *fontHeight, int *fontWidth) { LOGFONT lf; CHOOSEFONT cf; memset(&lf,0,sizeof(LOGFONT)); if(fontHeight!=NULL) lf.lfHeight = *fontHeight; if(fontWidth!=NULL) lf.lfWidth = *fontWidth; if(fontName!=NULL) strcpy(lf.lfFaceName,fontName); memset(&cf,0,sizeof(CHOOSEFONT)); cf.lStructSize = sizeof(CHOOSEFONT); cf.hwndOwner = hwnd; // cf.hDC = NULL; cf.lpLogFont = &lf; // cf.iPointSize = 16; // cf.Flags = CF_ANSIONLY | CF_FORCEFONTEXIST ; cf.Flags = CF_ANSIONLY | CF_SCREENFONTS | CF_INITTOLOGFONTSTRUCT; // cf.rgbColors = RGB(0,0,0); // cf.lCustData = NULL; // cf.lpfnHook = NULL; // cf.lpTemplateName = NULL; // cf.hInstance = 0; // cf.lpszStyle = NULL; cf.nFontType = SCREEN_FONTTYPE; // cf.nSizeMin = 4; // cf.nSizeMax = 72; if(ChooseFont(&cf)!=TRUE) return -1; if(fontName!=NULL) strcpy(fontName,lf.lfFaceName); if(fontHeight!=NULL) *fontHeight = abs(lf.lfHeight); if(fontWidth!=NULL) *fontWidth = lf.lfWidth; return 0; } /**********************************************************************/ void SetWindowPosSize ( HWND parent_hwnd, HWND hwnd, int x, int y ) { RECT rc1, rc2; int width1, height1; int width2, height2; if ( GetWindowRect ( hwnd, &rc1 ) ) { width1 = rc1.right - rc1.left; height1 = rc1.bottom - rc1.top; if ( x >= 0 ) { rc1.right = rc1.right - rc1.left + x; rc1.left = x; } else { // rc1.right = rc1.right - rc1.left; // rc1.left = 0; } if ( y >= 0 ) { rc1.bottom = rc1.bottom - rc1.top + y; rc1.top = y; } else { // rc1.bottom = rc1.bottom - rc1.top; // rc1.top = 0; } if ( GetClientRect ( parent_hwnd, &rc2 ) ) { width2 = rc2.right - rc2.left; height2 = rc2.bottom - rc2.top; if ( rc1.left < rc2.left ) rc1.left = rc2.left; if ( rc1.left > rc2.right ) rc1.left = rc2.right; if ( rc1.top < rc2.top ) rc1.top = rc2.top; if ( rc1.top > rc2.bottom ) rc1.top = rc2.bottom; if ( width1 > width2 ) width1 = width2; if ( height1 > height2 ) height1 = height2; MoveWindow ( hwnd, rc1.left, rc1.top, width1, height1, TRUE ); } } } /**********************************************************************/ BOOL PosSizeSave = TRUE; #define SEC_MAINWND "MainWnd" int INISaveMainWnd(void) { char *section = SEC_MAINWND; char *inifile = TIMIDITY_WINDOW_INI_FILE; char buffer[256]; if ( PosSizeSave ) { sprintf(buffer,"%d",MainWndInfo.PosX); if ( MainWndInfo.PosX >= 0 || MainWndInfo.PosY >= 0 ) { if ( MainWndInfo.PosX < 0 ) MainWndInfo.PosX = 0; if ( MainWndInfo.PosY < 0 ) MainWndInfo.PosY = 0; } if ( MainWndInfo.PosX >= 0 ) WritePrivateProfileString(section,"PosX",buffer,inifile); sprintf(buffer,"%d",MainWndInfo.PosY); if ( MainWndInfo.PosY >= 0 ) WritePrivateProfileString(section,"PosY",buffer,inifile); } sprintf(buffer,"%d",MainWndInfo.CanvasMode); WritePrivateProfileString(section,"CanvasMode",buffer,inifile); WritePrivateProfileString(NULL,NULL,NULL,inifile); // Write Flush return 0; } int INILoadMainWnd(void) { char *section = SEC_MAINWND; char *inifile = TIMIDITY_WINDOW_INI_FILE; int num; num = GetPrivateProfileInt(section,"PosX",-1,inifile); MainWndInfo.PosX = num; num = GetPrivateProfileInt(section,"PosY",-1,inifile); MainWndInfo.PosY = num; num = GetPrivateProfileInt(section,"CanvasMode",-1,inifile); MainWndInfo.CanvasMode = num; return 0; } #define SEC_LISTWND "ListWnd" int INISaveListWnd(void) { char *section = SEC_LISTWND; char *inifile = TIMIDITY_WINDOW_INI_FILE; char buffer[256]; if ( PosSizeSave ) { if ( ListWndInfo.PosX >= 0 || ListWndInfo.PosY >= 0 ) { if ( ListWndInfo.PosX < 0 ) ListWndInfo.PosX = 0; if ( ListWndInfo.PosY < 0 ) ListWndInfo.PosY = 0; } sprintf(buffer,"%d",ListWndInfo.PosX); if ( ListWndInfo.PosX >= 0 ) WritePrivateProfileString(section,"PosX",buffer,inifile); sprintf(buffer,"%d",ListWndInfo.PosY); if ( ListWndInfo.PosY >= 0 ) WritePrivateProfileString(section,"PosY",buffer,inifile); sprintf(buffer,"%d",ListWndInfo.Width); WritePrivateProfileString(section,"Width",buffer,inifile); sprintf(buffer,"%d",ListWndInfo.Height); WritePrivateProfileString(section,"Height",buffer,inifile); } WritePrivateProfileString(section,"fontNameEN",ListWndInfo.fontNameEN,inifile); WritePrivateProfileString(section,"fontNameJA",ListWndInfo.fontNameJA,inifile); sprintf(buffer,"%d",ListWndInfo.fontWidth); WritePrivateProfileString(section,"fontWidth",buffer,inifile); sprintf(buffer,"%d",ListWndInfo.fontHeight); WritePrivateProfileString(section,"fontHeight",buffer,inifile); sprintf(buffer,"%d",ListWndInfo.fontFlags); WritePrivateProfileString(section,"fontFlags",buffer,inifile); WritePrivateProfileString(NULL,NULL,NULL,inifile); // Write Flush return 0; } int INILoadListWnd(void) { char *section = SEC_LISTWND; char *inifile = TIMIDITY_WINDOW_INI_FILE; int num; char buffer[64]; num = GetPrivateProfileInt(section,"PosX",-1,inifile); ListWndInfo.PosX = num; num = GetPrivateProfileInt(section,"PosY",-1,inifile); ListWndInfo.PosY = num; num = GetPrivateProfileInt(section,"Width",-1,inifile); if(num!=-1) ListWndInfo.Width = num; num = GetPrivateProfileInt(section,"Height",-1,inifile); if(num!=-1) ListWndInfo.Height = num; GetPrivateProfileString(section,"fontNameEN","",buffer,32,inifile); if(buffer[0]!=0) strcpy(ListWndInfo.fontNameEN,buffer); GetPrivateProfileString(section,"fontNameJA","",buffer,32,inifile); if(buffer[0]!=0) strcpy(ListWndInfo.fontNameJA,buffer); num = GetPrivateProfileInt(section,"fontWidth",-1,inifile); if(num!=-1) ListWndInfo.fontWidth = num; num = GetPrivateProfileInt(section,"fontHeight",-1,inifile); if(num!=-1) ListWndInfo.fontHeight = num; num = GetPrivateProfileInt(section,"fontFlags",-1,inifile); if(num!=-1) ListWndInfo.fontFlags = num; return 0; } #define SEC_DOCWND "DocWnd" int INISaveDocWnd(void) { char *section = SEC_DOCWND; char *inifile = TIMIDITY_WINDOW_INI_FILE; char buffer[256]; if ( PosSizeSave ) { if ( DocWndInfo.PosX >= 0 || DocWndInfo.PosY >= 0 ) { if ( DocWndInfo.PosX < 0 ) DocWndInfo.PosX = 0; if ( DocWndInfo.PosY < 0 ) DocWndInfo.PosY = 0; } sprintf(buffer,"%d",DocWndInfo.PosX); if ( DocWndInfo.PosX >= 0 ) WritePrivateProfileString(section,"PosX",buffer,inifile); sprintf(buffer,"%d",DocWndInfo.PosY); if ( DocWndInfo.PosY >= 0 ) WritePrivateProfileString(section,"PosY",buffer,inifile); sprintf(buffer,"%d",DocWndInfo.Width); WritePrivateProfileString(section,"Width",buffer,inifile); sprintf(buffer,"%d",DocWndInfo.Height); WritePrivateProfileString(section,"Height",buffer,inifile); } WritePrivateProfileString(section,"fontNameEN",DocWndInfo.fontNameEN,inifile); WritePrivateProfileString(section,"fontNameJA",DocWndInfo.fontNameJA,inifile); sprintf(buffer,"%d",DocWndInfo.fontWidth); WritePrivateProfileString(section,"fontWidth",buffer,inifile); sprintf(buffer,"%d",DocWndInfo.fontHeight); WritePrivateProfileString(section,"fontHeight",buffer,inifile); sprintf(buffer,"%d",DocWndInfo.fontFlags); WritePrivateProfileString(section,"fontFlags",buffer,inifile); WritePrivateProfileString(NULL,NULL,NULL,inifile); // Write Flush return 0; } int INILoadDocWnd(void) { char *section = SEC_DOCWND; char *inifile = TIMIDITY_WINDOW_INI_FILE; int num; char buffer[64]; num = GetPrivateProfileInt(section,"PosX",-1,inifile); DocWndInfo.PosX = num; num = GetPrivateProfileInt(section,"PosY",-1,inifile); DocWndInfo.PosY = num; num = GetPrivateProfileInt(section,"Width",-1,inifile); if(num!=-1) DocWndInfo.Width = num; num = GetPrivateProfileInt(section,"Height",-1,inifile); if(num!=-1) DocWndInfo.Height = num; GetPrivateProfileString(section,"fontNameEN","",buffer,32,inifile); if(buffer[0]!=0) strcpy(DocWndInfo.fontNameEN,buffer); GetPrivateProfileString(section,"fontNameJA","",buffer,32,inifile); if(buffer[0]!=0) strcpy(DocWndInfo.fontNameJA,buffer); num = GetPrivateProfileInt(section,"fontWidth",-1,inifile); if(num!=-1) DocWndInfo.fontWidth = num; num = GetPrivateProfileInt(section,"fontHeight",-1,inifile); if(num!=-1) DocWndInfo.fontHeight = num; num = GetPrivateProfileInt(section,"fontFlags",-1,inifile); if(num!=-1) DocWndInfo.fontFlags = num; return 0; } #define SEC_CONSOLEWND "ConsoleWnd" int INISaveConsoleWnd(void) { char *section = SEC_CONSOLEWND; char *inifile = TIMIDITY_WINDOW_INI_FILE; char buffer[256]; if ( PosSizeSave ) { if ( ConsoleWndInfo.PosX >= 0 || ConsoleWndInfo.PosY >= 0 ) { if ( ConsoleWndInfo.PosX < 0 ) ConsoleWndInfo.PosX = 0; if ( ConsoleWndInfo.PosY < 0 ) ConsoleWndInfo.PosY = 0; } sprintf(buffer,"%d",ConsoleWndInfo.PosX); if ( ConsoleWndInfo.PosX >= 0 ) WritePrivateProfileString(section,"PosX",buffer,inifile); sprintf(buffer,"%d",ConsoleWndInfo.PosY); if ( ConsoleWndInfo.PosY >= 0 ) WritePrivateProfileString(section,"PosY",buffer,inifile); } WritePrivateProfileString(NULL,NULL,NULL,inifile); // Write Flush return 0; } int INILoadConsoleWnd(void) { char *section = SEC_CONSOLEWND; char *inifile = TIMIDITY_WINDOW_INI_FILE; int num; num = GetPrivateProfileInt(section,"PosX",-1,inifile); ConsoleWndInfo.PosX = num; num = GetPrivateProfileInt(section,"PosY",-1,inifile); ConsoleWndInfo.PosY = num; return 0; } /**********************************************************************/ // vZXԒʐMpɃ[Xbg̃T[o[Xbhpӂ #define TIMIDITY_MAILSLOT "\\\\.\\mailslot\\timiditypp_mailslot_ver_1_0" // [Xbgɓn` // wb_ // R}h // IvV // IvVP // IvVQ // ... // wb_ #define MC_HEADER "TiMidity++Win32GUI Mailslot-1.0" // R}h // TiMidity ̏I #define MC_TERMINATE "Terminate" // t@Cw #define MC_FILES "Files Argc Argv" // IvVP : t@CP // ... // vCXg̃NA #define MC_PLAYLIST_CLEAR "Playlist Clear" // tJn #define MC_PLAY "Play" // ̃t@C̉t #define MC_PLAY_NEXT "Play Next" // Õt@C̉t #define MC_PLAY_PREV "Play Prev" // t~ #define MC_STOP "Stop" // tꎞ~ #define MC_PAUSE "Pause" // TiMidity ̏Ԃw胁[XbgɑM #define MC_SEND_TIMIDITY_INFO "Send TiMidity Info" // IvVP : [Xbg // IvVQ : ԂP // ... // // "PlayFileName:`" : tt@C // "PlayTile:`" : t^Cg // "PlayStatus:`" : t(`:PLAY,STOP,PAUSE) static HANDLE hMailslot = NULL; void w32gMailslotThread(void); int w32gStartMailslotThread(void) { DWORD dwThreadID; HANDLE hThread; hThread = (HANDLE)crt_beginthreadex(NULL,0,(LPTHREAD_START_ROUTINE)w32gMailslotThread,NULL,0,&dwThreadID); if((unsigned long)hThread==-1){ return FALSE; // Error! } return TRUE; } int ReadFromMailslot(HANDLE hmailslot, char *buffer, int *size) { DWORD dwMessageSize, dwMessageNum, dwMessageReadSize; BOOL bRes; int i; bRes = GetMailslotInfo(hmailslot,NULL,&dwMessageSize,&dwMessageNum,(LPDWORD)NULL); if(bRes==FALSE || dwMessageSize==MAILSLOT_NO_MESSAGE) return FALSE; for(i=0;i<10;i++){ bRes = ReadFile(hMailslot,buffer,dwMessageSize,&dwMessageReadSize,(LPOVERLAPPED)NULL); #ifdef W32GUI_DEBUG PrintfDebugWnd("[%s]\n",buffer); #endif if(bRes==TRUE){ break; } Sleep(300); } if(bRes==TRUE){ *size = (int)dwMessageSize; return TRUE; } else return FALSE; } // void ReadFromMailslotIgnore(HANDLE hmailslot, int num) { int i; char buffer[10240]; int size; for(i=0;i 0 ? argc-1 : 0, argv+1); return FALSE; } else { if(TryUniqTiMidity(20)==TRUE){ w32gStartMailslotThread(); return TRUE; } return FALSE; } case 2: if(ExistOldTiMidity()==TRUE){ for(i=0;i<=20;i++){ TerminateOldTiMidity(); if(UniqTiMidity()==TRUE){ w32gStartMailslotThread(); return TRUE; } Sleep(1000); } } else { if(TryUniqTiMidity(20)==TRUE){ w32gStartMailslotThread(); return TRUE; } } return FALSE; case 3: return FALSE; case 4: if(ExistOldTiMidity()==TRUE){ for(i=0;i<=20;i++){ TerminateOldTiMidity(); if(ExistOldTiMidity()==FALSE){ return FALSE; } Sleep(1000); } } return FALSE; case 5: return TRUE; default: return FALSE; } } // w32gSecondTiMidity() ̌㏈ int w32gSecondTiMidityExit(void) { MailslotThreadTeminateFlag = TRUE; Sleep(300); if(hMailslot!=NULL) CloseHandle(hMailslot); ReleaseMutex(hMutexTiMidity); CloseHandle(hMutexTiMidity); return 0; } // Before it call timidity_start_initialize() int isURLFile(char *filename) { if(strncasecmp(filename,"http://",7)==0 || strncasecmp(filename,"ftp://",6)==0 || strncasecmp(filename,"news://",7)==0 || strncasecmp(filename,"file:",5)==0 || strncasecmp(filename,"dir:",4)==0){ return TRUE; } else { return FALSE; } } TiMidity++-2.13.2/interface/w32g_ut2.h0100644004711200001440000000651110026457501016365 0ustar tamukiusers/* TiMidity++ -- MIDI to WAVE converter and player Copyright (C) 1999-2002 Masanao Izumo Copyright (C) 1995 Tuukka Toivonen 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef __W32G_UT2_H__ #define __W32G_UT2_H__ extern int DlgChooseFontAndApply(HWND hwnd, HWND hwndFontChange, HFONT hFontPre, char *fontname, int *fontheight, int *fontwidth); extern int DlgChooseFont(HWND hwnd, char *fontName, int *fontHeight, int *fontWidth); extern void SetWindowPosSize ( HWND parent_hwnd, HWND hwnd, int x, int y ); // ini file of timidity window information #define TIMIDITY_WINDOW_INI_FILE timidity_window_inifile #define FONT_FLAGS_NONE 0x00 #define FONT_FLAGS_FIXED 0x01 #define FONT_FLAGS_ITALIC 0x02 #define FONT_FLAGS_BOLD 0x04 // section of ini file // [MainWnd] // PosX = // PosY = typedef struct MAINWNDINFO_ { HWND hwnd; int PosX; int PosY; int CanvasMode; } MAINWNDINFO; extern MAINWNDINFO MainWndInfo; // section of ini file // [ListWnd] // PosX = // PosY = // Width = // Height = // fontName = // fontWidth = // fontHeight = typedef struct LISTWNDINFO_ { HWND hwnd; int PosX; int PosY; int Width; // save parameter int Height; // save parameter HMENU hPopupMenu; HWND hwndListBox; HFONT hFontListBox; char *fontName; char fontNameJA[64]; // save parameter char fontNameEN[64]; // save parameter int fontWidth; // save parameter int fontHeight; // save parameter int fontFlags; // save parameter } LISTWNDINFO; extern LISTWNDINFO ListWndInfo; // section of ini file // [DocWnd] // PosX = // PosY = // Width = // Height = // fontName = // fontWidth = // fontHeight = #define DOCWND_DOCFILEMAX 10 typedef struct DOCWNDINFO_ { char DocFile[DOCWND_DOCFILEMAX][512]; int DocFileMax; int DocFileCur; char *Text; int TextSize; HWND hwnd; int PosX; int PosY; int Width; // save parameter int Height; // save parameter HMENU hPopupMenu; HWND hwndEdit; HFONT hFontEdit; char *fontName; char fontNameJA[64]; // save parameter char fontNameEN[64]; // save parameter int fontWidth; // save parameter int fontHeight; // save parameter int fontFlags; // save parameter // HANDLE hMutex; } DOCWNDINFO; extern DOCWNDINFO DocWndInfo; // section of ini file // [ConsoleWnd] // PosX = // PosY = typedef struct CONSOLEWNDINFO_ { HWND hwnd; int PosX; int PosY; } CONSOLEWNDINFO; extern CONSOLEWNDINFO ConsoleWndInfo; extern int INISaveMainWnd(void); extern int INILoadMainWnd(void); extern int INISaveListWnd(void); extern int INILoadListWnd(void); extern int INISaveDocWnd(void); extern int INILoadDocWnd(void); extern int INISaveConsoleWnd(void); extern int INILoadConsoleWnd(void); #endif /* __W32G_UT2_H__ */ TiMidity++-2.13.2/interface/w32g_i.c0100644004711200001440000037530010125651535016106 0ustar tamukiusers/* TiMidity++ -- MIDI to WAVE converter and player Copyright (C) 1999-2004 Masanao Izumo Copyright (C) 1995 Tuukka Toivonen 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA w32g_main.c: Written by Daisuke Aoki Modified by Masanao Izumo */ #ifdef HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ #include #include #include #include #include #undef RC_NONE #include // #include #if defined(__CYGWIN32__) || defined(__MINGW32__) #ifndef HAVE_NEW_MMSYSTEM #include #ifndef TPM_TOPALIGN #define TPM_TOPALIGN 0x0000L /* for old version of cygwin */ #endif #define TIME_ONESHOT 0 #define TIME_PERIODIC 1 int WINAPI timeSetEvent(UINT uDelay, UINT uResolution, void *fptc, DWORD dwUser, UINT fuEvent); int WINAPI timeKillEvent(UINT uTimerID); #endif #else #include #endif /* __CYGWIN32__ */ #include #ifndef NO_STRING_H #include #else #include #endif #include #include /* There is no on CYGWIN. * Edit_* and ListBox_* are defined in * */ #include "timidity.h" #include "common.h" #include "instrum.h" #include "playmidi.h" #include "readmidi.h" #include "output.h" #include "controls.h" #include "wrd.h" #include "w32g.h" #include "w32g_res.h" #include "w32g_utl.h" #include "w32g_ut2.h" #include "w32g_pref.h" #include "w32g_subwin.h" #if defined(__CYGWIN32__) || defined(__MINGW32__) #define WIN32GCC WINAPI void InitCommonControls(void); #endif #if 0 #define GDI_LOCK() { \ ctl->cmsg(CMSG_INFO, VERB_VERBOSE, "GDI_LOCK(%s: %d)", __FILE__, __LINE__ ); \ gdi_lock(); \ } #define GDI_UNLOCK() { \ ctl->cmsg(CMSG_INFO, VERB_VERBOSE, "GDI_UNLOCK(%s: %d)", __FILE__, __LINE__ ); \ gdi_unlock(); \ } #else #define GDI_LOCK() { gdi_lock(); } #define GDI_UNLOCK() { gdi_unlock(); } #endif static void InitMainWnd(HWND hStartWnd); static void ConsoleWndVerbosityApplyIncDec(int num); void ConsoleWndVerbosityApply(void); void CanvasPaintAll(void); void CanvasReset(void); void CanvasClear(void); void CanvasUpdate(int flag); void CanvasReadPanelInfo(int flag); void CanvasChange(int mode); void MPanelPaintAll(void); void MPanelReadPanelInfo(int flag); void MPanelReset(void); void MPanelUpdateAll(void); void ClearConsoleWnd(void); void InitListWnd(HWND hParentWnd); void InitTracerWnd(HWND hParentWnd); void InitWrdWnd(HWND hParentWnd); void InitDocWnd(HWND hParentWnd); void InitListSearchWnd(HWND hParentWnd); void PutsDocWnd(char *str); void ClearDocWnd(void); static void DlgPlaylistSave(HWND hwnd); static void DlgPlaylistOpen(HWND hwnd); static void DlgDirOpen(HWND hwnd); static void DlgMidiFileOpen(HWND hwnd); void VprintfEditCtlWnd(HWND hwnd, char *fmt, va_list argList); void PutsEditCtlWnd(HWND hwnd, char *str); void ClearEditCtlWnd(HWND hwnd); int w32gSaveDefaultPlaylist(void); #ifndef CLR_INVALID #define CLR_INVALID 0xffffffff #endif /* CLR_INVALID */ extern int optind; HINSTANCE hInst; static int progress_jump = -1; static HWND hMainWndScrollbarProgressWnd; static HWND hMainWndScrollbarVolumeWnd; // #define W32G_VOLUME_MAX 200 #define W32G_VOLUME_MAX MAX_AMPLIFICATION // HWND HWND hMainWnd = 0; HWND hDebugWnd = 0; HWND hConsoleWnd = 0; HWND hTracerWnd = 0; HWND hDocWnd = 0; HWND hListWnd = 0; HWND hWrdWnd = 0; HWND hSoundSpecWnd = 0; HWND hDebugEditWnd = 0; HWND hDocEditWnd = 0; // Process. HANDLE hProcess = 0; // Main Thread. HANDLE hMainThread = 0; HANDLE hPlayerThread = 0; HANDLE hMainThreadInfo = 0; DWORD dwMainThreadID = 0; static volatile int wait_thread_flag = 1; typedef struct MAINTHREAD_ARGS_ { int *pArgc; char ***pArgv; } MAINTHREAD_ARGS; void WINAPI MainThread(void *arglist); // Window Thread HANDLE hWindowThread = 0; HANDLE hWindowThreadInfo = 0; // Thread volatile int ThreadNumMax = 0; // Debug Thread volatile int DebugThreadExit = 1; volatile HANDLE hDebugThread = 0; void DebugThreadInit(void); void PrintfDebugWnd(char *fmt, ...); void ClearDebugWnd(void); void InitDebugWnd(HWND hParentWnd); // Flags int InitMinimizeFlag = 0; int DebugWndStartFlag = 1; int ConsoleWndStartFlag = 0; int ListWndStartFlag = 0; int TracerWndStartFlag = 0; int DocWndStartFlag = 0; int WrdWndStartFlag = 0; int DebugWndFlag = 1; int ConsoleWndFlag = 1; int ListWndFlag = 1; int TracerWndFlag = 0; int DocWndFlag = 1; int WrdWndFlag = 0; int SoundSpecWndFlag = 0; int WrdGraphicFlag; int TraceGraphicFlag; char *IniFile; char *ConfigFile; char *PlaylistFile; char *PlaylistHistoryFile; char *MidiFileOpenDir; char *ConfigFileOpenDir; char *PlaylistFileOpenDir; // Priority int PlayerThreadPriority; int MidiPlayerThreadPriority; int MainThreadPriority; int GUIThreadPriority; int TracerThreadPriority; int WrdThreadPriority; // dir int SeachDirRecursive = 0; // ċAIfBNg // Ini File int IniFileAutoSave = 1; // INI t@C̎Z[u // misc int DocMaxSize; char *DocFileExt; int AutoloadPlaylist = 0; int AutosavePlaylist = 0; int volatile save_playlist_once_before_exit_flag = 1; static volatile int w32g_wait_for_init; void w32g_send_rc(int rc, int32 value); int w32g_lock_open_file = 0; void TiMidityHeapCheck(void); volatile DWORD dwWindowThreadID = -1; void w32g_i_init(void) { ThreadNumMax++; hProcess = GetCurrentProcess(); hWindowThread = GetCurrentThread(); dwWindowThreadID = GetCurrentThreadId(); InitCommonControls(); #ifdef W32GUI_DEBUG DebugThreadInit(); #endif } int PlayerLanguage = LANGUAGE_ENGLISH; //int PlayerLanguage = LANGUAGE_JAPANESE; #define PInfoOK 1 long SetValue(int32 value, int32 min, int32 max) { int32 v = value; if(v < min) v = min; else if( v > max) v = max; return v; } int w32gSecondTiMidity(int opt, int argc, char **argv); int w32gSecondTiMidityExit(void); int SecondMode = 0; void FirstLoadIniFile(void); #ifndef WIN32GCC extern void CmdLineToArgv(LPSTR lpCmdLine, int *argc, CHAR ***argv); extern int win_main(int argc, char **argv); /* timidity.c */ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { int argc; CHAR **argv = NULL; CmdLineToArgv(lpCmdLine,&argc,&argv); #if 0 FirstLoadIniFile(); if(w32gSecondTiMidity(SecondMode,argc,argv)==TRUE){ int res = win_main(argc, argv); w32gSecondTiMidityExit(); return res; } else return -1; #else wrdt=wrdt_list[0]; return win_main(argc, argv); #endif } #endif /* WIN32GCC */ // *************************************************************************** // System Function void CALLBACK KillProcess(UINT IDEvent, UINT uReserved, DWORD dwUser, DWORD dwReserved1, DWORD dwReserved2) { exit(0); // ExitProcess(0); } void OnExit(void) { #ifdef W32GUI_DEBUG PrintfDebugWnd("PostQuitMessage\n"); Sleep(200); #endif PostQuitMessage(0); } static int OnExitReadyWait = 200; void OnExitReady(void) { int i; #ifdef W32GUI_DEBUG PrintfDebugWnd("OnExitReady: Start.\n"); #endif w32g_send_rc(RC_STOP, 0); /* Exit after 10 sec. */ timeSetEvent(10000, 1000, KillProcess, 0, TIME_ONESHOT); /* Wait really stopping to play */ i = 1000/OnExitReadyWait; /* 1 sec. */ while(w32g_play_active && i-- > 0) { Sleep(OnExitReadyWait); VOLATILE_TOUCH(w32g_play_active); } #ifdef W32GUI_DEBUG PrintfDebugWnd("OnExitReady: End.\n"); #endif } void OnQuit(void) { SendMessage(hMainWnd, WM_CLOSE, 0, 0); } // *************************************************************************** // Start Window // 匳̃EBhE̒nʂMain WindowɏAł͂̏֐ void InitStartWnd(int nCmdShow) { InitMainWnd(NULL); InitConsoleWnd(hMainWnd); InitListWnd(hMainWnd); InitTracerWnd(hMainWnd); InitDocWnd(hMainWnd); InitWrdWnd(hMainWnd); InitSoundSpecWnd(hMainWnd); hMainWndScrollbarProgressWnd = GetDlgItem(hMainWnd, IDC_SCROLLBAR_PROGRESS); hMainWndScrollbarVolumeWnd = GetDlgItem(hMainWnd, IDC_SCROLLBAR_VOLUME); EnableScrollBar(hMainWndScrollbarVolumeWnd, SB_CTL,ESB_ENABLE_BOTH); SetScrollRange(hMainWndScrollbarVolumeWnd, SB_CTL, 0, W32G_VOLUME_MAX, TRUE); SetScrollPos(hMainWndScrollbarVolumeWnd, SB_CTL, W32G_VOLUME_MAX - amplification, TRUE); } /*****************************************************************************/ // Main Window #define SWS_EXIST 0x0001 #define SWS_ICON 0x0002 #define SWS_HIDE 0x0004 typedef struct SUBWINDOW_ { HWND *hwnd; int status; } SUBWINDOW; SUBWINDOW subwindow[] = { {&hConsoleWnd,0}, {&hListWnd,0}, {&hTracerWnd,0}, {&hDocWnd,0}, {&hWrdWnd,0}, {&hSoundSpecWnd,0}, {NULL,0} }; int SubWindowMax = 5; SUBWINDOW SubWindowHistory[] = { {&hConsoleWnd,0}, {&hListWnd,0}, {&hTracerWnd,0}, {&hDocWnd,0}, {&hWrdWnd,0}, {&hSoundSpecWnd,0}, {NULL,0} }; MAINWNDINFO MainWndInfo; BOOL CALLBACK MainProc(HWND hwnd, UINT uMess, WPARAM wParam, LPARAM lParam); void update_subwindow(void); void OnShow(void); void OnHide(void); static int MainWndInfoReset(HWND hwnd); static int MainWndInfoApply(void); extern void reload_cfg(void); // OUTPUT MENU #define IDM_OUTPUT 0x4000 static HMENU outputMenu; static void InitOutputMenu(HWND hWnd) { HMENU hMenu; MENUITEMINFO mii; int i; hMenu = GetMenu(hWnd); if (outputMenu != NULL) {DestroyMenu (outputMenu);} outputMenu = CreateMenu(); mii.cbSize = sizeof (MENUITEMINFO); mii.fMask = MIIM_TYPE | MIIM_SUBMENU; mii.fType = MFT_STRING; mii.hSubMenu = outputMenu; if (PlayerLanguage == LANGUAGE_JAPANESE) { mii.dwTypeData = TEXT("o(&O)"); } else { mii.dwTypeData = TEXT("Output(&O)"); } InsertMenuItem(hMenu, GetMenuItemCount(hMenu) - 1, TRUE, &mii); for (i = 0; play_mode_list[i] != 0; i++) { mii.fMask = MIIM_TYPE | MIIM_ID | MIIM_STATE; mii.wID = IDM_OUTPUT + i; mii.fType = MFT_STRING; if (st_temp->opt_playmode[0] == play_mode_list[i]->id_character) { mii.fState = MFS_CHECKED; } else { mii.fState = MFS_UNCHECKED; } mii.dwTypeData = play_mode_list[i]->id_name; InsertMenuItem(outputMenu, i, TRUE, &mii); } SetMenu(hWnd , hMenu); } static void UpdateOutputMenu(HWND hWnd, UINT wId) { MENUITEMINFO mii; int i, num = -1, oldnum; for (i = 0; play_mode_list[i] != 0; i++) { mii.cbSize = sizeof (MENUITEMINFO); mii.fMask = MIIM_STATE | MIIM_ID; GetMenuItemInfo(outputMenu, i, TRUE, &mii); if (wId == mii.wID) { mii.fState = MFS_CHECKED; num = i; } else {mii.fState = MFS_UNCHECKED;} SetMenuItemInfo(outputMenu, i, TRUE, &mii); if (st_temp->opt_playmode[0] == play_mode_list[i]->id_character) { oldnum = i; } } if (!w32g_play_active && num != oldnum) { if (num >= 0) {st_temp->opt_playmode[0] = play_mode_list[num]->id_character;} else {st_temp->opt_playmode[0] = 'd';} PrefSettingApplyReally(); } } static void InitMainWnd(HWND hParentWnd) { HICON hIcon = LoadImage(hInst, MAKEINTRESOURCE(IDI_ICON_TIMIDITY), IMAGE_ICON, 16, 16, 0); if ( hMainWnd != NULL ) { DestroyWindow ( hMainWnd ); hMainWnd = NULL; } INILoadMainWnd(); if (PlayerLanguage == LANGUAGE_JAPANESE) hMainWnd = CreateDialog(hInst,MAKEINTRESOURCE(IDD_DIALOG_MAIN),hParentWnd,MainProc); else hMainWnd = CreateDialog(hInst,MAKEINTRESOURCE(IDD_DIALOG_MAIN_EN),hParentWnd,MainProc); InitOutputMenu(hMainWnd); if (hIcon!=NULL) SendMessage(hMainWnd,WM_SETICON,FALSE,(LPARAM)hIcon); { // Set the title of the main window again. char buffer[256]; SendMessage( hMainWnd, WM_GETTEXT, (WPARAM)255, (LPARAM)buffer); SendMessage( hMainWnd, WM_SETTEXT, (WPARAM)0, (LPARAM)buffer); } MainWndInfoApply(); } static int MainWndInfoReset(HWND hwnd) { memset(&MainWndInfo,0,sizeof(MAINWNDINFO)); MainWndInfo.PosX = - 1; MainWndInfo.PosY = - 1; return 0; } static int MainWndInfoApply(void) { return 0; } void MainCmdProc(HWND hwnd, int wId, HWND hwndCtl, UINT wNotifyCode); void MainWndSetPauseButton(int flag); void MainWndSetPlayButton(int flag); void MainWndToggleConsoleButton(void); void MainWndUpdateConsoleButton(void); void MainWndToggleTracerButton(void); void MainWndUpdateTracerButton(void); void MainWndToggleListButton(void); void MainWndUpdateListButton(void); void MainWndToggleDocButton(void); void MainWndUpdateDocButton(void); void MainWndToggleWrdButton(void); void MainWndUpdateWrdButton(void); void MainWndToggleSoundSpecButton(void); void MainWndUpdateSoundSpecButton(void); void ShowSubWindow(HWND hwnd,int showflag); void ToggleSubWindow(HWND hwnd); static void VersionWnd(HWND hParentWnd); static void TiMidityWnd(HWND hParentWnd); static void SupplementWnd(HWND hParentWnd); static void InitCanvasWnd(HWND hwnd); static void CanvasInit(HWND hwnd); static void InitPanelWnd(HWND hwnd); static void MPanelInit(HWND hwnd); static void InitMainToolbar(HWND hwnd); static void InitSubWndToolbar(HWND hwnd); static UINT PlayerForwardAndBackwardEventID = 0; static void CALLBACK PlayerForward(UINT IDEvent, UINT uReserved, DWORD dwUser, DWORD dwReserved1, DWORD dwReserved2) { w32g_send_rc(RC_FORWARD, play_mode->rate); } static void CALLBACK PlayerBackward(UINT IDEvent, UINT uReserved, DWORD dwUser, DWORD dwReserved1, DWORD dwReserved2) { w32g_send_rc(RC_BACK, play_mode->rate); } extern void ShowPrefWnd ( void ); extern void HidePrefWnd ( void ); extern BOOL IsVisiblePrefWnd ( void ); BOOL CALLBACK MainProc(HWND hwnd, UINT uMess, WPARAM wParam, LPARAM lParam) { static BOOL PrefWndShow; // PrintfDebugWnd("MainProc: Mess%lx WPARAM%lx LPARAM%lx\n",uMess,wParam,lParam); switch (uMess) { case WM_INITDIALOG: PrefWndShow = FALSE; update_subwindow(); MainWndUpdateConsoleButton(); MainWndUpdateTracerButton(); MainWndUpdateListButton(); MainWndUpdateDocButton(); MainWndUpdateWrdButton(); MainWndUpdateSoundSpecButton(); InitPanelWnd(hwnd); InitCanvasWnd(hwnd); InitMainToolbar(hwnd); InitSubWndToolbar(hwnd); { HMENU hMenu = GetSystemMenu(hwnd, FALSE); #if 1 RemoveMenu(hMenu,SC_MAXIMIZE,MF_BYCOMMAND); RemoveMenu(hMenu,SC_SIZE,MF_BYCOMMAND); #else EnableMenuItem(hMenu, SC_MAXIMIZE, MF_BYCOMMAND | MF_GRAYED); EnableMenuItem(hMenu, SC_SIZE, MF_BYCOMMAND | MF_GRAYED); #endif EnableMenuItem(hMenu, SC_MOVE, MF_BYCOMMAND | MF_GRAYED); InsertMenu(hMenu, 0, MF_BYPOSITION | MF_SEPARATOR, 0, 0); InsertMenu(hMenu, 0, MF_BYPOSITION, SC_SCREENSAVE, "Screen Saver"); InsertMenu(hMenu, 0, MF_BYPOSITION | MF_SEPARATOR, 0, 0); InsertMenu(hMenu, 0, MF_BYPOSITION | MF_STRING, IDM_STOP, "Stop"); InsertMenu(hMenu, 0, MF_BYPOSITION | MF_STRING, IDM_PAUSE, "Pause"); InsertMenu(hMenu, 0, MF_BYPOSITION | MF_STRING, IDM_PREV, "Prev"); InsertMenu(hMenu, 0, MF_BYPOSITION | MF_STRING, IDM_NEXT, "Next"); InsertMenu(hMenu, 0, MF_BYPOSITION | MF_STRING, IDM_PLAY, "Play"); DrawMenuBar(hwnd); } { RECT d_rc, w_rc; GetClientRect ( GetDesktopWindow (), &d_rc ); GetWindowRect ( hwnd, &w_rc ); d_rc.right -= w_rc.right - w_rc.left; d_rc.bottom -= w_rc.bottom - w_rc.top; if ( MainWndInfo.PosX < d_rc.left ) MainWndInfo.PosX = d_rc.left; if ( MainWndInfo.PosX > d_rc.right ) MainWndInfo.PosX = d_rc.right; if ( MainWndInfo.PosY < d_rc.top ) MainWndInfo.PosY = d_rc.top; if ( MainWndInfo.PosY > d_rc.bottom ) MainWndInfo.PosY = d_rc.bottom; SetWindowPosSize(GetDesktopWindow(),hwnd,MainWndInfo.PosX, MainWndInfo.PosY ); } return FALSE; HANDLE_MSG(hwnd,WM_COMMAND,MainCmdProc); case WM_DESTROY: if(save_playlist_once_before_exit_flag) { save_playlist_once_before_exit_flag = 0; w32gSaveDefaultPlaylist(); } INISaveMainWnd(); PostQuitMessage(0); break; case WM_CLOSE: if(save_playlist_once_before_exit_flag) { save_playlist_once_before_exit_flag = 0; w32gSaveDefaultPlaylist(); } DestroyWindow(hwnd); break; case WM_SIZE: if(wParam == SIZE_MINIMIZED){ if ( IsVisiblePrefWnd () ) PrefWndShow = TRUE; else PrefWndShow = FALSE; HidePrefWnd (); update_subwindow(); OnHide(); } else if ( wParam == SIZE_RESTORED ) { if ( PrefWndShow ) { ShowPrefWnd (); } } return FALSE; case WM_MOVE: if ( ! IsIconic(hwnd) ) { RECT rc; GetWindowRect(hwnd,&rc); MainWndInfo.PosX = rc.left; MainWndInfo.PosY = rc.top; } break; case WM_QUERYOPEN: OnShow(); return FALSE; case WM_DROPFILES: w32g_send_rc(RC_EXT_DROP, (int32)wParam); return FALSE; case WM_HSCROLL: { int nScrollCode = (int)LOWORD(wParam); int nPos = (int) HIWORD(wParam); HWND bar = (HWND)lParam; if(bar != hMainWndScrollbarProgressWnd) break; switch(nScrollCode) { case SB_THUMBTRACK: case SB_THUMBPOSITION: progress_jump = nPos; break; case SB_LINELEFT: progress_jump = GetScrollPos(bar, SB_CTL) - 1; if(progress_jump < 0) progress_jump = 0; break; case SB_PAGELEFT: progress_jump = GetScrollPos(bar, SB_CTL) - 10; if(progress_jump < 0) progress_jump = 0; break; case SB_LINERIGHT: progress_jump = GetScrollPos(bar, SB_CTL) + 1; break; case SB_PAGERIGHT: progress_jump = GetScrollPos(bar, SB_CTL) + 10; break; case SB_ENDSCROLL: if(progress_jump != -1) { w32g_send_rc(RC_JUMP, progress_jump * play_mode->rate); SetScrollPos(hMainWndScrollbarProgressWnd, SB_CTL, progress_jump, TRUE); progress_jump = -1; } break; } break; } break; case WM_VSCROLL: { int nScrollCode = (int) LOWORD(wParam); int nPos = (int) HIWORD(wParam); HWND bar = (HWND) lParam; static int pos = -1; if(bar != hMainWndScrollbarVolumeWnd) break; switch(nScrollCode) { case SB_THUMBTRACK: case SB_THUMBPOSITION: pos = nPos; break; case SB_LINEUP: case SB_PAGEUP: pos = GetScrollPos(bar, SB_CTL) - 5; if(pos < 0) pos = 0; break; case SB_LINEDOWN: case SB_PAGEDOWN: pos = GetScrollPos(bar, SB_CTL) + 5; if(pos > W32G_VOLUME_MAX) pos = W32G_VOLUME_MAX; break; case SB_ENDSCROLL: if(pos != -1) { w32g_send_rc(RC_CHANGE_VOLUME, (W32G_VOLUME_MAX - pos) - amplification); SetScrollPos(bar, SB_CTL, pos, TRUE); pos = -1; } break; } } break; case WM_SYSCOMMAND: switch(wParam){ case IDM_STOP: case IDM_PAUSE: case IDM_PREV: case IDM_PLAY: case IDM_NEXT: case IDM_FOREWARD: case IDM_BACKWARD: SendMessage(hwnd,WM_COMMAND,wParam,(LPARAM)NULL); break; default: break; } return FALSE; case WM_NOTIFY: switch(wParam) { case IDC_TOOLBARWINDOW_MAIN:{ LPTBNOTIFY TbNotify = (LPTBNOTIFY)lParam; switch(TbNotify->iItem){ case IDM_BACKWARD: if(TbNotify->hdr.code==TBN_BEGINDRAG){ #ifdef W32GUI_DEBUG //PrintfDebugWnd("IDM_BACKWARD: BUTTON ON\n"); #endif PlayerBackward(0,0,0,0,0); PlayerForwardAndBackwardEventID = timeSetEvent(100, 100, PlayerBackward, 0, TIME_PERIODIC); } if(PlayerForwardAndBackwardEventID != 0) if(TbNotify->hdr.code==TBN_ENDDRAG){ #ifdef W32GUI_DEBUG //PrintfDebugWnd("IDM_BACKWARD: BUTTON OFF\n"); #endif timeKillEvent(PlayerForwardAndBackwardEventID); PlayerForwardAndBackwardEventID = 0; } break; case IDM_FOREWARD: if(TbNotify->hdr.code ==TBN_BEGINDRAG && PlayerForwardAndBackwardEventID == 0){ #ifdef W32GUI_DEBUG //PrintfDebugWnd("IDM_FOREWARD: BUTTON ON\n"); #endif PlayerForward(0,0,0,0,0); PlayerForwardAndBackwardEventID = timeSetEvent(100,300,PlayerForward,0,TIME_PERIODIC); } else if((TbNotify->hdr.code == TBN_ENDDRAG || TbNotify->hdr.code == NM_CLICK || TbNotify->hdr.code == NM_RCLICK) && PlayerForwardAndBackwardEventID != 0) { #ifdef W32GUI_DEBUG //PrintfDebugWnd("IDM_FOREWARD: BUTTON OFF\n"); #endif timeKillEvent(PlayerForwardAndBackwardEventID); PlayerForwardAndBackwardEventID = 0; } break; default: break; } } break; /* end of case IDC_TOOLBARWINDOW_MAIN */ default: break; } return FALSE; case WM_SHOWWINDOW: { BOOL fShow = (BOOL)wParam; if ( fShow ) { if ( PrefWndShow ) { ShowPrefWnd (); } else { HidePrefWnd (); } } else { if ( IsVisiblePrefWnd () ) PrefWndShow = TRUE; else PrefWndShow = FALSE; HidePrefWnd (); } break; } break; default: if (uMess == RegisterWindowMessage("TaskbarCreated")) { ShowWindow(hMainWnd, SW_HIDE); ShowWindow(hMainWnd, SW_SHOWNOACTIVATE); return 0; } return FALSE; } return FALSE; } void MainCmdProc(HWND hwnd, int wId, HWND hwndCtl, UINT wNotifyCode) { // PrintfDebugWnd("WM_COMMAND: ID%lx HWND%lx CODE%lx\n",wId,hwndCtl,wNotifyCode); switch(wId) { case IDM_STOP: w32g_send_rc(RC_STOP, 0); break; case IDM_PAUSE: SendDlgItemMessage(hMainWnd, IDC_TOOLBARWINDOW_MAIN, TB_CHECKBUTTON, IDM_PAUSE, (LPARAM)MAKELONG(!play_pause_flag, 0)); w32g_send_rc(RC_TOGGLE_PAUSE, 0); break; case IDM_PREV: w32g_send_rc(RC_REALLY_PREVIOUS, 0); break; case IDM_BACKWARD: /* Do nothing here. See WM_NOTIFY in MainProc() */ break; case IDM_PLAY: if(play_pause_flag) { SendDlgItemMessage(hMainWnd, IDC_TOOLBARWINDOW_MAIN, TB_CHECKBUTTON, IDM_PAUSE, (LPARAM)MAKELONG(FALSE, 0)); w32g_send_rc(RC_TOGGLE_PAUSE, 0); } if(!w32g_play_active) w32g_send_rc(RC_LOAD_FILE, 0); break; case IDM_FOREWARD: /* Do nothing here. See WM_NOTIFY in MainProc() */ break; case IDM_NEXT: w32g_send_rc(RC_NEXT, 0); break; case IDM_CONSOLE: case IDM_MWCONSOLE: ToggleSubWindow(hConsoleWnd); break; case IDM_TRACER: case IDM_MWTRACER: ToggleSubWindow(hTracerWnd); // MainWndUpdateTracerButton(); // MessageBox(hwnd, "Not Supported.","Warning!",MB_OK); break; case IDM_LIST: case IDM_MWPLAYLIST: ToggleSubWindow(hListWnd); if(IsWindowVisible(hListWnd)) w32g_send_rc(RC_EXT_UPDATE_PLAYLIST, 0); break; case IDM_DOC: case IDM_MWDOCUMENT: ToggleSubWindow(hDocWnd); // if(IsWindowVisible(hDocWnd)) // w32g_send_rc(RC_EXT_DOC, 0); break; case IDM_WRD: case IDM_MWWRDTRACER: ToggleSubWindow(hWrdWnd); // MainWndUpdateWrdButton(); // MessageBox(hwnd, "Not Supported.","Warning!",MB_OK); break; case IDM_SOUNDSPEC: case IDM_MWSOUNDSPEC: MainWndUpdateSoundSpecButton(); MessageBox(hwnd, "Not Supported.","Warning!",MB_OK); break; case IDOK: break; case IDCANCEL: OnQuit(); break; case IDM_MFOPENFILE: DlgMidiFileOpen(hwnd); break; case IDM_MFOPENDIR: DlgDirOpen(hwnd); break; case IDM_MFLOADPLAYLIST: DlgPlaylistOpen(hwnd); break; case IDM_MFSAVEPLAYLISTAS: DlgPlaylistSave(hwnd); break; case IDM_MFEXIT: OnQuit(); break; case IDM_SETTING: PrefWndCreate(hMainWnd); break; case IDM_MCSAVEINIFILE: VOLATILE_TOUCH(PrefWndDoing); if(PrefWndDoing){ MessageBox(hMainWnd, "Can't Save Ini file while preference dialog.", "Warning", MB_OK); break; } SaveIniFile(sp_current, st_current); break; case IDM_MCLOADINIFILE: if(!w32g_has_ini_file) { MessageBox(hMainWnd, "Can't load Ini file.", "Warning", MB_OK); break; } VOLATILE_TOUCH(PrefWndDoing); if(PrefWndDoing){ MessageBox(hMainWnd, "Can't load Ini file while preference dialog.", "Warning", MB_OK); break; } LoadIniFile(sp_temp,st_temp); PrefWndCreate(hMainWnd); break; case IDM_MWDEBUG: #ifdef W32GUI_DEBUG if(IsWindowVisible(hDebugWnd)) ShowWindow(hDebugWnd,SW_HIDE); else ShowWindow(hDebugWnd,SW_SHOW); #endif break; case IDM_MHTOPIC: MessageBox(hwnd, "Not Supported.","Warning!",MB_OK); break; case IDM_MHHELP: MessageBox(hwnd, "Not Supported.","Warning!",MB_OK); break; case IDM_MHONLINEHELP: if (PlayerLanguage == LANGUAGE_JAPANESE) { ShellExecute(HWND_DESKTOP, NULL, "http://timidity-docs.sourceforge.jp/", NULL, NULL, SW_SHOWNORMAL); } else { ShellExecute(HWND_DESKTOP, NULL, "http://timidity.sourceforge.net/index.html.en", NULL, NULL, SW_SHOWNORMAL); } break; case IDM_MHBTS: if (PlayerLanguage == LANGUAGE_JAPANESE) { ShellExecute(HWND_DESKTOP, NULL, "http://timidity-docs.sourceforge.jp/cgi-bin/kagemai-ja/guest.cgi", NULL, NULL, SW_SHOWNORMAL); } else { ShellExecute(HWND_DESKTOP, NULL, "http://timidity-docs.sourceforge.jp/cgi-bin/kagemai-en/guest.cgi", NULL, NULL, SW_SHOWNORMAL); } break; case IDM_MHONLINEHELPCFG: ShellExecute(HWND_DESKTOP, NULL, "http://timidity-docs.sourceforge.jp/cgi-bin/hiki/hiki.cgi?%28ja%29timidity.cfg", NULL, NULL, SW_SHOWNORMAL); break; case IDM_MHVERSION: VersionWnd(hwnd); break; case IDM_MHTIMIDITY: TiMidityWnd(hwnd); break; case IDM_FORCE_RELOAD: if (!w32g_play_active) {reload_cfg();} break; case IDM_MHSUPPLEMENT: SupplementWnd(hwnd); break; default: UpdateOutputMenu(hwnd, wId); break; } } void update_subwindow(void) { SUBWINDOW *s = subwindow; int i; for(i=0;s[i].hwnd!=NULL;i++){ if(IsWindow(*(s[i].hwnd))) s[i].status |= SWS_EXIST; else { s[i].status = 0; continue; } if(IsIconic(*(s[i].hwnd))) s[i].status |= SWS_ICON; else s[i].status &= ~ SWS_ICON; if(IsWindowVisible(*(s[i].hwnd))) s[i].status &= ~ SWS_HIDE; else s[i].status |= SWS_HIDE; } } void MainWndSetPauseButton(int flag) { if(flag) SendDlgItemMessage(hMainWnd, IDC_TOOLBARWINDOW_MAIN, TB_CHECKBUTTON, IDM_PAUSE, (LPARAM)MAKELONG(TRUE, 0)); else SendDlgItemMessage(hMainWnd, IDC_TOOLBARWINDOW_MAIN, TB_CHECKBUTTON, IDM_PAUSE, (LPARAM)MAKELONG(FALSE, 0)); } void MainWndSetPlayButton(int flag) { return; } void MainWndUpdateConsoleButton(void) { if(IsWindowVisible(hConsoleWnd)) SendDlgItemMessage(hMainWnd, IDC_TOOLBARWINDOW_SUBWND, TB_CHECKBUTTON, IDM_CONSOLE, (LPARAM)MAKELONG(TRUE, 0)); else SendDlgItemMessage(hMainWnd, IDC_TOOLBARWINDOW_SUBWND, TB_CHECKBUTTON, IDM_CONSOLE, (LPARAM)MAKELONG(FALSE, 0)); } void MainWndUpdateListButton(void) { if(IsWindowVisible(hListWnd)) SendDlgItemMessage(hMainWnd, IDC_TOOLBARWINDOW_SUBWND, TB_CHECKBUTTON, IDM_LIST, (LPARAM)MAKELONG(TRUE, 0)); else SendDlgItemMessage(hMainWnd, IDC_TOOLBARWINDOW_SUBWND, TB_CHECKBUTTON, IDM_LIST, (LPARAM)MAKELONG(FALSE, 0)); } void MainWndUpdateDocButton(void) { if(IsWindowVisible(hDocWnd)) SendDlgItemMessage(hMainWnd, IDC_TOOLBARWINDOW_SUBWND, TB_CHECKBUTTON, IDM_DOC, (LPARAM)MAKELONG(TRUE, 0)); else SendDlgItemMessage(hMainWnd, IDC_TOOLBARWINDOW_SUBWND, TB_CHECKBUTTON, IDM_DOC, (LPARAM)MAKELONG(FALSE, 0)); } void MainWndUpdateTracerButton(void) { if(IsWindowVisible(hTracerWnd)) SendDlgItemMessage(hMainWnd, IDC_TOOLBARWINDOW_SUBWND, TB_CHECKBUTTON, IDM_TRACER, (LPARAM)MAKELONG(TRUE, 0)); else SendDlgItemMessage(hMainWnd, IDC_TOOLBARWINDOW_SUBWND, TB_CHECKBUTTON, IDM_TRACER, (LPARAM)MAKELONG(FALSE, 0)); } void MainWndUpdateWrdButton(void) { if(IsWindowVisible(hWrdWnd)) SendDlgItemMessage(hMainWnd, IDC_TOOLBARWINDOW_SUBWND, TB_CHECKBUTTON, IDM_WRD, (LPARAM)MAKELONG(TRUE, 0)); else SendDlgItemMessage(hMainWnd, IDC_TOOLBARWINDOW_SUBWND, TB_CHECKBUTTON, IDM_WRD, (LPARAM)MAKELONG(FALSE, 0)); } void MainWndUpdateSoundSpecButton(void) { } #undef SUBWINDOW_POS_IS_OLD_CLOSED_WINDOW void ShowSubWindow(HWND hwnd,int showflag) { int i, num; RECT rc; #ifdef SUBWINDOW_POS_IS_OLD_CLOSED_WINDOW RECT rc2; #endif int max = 0; if(showflag){ if(IsWindowVisible(hwnd)) return; for(i=0;SubWindowHistory[i].hwnd!=NULL;i++) if(*(SubWindowHistory[i].hwnd)==hwnd) num = i; for(i=0;SubWindowHistory[i].hwnd!=NULL;i++) if(*(SubWindowHistory[i].hwnd)!=hwnd){ if(SubWindowHistory[i].status > 0) SubWindowHistory[i].status += 1; if(SubWindowHistory[i].status>SubWindowMax){ if(SubWindowHistory[i].status>max){ GetWindowRect(*(SubWindowHistory[i].hwnd), &rc); max = SubWindowHistory[i].status; } ShowWindow(*(SubWindowHistory[i].hwnd),SW_HIDE); SubWindowHistory[i].status = 0; } } #ifdef SUBWINDOW_POS_IS_OLD_CLOSED_WINDOW // TuEChEő吔zĕ‚ÂEChEɍ킹dl͎~߂邱ƂɂB if(max>0){ GetWindowRect(hwnd, &rc2); MoveWindow(hwnd,rc.left,rc.top,rc2.right-rc2.left,rc2.bottom-rc2.top,TRUE); } #endif ShowWindow(hwnd,SW_SHOW); SubWindowHistory[num].status = 1; } else { if(!IsWindowVisible(hwnd)) return; for(i=0;SubWindowHistory[i].hwnd!=NULL;i++) if(*(SubWindowHistory[i].hwnd)==hwnd) num = i; for(i=0;SubWindowHistory[i].hwnd!=NULL;i++) if(i!=num) if(SubWindowHistory[i].status>=SubWindowHistory[num].status) SubWindowHistory[i].status -= 1; ShowWindow(hwnd,SW_HIDE); SubWindowHistory[num].status = 0; } MainWndUpdateConsoleButton(); MainWndUpdateListButton(); MainWndUpdateTracerButton(); MainWndUpdateDocButton(); MainWndUpdateWrdButton(); MainWndUpdateSoundSpecButton(); } void ToggleSubWindow(HWND hwnd) { if(IsWindowVisible(hwnd)) ShowSubWindow(hwnd,0); else ShowSubWindow(hwnd,1); } void OnShow(void) { SUBWINDOW *s = subwindow; int i; for(i=0;s[i].hwnd!=NULL;i++) if(s[i].status & SWS_EXIST) { if(s[i].status & SWS_HIDE) ShowWindow(*(s[i].hwnd),SW_HIDE); else ShowWindow(*(s[i].hwnd),SW_SHOW); } } void OnHide(void) { SUBWINDOW *s = subwindow; int i; for(i=0;s[i].hwnd!=NULL;i++){ if(s[i].status & SWS_EXIST) ShowWindow(*(s[i].hwnd),SW_HIDE); } } #ifdef W32GUI_DEBUG void DebugThread(void *args) { MSG msg; DebugThreadExit = 0; InitDebugWnd(NULL); AttachThreadInput(GetWindowThreadProcessId(hDebugThread,NULL), GetWindowThreadProcessId(hWindowThread,NULL),TRUE); AttachThreadInput(GetWindowThreadProcessId(hWindowThread,NULL), GetWindowThreadProcessId(hDebugThread,NULL),TRUE); while( GetMessage(&msg,NULL,0,0) ){ TranslateMessage(&msg); DispatchMessage(&msg); } DebugThreadExit = 1; crt_endthread(); } void DebugThreadInit(void) { DWORD dwThreadID; if(!DebugThreadExit) return; hDebugThread = crt_beginthreadex(NULL,0,DebugThread,0,0,&dwThreadID); } #endif //----------------------------------------------------------------------------- // Toolbar Main static TBBUTTON MainTbb[] = { {4, IDM_STOP, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, 0}, {3, IDM_PAUSE, TBSTATE_ENABLED, TBSTYLE_CHECK, 0, 0}, {0, IDM_PREV, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, 0}, {1, IDM_BACKWARD, TBSTATE_ENABLED,TBSTYLE_BUTTON, 0, 0}, {2, IDM_PLAY, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, 0}, {5, IDM_FOREWARD, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, 0}, {6, IDM_NEXT, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, 0} }; static void InitMainToolbar(HWND hwnd) { TBADDBITMAP MainTbab; SendDlgItemMessage(hwnd, IDC_TOOLBARWINDOW_MAIN, TB_BUTTONSTRUCTSIZE, (WPARAM)sizeof(TBBUTTON), 0); SendDlgItemMessage(hwnd, IDC_TOOLBARWINDOW_MAIN, TB_SETBUTTONSIZE, (WPARAM)0, (LPARAM)MAKELONG(16,16)); MainTbab.hInst = hInst; MainTbab.nID =(int)IDB_BITMAP_MAIN_BUTTON; SendDlgItemMessage(hwnd, IDC_TOOLBARWINDOW_MAIN, TB_ADDBITMAP, 7, (LPARAM)&MainTbab); SendDlgItemMessage(hwnd, IDC_TOOLBARWINDOW_MAIN, TB_ADDBUTTONS, (WPARAM)7,(LPARAM)&MainTbb); SendDlgItemMessage(hwnd, IDC_TOOLBARWINDOW_MAIN, TB_AUTOSIZE, 0, 0); } //----------------------------------------------------------------------------- // Toolbar SubWnd static TBBUTTON SubWndTbb[] = { {3, IDM_CONSOLE, TBSTATE_ENABLED, TBSTYLE_CHECK, 0, 0}, {1, IDM_LIST, TBSTATE_ENABLED, TBSTYLE_CHECK, 0, 0}, {2, IDM_TRACER, TBSTATE_ENABLED, TBSTYLE_CHECK, 0, 0}, {0, IDM_DOC, TBSTATE_ENABLED, TBSTYLE_CHECK, 0, 0}, {4, IDM_WRD, TBSTATE_ENABLED, TBSTYLE_CHECK, 0, 0}, }; static void InitSubWndToolbar(HWND hwnd) { TBADDBITMAP SubWndTbab; SendDlgItemMessage(hwnd, IDC_TOOLBARWINDOW_SUBWND, TB_BUTTONSTRUCTSIZE, (WPARAM)sizeof(TBBUTTON), 0); SendDlgItemMessage(hwnd, IDC_TOOLBARWINDOW_SUBWND, TB_SETBUTTONSIZE, (WPARAM)0, (LPARAM)MAKELONG(16,16)); SubWndTbab.hInst = hInst; SubWndTbab.nID =(int)IDB_BITMAP_SUBWND_BUTTON; SendDlgItemMessage(hwnd, IDC_TOOLBARWINDOW_SUBWND, TB_ADDBITMAP, 5, (LPARAM)&SubWndTbab); SendDlgItemMessage(hwnd, IDC_TOOLBARWINDOW_SUBWND, TB_ADDBUTTONS, (WPARAM)5,(LPARAM)&SubWndTbb); SendDlgItemMessage(hwnd, IDC_TOOLBARWINDOW_SUBWND, TB_AUTOSIZE, 0, 0); } //----------------------------------------------------------------------------- // Canvas Window #define MAPBAR_LIKE_TMIDI // note bar view like tmidi #define TM_CANVAS_XMAX 160 #define TM_CANVAS_YMAX 160 #define TM_CANVASMAP_XMAX 16 #define TM_CANVASMAP_YMAX 16 #define CANVAS_XMAX 160 #define CANVAS_YMAX 160 #define CMAP_XMAX 16 #define CMAP_YMAX 16 #define CK_MAX_CHANNELS 16 #define CMAP_MODE_16 1 #define CMAP_MODE_32 2 #define CMAP_MAX_CHANNELS 32 struct Canvas_ { HWND hwnd; HWND hParentWnd; RECT rcMe; int Mode; HDC hdc; HDC hmdc; HGDIOBJ hgdiobj_hmdcprev; int UpdateAll; int PaintDone; HANDLE hPopupMenu; HANDLE hPopupMenuKeyboard; // Sleep mode RECT rcSleep; HBITMAP hbitmap; HBITMAP hBitmapSleep; int SleepUpdateFlag; // Map mode RECT rcMap; char MapMap[CMAP_MAX_CHANNELS][CMAP_YMAX]; char MapMapOld[CMAP_MAX_CHANNELS][CMAP_YMAX]; char MapBar[CMAP_MAX_CHANNELS]; char MapBarOld[CMAP_MAX_CHANNELS]; int MapDelay; int MapResidual; int MapUpdateFlag; int MapMode; int MapBarWidth; int MapBarMax; int MapCh; int MapPan[CMAP_MAX_CHANNELS]; int MapPanOld[CMAP_MAX_CHANNELS]; int MapSustain[CMAP_MAX_CHANNELS]; int MapSustainOld[CMAP_MAX_CHANNELS]; int MapExpression[CMAP_MAX_CHANNELS]; int MapExpressionOld[CMAP_MAX_CHANNELS]; int MapVolume[CMAP_MAX_CHANNELS]; int MapVolumeOld[CMAP_MAX_CHANNELS]; int MapPitchbend[CMAP_MAX_CHANNELS]; int MapPitchbendOld[CMAP_MAX_CHANNELS]; int MapChChanged; ChannelBitMask DrumChannel; RECT rcMapMap; RECT rcMapSub; // Keyboard mode RECT rcKeyboard; uint32 CKxnote[MAX_W32G_MIDI_CHANNELS][4]; uint32 CKxnote_old[MAX_W32G_MIDI_CHANNELS][4]; int CKNoteFrom; int CKNoteTo; int CKCh; int CKPart; RECT rcGSLCD; int8 GSLCD[16][16]; int8 GSLCD_old[16][16]; int KeyboardUpdateFlag; int xnote_reset; // misc Channel channel[MAX_W32G_MIDI_CHANNELS]; } volatile Canvas; #define IDC_CANVAS 4242 static HWND hCanvasWnd; static char CanvasWndClassName[] = "TiMidity Canvas"; static LRESULT CALLBACK CanvasWndProc(HWND hwnd, UINT uMess, WPARAM wParam, LPARAM lParam); static void CanvasPaintDo(void); #define IDM_CANVAS_SLEEP 2321 #define IDM_CANVAS_MAP 2322 #define IDM_CANVAS_KEYBOARD 2323 #define IDM_CANVAS_REDRAW 2324 #define IDM_CANVAS_MAP16 2325 #define IDM_CANVAS_MAP32 2326 #define IDM_CANVAS_KEYBOARD_A 2327 #define IDM_CANVAS_KEYBOARD_B 2328 #define IDM_CANVAS_KEYBOARD_C 2329 #define IDM_CANVAS_GSLCD 2330 static void InitCanvasWnd(HWND hwnd) { WNDCLASS wndclass ; hCanvasWnd = 0; wndclass.style = CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS | CS_CLASSDC; wndclass.lpfnWndProc = CanvasWndProc ; wndclass.cbClsExtra = 0 ; wndclass.cbWndExtra = 0 ; wndclass.hInstance = hInst ; wndclass.hIcon = NULL; wndclass.hCursor = LoadCursor(0,IDC_ARROW) ; wndclass.hbrBackground = (HBRUSH)(COLOR_SCROLLBAR + 1); wndclass.lpszMenuName = NULL; wndclass.lpszClassName = CanvasWndClassName; RegisterClass(&wndclass); hCanvasWnd = CreateWindowEx(0,CanvasWndClassName,0,WS_CHILD,CW_USEDEFAULT, 0,CANVAS_XMAX,CANVAS_YMAX,GetDlgItem(hwnd,IDC_RECT_CANVAS),0,hInst,0); CanvasInit(hCanvasWnd); CanvasReset(); CanvasClear(); CanvasReadPanelInfo(1); CanvasUpdate(1); CanvasPaintAll(); ShowWindow(hCanvasWnd,SW_SHOW); UpdateWindow(hCanvasWnd); } static LRESULT CALLBACK CanvasWndProc(HWND hwnd, UINT uMess, WPARAM wParam, LPARAM lParam) { switch (uMess) { case WM_CREATE: Canvas.hPopupMenuKeyboard = CreatePopupMenu(); AppendMenu(Canvas.hPopupMenuKeyboard,MF_STRING,IDM_CANVAS_KEYBOARD_A,"A Part"); AppendMenu(Canvas.hPopupMenuKeyboard,MF_STRING,IDM_CANVAS_KEYBOARD_B,"B Part"); Canvas.hPopupMenu = CreatePopupMenu(); AppendMenu(Canvas.hPopupMenu,MF_STRING,IDM_CANVAS_GSLCD,"LCD Mode"); AppendMenu(Canvas.hPopupMenu,MF_STRING,IDM_CANVAS_MAP16,"Map16 Mode"); AppendMenu(Canvas.hPopupMenu,MF_STRING,IDM_CANVAS_MAP32,"Map32 Mode"); // AppendMenu(Canvas.hPopupMenu,MF_STRING,IDM_CANVAS_KEYBOARD,"Keyboard Mode"); AppendMenu(Canvas.hPopupMenu,MF_POPUP,(UINT)Canvas.hPopupMenuKeyboard,"Keyboard Mode"); AppendMenu(Canvas.hPopupMenu,MF_STRING,IDM_CANVAS_SLEEP,"Sleep Mode"); AppendMenu(Canvas.hPopupMenu,MF_SEPARATOR,0,0); AppendMenu(Canvas.hPopupMenu,MF_STRING,IDM_CANVAS_REDRAW,"Redraw"); break; case WM_DESTROY: DestroyMenu ( Canvas.hPopupMenuKeyboard ); Canvas.hPopupMenuKeyboard = NULL; break; case WM_PAINT: CanvasPaintDo(); return 0; case WM_LBUTTONDBLCLK: w32g_send_rc(RC_EXT_MODE_CHANGE, 0); break; case WM_RBUTTONDOWN: { RECT rc; GetWindowRect(Canvas.hwnd,(RECT *)&rc); SetForegroundWindow ( Canvas.hwnd ); TrackPopupMenu(Canvas.hPopupMenu,TPM_TOPALIGN|TPM_LEFTALIGN, rc.left+(int)LOWORD(lParam),rc.top+(int)HIWORD(lParam), 0,Canvas.hwnd,NULL); PostMessage ( Canvas.hwnd, WM_NULL, 0, 0 ); } break; case WM_COMMAND: switch (LOWORD(wParam)) { case IDM_CANVAS_GSLCD: CanvasChange(CANVAS_MODE_GSLCD); break; case IDM_CANVAS_MAP16: Canvas.MapMode = CMAP_MODE_16; CanvasChange(CANVAS_MODE_MAP16); break; case IDM_CANVAS_MAP32: Canvas.MapMode = CMAP_MODE_32; CanvasChange(CANVAS_MODE_MAP32); break; case IDM_CANVAS_KEYBOARD: CanvasChange(CANVAS_MODE_KBD_A); break; case IDM_CANVAS_KEYBOARD_A: Canvas.CKPart = 1; CanvasChange(CANVAS_MODE_KBD_A); break; case IDM_CANVAS_KEYBOARD_B: Canvas.CKPart = 2; CanvasChange(CANVAS_MODE_KBD_B); break; case IDM_CANVAS_SLEEP: CanvasChange(CANVAS_MODE_SLEEP); break; case IDM_CANVAS_REDRAW: // PanelResetPart(PANELRESET_CHANNEL); CanvasReset(); CanvasClear(); CanvasReadPanelInfo(1); CanvasUpdate(1); CanvasPaintAll(); break; } break; default: return DefWindowProc(hwnd,uMess,wParam,lParam) ; } return 0L; } // Color #define CCR_FORE RGB(0x00,0x00,0x00) #define CCR_BACK RGB(0x00,0xf0,0x00) #define CCR_DFORE RGB(0x70,0x00,0x00) #define CCR_DBACK RGB(0x00,0xf0,0x00) #define CCR_LOW RGB(0x80,0xd0,0x00) #define CCR_MIDDLE RGB(0xb0,0xb0,0x00) #define CCR_HIGH RGB(0xe0,0x00,0x00) // F m : n ō static COLORREF HalfColorMN(COLORREF fc, COLORREF bc, int m, int n) { return fc*m/(m+n) + bc*n/(m+n); } static COLORREF HalfColor23(COLORREF fc, COLORREF bc) { return HalfColorMN(fc,bc,2,3); } static COLORREF HalfColor15(COLORREF fc, COLORREF bc) { return HalfColorMN(fc,bc,1,5); } #define CC_BACK 0 #define CC_FORE 1 #define CC_LOW 2 #define CC_MIDDLE 3 #define CC_HIGH 4 #define CC_FORE_HALF 11 #define CC_LOW_HALF 12 #define CC_MIDDLE_HALF 13 #define CC_HIGH_HALF 14 #define CC_FORE_WEAKHALF 15 #define CC_DBACK 21 #define CC_DFORE 22 #define CC_DFORE_HALF 23 #define CC_DFORE_WEAKHALF 24 static COLORREF CanvasColor(int c) { switch(c){ case CC_BACK: return CCR_BACK; case CC_FORE: return CCR_FORE; case CC_FORE_HALF: return HalfColor15(CCR_FORE,CCR_BACK); case CC_FORE_WEAKHALF: return HalfColor23(CCR_FORE,CCR_BACK); case CC_DBACK: return CCR_DBACK; case CC_DFORE: return CCR_DFORE; case CC_DFORE_HALF: return HalfColor15(CCR_DFORE,CCR_DBACK); case CC_DFORE_WEAKHALF: return HalfColor23(CCR_DFORE,CCR_DBACK); case CC_LOW: return CCR_LOW; case CC_MIDDLE: return CCR_MIDDLE; case CC_HIGH: return CCR_HIGH; case CC_LOW_HALF: return HalfColor23(CCR_LOW,CCR_BACK); case CC_MIDDLE_HALF: return HalfColor23(CCR_MIDDLE,CCR_BACK); case CC_HIGH_HALF: return HalfColor23(CCR_HIGH,CCR_BACK); default: return CCR_BACK; } } static int CanvasOK = 0; static void CanvasInit(HWND hwnd) { RECT rc; GDI_LOCK(); // gdi_lock Canvas.hwnd = hwnd; Canvas.hParentWnd = GetParent(Canvas.hwnd); GetClientRect(Canvas.hParentWnd,&rc); MoveWindow(Canvas.hwnd,0,0,rc.right-rc.left,rc.bottom-rc.top,FALSE); GetClientRect(Canvas.hwnd,(RECT *)&(Canvas.rcMe)); Canvas.hdc = GetDC(Canvas.hwnd); Canvas.hbitmap = CreateCompatibleBitmap(Canvas.hdc,CANVAS_XMAX,CANVAS_YMAX); Canvas.hmdc = CreateCompatibleDC(Canvas.hdc); ReleaseDC(Canvas.hwnd,Canvas.hdc); Canvas.hBitmapSleep = LoadBitmap(hInst,MAKEINTRESOURCE(IDB_BITMAP_SLEEP)); Canvas.hgdiobj_hmdcprev = SelectObject(Canvas.hmdc,Canvas.hbitmap); SetRect((RECT *)&(Canvas.rcSleep),0,0,96,64); SetRect((RECT *)&(Canvas.rcMap),3,2+2,0,0); SetRect((RECT *)&(Canvas.rcKeyboard),1,1,0,0); SetRect((RECT *)&(Canvas.rcGSLCD),3,4,99,68); Canvas.rcMapMap.left = Canvas.rcMap.left; Canvas.rcMapMap.top = Canvas.rcMap.top; Canvas.rcMapMap.right = Canvas.rcMapMap.left + 6*16 - 1; Canvas.rcMapMap.bottom = Canvas.rcMapMap.top + 3*16 - 1; Canvas.rcMapSub.left = Canvas.rcMapMap.left; Canvas.rcMapSub.top = Canvas.rcMapMap.bottom + 2; Canvas.rcMapSub.right = Canvas.rcMapSub.left + 6*16 - 1; Canvas.rcMapSub.bottom = Canvas.rcMapSub.top +4+3+3+3+4 - 1; Canvas.MapDelay = 1; Canvas.MapResidual = 0; Canvas.MapMode = (MainWndInfo.CanvasMode == CANVAS_MODE_MAP32) ? CMAP_MODE_32 : CMAP_MODE_16; Canvas.MapBarMax = 16; // Canvas.CKNoteFrom = 24; // Canvas.CKNoteTo = 24 + 96; Canvas.CKNoteFrom = 12; Canvas.CKNoteTo = Canvas.CKNoteFrom + 96 + 3; Canvas.CKCh = 16; Canvas.CKPart = (MainWndInfo.CanvasMode == CANVAS_MODE_KBD_B) ? 2 : 1; Canvas.UpdateAll = 0; Canvas.Mode = (MainWndInfo.CanvasMode < CANVAS_MODE_GSLCD || MainWndInfo.CanvasMode > CANVAS_MODE_SLEEP) ? 1 : MainWndInfo.CanvasMode; Canvas.PaintDone = 0; GDI_UNLOCK(); // gdi_lock CanvasReset(); CanvasOK = 1; } // Canvas Map static void CanvasMapClear(void) { HPEN hPen; HBRUSH hBrush; HGDIOBJ hgdiobj_hpen, hgdiobj_hbrush; if(!CanvasOK) return; GDI_LOCK(); // gdi_lock hPen = CreatePen(PS_SOLID,1,CanvasColor(CC_BACK)); hBrush = CreateSolidBrush(CanvasColor(CC_BACK)); hgdiobj_hpen = SelectObject(Canvas.hmdc, hPen); hgdiobj_hbrush = SelectObject(Canvas.hmdc, hBrush); Rectangle(Canvas.hmdc, Canvas.rcMe.left,Canvas.rcMe.top,Canvas.rcMe.right,Canvas.rcMe.bottom); SelectObject(Canvas.hmdc, hgdiobj_hpen); DeleteObject(hPen); SelectObject(Canvas.hmdc, hgdiobj_hbrush); DeleteObject(hBrush); GDI_UNLOCK(); // gdi_lock InvalidateRect(hCanvasWnd, NULL, FALSE); } static void CanvasMapReset(void) { int i,j,ch; if(!CanvasOK) return; switch(Canvas.MapMode){ case CMAP_MODE_32: Canvas.MapCh = 32; #ifdef MAPBAR_LIKE_TMIDI Canvas.MapBarWidth = 5; Canvas.MapBarMax = 10+1; Canvas.rcMapMap.bottom = Canvas.rcMapMap.top + 3*Canvas.MapBarMax*2 + 6 - 1; #else Canvas.MapBarWidth = 2; Canvas.MapBarMax = 16; Canvas.rcMapMap.bottom = Canvas.rcMapMap.top + 3*Canvas.MapBarMax - 1; #endif break; default: case CMAP_MODE_16: Canvas.MapCh = 16; Canvas.MapBarWidth = 5; Canvas.MapBarMax = 16; Canvas.rcMapMap.bottom = Canvas.rcMapMap.top + 3*Canvas.MapBarMax - 1; break; } for(i=0;ichanged && !flag) return; // Bar Canvas.DrumChannel = drumchannels; for(ch=0;chv_flags[ch] == FLAG_NOTE_ON){ #if 0 v = Panel->ctotal[ch]/8; #else v = (int) Panel->ctotal[ch] * Canvas.MapBarMax / 128; #endif } else { v = 0; } if(v<0) v = 0; else if(v>Canvas.MapBarMax-1) v = Canvas.MapBarMax-1; if(v != Canvas.MapBar[ch]){ // x if(Canvas.MapDelay){ int old = Canvas.MapBar[ch]; if(Canvas.MapBar[ch]<0) Canvas.MapBar[ch] = v; else Canvas.MapBar[ch] = (old*10*1/3 + v*10*2/3)/10; if(old == Canvas.MapBar[ch]){ if(v>old) Canvas.MapBar[ch] = old + 1; else if(vchannel[ch].panning==NO_PANNING) Canvas.MapPan[ch] = -1; else { Canvas.MapPan[ch] = ( Panel->channel[ch].panning - 64 ) * 3 /128; // Canvas.MapPan[ch] = ( 64 - Panel->channel[ch].panning ) * 3 /128; Canvas.MapPan[ch] = SetValue(Canvas.MapPan[ch],-2,2) + 2; } if(Panel->channel[ch].sustain) Canvas.MapSustain[ch] = 5; else Canvas.MapSustain[ch] = 0; //Canvas.MapSustain[ch] = SetValue(Canvas.MapSustain[ch],0,10); #if 0 Canvas.MapExpression[ch] = (Panel->channel[ch].expression * 11) >>8; #else Canvas.MapExpression[ch] = (Panel->channel[ch].expression * 11) >>7; #endif Canvas.MapExpression[ch] = SetValue(Canvas.MapExpression[ch],0,10); #if 0 Canvas.MapVolume[ch] = (Panel->channel[ch].volume * 11) >>8; #else Canvas.MapVolume[ch] = (Panel->channel[ch].volume * 11) >>7; #endif Canvas.MapVolume[ch] = SetValue(Canvas.MapVolume[ch],0,10); Canvas.MapPitchbend[ch] = Panel->channel[ch].pitchbend; if(Canvas.MapPanOld[ch]!=Canvas.MapPan[ch]) changed = 1; if(Canvas.MapSustainOld[ch]!=Canvas.MapSustain[ch]) changed = 1; if(Canvas.MapExpressionOld[ch]!=Canvas.MapExpression[ch]) changed = 1; if(Canvas.MapVolumeOld[ch]!=Canvas.MapVolume[ch]) changed = 1; if(Canvas.MapPitchbendOld[ch]!=Canvas.MapPitchbend[ch]) changed = 1; if(changed) Canvas.MapChChanged |= 1 << ch; } } } static void CanvasMapDrawMapBar(int flag) { int i,ch; if(!CanvasOK) return; if(Canvas.UpdateAll) flag = 1; if(!Canvas.MapResidual && !flag) return; Canvas.MapResidual = 0; for(ch=0;chchanged){ int ch; GDI_LOCK(); for(ch=0;ch=0){ x = rc.left + Canvas.MapPan[ch]; for(y=rc.top;y<=rc.bottom;y++) SetPixelV(Canvas.hmdc,x,y,colorFG); } // SUSTAIN rc.top = rc.bottom + 2; rc.bottom = rc.top + 2 - 1; if(Canvas.MapSustain[ch]){ for(x=rc.left;x<=rc.right;x++){ for(y=rc.top;y<=rc.bottom;y++) SetPixelV(Canvas.hmdc,x,y,colorFG); } } else { for(x=rc.left;x<=rc.right;x++){ for(y=rc.top;y<=rc.bottom;y++) SetPixelV(Canvas.hmdc,x,y,colorBG); } // EXPRESSION rc.top = rc.bottom + 2; rc.bottom = rc.top + 2 - 1; for(i=1;i<=10;i++){ if(i <= Canvas.MapExpression[ch]) color = colorFG; else color = colorBG; x = rc.left + (i-1)/2; y = rc.top + (i+1)%2; SetPixelV(Canvas.hmdc,x,y,color); } // VOLUME rc.top = rc.bottom + 2; rc.bottom = rc.top + 2 - 1; for(i=1;i<=10;i++){ if(i <= Canvas.MapVolume[ch]) color = colorFG; else color = colorBG; x = rc.left + (i-1)/2; y = rc.top + (i+1)%2; SetPixelV(Canvas.hmdc,x,y,color); } // PITCH_BEND rc.top = rc.bottom + 2; rc.bottom = rc.top + 3 - 1; for(x=rc.left;x<=rc.right;x++){ for(y=rc.top;y<=rc.bottom;y++) SetPixelV(Canvas.hmdc,x,y,colorBG); } if(Canvas.MapPitchbend[ch]==-2){ y = rc.top + 1; for(x=rc.left;x<=rc.right;x++) SetPixelV(Canvas.hmdc,x,y,colorFG); y++; for(x=rc.left;x<=rc.right;x++) SetPixelV(Canvas.hmdc,x,y,colorFG); } else if(Canvas.MapPitchbend[ch]>0x2000){ y = rc.top; for(x=rc.left;x<=rc.left;x++) SetPixelV(Canvas.hmdc,x,y,colorFG); y++; for(x=rc.left;x<=rc.left+2;x++) SetPixelV(Canvas.hmdc,x,y,colorFG); y++; for(x=rc.left;x<=rc.left+4;x++) SetPixelV(Canvas.hmdc,x,y,colorFG); } else if(Canvas.MapPitchbend[ch]<0x2000){ y = rc.top; for(x=rc.right;x<=rc.right;x++) SetPixelV(Canvas.hmdc,x,y,colorFG); y++; for(x=rc.right-2;x<=rc.right;x++) SetPixelV(Canvas.hmdc,x,y,colorFG); y++; for(x=rc.right-4;x<=rc.right;x++) SetPixelV(Canvas.hmdc,x,y,colorFG); } } } InvalidateRect(hCanvasWnd,(RECT *)&(Canvas.rcMapSub),FALSE); GDI_UNLOCK(); } } if(!Canvas.MapResidual && !flag) return; change_flag = 0; #ifndef MAPBAR_LIKE_TMIDI GDI_LOCK(); for(i=0;ichanged && !flag) {return;} for(i = 0; i < 16; i++) { for(j = 0; j < 16; j++) { Canvas.GSLCD_old[i][j] = Canvas.GSLCD[i][j]; Canvas.GSLCD[i][j] = Panel->GSLCD[i][j]; } } } #define CGSLCD_BG RGB(0x00,0xf0,0x00) #define CGSLCD_ON RGB(0x00,0x00,0x00) #define CGSLCD_OFF RGB(0x00,0xc0,0x00) static void CanvasGSLCDUpdate(int flag) { int i, j, x, y, changed = 0; COLORREF colorON = CGSLCD_ON, colorOFF = CGSLCD_OFF; HPEN hPen; HBRUSH hBrush; HGDIOBJ hgdiobj_hpen, hgdiobj_hbrush; if(!PInfoOK) {return;} if(Canvas.UpdateAll) {flag = 1;} if(!Panel->changed && !flag) {return;} GDI_LOCK(); // gdi_lock for (i = 0; i < 16; i++) { for (j = 0; j < 16; j++) { x = Canvas.rcGSLCD.left + i * 6; y = Canvas.rcGSLCD.top + j * 4; if (flag || Canvas.GSLCD[i][j] != Canvas.GSLCD_old[i][j]) { changed = 1; if (Canvas.GSLCD[i][j] == 1) { hPen = CreatePen(PS_SOLID, 1, colorON); hBrush = CreateSolidBrush(colorON); } else { hPen = CreatePen(PS_SOLID, 1, colorOFF); hBrush = CreateSolidBrush(colorOFF); } hgdiobj_hpen = SelectObject(Canvas.hmdc, hPen); hgdiobj_hbrush = SelectObject(Canvas.hmdc, hBrush); Rectangle(Canvas.hmdc, x, y, x + 5, y + 3); SelectObject(Canvas.hmdc, hgdiobj_hpen); DeleteObject(hPen); SelectObject(Canvas.hmdc, hgdiobj_hbrush); DeleteObject(hBrush); } } } if (changed) { GDI_UNLOCK(); InvalidateRect(Canvas.hwnd, (RECT *)&Canvas.rcGSLCD, FALSE); GDI_LOCK(); } GDI_UNLOCK(); // gdi_lock if(flag) {InvalidateRect(hCanvasWnd, NULL, FALSE);} } static void CanvasGSLCDClear(void) { HPEN hPen; HBRUSH hBrush; HGDIOBJ hgdiobj_hpen, hgdiobj_hbrush; COLORREF BGcolor; if(!CanvasOK) return; GDI_LOCK(); // gdi_lock BGcolor = RGB(0,0,0); hPen = CreatePen(PS_SOLID,1,BGcolor); hBrush = CreateSolidBrush(BGcolor); hgdiobj_hpen = SelectObject(Canvas.hmdc, hPen); hgdiobj_hbrush = SelectObject(Canvas.hmdc, hBrush); Rectangle(Canvas.hmdc, Canvas.rcMe.left,Canvas.rcMe.top,Canvas.rcMe.right,Canvas.rcMe.bottom); SelectObject(Canvas.hmdc, hgdiobj_hpen); DeleteObject(hPen); SelectObject(Canvas.hmdc, hgdiobj_hbrush); DeleteObject(hBrush); BGcolor = CGSLCD_BG; hPen = CreatePen(PS_SOLID,1,BGcolor); hBrush = CreateSolidBrush(BGcolor); hgdiobj_hpen = SelectObject(Canvas.hmdc, hPen); hgdiobj_hbrush = SelectObject(Canvas.hmdc, hBrush); Rectangle(Canvas.hmdc, Canvas.rcMe.left + 1,Canvas.rcMe.top + 1,Canvas.rcMe.right - 1,Canvas.rcMe.bottom - 1); SelectObject(Canvas.hmdc, hgdiobj_hpen); DeleteObject(hPen); SelectObject(Canvas.hmdc, hgdiobj_hbrush); DeleteObject(hBrush); GDI_UNLOCK(); // gdi_lock CanvasGSLCDReset(); CanvasGSLCDReadPanelInfo(1); CanvasGSLCDUpdate(1); InvalidateRect(hCanvasWnd, NULL, FALSE); } // Canvas Keyboard static void CanvasKeyboardReset(void) { int i,j; int ChFrom = (Canvas.CKPart - 1) * Canvas.CKCh; int ChTo = Canvas.CKPart * Canvas.CKCh - 1; for(i=ChFrom;i<=ChTo;i++){ for(j=0;j<4;j++){ Canvas.CKxnote[i][j] = 0; Canvas.CKxnote_old[i][j] = 0; } } Canvas.PaintDone = 0; } static void CanvasKeyboardReadPanelInfo(int flag) { int i,j; int ChFrom, ChTo; if(!CanvasOK) return; if(!PInfoOK) return; ChFrom = (Canvas.CKPart - 1) * Canvas.CKCh; ChTo = Canvas.CKPart * Canvas.CKCh - 1; if(Canvas.UpdateAll) flag = 1; if(!Panel->changed && !flag) return; for(i=ChFrom;i<=ChTo;i++) for(j=0;j<4;j++){ Canvas.CKxnote_old[i][j] = Canvas.CKxnote[i][j]; Canvas.CKxnote[i][j] = Panel->xnote[i][j]; } } #define CK_KEY_BLACK 1 #define CK_KEY_WHITE 2 #define CK_ON RGB(0xff,0x00,0x00) #define CK_OFF_WHITE RGB(0xff,0xff,0xff) #define CK_OFF_BLACK RGB(0x00,0x00,0x00) #define CK_DOFF_WHITE RGB(0xcc,0xcc,0xcc) #define CK_DOFF_BLACK RGB(0x00,0x00,0x00) static void CanvasKeyboardUpdate(int flag) { int j,k,l; int channel; int ChFrom, ChTo; if(!PInfoOK) return; if(Canvas.UpdateAll) flag = 1; if(!COMPARE_CHANNELMASK(Canvas.DrumChannel,drumchannels)) flag = 1; if(!Panel->changed && !flag) return; ChFrom = (Canvas.CKPart - 1) * Canvas.CKCh; ChTo = Canvas.CKPart * Canvas.CKCh - 1; GDI_LOCK(); // gdi_lock for(channel=ChFrom;channel<=ChTo;channel++){ int change_flag = 0; int drumflag = IS_SET_CHANNELMASK(drumchannels,channel); COLORREF colorON, colorOFF_WHITE, colorOFF_BLACK; if(drumflag){ colorON = CK_ON; colorOFF_WHITE = CK_DOFF_WHITE; colorOFF_BLACK = CK_OFF_BLACK; } else { colorON = CK_ON; colorOFF_WHITE = CK_OFF_WHITE; colorOFF_BLACK = CK_OFF_BLACK; } for(j=0;j<4;j++){ int32 xnote, xnote_diff; xnote = Canvas.CKxnote[channel][j]; xnote_diff = Canvas.CKxnote[channel][j] ^ Canvas.CKxnote_old[channel][j]; if(!flag && xnote_diff == 0) continue; for(k=0;k<32;k++){ int key = 0; int KeyOn = 0; int note = j*32+k; int reff = (int32)1 << k; int x,y; if(note < Canvas.CKNoteFrom || note > Canvas.CKNoteTo) continue; if(!flag && !(xnote_diff & reff)) continue; if(xnote & reff) KeyOn = 1; note = note % 12; if(note == 1 || note == 3 || note == 6 || note == 8 || note == 10) key = CK_KEY_BLACK; else key = CK_KEY_WHITE; x = Canvas.rcKeyboard.left + j * 32 + k - Canvas.CKNoteFrom; y = Canvas.rcKeyboard.top + (channel - ChFrom) * 4; switch(key){ case CK_KEY_BLACK: if(KeyOn){ for(l=0;l<2;l++) SetPixelV(Canvas.hmdc,x,y+l,colorON); SetPixelV(Canvas.hmdc,x,y+2,colorOFF_WHITE); } else { for(l=0;l<2;l++) SetPixelV(Canvas.hmdc,x,y+l,colorOFF_BLACK); SetPixelV(Canvas.hmdc,x,y+2,colorOFF_WHITE); } break; case CK_KEY_WHITE: if(KeyOn){ SetPixelV(Canvas.hmdc,x,y,colorOFF_WHITE); for(l=1;l<3;l++) SetPixelV(Canvas.hmdc,x,y+l,colorON); } else { SetPixelV(Canvas.hmdc,x,y,colorOFF_WHITE); for(l=1;l<3;l++) SetPixelV(Canvas.hmdc,x,y+l,colorOFF_WHITE); } break; default: break; } change_flag = 1; } } if(change_flag){ RECT rc; GDI_UNLOCK(); GetClientRect(Canvas.hwnd,&rc); rc.top = Canvas.rcKeyboard.top + (channel - ChFrom) * 4; rc.bottom = rc.top + 4; InvalidateRect(Canvas.hwnd, &rc, FALSE); GDI_LOCK(); } } GDI_UNLOCK(); // gdi_lock if(flag) InvalidateRect(hCanvasWnd, NULL, FALSE); Canvas.DrumChannel = drumchannels; } static void CanvasKeyboardClear(void) { int i; HPEN hPen; HBRUSH hBrush; HGDIOBJ hgdiobj_hpen, hgdiobj_hbrush; COLORREF FGcolor, BGcolor; HFONT hfont; HGDIOBJ hgdiobj; RECT rc; char buffer[16]; if(!CanvasOK) return; GDI_LOCK(); // gdi_lock #if 0 hPen = CreatePen(PS_SOLID,1,CanvasColor(CC_BACK)); hBrush = CreateSolidBrush(CanvasColor(CC_BACK)); #else FGcolor = RGB(0xff,0xff,0xff); BGcolor = RGB(0x00,0x00,0x00); hPen = CreatePen(PS_SOLID,1,BGcolor); hBrush = CreateSolidBrush(BGcolor); #endif hgdiobj_hpen = SelectObject(Canvas.hmdc, hPen); hgdiobj_hbrush = SelectObject(Canvas.hmdc, hBrush); Rectangle(Canvas.hmdc, Canvas.rcMe.left,Canvas.rcMe.top,Canvas.rcMe.right,Canvas.rcMe.bottom); SelectObject(Canvas.hmdc, hgdiobj_hpen); DeleteObject(hPen); SelectObject(Canvas.hmdc, hgdiobj_hbrush); DeleteObject(hBrush); hfont = CreateFont(7,7,0,0,FW_DONTCARE,FALSE,FALSE,FALSE, DEFAULT_CHARSET,OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE,"Arial Bold"); hgdiobj = SelectObject(Canvas.hmdc,hfont); SetTextAlign(Canvas.hmdc, TA_LEFT | TA_TOP | TA_NOUPDATECP); rc.left = Canvas.rcMe.left+1 ; rc.top = Canvas.rcMe.bottom-7; rc.right = Canvas.rcMe.left+1 + 40; rc.bottom = Canvas.rcMe.bottom; SetTextColor(Canvas.hmdc,RGB(0xff,0xff,0xff)); SetBkColor(Canvas.hmdc,RGB(0x00,0x00,0x00)); strcpy(buffer," "); ExtTextOut(Canvas.hmdc,rc.left,rc.top,ETO_CLIPPED|ETO_OPAQUE,&rc, buffer,strlen(buffer),NULL); for(i=1;i<=3;i++){ if(i==Canvas.CKPart){ SetTextColor(Canvas.hmdc,RGB(0xff,0xff,0xff)); SetBkColor(Canvas.hmdc,RGB(0x00,0x00,0x00)); } else { SetTextColor(Canvas.hmdc,RGB(0x80,0x80,0x80)); SetBkColor(Canvas.hmdc,RGB(0x00,0x00,0x00)); } rc.left = Canvas.rcMe.left+1 + 0 + (i-1)*24; rc.top = Canvas.rcMe.bottom-7; rc.right = Canvas.rcMe.left+1 + 0 + (i)*24 - 1; rc.bottom = Canvas.rcMe.bottom; sprintf(buffer,"[%c]",i+'A'-1); ExtTextOut(Canvas.hmdc,rc.left,rc.top,ETO_CLIPPED|ETO_OPAQUE,&rc, buffer,strlen(buffer),NULL); } if((HGDIOBJ)hgdiobj!=(HGDIOBJ)NULL && (HGDIOBJ)hgdiobj!=(HGDIOBJ)GDI_ERROR) SelectObject(Canvas.hmdc,hgdiobj); DeleteObject(hfont); GDI_UNLOCK(); // gdi_lock CanvasKeyboardReset(); CanvasKeyboardReadPanelInfo(1); CanvasKeyboardUpdate(1); InvalidateRect(hCanvasWnd, NULL, FALSE); } // Canvas All static void CanvasPaintDo(void) { RECT rc; if ( GetUpdateRect(Canvas.hwnd, &rc, FALSE) ) { PAINTSTRUCT ps; GDI_LOCK(); // gdi_lock Canvas.hdc = BeginPaint(Canvas.hwnd, &ps); BitBlt(Canvas.hdc,rc.left,rc.top,rc.right,rc.bottom,Canvas.hmdc,rc.left,rc.top,SRCCOPY); EndPaint(Canvas.hwnd, &ps); GDI_UNLOCK(); // gdi_lock } } void CanvasPaint(void) { Canvas.PaintDone = 0; UpdateWindow(hCanvasWnd); } void CanvasPaintAll(void) { InvalidateRect(hCanvasWnd, NULL, FALSE); CanvasPaint(); } void CanvasReset(void) { if (! CanvasOK) return; switch (Canvas.Mode) { case CANVAS_MODE_GSLCD: CanvasGSLCDReset(); break; case CANVAS_MODE_MAP16: case CANVAS_MODE_MAP32: CanvasMapReset(); break; case CANVAS_MODE_KBD_A: case CANVAS_MODE_KBD_B: CanvasKeyboardReset(); break; case CANVAS_MODE_SLEEP: CanvasSleepReset(); break; } } void CanvasClear(void) { if (! CanvasOK) return; switch (Canvas.Mode) { case CANVAS_MODE_GSLCD: CanvasGSLCDClear(); break; case CANVAS_MODE_MAP16: case CANVAS_MODE_MAP32: CanvasMapClear(); break; case CANVAS_MODE_KBD_A: case CANVAS_MODE_KBD_B: CanvasKeyboardClear(); break; case CANVAS_MODE_SLEEP: CanvasSleepClear(); break; } } void CanvasUpdate(int flag) { if (! CanvasOK) return; switch (Canvas.Mode) { case CANVAS_MODE_GSLCD: CanvasGSLCDUpdate(flag); break; case CANVAS_MODE_MAP16: case CANVAS_MODE_MAP32: CanvasMapUpdate(flag); break; case CANVAS_MODE_KBD_A: case CANVAS_MODE_KBD_B: CanvasKeyboardUpdate(flag); break; case CANVAS_MODE_SLEEP: CanvasSleepUpdate(flag); break; } } void CanvasReadPanelInfo(int flag) { if (! CanvasOK) return; switch (Canvas.Mode) { case CANVAS_MODE_GSLCD: CanvasGSLCDReadPanelInfo(flag); break; case CANVAS_MODE_MAP16: case CANVAS_MODE_MAP32: CanvasMapReadPanelInfo(flag); break; case CANVAS_MODE_KBD_A: case CANVAS_MODE_KBD_B: CanvasKeyboardReadPanelInfo(flag); break; case CANVAS_MODE_SLEEP: // CanvasSleepReadPanelInfo(flag); break; } } void CanvasChange(int mode) { if (mode != 0) Canvas.Mode = mode; else { if (Canvas.Mode == CANVAS_MODE_SLEEP) Canvas.Mode = CANVAS_MODE_GSLCD; else if (Canvas.Mode == CANVAS_MODE_GSLCD) { Canvas.MapMode = CMAP_MODE_16; Canvas.Mode = CANVAS_MODE_MAP16; } else if (Canvas.Mode == CANVAS_MODE_MAP16) { Canvas.MapMode = CMAP_MODE_32; Canvas.Mode = CANVAS_MODE_MAP32; } else if (Canvas.Mode == CANVAS_MODE_MAP32) { Canvas.CKPart = 1; Canvas.Mode = CANVAS_MODE_KBD_A; } else if (Canvas.Mode == CANVAS_MODE_KBD_A) { Canvas.CKPart = 2; Canvas.Mode = CANVAS_MODE_KBD_B; } else if (Canvas.Mode == CANVAS_MODE_KBD_B) Canvas.Mode = CANVAS_MODE_SLEEP; } MainWndInfo.CanvasMode = Canvas.Mode; CanvasReset(); CanvasClear(); CanvasReadPanelInfo(1); CanvasUpdate(1); CanvasPaintAll(); } int CanvasGetMode(void) { return Canvas.Mode; } //----------------------------------------------------------------------------- // Main Panel // CplEChE֘A // // // // // // // #define MPANEL_XMAX 440 #define MPANEL_YMAX 88 // update flag. #define MP_UPDATE_ALL 0xffffL #define MP_UPDATE_NONE 0x0000L #define MP_UPDATE_TITLE 0x0001L #define MP_UPDATE_FILE 0x0002L #define MP_UPDATE_TIME 0x0004L #define MP_UPDATE_METRONOME 0x0008L #define MP_UPDATE_VOICES 0x0010L #define MP_UPDATE_MVOLUME 0x0020L #define MP_UPDATE_RATE 0x0040L #define MP_UPDATE_PLAYLIST 0x0080L #define MP_UPDATE_MISC 0x0200L #define MP_UPDATE_MESSAGE 0x0400L #define MP_UPDATE_BACKGROUND 0x0800L #define MP_UPDATE_KEYSIG 0x1000L #define MP_UPDATE_TEMPO 0x2000L #define MP_TITLE_MAX 256 #define MP_FILE_MAX 256 struct MPanel_ { HWND hwnd; HWND hParentWnd; HDC hdc; HDC hmdc; HGDIOBJ hgdiobj_hmdcprev; HBITMAP hbitmap; HBITMAP hbitmapBG; /* the background bitmap */ HBITMAP hbitmapBGFilter; /* the background bitmap filter */ HFONT hfont; char Font[256]; char FontLang[256]; char FontLangFixed[256]; RECT rcMe; RECT rcTitle; RECT rcFile; RECT rcTime; RECT rcVoices; RECT rcMVolume; RECT rcRate; RECT rcMetronome; RECT rcKeysig; RECT rcTempo; RECT rcList; RECT rcMisc; RECT rcMessage; char Title[MP_TITLE_MAX+1]; char File[MP_FILE_MAX+1]; int CurTime_h; int CurTime_m; int CurTime_s; int CurTime_ss; int TotalTime_h; int TotalTime_m; int TotalTime_s; int TotalTime_ss; int CurVoices; int MaxVoices; int MVolume; int Rate; int Meas; int Beat; char Keysig[7]; int Key_offset; int Tempo; int Tempo_ratio; int PlaylistNum; int PlaylistMax; HFONT hFontTitle; HFONT hFontFile; HFONT hFontTime; HFONT hFontVoices; HFONT hFontMVolume; HFONT hFontRate; HFONT hFontMetronome; HFONT hFontKeysig; HFONT hFontTempo; HFONT hFontList; HFONT hFontMisc; HFONT hFontMessage; long UpdateFlag; COLORREF FGColor; COLORREF BGColor; COLORREF BGBGColor; enum play_system_modes play_system_mode; int current_file_info_file_type; int current_file_info_max_channel; } MPanel; extern volatile int MPanelOK; static struct MPanelMessageData_ { int len; // bZ[W{bNX̒B char buff[1024]; // obt@B DWORD prevtime; int msec; // cbB int pointer; // ݂̃|C^B char curbuff[1024]; int curbuffsize; int curmode; // ݃bZ[W̃[hB int curmsec; // ݃bZ[W̎cbB char nextbuff[1024]; int nextmode; // ݃bZ[W̃[hB int nextmsec; // ݃bZ[W̎cbB } MPanelMessageData; void MPanelMessageInit(void); void MPanelMessageAdd(char *message, int msec, int mode); void MPanelMessageClearAll(void); void MPanelMessageClear(void); void MPanelMessageNext(void); void MPanelMessageUpdate(void); static HWND hPanelWnd; static char PanelWndClassName[] = "TiMidity Main Panel"; static LRESULT CALLBACK PanelWndProc(HWND hwnd, UINT uMess, WPARAM wParam, LPARAM lParam); int MPanelMode = 0; static void InitPanelWnd(HWND hwnd) { WNDCLASS wndclass ; hPanelWnd = 0; wndclass.style = CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS | CS_CLASSDC; wndclass.lpfnWndProc = PanelWndProc ; wndclass.cbClsExtra = 0 ; wndclass.cbWndExtra = 0 ; wndclass.hInstance = hInst ; wndclass.hIcon = NULL; wndclass.hCursor = LoadCursor(0,IDC_ARROW) ; wndclass.hbrBackground = (HBRUSH)(COLOR_SCROLLBAR + 1); wndclass.lpszMenuName = NULL; wndclass.lpszClassName = PanelWndClassName; RegisterClass(&wndclass); hPanelWnd = CreateWindowEx(0,PanelWndClassName,0,WS_CHILD, CW_USEDEFAULT,0,MPANEL_XMAX,MPANEL_YMAX, GetDlgItem(hwnd,IDC_RECT_PANEL),0,hInst,0); MPanelInit(hPanelWnd); MPanelReset(); MPanelReadPanelInfo(1); MPanelUpdateAll(); MPanelPaintAll(); UpdateWindow(hPanelWnd); ShowWindow(hPanelWnd,SW_SHOW); } static void MPanelPaintDo(void); static LRESULT CALLBACK PanelWndProc(HWND hwnd, UINT uMess, WPARAM wParam, LPARAM lParam) { switch (uMess) { case WM_CREATE: break; case WM_PAINT: MPanelPaintDo(); return 0; case WM_LBUTTONDBLCLK: // MPanelReset(); MPanelReadPanelInfo(1); MPanelUpdateAll(); MPanelPaintAll(); break; case WM_DESTROY: if(MPanel.hFontTitle!=NULL) DeleteObject(MPanel.hFontTitle); if(MPanel.hFontFile!=NULL) DeleteObject(MPanel.hFontFile); if(MPanel.hFontTime!=NULL) DeleteObject(MPanel.hFontTime); if(MPanel.hFontVoices!=NULL) DeleteObject(MPanel.hFontVoices); if(MPanel.hFontMVolume!=NULL) DeleteObject(MPanel.hFontMVolume); if(MPanel.hFontRate!=NULL) DeleteObject(MPanel.hFontRate); if (MPanel.hFontMetronome != NULL) DeleteObject(MPanel.hFontMetronome); if (MPanel.hFontKeysig != NULL) DeleteObject(MPanel.hFontKeysig); if (MPanel.hFontTempo != NULL) DeleteObject(MPanel.hFontTempo); if(MPanel.hFontList!=NULL) DeleteObject(MPanel.hFontList); if(MPanel.hFontMisc!=NULL) DeleteObject(MPanel.hFontMisc); if(MPanel.hFontMessage!=NULL) DeleteObject(MPanel.hFontMessage); break; default: return DefWindowProc(hwnd,uMess,wParam,lParam) ; } return 0L; } // Initialization of MPanel strucuter at once. volatile int MPanelOK = 0; static void MPanelInit(HWND hwnd) { RECT rc; int tmp; GDI_LOCK(); // gdi_lock MPanel.hwnd = hwnd; MPanel.hParentWnd = GetParent(MPanel.hwnd); GetClientRect(MPanel.hParentWnd,&rc); MoveWindow(MPanel.hwnd,0,0,rc.right-rc.left,rc.bottom-rc.top,FALSE); MPanel.hdc = GetDC(MPanel.hwnd); MPanel.hbitmap = CreateCompatibleBitmap(MPanel.hdc,MPANEL_XMAX,MPANEL_YMAX); MPanel.hmdc = CreateCompatibleDC(MPanel.hdc); MPanel.hgdiobj_hmdcprev = SelectObject(MPanel.hmdc,MPanel.hbitmap); ReleaseDC(MPanel.hwnd,MPanel.hdc); GetClientRect(MPanel.hwnd,&rc); // RECT reft,top,right,bottom SetRect(&(MPanel.rcMe),rc.left,rc.top,rc.right,rc.bottom); rc = MPanel.rcMe; SetRect(&(MPanel.rcTitle), rc.left+2, rc.top+2, rc.right-2, rc.top+2+14); SetRect(&(MPanel.rcFile), rc.left+2, rc.top+2+14+1, rc.right-2, rc.top+2+14+1+12); #if 0 SetRect(&(MPanel.rcTime), rc.left+2, rc.top+2+14+1+12+1, rc.left+2+180, rc.top+2+14+1+12+1+25); SetRect(&(MPanel.rcVoices), rc.right-2-36-1-24-48, rc.top+2+14+1+12+1, rc.right-2-36-1-24, rc.top+2+14+1+12+1+12); SetRect(&(MPanel.rcMVolume),rc.right-2-36, rc.top+2+14+1+12+1, rc.right-2, rc.top+2+14+1+12+1+12); SetRect(&(MPanel.rcRate), rc.right-2-60-1-18-48, rc.top+2+14+1+12+1+12+1, rc.right-2-36-1, rc.top+2+14+1+12+1+12+1+12); SetRect(&(MPanel.rcList), rc.right-2-60, rc.top+2+14+1+12+1+12+1, rc.right-2, rc.top+2+14+1+12+1+12+1+12); SetRect(&(MPanel.rcMisc), rc.left+2, rc.top+2+14+1+12+1+25+1,rc.right-2,rc.top+2+14+1+12+1+25+1+12); SetRect(&(MPanel.rcMessage),rc.left,rc.top,rc.right,rc.bottom); #else SetRect(&(MPanel.rcTime), rc.left + 2, rc.top + 2 + 14 + 1 + 12 + 1, rc.left + 2 + 176, rc.top + 2 + 14 + 1 + 12 + 1 + 25); SetRect(&(MPanel.rcVoices), rc.left + 2 + 176 + 2, rc.top + 2 + 14 + 1 + 12 + 1, rc.left + 2 + 176 + 2 + 50, rc.top + 2 + 14 + 1 + 12 + 1 + 12); SetRect(&(MPanel.rcRate), rc.left + 2 + 176 + 2 + 50 + 2, rc.top + 2 + 14 + 1 + 12 + 1, rc.right - 2 - 38 - 2, rc.top + 2 + 14 + 1 + 12 + 1 + 12); SetRect(&(MPanel.rcMVolume), rc.right - 2 - 38, rc.top + 2 + 14 + 1 + 12 + 1, rc.right - 2, rc.top + 2 + 14 + 1 + 12 + 1 + 12); SetRect(&(MPanel.rcMetronome), rc.left + 2 + 176 - 40, rc.top + 2 + 14 + 1 + 12 + 1 + 12 + 1 + 12 + 1, rc.left + 2 + 176, rc.top + 2 + 14 + 1 + 12 + 1 + 12 + 1 + 12 + 1 + 12); SetRect(&(MPanel.rcKeysig), rc.left + 2 + 176 + 2, rc.top + 2 + 14 + 1 + 12 + 1 + 12 + 1, rc.right - 2 - 69 - 2, rc.top + 2 + 14 + 1 + 12 + 1 + 12 + 1 + 12); SetRect(&(MPanel.rcTempo), rc.right - 2 - 69, rc.top + 2 + 14 + 1 + 12 + 1 + 12 + 1, rc.right - 2, rc.top + 2 + 14 + 1 + 12 + 1 + 12 + 1 + 12); SetRect(&(MPanel.rcMisc), rc.left + 2 + 176 + 2, rc.top + 2 + 14 + 1 + 12 + 1 + 12 + 1 + 12 + 1, rc.right - 2 - 54 - 2, rc.top + 2 + 14 + 1 + 12 + 1 + 12 + 1 + 12 + 1 + 12); SetRect(&(MPanel.rcList), rc.right - 2 - 54, rc.top + 2 + 14 + 1 + 12 + 1 + 12 + 1 + 12 + 1, rc.right - 2, rc.top + 2 + 14 + 1 + 12 + 1 + 12 + 1 + 12 + 1 + 12); SetRect(&(MPanel.rcMessage), rc.left + 2, rc.top + 2 + 14 + 1 + 12 + 1 + 25 + 1, rc.left + 2 + 176 - 40 - 2, rc.top + 2 + 14 + 1 + 12 + 1 + 25 + 1 + 12); #endif MPanel.hFontTitle = NULL; MPanel.hFontFile = NULL; MPanel.hFontTime = NULL; MPanel.hFontVoices = NULL; MPanel.hFontMVolume = NULL; MPanel.hFontRate = NULL; MPanel.hFontMetronome = NULL; MPanel.hFontKeysig = NULL; MPanel.hFontTempo = NULL; MPanel.hFontList = NULL; // strcpy(MPanel.Font,"Times New Roman"); strcpy(MPanel.Font,"Arial Bold"); switch(PlayerLanguage){ case LANGUAGE_ENGLISH: strcpy(MPanel.FontLang,"Times New Roman"); strcpy(MPanel.FontLangFixed,"Times New Roman"); break; default: case LANGUAGE_JAPANESE: strcpy(MPanel.FontLang,"lr o"); strcpy(MPanel.FontLangFixed,"lr "); break; } rc = MPanel.rcTitle; MPanel.hFontTitle = CreateFont(rc.bottom-rc.top+1,0,0,0,FW_DONTCARE,FALSE,FALSE,FALSE, DEFAULT_CHARSET,OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE,MPanel.FontLang); rc = MPanel.rcFile; MPanel.hFontFile = CreateFont(rc.bottom-rc.top+1,0,0,0,FW_DONTCARE,FALSE,FALSE,FALSE, DEFAULT_CHARSET,OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE,MPanel.FontLang); rc = MPanel.rcTime; MPanel.hFontTime = CreateFont(24,0,0,0,FW_DONTCARE,FALSE,FALSE,FALSE, DEFAULT_CHARSET,OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE,MPanel.Font); rc = MPanel.rcVoices; MPanel.hFontVoices = CreateFont(rc.bottom-rc.top+1,0,0,0,FW_DONTCARE,FALSE,FALSE,FALSE, DEFAULT_CHARSET,OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE,MPanel.Font); rc = MPanel.rcMVolume; MPanel.hFontMVolume = CreateFont(rc.bottom-rc.top+1,0,0,0,FW_DONTCARE,FALSE,FALSE,FALSE, DEFAULT_CHARSET,OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE,MPanel.Font); rc = MPanel.rcRate; MPanel.hFontRate = CreateFont(rc.bottom-rc.top+1,0,0,0,FW_DONTCARE,FALSE,FALSE,FALSE, DEFAULT_CHARSET,OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE,MPanel.Font); rc = MPanel.rcMetronome; MPanel.hFontMetronome = CreateFont(rc.bottom - rc.top + 1, 0, 0, 0, FW_DONTCARE, FALSE, FALSE, FALSE, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE, MPanel.Font); rc = MPanel.rcKeysig; tmp = (rc.bottom - rc.top + 1) / 2; MPanel.hFontKeysig = CreateFont(tmp * 2, tmp, 0, 0, FW_DONTCARE, FALSE, FALSE, FALSE, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, FIXED_PITCH | FF_DONTCARE, MPanel.Font); rc = MPanel.rcTempo; tmp = (rc.bottom - rc.top + 1) / 2; MPanel.hFontTempo = CreateFont(tmp * 2, tmp, 0, 0, FW_DONTCARE, FALSE, FALSE, FALSE, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, FIXED_PITCH | FF_DONTCARE, MPanel.Font); rc = MPanel.rcList; MPanel.hFontList = CreateFont(rc.bottom-rc.top+1,0,0,0,FW_DONTCARE,FALSE,FALSE,FALSE, DEFAULT_CHARSET,OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE,MPanel.Font); rc = MPanel.rcMisc; tmp = (rc.bottom-rc.top+1)/2; MPanel.hFontMisc = CreateFont(tmp*2,tmp,0,0,FW_DONTCARE,FALSE,FALSE,FALSE, DEFAULT_CHARSET,OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY, FIXED_PITCH | FF_DONTCARE,MPanel.Font); rc = MPanel.rcMessage; tmp = (rc.bottom-rc.top+1)/2; MPanel.hFontMessage = CreateFont(tmp*2,tmp,0,0,FW_DONTCARE,FALSE,FALSE,FALSE, DEFAULT_CHARSET,OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY, FIXED_PITCH | FF_DONTCARE,MPanel.FontLangFixed); MPanelOK = 1; GDI_UNLOCK(); // gdi_lock MPanelMessageInit(); } // pl\̂ZbgB void MPanelReset(void) { if(!MPanelOK) return; MPanel.Title[0] = '\0'; MPanel.File[0] = '\0'; strcpy(MPanel.Title,"No title."); strcpy(MPanel.File,"No file."); MPanel.CurTime_h = 0; MPanel.CurTime_m = 0; MPanel.CurTime_s = 0; MPanel.CurTime_ss = 0; MPanel.TotalTime_h = 0; MPanel.TotalTime_m = 0; MPanel.TotalTime_s = 0; MPanel.TotalTime_ss = 0; MPanel.CurVoices = 0; MPanel.MaxVoices = 0; MPanel.MVolume = 0; MPanel.Rate = 0; MPanel.Meas = 0; MPanel.Beat = 0; MPanel.Keysig[0] = '\0'; MPanel.Key_offset = 0; MPanel.Tempo = 0; MPanel.Tempo_ratio = 0; MPanel.PlaylistNum = 0; MPanel.PlaylistMax = 0; MPanel.UpdateFlag = MP_UPDATE_ALL; // MPanel.FGColor = RGB(0x00,0x00,0x00); // MPanel.BGColor = RGB(0xff,0xff,0xff); MPanel.FGColor = RGB(0x00,0x00,0x00); // MPanel.BGColor = RGB(0xc0,0xc0,0xc0); MPanel.BGColor = RGB(0xc0,0xc5,0xc3); MPanel.BGBGColor = RGB(0x60,0x60,0x60); #if 0 if(MPanel.hFontTitle!=NULL) DeleteObject(MPanel.hFontTitle); if(MPanel.hFontFile!=NULL) DeleteObject(MPanel.hFontFile); if(MPanel.hFontTime!=NULL) DeleteObject(MPanel.hFontTime); if(MPanel.hFontVoices!=NULL) DeleteObject(MPanel.hFontVoices); if(MPanel.hFontMVolume!=NULL) DeleteObject(MPanel.hFontMVolume); if(MPanel.hFontRate!=NULL) DeleteObject(MPanel.hFontRate); if (MPanel.hFontMetronome != NULL) DeleteObject(MPanel.hFontMetronome); if (MPanel.hFontKeysig != NULL) DeleteObject(MPanel.hFontKeysig); if (MPanel.hFontTempo != NULL) DeleteObject(MPanel.hFontTempo); if(MPanel.hFontList!=NULL) DeleteObject(MPanel.hFontList); #endif MPanel.play_system_mode = DEFAULT_SYSTEM_MODE; MPanel.current_file_info_file_type = IS_OTHER_FILE; MPanel.current_file_info_max_channel = -1; MPanelMessageClearAll(); } // pl\̂ɍXVB void MPanelUpdate(void) { if(!MPanelOK) return; MPanelMessageUpdate(); if(MPanel.UpdateFlag==MP_UPDATE_NONE) return; if(MPanel.UpdateFlag & MP_UPDATE_BACKGROUND){ // rbg}bv\t邪͓h‚ԂB HPEN hPen; HBRUSH hBrush; // COLORREF color = MPanel.FGColor; COLORREF color = MPanel.BGBGColor; RECT rc = MPanel.rcMe; HGDIOBJ hgdiobj_hpen, hgdiobj_hbrush; GDI_LOCK(); // gdi_lock hPen = CreatePen(PS_SOLID,1,color); hBrush = CreateSolidBrush(color); hgdiobj_hpen = SelectObject(MPanel.hmdc, hPen); hgdiobj_hbrush = SelectObject(MPanel.hmdc, hBrush); Rectangle(MPanel.hmdc,rc.left,rc.top,rc.right,rc.bottom); SelectObject(MPanel.hmdc, hgdiobj_hpen); DeleteObject(hPen); SelectObject(MPanel.hmdc, hgdiobj_hbrush); DeleteObject(hBrush); GDI_UNLOCK(); // gdi_lock InvalidateRect(MPanel.hwnd,&rc, FALSE); } if(MPanel.UpdateFlag & MP_UPDATE_TITLE){ HGDIOBJ hgdiobj = SelectObject(MPanel.hmdc,MPanel.hFontTitle); GDI_LOCK(); // gdi_lock SetTextColor(MPanel.hmdc,MPanel.FGColor); SetBkColor(MPanel.hmdc,MPanel.BGColor); //#include "w32g2_c.h" SetTextAlign(MPanel.hmdc, TA_LEFT | TA_TOP | TA_NOUPDATECP); ExtTextOut(MPanel.hmdc,MPanel.rcTitle.left,MPanel.rcTitle.top, ETO_CLIPPED | ETO_OPAQUE,&(MPanel.rcTitle), MPanel.Title,strlen(MPanel.Title),NULL); if((HGDIOBJ)hgdiobj!=(HGDIOBJ)NULL && (HGDIOBJ)hgdiobj!=(HGDIOBJ)GDI_ERROR) SelectObject(MPanel.hmdc,hgdiobj); GDI_UNLOCK(); // gdi_lock InvalidateRect(hPanelWnd, &(MPanel.rcTitle), FALSE); } if(MPanel.UpdateFlag & MP_UPDATE_FILE){ HGDIOBJ hgdiobj; GDI_LOCK(); // gdi_lock hgdiobj = SelectObject(MPanel.hmdc,MPanel.hFontFile); SetTextColor(MPanel.hmdc,MPanel.FGColor); SetBkColor(MPanel.hmdc,MPanel.BGColor); SetTextAlign(MPanel.hmdc, TA_LEFT | TA_TOP | TA_NOUPDATECP); ExtTextOut(MPanel.hmdc,MPanel.rcFile.left,MPanel.rcFile.top, ETO_CLIPPED | ETO_OPAQUE,&(MPanel.rcFile), MPanel.File,strlen(MPanel.File),NULL); if((HGDIOBJ)hgdiobj!=(HGDIOBJ)NULL && (HGDIOBJ)hgdiobj!=(HGDIOBJ)GDI_ERROR) SelectObject(MPanel.hmdc,hgdiobj); GDI_UNLOCK(); // gdi_lock InvalidateRect(hPanelWnd, &(MPanel.rcFile), FALSE); } if(MPanel.UpdateFlag & MP_UPDATE_TIME){ char buffer[256]; HGDIOBJ hgdiobj; GDI_LOCK(); // gdi_lock hgdiobj = SelectObject(MPanel.hmdc,MPanel.hFontTime); sprintf(buffer," %02d:%02d:%02d/%02d:%02d:%02d", MPanel.CurTime_h,MPanel.CurTime_m,MPanel.CurTime_s, MPanel.TotalTime_h,MPanel.TotalTime_m,MPanel.TotalTime_s); SetTextColor(MPanel.hmdc,MPanel.FGColor); SetBkColor(MPanel.hmdc,MPanel.BGColor); SetTextAlign(MPanel.hmdc, TA_LEFT | TA_TOP | TA_NOUPDATECP); ExtTextOut(MPanel.hmdc,MPanel.rcTime.left,MPanel.rcTime.top, ETO_CLIPPED | ETO_OPAQUE,&(MPanel.rcTime), buffer,strlen(buffer),NULL); if((HGDIOBJ)hgdiobj!=(HGDIOBJ)NULL && (HGDIOBJ)hgdiobj!=(HGDIOBJ)GDI_ERROR) SelectObject(MPanel.hmdc,hgdiobj); GDI_UNLOCK(); // gdi_lock InvalidateRect(hPanelWnd, &(MPanel.rcTime), FALSE); } if(MPanel.UpdateFlag & MP_UPDATE_VOICES){ char buffer[256]; HGDIOBJ hgdiobj; GDI_LOCK(); // gdi_lock hgdiobj = SelectObject(MPanel.hmdc,MPanel.hFontVoices); sprintf(buffer," %03d/%03d",MPanel.CurVoices,MPanel.MaxVoices); SetTextColor(MPanel.hmdc,MPanel.FGColor); SetBkColor(MPanel.hmdc,MPanel.BGColor); SetTextAlign(MPanel.hmdc, TA_LEFT | TA_TOP | TA_NOUPDATECP); ExtTextOut(MPanel.hmdc,MPanel.rcVoices.left,MPanel.rcVoices.top, ETO_CLIPPED | ETO_OPAQUE,&(MPanel.rcVoices), buffer,strlen(buffer),NULL); if((HGDIOBJ)hgdiobj!=(HGDIOBJ)NULL && (HGDIOBJ)hgdiobj!=(HGDIOBJ)GDI_ERROR) SelectObject(MPanel.hmdc,hgdiobj); GDI_UNLOCK(); // gdi_lock InvalidateRect(hPanelWnd, &(MPanel.rcVoices), FALSE); } if(MPanel.UpdateFlag & MP_UPDATE_MVOLUME){ char buffer[256]; HGDIOBJ hgdiobj; GDI_LOCK(); // gdi_lock hgdiobj = SelectObject(MPanel.hmdc,MPanel.hFontVoices); sprintf(buffer," %03d%%",MPanel.MVolume); SetTextColor(MPanel.hmdc,MPanel.FGColor); SetBkColor(MPanel.hmdc,MPanel.BGColor); SetTextAlign(MPanel.hmdc, TA_LEFT | TA_TOP | TA_NOUPDATECP); ExtTextOut(MPanel.hmdc,MPanel.rcMVolume.left,MPanel.rcMVolume.top, ETO_CLIPPED | ETO_OPAQUE,&(MPanel.rcMVolume), buffer,strlen(buffer),NULL); if((HGDIOBJ)hgdiobj!=(HGDIOBJ)NULL && (HGDIOBJ)hgdiobj!=(HGDIOBJ)GDI_ERROR) SelectObject(MPanel.hmdc,hgdiobj); GDI_UNLOCK(); // gdi_lock InvalidateRect(hPanelWnd, &(MPanel.rcMVolume), FALSE); } if(MPanel.UpdateFlag & MP_UPDATE_RATE){ char buffer[256]; HGDIOBJ hgdiobj; GDI_LOCK(); // gdi_lock hgdiobj = SelectObject(MPanel.hmdc,MPanel.hFontRate); sprintf(buffer," %05dHz",MPanel.Rate); SetTextColor(MPanel.hmdc,MPanel.FGColor); SetBkColor(MPanel.hmdc,MPanel.BGColor); SetTextAlign(MPanel.hmdc, TA_LEFT | TA_TOP | TA_NOUPDATECP); ExtTextOut(MPanel.hmdc,MPanel.rcRate.left,MPanel.rcRate.top, ETO_CLIPPED | ETO_OPAQUE,&(MPanel.rcRate), buffer,strlen(buffer),NULL); if((HGDIOBJ)hgdiobj!=(HGDIOBJ)NULL && (HGDIOBJ)hgdiobj!=(HGDIOBJ)GDI_ERROR) SelectObject(MPanel.hmdc,hgdiobj); GDI_UNLOCK(); // gdi_lock InvalidateRect(hPanelWnd, &(MPanel.rcRate), FALSE); } if (MPanel.UpdateFlag & MP_UPDATE_METRONOME) { char buffer[256]; HGDIOBJ hgdiobj; GDI_LOCK(); // gdi_lock hgdiobj = SelectObject(MPanel.hmdc, MPanel.hFontMetronome); sprintf(buffer, " %03d.%02d", MPanel.Meas, MPanel.Beat); SetTextColor(MPanel.hmdc, MPanel.FGColor); SetBkColor(MPanel.hmdc, MPanel.BGColor); SetTextAlign(MPanel.hmdc, TA_LEFT | TA_TOP | TA_NOUPDATECP); ExtTextOut(MPanel.hmdc, MPanel.rcMetronome.left, MPanel.rcMetronome.top, ETO_CLIPPED | ETO_OPAQUE, &(MPanel.rcMetronome), buffer, strlen(buffer), NULL); if ((HGDIOBJ) hgdiobj != (HGDIOBJ) NULL && (HGDIOBJ) hgdiobj != (HGDIOBJ) GDI_ERROR) SelectObject(MPanel.hmdc, hgdiobj); GDI_UNLOCK(); // gdi_lock InvalidateRect(hPanelWnd, &(MPanel.rcMetronome), FALSE); } if (MPanel.UpdateFlag & MP_UPDATE_KEYSIG) { char buffer[256]; HGDIOBJ hgdiobj; GDI_LOCK(); // gdi_lock hgdiobj = SelectObject(MPanel.hmdc, MPanel.hFontKeysig); if (MPanel.Keysig[0] == '\0') strcpy(MPanel.Keysig, "-- ---"); sprintf(buffer, "%s (%+03d)", MPanel.Keysig, MPanel.Key_offset); SetTextColor(MPanel.hmdc, MPanel.FGColor); SetBkColor(MPanel.hmdc, MPanel.BGColor); SetTextAlign(MPanel.hmdc, TA_LEFT | TA_TOP | TA_NOUPDATECP); ExtTextOut(MPanel.hmdc, MPanel.rcKeysig.left + 2, MPanel.rcKeysig.top, ETO_CLIPPED | ETO_OPAQUE, &(MPanel.rcKeysig), buffer, strlen(buffer), NULL); if ((HGDIOBJ) hgdiobj != (HGDIOBJ) NULL && (HGDIOBJ) hgdiobj != (HGDIOBJ) GDI_ERROR) SelectObject(MPanel.hmdc, hgdiobj); GDI_UNLOCK(); // gdi_lock InvalidateRect(hPanelWnd, &(MPanel.rcKeysig), FALSE); } if (MPanel.UpdateFlag & MP_UPDATE_TEMPO) { char buffer[256]; HGDIOBJ hgdiobj; GDI_LOCK(); // gdi_lock hgdiobj = SelectObject(MPanel.hmdc, MPanel.hFontTempo); sprintf(buffer, "%3d (%03d %%)", MPanel.Tempo, MPanel.Tempo_ratio); SetTextColor(MPanel.hmdc, MPanel.FGColor); SetBkColor(MPanel.hmdc, MPanel.BGColor); SetTextAlign(MPanel.hmdc, TA_LEFT | TA_TOP | TA_NOUPDATECP); ExtTextOut(MPanel.hmdc, MPanel.rcTempo.left + 2, MPanel.rcTempo.top, ETO_CLIPPED | ETO_OPAQUE, &(MPanel.rcTempo), buffer, strlen(buffer), NULL); if ((HGDIOBJ) hgdiobj != (HGDIOBJ) NULL && (HGDIOBJ) hgdiobj != (HGDIOBJ) GDI_ERROR) SelectObject(MPanel.hmdc, hgdiobj); GDI_UNLOCK(); // gdi_lock InvalidateRect(hPanelWnd, &(MPanel.rcTempo), FALSE); } if(MPanel.UpdateFlag & MP_UPDATE_PLAYLIST){ char buffer[256]; HGDIOBJ hgdiobj; GDI_LOCK(); // gdi_lock hgdiobj = SelectObject(MPanel.hmdc,MPanel.hFontList); sprintf(buffer," %04d/%04d",MPanel.PlaylistNum,MPanel.PlaylistMax); SetTextColor(MPanel.hmdc,MPanel.FGColor); SetBkColor(MPanel.hmdc,MPanel.BGColor); SetTextAlign(MPanel.hmdc, TA_LEFT | TA_TOP | TA_NOUPDATECP); ExtTextOut(MPanel.hmdc,MPanel.rcList.left,MPanel.rcList.top, ETO_CLIPPED | ETO_OPAQUE,&(MPanel.rcList), buffer,strlen(buffer),NULL); if((HGDIOBJ)hgdiobj!=(HGDIOBJ)NULL && (HGDIOBJ)hgdiobj!=(HGDIOBJ)GDI_ERROR) SelectObject(MPanel.hmdc,hgdiobj); GDI_UNLOCK(); // gdi_lock InvalidateRect(hPanelWnd, &(MPanel.rcList), FALSE); } if(MPanel.UpdateFlag & MP_UPDATE_MISC){ char buffer[256]; HGDIOBJ hgdiobj; GDI_LOCK(); // gdi_lock hgdiobj = SelectObject(MPanel.hmdc,MPanel.hFontMisc); buffer[0] = '\0'; switch(MPanel.play_system_mode){ case GM_SYSTEM_MODE: strcat(buffer,"[GM]"); break; case GS_SYSTEM_MODE: strcat(buffer,"[GS]"); break; case XG_SYSTEM_MODE: strcat(buffer,"[XG]"); break; default: case DEFAULT_SYSTEM_MODE: strcat(buffer,"[--]"); break; } switch(MPanel.current_file_info_file_type){ case IS_SMF_FILE: strcat(buffer,"[SMF]"); break; case IS_MCP_FILE: strcat(buffer,"[MCP]"); break; case IS_RCP_FILE: strcat(buffer,"[RCP]"); break; case IS_R36_FILE: strcat(buffer,"[R36]"); break; case IS_G18_FILE: strcat(buffer,"[G18]"); break; case IS_G36_FILE: strcat(buffer,"[G36]"); break; case IS_SNG_FILE: strcat(buffer,"[SNG]"); break; case IS_MM2_FILE: strcat(buffer,"[MM2]"); break; case IS_MML_FILE: strcat(buffer,"[MML]"); break; case IS_FM_FILE: strcat(buffer,"[FM ]"); break; case IS_FPD_FILE: strcat(buffer,"[FPD]"); break; case IS_MOD_FILE: strcat(buffer,"[MOD]"); break; case IS_669_FILE: strcat(buffer,"[669]"); break; case IS_MTM_FILE: strcat(buffer,"[MTM]"); break; case IS_STM_FILE: strcat(buffer,"[STM]"); break; case IS_S3M_FILE: strcat(buffer,"[S3M]"); break; case IS_ULT_FILE: strcat(buffer,"[ULT]"); break; case IS_XM_FILE: strcat(buffer,"[XM ]"); break; case IS_FAR_FILE: strcat(buffer,"[FAR]"); break; case IS_WOW_FILE: strcat(buffer,"[WOW]"); break; case IS_OKT_FILE: strcat(buffer,"[OKT]"); break; case IS_DMF_FILE: strcat(buffer,"[DMF]"); break; case IS_MED_FILE: strcat(buffer,"[MED]"); break; case IS_IT_FILE: strcat(buffer,"[IT ]"); break; case IS_PTM_FILE: strcat(buffer,"[PTM]"); break; case IS_MFI_FILE: strcat(buffer,"[MFI]"); break; default: case IS_OTHER_FILE: strcat(buffer,"[---]"); break; } if(MPanel.current_file_info_max_channel>=0){ char local[16]; sprintf(local,"[%02dch]",MPanel.current_file_info_max_channel+1); strcat(buffer,local); }else strcat(buffer,"[--ch]"); SetTextColor(MPanel.hmdc,MPanel.FGColor); SetBkColor(MPanel.hmdc,MPanel.BGColor); SetTextAlign(MPanel.hmdc, TA_LEFT | TA_TOP | TA_NOUPDATECP); ExtTextOut(MPanel.hmdc,MPanel.rcMisc.left,MPanel.rcMisc.top, ETO_CLIPPED | ETO_OPAQUE,&(MPanel.rcMisc), buffer,strlen(buffer),NULL); if((HGDIOBJ)hgdiobj!=(HGDIOBJ)NULL && (HGDIOBJ)hgdiobj!=(HGDIOBJ)GDI_ERROR) SelectObject(MPanel.hmdc,hgdiobj); GDI_UNLOCK(); // gdi_lock InvalidateRect(hPanelWnd, &(MPanel.rcMisc), FALSE); } if(MPanel.UpdateFlag & MP_UPDATE_MESSAGE){ HGDIOBJ hgdiobj; GDI_LOCK(); // gdi_lock hgdiobj = SelectObject(MPanel.hmdc,MPanel.hFontMessage); SetTextColor(MPanel.hmdc,MPanel.FGColor); SetBkColor(MPanel.hmdc,MPanel.BGColor); SetTextAlign(MPanel.hmdc, TA_LEFT | TA_TOP | TA_NOUPDATECP); switch ( MPanelMessageData.curmode ) { case 0: ExtTextOut(MPanel.hmdc,MPanel.rcMessage.left,MPanel.rcMessage.top, ETO_CLIPPED | ETO_OPAQUE,&(MPanel.rcMessage), MPanelMessageData.buff,strlen(MPanelMessageData.buff),NULL); case 1: ExtTextOut(MPanel.hmdc,MPanel.rcMessage.left,MPanel.rcMessage.top, ETO_CLIPPED | ETO_OPAQUE,&(MPanel.rcMessage), MPanelMessageData.buff,strlen(MPanelMessageData.buff),NULL); // ExtTextOut(MPanel.hmdc,MPanel.rcMessage.left-(MPanel.rcMessage.bottom-MPanel.rcMessage.top)*2, // MPanel.rcMessage.top, ETO_CLIPPED | ETO_OPAQUE,&(MPanel.rcMessage), // MPanelMessageData.buff,strlen(MPanelMessageData.buff),NULL); case 2: ExtTextOut(MPanel.hmdc,MPanel.rcMessage.left,MPanel.rcMessage.top, ETO_CLIPPED | ETO_OPAQUE,&(MPanel.rcMessage), MPanelMessageData.buff,strlen(MPanelMessageData.buff),NULL); case -1: default: ExtTextOut(MPanel.hmdc,MPanel.rcMessage.left,MPanel.rcMessage.top, ETO_CLIPPED | ETO_OPAQUE,&(MPanel.rcMessage), MPanelMessageData.buff,strlen(MPanelMessageData.buff),NULL); } if((HGDIOBJ)hgdiobj!=(HGDIOBJ)NULL && (HGDIOBJ)hgdiobj!=(HGDIOBJ)GDI_ERROR) SelectObject(MPanel.hmdc,hgdiobj); GDI_UNLOCK(); // gdi_lock InvalidateRect(hPanelWnd, &(MPanel.rcMessage), FALSE); } if(MPanel.UpdateFlag==MP_UPDATE_ALL) InvalidateRect(hPanelWnd, NULL, FALSE); MPanel.UpdateFlag = MP_UPDATE_NONE; } static void MPanelPaintDo(void) { RECT rc; if ( GetUpdateRect(MPanel.hwnd, &rc, FALSE) ) { PAINTSTRUCT ps; HDC hdc; GDI_LOCK(); // gdi_lock hdc = BeginPaint(MPanel.hwnd, &ps); BitBlt(hdc,rc.left,rc.top,rc.right,rc.bottom,MPanel.hmdc,rc.left,rc.top,SRCCOPY); EndPaint(MPanel.hwnd, &ps); GDI_UNLOCK(); // gdi_lock } } // ` void MPanelPaint(void) { UpdateWindow(hPanelWnd); } // S` void MPanelPaintAll(void) { InvalidateRect(hPanelWnd, NULL, FALSE); MPanelPaint(); } // pl\̂ɊSXVB void MPanelUpdateAll(void) { if(!MPanelOK) return; MPanel.UpdateFlag = MP_UPDATE_ALL; MPanelUpdate(); } // PanelInfo \̂ǂݍŃpl\̂֓KpB // flag ͋XVB void MPanelReadPanelInfo(int flag) { int cur_pl_num, playlist_num; if(!MPanelOK) return; if(!PInfoOK) return; if(!Panel->changed && !flag) return; if(flag || MPanel.CurTime_s != Panel->cur_time_s // || MPanel.CurTime_ss != Panel->cur_time_ss || MPanel.CurTime_m != Panel->cur_time_m || MPanel.CurTime_h != Panel->cur_time_h || MPanel.TotalTime_s != Panel->total_time_s // || MPanel.TotalTime_ss != Panel->total_time_ss || MPanel.TotalTime_m != Panel->total_time_m || MPanel.TotalTime_h != Panel->total_time_h ){ MPanel.CurTime_h = Panel->cur_time_h; MPanel.CurTime_m = Panel->cur_time_m; MPanel.CurTime_s = Panel->cur_time_s; MPanel.CurTime_ss = Panel->cur_time_ss; MPanel.TotalTime_h = Panel->total_time_h; MPanel.TotalTime_m = Panel->total_time_m; MPanel.TotalTime_s = Panel->total_time_s; // MPanel.TotalTime_ss = Panel->total_time_ss; RANGE(MPanel.CurTime_h,0,99); RANGE(MPanel.TotalTime_h,0,99); MPanel.UpdateFlag |= MP_UPDATE_TIME; } if(flag || MPanel.MaxVoices != Panel->voices){ MPanel.MaxVoices = Panel->voices; MPanel.UpdateFlag |= MP_UPDATE_VOICES; } if(flag || MPanel.CurVoices != Panel->cur_voices){ MPanel.CurVoices = Panel->cur_voices; MPanel.UpdateFlag |= MP_UPDATE_VOICES; } if(flag || MPanel.MVolume != amplification){ MPanel.MVolume = amplification; MPanel.UpdateFlag |= MP_UPDATE_MVOLUME; } if(flag || MPanel.Rate != play_mode->rate){ MPanel.Rate = play_mode->rate; MPanel.UpdateFlag |= MP_UPDATE_RATE; } if (flag || MPanel.Meas != Panel->meas) { MPanel.Meas = Panel->meas; MPanel.UpdateFlag |= MP_UPDATE_METRONOME; } if (flag || MPanel.Beat != Panel->beat) { MPanel.Beat = Panel->beat; MPanel.UpdateFlag |= MP_UPDATE_METRONOME; } if (flag || MPanel.Keysig != Panel->keysig) { strcpy(MPanel.Keysig, Panel->keysig); MPanel.UpdateFlag |= MP_UPDATE_KEYSIG; } if (flag || MPanel.Key_offset != Panel->key_offset) { MPanel.Key_offset = Panel->key_offset; MPanel.UpdateFlag |= MP_UPDATE_KEYSIG; } if (flag || MPanel.Tempo != Panel->tempo) { MPanel.Tempo = Panel->tempo; MPanel.UpdateFlag |= MP_UPDATE_TEMPO; } if (flag || MPanel.Tempo_ratio != Panel->tempo_ratio) { MPanel.Tempo_ratio = Panel->tempo_ratio; MPanel.UpdateFlag |= MP_UPDATE_TEMPO; } w32g_get_playlist_index(&cur_pl_num, &playlist_num, NULL); if(playlist_num > 0) cur_pl_num++; if(flag || MPanel.PlaylistNum != cur_pl_num){ MPanel.PlaylistNum = cur_pl_num; MPanel.UpdateFlag |= MP_UPDATE_PLAYLIST; } if(flag || MPanel.PlaylistMax != playlist_num){ MPanel.PlaylistMax = playlist_num; MPanel.UpdateFlag |= MP_UPDATE_PLAYLIST; } if(flag || MPanel.play_system_mode != play_system_mode){ MPanel.play_system_mode = play_system_mode; MPanel.UpdateFlag |= MP_UPDATE_MISC; } if(current_file_info!=NULL){ if(flag || MPanel.current_file_info_file_type != current_file_info->file_type){ MPanel.current_file_info_file_type = current_file_info->file_type; MPanel.UpdateFlag |= MP_UPDATE_MISC; } if(flag || MPanel.current_file_info_max_channel != current_file_info->max_channel){ MPanel.current_file_info_max_channel = current_file_info->max_channel; MPanel.UpdateFlag |= MP_UPDATE_MISC; } } } void MPanelStartLoad(char *filename) { strncpy((char *)MPanel.File, filename, MP_FILE_MAX); MPanel.UpdateFlag |= MP_UPDATE_FILE; MPanelUpdate(); } void MPanelMessageInit(void) { int width = (MPanel.rcMessage.bottom - MPanel.rcMessage.top + 1) / 2; MPanelMessageData.len = (MPanel.rcMessage.right - MPanel.rcMessage.left) / width; MPanelMessageClearAll(); } // sec b message 𗬂B // mode 0: sec b message \BftHgB // mode 1: sec b̊Ԃ message E獶ɗB // mode 2: sec b̊Ԃ messege \B|C^EɈڂB|C^EɐFςB void MPanelMessageAdd(char *message, int msec, int mode) { if ( MPanelMessageData.nextmode >= 0 ) { MPanelMessageNext(); strncpy(MPanelMessageData.nextbuff,message,sizeof(MPanelMessageData.nextbuff)-1); MPanelMessageData.nextmode = mode; MPanelMessageData.nextmsec = msec; } else if ( MPanelMessageData.curmode >= 0 ){ strncpy(MPanelMessageData.nextbuff,messagesizeof(MPanelMessageData.nextbuff)-1); MPanelMessageData.nextmode = mode; MPanelMessageData.nextmsec = msec; } else { strncpy(MPanelMessageData.nextbuff,messagesizeof(MPanelMessageData.nextbuff)-1); MPanelMessageData.nextmode = mode; MPanelMessageData.nextmsec = msec; MPanelMessageNext(); } } int MPanelMessageHaveMesssage(void) { if ( MPanelMessageData.curmode >= 0 || MPanelMessageData.nextmode >= 0 ) return 1; else return 0; } void MPanelMessageClearAll(void) { MPanelMessageData.buff[0] = '\0'; MPanelMessageData.curmode = -1; MPanelMessageData.nextmode = -1; MPanel.UpdateFlag |= MP_UPDATE_MESSAGE; } void MPanelMessageClear(void) { MPanelMessageData.buff[0] = '\0'; MPanel.UpdateFlag |= MP_UPDATE_MESSAGE; } void MPanelMessageNext(void) { MPanelMessageClear(); if ( MPanelMessageData.nextmode >= 0 ) { strcpy(MPanelMessageData.curbuff,MPanelMessageData.nextbuff); MPanelMessageData.curbuffsize = strlen(MPanelMessageData.curbuff); MPanelMessageData.curmode = MPanelMessageData.nextmode; MPanelMessageData.curmsec = MPanelMessageData.nextmsec; MPanelMessageData.pointer = -1; MPanelMessageData.nextmode = -1; MPanelMessageData.prevtime = -1; } else { MPanelMessageData.curmode = -1; MPanelMessageData.prevtime = -1; } MPanel.UpdateFlag |= MP_UPDATE_MESSAGE; } void MPanelMessageUpdate(void) { // DWORD curtime = GetCurrentTime(); DWORD curtime = 0; int pointer; if ( MPanelMessageData.curmode >= 0 ) { curtime += Panel->cur_time_h; curtime *= 24; curtime += Panel->cur_time_m; curtime *= 60; curtime += Panel->cur_time_s; curtime *= 1000; curtime += Panel->cur_time_ss; } switch ( MPanelMessageData.curmode ) { case 0: if ( MPanelMessageData.prevtime == -1 ){ strcpy( MPanelMessageData.buff, MPanelMessageData.curbuff ); MPanelMessageData.prevtime = curtime; MPanelMessageData.msec = MPanelMessageData.curmsec; MPanel.UpdateFlag |= MP_UPDATE_MESSAGE; } else { MPanelMessageData.msec -= curtime - MPanelMessageData.prevtime; MPanelMessageData.prevtime = curtime; } if ( MPanelMessageData.msec <= 0 || curtime < MPanelMessageData.prevtime ) { MPanelMessageNext(); MPanelMessageUpdate(); MPanel.UpdateFlag |= MP_UPDATE_MESSAGE; break; } break; case 1: if ( MPanelMessageData.prevtime == -1 ){ MPanelMessageData.prevtime = curtime; MPanelMessageData.msec = MPanelMessageData.curmsec; MPanel.UpdateFlag |= MP_UPDATE_MESSAGE; } else { MPanelMessageData.msec -= curtime - MPanelMessageData.prevtime; MPanelMessageData.prevtime = curtime; } if ( MPanelMessageData.msec <= 0 || curtime < MPanelMessageData.prevtime ) { MPanelMessageNext(); MPanelMessageUpdate(); MPanel.UpdateFlag |= MP_UPDATE_MESSAGE; return; } // pointer = MPanelMessageData.len * 4 / 5 + ( MPanelMessageData.curmsec - MPanelMessageData.msec ) / 1000 * 2; pointer = MPanelMessageData.len - 8 + ( MPanelMessageData.curmsec - MPanelMessageData.msec ) / 1000 * 2; pointer = (int)( pointer / 2 ) * 2; if ( MPanelMessageData.pointer != pointer ) { int p = MPanelMessageData.len - pointer; MPanelMessageData.buff[0] = '\0'; MPanelMessageData.pointer = pointer; if ( p >= 0 ) { memset( MPanelMessageData.buff, 0x20, p ); MPanelMessageData.buff[p] = '\0'; strcat( MPanelMessageData.buff, MPanelMessageData.curbuff); } else if ( MPanelMessageData.curbuffsize + p > 0 ) { strcpy( MPanelMessageData.buff, MPanelMessageData.curbuff - p); } else { MPanelMessageData.buff[0] = '\0'; } MPanel.UpdateFlag |= MP_UPDATE_MESSAGE; } break; case 2: if ( MPanelMessageData.prevtime == -1 ){ strcpy( MPanelMessageData.buff, MPanelMessageData.curbuff ); MPanelMessageData.prevtime = curtime; MPanelMessageData.msec = MPanelMessageData.curmsec; MPanel.UpdateFlag |= MP_UPDATE_MESSAGE; } else { MPanelMessageData.msec -= curtime - MPanelMessageData.prevtime; MPanelMessageData.prevtime = curtime; } if ( MPanelMessageData.msec <= 0 || curtime < MPanelMessageData.prevtime ) { MPanelMessageNext(); MPanelMessageUpdate(); MPanel.UpdateFlag |= MP_UPDATE_MESSAGE; break; } pointer = ( MPanelMessageData.len + MPanelMessageData.curbuffsize ) * ( MPanelMessageData.curmsec - MPanelMessageData.msec ) / MPanelMessageData.curmsec; if ( MPanelMessageData.pointer != pointer ) { MPanel.UpdateFlag |= MP_UPDATE_MESSAGE; } break; case 3: if ( MPanelMessageData.prevtime == -1 ){ MPanelMessageData.prevtime = curtime; MPanelMessageData.msec = MPanelMessageData.curmsec; MPanel.UpdateFlag |= MP_UPDATE_MESSAGE; } else { MPanelMessageData.msec -= curtime - MPanelMessageData.prevtime; MPanelMessageData.prevtime = curtime; } if ( MPanelMessageData.msec <= 0 || curtime < MPanelMessageData.prevtime ) { MPanelMessageNext(); MPanelMessageUpdate(); MPanel.UpdateFlag |= MP_UPDATE_MESSAGE; return; } pointer = MPanelMessageData.len * 3 / 4 + ( MPanelMessageData.len / 4 + MPanelMessageData.curbuffsize ) * ( MPanelMessageData.curmsec - MPanelMessageData.msec ) / MPanelMessageData.curmsec; pointer = ((int)(pointer / 2)) * 2; if ( MPanelMessageData.pointer != pointer ) { int p = MPanelMessageData.len - pointer; MPanelMessageData.buff[0] = '\0'; MPanelMessageData.pointer = pointer; if ( p >= 0 ) { memset( MPanelMessageData.buff, 0x20, p ); MPanelMessageData.buff[p] = '\0'; strcat( MPanelMessageData.buff, MPanelMessageData.curbuff); } else if ( MPanelMessageData.curbuffsize + p > 0 ) { strcpy( MPanelMessageData.buff, MPanelMessageData.curbuff - p); } else { MPanelMessageData.buff[0] = '\0'; } MPanel.UpdateFlag |= MP_UPDATE_MESSAGE; } break; case 4: if ( MPanelMessageData.prevtime == -1 ){ MPanelMessageData.prevtime = curtime; #define MPANELMESSAGE_MODE2_SLEEPMSEC 1000 if ( MPanelMessageData.curmsec < MPANELMESSAGE_MODE2_SLEEPMSEC * 2 ) { MPanelMessageData.curmsec = MPANELMESSAGE_MODE2_SLEEPMSEC * 2; } MPanelMessageData.msec = MPanelMessageData.curmsec; MPanel.UpdateFlag |= MP_UPDATE_MESSAGE; } else { MPanelMessageData.msec -= curtime - MPanelMessageData.prevtime; MPanelMessageData.prevtime = curtime; } if ( MPanelMessageData.msec <= 0 || curtime < MPanelMessageData.prevtime ) { MPanelMessageNext(); MPanelMessageUpdate(); MPanel.UpdateFlag |= MP_UPDATE_MESSAGE; return; } if ( MPanelMessageData.curmsec - MPanelMessageData.msec <= MPANELMESSAGE_MODE2_SLEEPMSEC ) { pointer = 0; } else { pointer = MPanelMessageData.curbuffsize * ( MPanelMessageData.curmsec - MPanelMessageData.msec - MPANELMESSAGE_MODE2_SLEEPMSEC ) / ( MPanelMessageData.curmsec - MPANELMESSAGE_MODE2_SLEEPMSEC ); } pointer = ((int)(pointer / 2)) * 2; if ( MPanelMessageData.pointer != pointer ) { MPanelMessageData.buff[0] = '\0'; MPanelMessageData.pointer = pointer; if ( pointer < MPanelMessageData.curbuffsize ) { strcpy( MPanelMessageData.buff, MPanelMessageData.curbuff + pointer ); } else { MPanelMessageData.buff[0] = '\0'; } MPanel.UpdateFlag |= MP_UPDATE_MESSAGE; } break; case -1: default: // MPanelMessageData.buff[0] = '\0'; break; } } // ---------------------------------------------------------------------------- // Misc. Controls // ---------------------------------------------------------------------------- // **************************************************************************** // Version Window static void VersionWnd(HWND hParentWnd) { char VersionText[2024]; sprintf(VersionText, "TiMidity++ %s%s" NLS NLS "TiMidity-0.2i by Tuukka Toivonen ." NLS "TiMidity Win32 version by Davide Moretti ." NLS "TiMidity Windows 95 port by Nicolas Witczak." NLS "TiMidity Win32 GUI by Daisuke Aoki ." NLS " Japanese menu, dialog, etc by Saito ." NLS "TiMidity++ by Masanao Izumo ." NLS ,(strcmp(timidity_version, "current")) ? "version " : "", timidity_version); MessageBox(hParentWnd, VersionText, "Version", MB_OK); } static void TiMidityWnd(HWND hParentWnd) { char TiMidityText[2024]; sprintf(TiMidityText, " TiMidity++ %s%s -- MIDI to WAVE converter and player" NLS " Copyright (C) 1999-2002 Masanao Izumo " NLS " Copyright (C) 1995 Tuukka Toivonen " NLS NLS " Win32 version by Davide Moretti " NLS " GUI by Daisuke Aoki ." NLS " Modified by Masanao Izumo ." NLS NLS " This program is free software; you can redistribute it and/or modify" NLS " it under the terms of the GNU General Public License as published by" NLS " the Free Software Foundation; either version 2 of the License, or" NLS " (at your option) any later version." NLS NLS " This program is distributed in the hope that it will be useful," NLS " but WITHOUT ANY WARRANTY; without even the implied warranty of"NLS " MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the" NLS " GNU General Public License for more details." NLS NLS " You should have received a copy of the GNU General Public License" NLS " along with this program; if not, write to the Free Software" NLS " Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA" NLS , (strcmp(timidity_version, "current")) ? "version " : "", timidity_version ); MessageBox(hParentWnd, TiMidityText, "TiMidity++", MB_OK); } static void SupplementWnd(HWND hParentWnd) { char SupplementText[2024]; sprintf(SupplementText, "GS is a registered trademark of Roland Corporation. " NLS "XG is a registered trademark of Yamaha Corporation. " NLS ); MessageBox(hParentWnd, SupplementText, "Supplement", MB_OK); } // **************************************************************************** #ifdef W32GUI_DEBUG void TiMidityHeapCheck(void) { HANDLE *ProcessHeaps = NULL; DWORD dwNumberOfHeaps; DWORD dw = 10; int i; PrintfDebugWnd("\n[Heaps Check Start]\n"); if(GetProcessHeap()!=NULL) if(HeapValidate(GetProcessHeap(),0,NULL)==TRUE) PrintfDebugWnd("Process Heap is Valid\n"); else PrintfDebugWnd("Process Heap is Invalid\n"); ProcessHeaps = (HANDLE *)realloc(ProcessHeaps,sizeof(HANDLE)*dw); dwNumberOfHeaps = GetProcessHeaps(dw, ProcessHeaps); if(dw Clear! ###\n"); break; default: break; } break; case WM_SIZE: // GetClientRect(hDebugWnd, &rc); // MoveWindow(hDebugEditWnd, rc.left, rc.top,rc.right, rc.bottom - 30,TRUE); return FALSE; case WM_CLOSE: ShowWindow(hDebugWnd, SW_HIDE); break; default: return FALSE; } return FALSE; } #if 0 void InitDebugEditWnd(HWND hParentWnd) { RECT rc; GetClientRect(hParentWnd, &rc); hDebugEditWnd = CreateWindowEx( WS_EX_CLIENTEDGE|WS_EX_TOOLWINDOW|WS_EX_DLGMODALFRAME, "EDIT","", WS_CHILD | WS_VISIBLE | WS_VSCROLL | ES_AUTOHSCROLL | WS_HSCROLL |ES_READONLY | ES_WANTRETURN | ES_MULTILINE | ES_AUTOVSCROLL , // 0,0,rc.right, rc.bottom - 30,hParentWnd,NULL,hInst,NULL); 0,0,100,100,hParentWnd,NULL,hInst,NULL); SendMessage(hDebugEditWnd, EM_SETLIMITTEXT, (WPARAM)1024*640, 0); // SendMessage(hDebugEditWnd, WM_PAINT, 0, 0); GetClientRect(hParentWnd, &rc); MoveWindow(hDebugEditWnd,rc.left,rc.top,rc.right,rc.bottom-30,TRUE); ClearDebugWnd(); ShowWindow(hDebugEditWnd,SW_SHOW); UpdateWindow(hDebugEditWnd); } #endif void PutsDebugWnd(char *str) { if(!IsWindow(hDebugEditWnd) || !DebugWndFlag) return; PutsEditCtlWnd(hDebugEditWnd,str); } void PrintfDebugWnd(char *fmt, ...) { va_list ap; if(!IsWindow(hDebugEditWnd) || !DebugWndFlag) return; va_start(ap, fmt); VprintfEditCtlWnd(hDebugEditWnd,fmt,ap); va_end(ap); } void ClearDebugWnd(void) { if(!IsWindow(hDebugEditWnd)) return; ClearEditCtlWnd(hDebugEditWnd); } #endif // **************************************************************************** // Main Thread extern HWND hListSearchWnd; extern void HideListSearch(void); DWORD volatile dwMainThreadId = 0; void WINAPI MainThread(void *arglist) { MSG msg; ThreadNumMax++; dwMainThreadId = GetCurrentThreadId (); #ifdef W32GUI_DEBUG PrintfDebugWnd("(*/%d)MainThread : Start.\n",ThreadNumMax); #endif #ifdef USE_THREADTIMES ThreadTimesAddThread(hMainThread,"MainThread"); #endif // Thread priority // SetThreadPriority(GetCurrentThread(),THREAD_PRIORITY_BELOW_NORMAL); SetThreadPriority(GetCurrentThread(),THREAD_PRIORITY_NORMAL); // SetThreadPriority(GetCurrentThread(),THREAD_PRIORITY_ABOVE_NORMAL); InitStartWnd(SW_HIDE); w32g_wait_for_init = 0; // message loop for the application while( GetMessage(&msg,NULL,0,0) ){ // HandleFastSearch(msg); //PrintfDebugWnd("H%lu M%lu WP%lu LP%lu T%lu x%d y%d\n", // msg.hwnd, msg.message, msg.wParam, msg.lParam, msg.time, msg.pt.x, msg.pt.y); #if 1 // ESC ő‚B if ( msg.message == WM_KEYDOWN && (int)msg.wParam == VK_ESCAPE ) { if ( msg.hwnd == hConsoleWnd || IsChild ( hConsoleWnd, msg.hwnd ) ) { ToggleSubWindow(hConsoleWnd); } else if ( msg.hwnd == hDocWnd || IsChild ( hDocWnd, msg.hwnd ) ) { ToggleSubWindow(hDocWnd); } else if ( msg.hwnd == hWrdWnd || IsChild ( hWrdWnd, msg.hwnd ) ) { ToggleSubWindow(hWrdWnd); } else if ( msg.hwnd == hListWnd || IsChild ( hListWnd, msg.hwnd ) ) { ToggleSubWindow(hListWnd); } else if ( msg.hwnd == hListSearchWnd || IsChild ( hListSearchWnd, msg.hwnd ) ) { HideListSearch(); } else if ( msg.hwnd == hTracerWnd || IsChild ( hTracerWnd, msg.hwnd ) ) { ToggleSubWindow(hTracerWnd); } } #endif TranslateMessage(&msg); DispatchMessage(&msg); } #ifdef W32GUI_DEBUG Sleep(200); PrintfDebugWnd("w32gui_main: DebugWndExit\n"); // MessageBox(NULL, "Exit!","Exit!",MB_OK); if(hDebugWnd!=NULL) for(;;){ if(!DebugThreadExit){ SendMessage(hDebugWnd,WM_COMMAND,(WPARAM)IDC_BUTTON_EXIT,0); Sleep(100); } else break; } #endif if(!w32g_restart_gui_flag) { OnExitReady(); w32g_send_rc(RC_QUIT, 0); } crt_endthread(); } // ************************************************************************** // Misc Dialog #define DialogMaxFileName 16536 static char DialogFileNameBuff[DialogMaxFileName]; static char *DlgFileOpen(HWND hwnd, char *title, char *filter, char *dir) { OPENFILENAME ofn; memset(DialogFileNameBuff, 0, sizeof(DialogFileNameBuff)); memset(&ofn, 0, sizeof(OPENFILENAME)); ofn.lStructSize = sizeof(OPENFILENAME); ofn.hwndOwner = hwnd; ofn.hInstance = hInst ; ofn.lpstrFilter = filter; ofn.lpstrCustomFilter = NULL; ofn.nMaxCustFilter = 0; ofn.nFilterIndex = 1 ; ofn.lpstrFile = DialogFileNameBuff; ofn.nMaxFile = sizeof(DialogFileNameBuff); ofn.lpstrFileTitle = 0; ofn.nMaxFileTitle = 0; ofn.lpstrInitialDir = dir; ofn.lpstrTitle = title; ofn.Flags = OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST | OFN_ALLOWMULTISELECT | OFN_EXPLORER | OFN_READONLY; ofn.lpstrDefExt = 0; ofn.lCustData = 0; ofn.lpfnHook = 0; ofn.lpTemplateName= 0; if(GetOpenFileName(&ofn)==TRUE) return DialogFileNameBuff; else return NULL; } static void DlgMidiFileOpen(HWND hwnd) { char *dir, *file; char *filter = "timidity file\0*.mid;*.smf;*.rcp;*.r36;*.g18;*.g36;*.rmi;*.lzh;*.zip;*.gz\0" "midi file\0*.mid;*.smf;*.rcp;*.r36;*.g18;*.g36;*.rmi\0" "archive file\0*.lzh;*.zip;*.gz\0" "playlist file\0*.pls;*.m3u;*.asx\0" "all files\0*.*\0" "\0\0"; if(w32g_lock_open_file) return; if(MidiFileOpenDir[0]) dir = MidiFileOpenDir; else dir = NULL; if((file = DlgFileOpen(hwnd, NULL, filter, dir)) == NULL) return; w32g_lock_open_file = 1; w32g_send_rc(RC_EXT_LOAD_FILE, (int32)file); } static volatile LPITEMIDLIST itemidlist_pre = NULL; int CALLBACK DlgDirOpenBrowseCallbackProc(HWND hwnd, UINT uMsg, LPARAM lParam, LPARAM lpData) { switch(uMsg){ case BFFM_INITIALIZED: if(itemidlist_pre) SendMessage(hwnd,BFFM_SETSELECTION,(WPARAM)0,(LPARAM)itemidlist_pre); break; default: break; } return 0; } static void DlgDirOpen(HWND hwnd) { static int initflag = 1; static char biBuffer[MAXPATH + 256]; static char Buffer[MAXPATH + 256]; BROWSEINFO bi; LPITEMIDLIST itemidlist; if(w32g_lock_open_file) return; if(initflag==1){ biBuffer[0] = '\0'; initflag = 0; } memset(&bi, 0, sizeof(bi)); bi.hwndOwner = NULL; bi.pidlRoot = NULL; bi.pszDisplayName = biBuffer; if ( PlayerLanguage == LANGUAGE_JAPANESE ) bi.lpszTitle = "MIDI t@ĈfBNgIȂ܂悤B"; else bi.lpszTitle = "Select a directory with MIDI files."; bi.ulFlags = 0; bi.lpfn = DlgDirOpenBrowseCallbackProc; bi.lParam = 0; bi.iImage = 0; itemidlist = SHBrowseForFolder(&bi); if(!itemidlist) return; /* Cancel */ SHGetPathFromIDList(itemidlist, Buffer); strncpy(biBuffer, Buffer, sizeof(Buffer) - 1); if(itemidlist_pre) CoTaskMemFree(itemidlist_pre); itemidlist_pre = itemidlist; w32g_lock_open_file = 1; directory_form(Buffer); w32g_send_rc(RC_EXT_LOAD_FILE, (int32)Buffer); } static void DlgPlaylistOpen(HWND hwnd) { char *dir, *file; char *filter = "playlist file\0*.pls;*.m3u;*.asx\0" "all files\0*.*\0" "\0\0"; if(w32g_lock_open_file) return; if(MidiFileOpenDir[0]) dir = MidiFileOpenDir; else dir = NULL; if((file = DlgFileOpen(hwnd, NULL, filter, dir)) == NULL) return; w32g_lock_open_file = 1; w32g_send_rc(RC_EXT_LOAD_PLAYLIST, (int32)file); } #include /* for stat() */ static int CheckOverWrite(HWND hwnd, char *filename) { char buff[BUFSIZ]; int exists; #if 0 FILE *fp; if((fp = fopen(filename, "r")) == NULL) exists = 0; else { fclose(fp); exists = 1; } #else struct stat st; exists = (stat(filename, &st) != -1); #endif if(!exists) return 1; snprintf(buff, sizeof(buff), "%s exists. Overwrite it?", filename); return MessageBox(hwnd, buff, "Warning", MB_YESNO) == IDYES; } static void DlgPlaylistSave(HWND hwnd) { OPENFILENAME ofn; static char *dir; char *filter = "playlist file\0*.pls;*.m3u;*.asx\0" "all files\0*.*\0" "\0\0"; if(w32g_lock_open_file) return; if(MidiFileOpenDir[0]) dir = MidiFileOpenDir; else dir = NULL; memset(DialogFileNameBuff, 0, sizeof(DialogFileNameBuff)); memset(&ofn, 0, sizeof(OPENFILENAME)); ofn.lStructSize = sizeof(OPENFILENAME); ofn.hwndOwner = hwnd; ofn.hInstance = hInst; ofn.lpstrFilter = filter; ofn.lpstrCustomFilter = NULL; ofn.nMaxCustFilter = 0; ofn.nFilterIndex = 1 ; ofn.lpstrFile = DialogFileNameBuff; ofn.nMaxFile = sizeof(DialogFileNameBuff); ofn.lpstrFileTitle = NULL; ofn.nMaxFileTitle = 0; ofn.lpstrInitialDir = dir; ofn.lpstrTitle = "Save Playlist File"; ofn.Flags = OFN_PATHMUSTEXIST | OFN_EXPLORER | OFN_HIDEREADONLY; // ofn.lpstrDefExt = 0; ofn.lpstrDefExt = "pls"; ofn.lCustData = 0; ofn.lpfnHook = 0; ofn.lpTemplateName= 0; if(GetSaveFileName(&ofn) != TRUE) return; if(!CheckOverWrite(hwnd, DialogFileNameBuff)) return; w32g_lock_open_file = 1; w32g_send_rc(RC_EXT_SAVE_PLAYLIST, (int32)DialogFileNameBuff); } // **************************************************************************** // Edit Ctl. void VprintfEditCtlWnd(HWND hwnd, char *fmt, va_list argList) { char buffer[BUFSIZ], out[BUFSIZ]; char *in; int i; if(!IsWindow(hwnd)) return; vsnprintf(buffer, sizeof(buffer), fmt, argList); in = buffer; i = 0; for(;;){ if(*in == '\0' || i>sizeof(out)-3){ out[i] = '\0'; break; } if(*in=='\n'){ out[i] = 13; out[i+1] = 10; in++; i += 2; continue; } out[i] = *in; in++; i++; } Edit_SetSel(hwnd,-1,-1); Edit_ReplaceSel(hwnd,out); } void PrintfEditCtlWnd(HWND hwnd, char *fmt, ...) { va_list ap; va_start(ap, fmt); VprintfEditCtlWnd(hwnd,fmt,ap); va_end(ap); } #if 1 void PutsEditCtlWnd(HWND hwnd, char *str) { char *in = str; int i; char out[BUFSIZ]; i = 0; for(;;){ if(*in == '\0' || i>sizeof(out)-3){ out[i] = '\0'; break; } if(*in=='\n'){ out[i] = 13; out[i+1] = 10; in++; i += 2; continue; } out[i] = *in; in++; i++; } if(IsWindow(hwnd)){ Edit_SetSel(hwnd,-1,-1); Edit_ReplaceSel(hwnd,out); } } #else void PutsEditCtlWnd(HWND hwnd, char *str) { if(!IsWindow(hwnd)) return; PrintfEditCtlWnd(hwnd,"%s",str); } #endif void ClearEditCtlWnd(HWND hwnd) { char pszVoid[]=""; if(!IsWindow(hwnd)) return; if(IsWindow(hwnd)){ // Edit_SetSel(hwnd,0,-1); Edit_SetSel(hwnd,-1,-1); } Edit_SetText(hwnd,pszVoid); } // **************************************************************************** // Misc funciton. int w32g_msg_box(char *message, char *title, int type) { return MessageBox(hMainWnd, message, title, type); } //#define RC_QUEUE_SIZE 8 #define RC_QUEUE_SIZE 48 static struct { int rc; int32 value; } rc_queue[RC_QUEUE_SIZE]; static volatile int rc_queue_len, rc_queue_beg, rc_queue_end; static HANDLE w32g_lock_sem = NULL; static HANDLE w32g_empty_sem = NULL; void w32g_lock(void) { if(w32g_lock_sem) WaitForSingleObject(w32g_lock_sem, INFINITE); } void w32g_unlock(void) { if(w32g_lock_sem) ReleaseSemaphore(w32g_lock_sem, 1, NULL); } void w32g_send_rc(int rc, int32 value) { w32g_lock(); if(rc_queue_len == RC_QUEUE_SIZE) { /* Over flow. Remove the oldest message */ rc_queue_len--; rc_queue_beg = (rc_queue_beg + 1) % RC_QUEUE_SIZE; } rc_queue_len++; rc_queue[rc_queue_end].rc = rc; rc_queue[rc_queue_end].value = value; rc_queue_end = (rc_queue_end + 1) % RC_QUEUE_SIZE; if(w32g_empty_sem) ReleaseSemaphore(w32g_empty_sem, 1, NULL); w32g_unlock(); } int w32g_get_rc(int32 *value, int wait_if_empty) { int rc; while(rc_queue_len == 0) { if(!wait_if_empty) return RC_NONE; if(w32g_empty_sem) WaitForSingleObject(w32g_empty_sem, INFINITE); VOLATILE_TOUCH(rc_queue_len); } w32g_lock(); rc = rc_queue[rc_queue_beg].rc; *value = rc_queue[rc_queue_beg].value; rc_queue_len--; rc_queue_beg = (rc_queue_beg + 1) % RC_QUEUE_SIZE; w32g_unlock(); return rc; } int w32g_open(void) { SaveSettingTiMidity(st_current); memcpy(st_temp, st_current, sizeof(SETTING_TIMIDITY)); w32g_lock_sem = CreateSemaphore(NULL, 1, 1, "TiMidity Mutex Lock"); w32g_empty_sem = CreateSemaphore(NULL, 0, 8, "TiMidity Empty Lock"); hPlayerThread = GetCurrentThread(); w32g_wait_for_init = 1; hMainThread = crt_beginthreadex(NULL, 0, (LPTHREAD_START_ROUTINE)MainThread, NULL, 0, &dwMainThreadID); while(w32g_wait_for_init) { Sleep(0); VOLATILE_TOUCH(w32g_wait_for_init); } return 0; } static void terminate_main_thread(void) { DWORD status; switch(WaitForSingleObject(hMainThread, 0)) { case WAIT_OBJECT_0: break; case WAIT_TIMEOUT: OnQuit(); status = WaitForSingleObject(hMainThread, 5000); if(status == WAIT_TIMEOUT) TerminateThread(hMainThread, 0); break; default: TerminateThread(hMainThread, 0); break; } } void w32g_close(void) { terminate_main_thread(); if(w32g_lock_sem){ CloseHandle(w32g_lock_sem); w32g_lock_sem = NULL; } if(w32g_empty_sem){ CloseHandle(w32g_empty_sem); w32g_empty_sem = NULL; } } void w32g_restart(void) { w32g_restart_gui_flag = 1; terminate_main_thread(); if(w32g_lock_sem){ CloseHandle(w32g_lock_sem); w32g_lock_sem = NULL; } if(w32g_empty_sem){ CloseHandle(w32g_empty_sem); w32g_empty_sem = NULL; } /* Reset variable */ hDebugEditWnd = 0; /* Now ready to start */ w32g_open(); w32g_restart_gui_flag = 0; } void w32g_ctle_play_start(int sec) { char *title; if(sec >= 0) { SetScrollRange(hMainWndScrollbarProgressWnd, SB_CTL, 0, sec, TRUE); MainWndScrollbarProgressUpdate(0); } else MainWndScrollbarProgressUpdate(-1); Panel->cur_time_h = MPanel.CurTime_h = 0; Panel->cur_time_m = MPanel.CurTime_m = 0; Panel->cur_time_s = MPanel.CurTime_s = 0; Panel->cur_time_ss = MPanel.CurTime_ss = 0; MPanel.TotalTime_h = sec / 60 / 60; RANGE(MPanel.TotalTime_h, 0, 99); Panel->total_time_h = MPanel.TotalTime_h; sec %= 60 * 60; Panel->total_time_m = MPanel.TotalTime_m = sec / 60; Panel->total_time_s = MPanel.TotalTime_s = sec % 60; Panel->total_time_ss = MPanel.TotalTime_ss = 0; MPanel.UpdateFlag |= MP_UPDATE_TIME; /* Now, ready to get the title of MIDI */ if((title = get_midi_title(MPanel.File)) != NULL) { strncpy(MPanel.Title, title, MP_TITLE_MAX); MPanel.UpdateFlag |= MP_UPDATE_TITLE; } MPanelUpdate(); } void MainWndScrollbarProgressUpdate(int sec) { static int lastsec = -1, enabled = 0; if(sec == lastsec) return; if(sec == -1) { EnableWindow(hMainWndScrollbarProgressWnd, FALSE); enabled = 0; progress_jump = -1; } else { if(!enabled) { EnableWindow(hMainWndScrollbarProgressWnd, TRUE); enabled = 1; } if(progress_jump == -1) SetScrollPos(hMainWndScrollbarProgressWnd, SB_CTL, sec, TRUE); } lastsec = sec; } void w32g_show_console(void) { ShowWindow(hConsoleWnd, SW_SHOW); SendDlgItemMessage(hMainWnd, IDC_TOOLBARWINDOW_SUBWND, TB_CHECKBUTTON, IDM_CONSOLE, (LPARAM)MAKELONG(TRUE, 0)); } /////////////////////////////////////////////////////////////////////// // GDI ANZXPXbhɌ肷邽߂̃bN@\ static HANDLE volatile hMutexGDI = NULL; // static int volatile lock_num = 0; int gdi_lock_ex ( DWORD timeout ) { // lock_num++; // ctl->cmsg(CMSG_INFO, VERB_VERBOSE, // "gdi_lock<%d %d>", GetCurrentThreadId(),lock_num ); if(hMutexGDI==NULL){ hMutexGDI = CreateMutex(NULL,FALSE,NULL); if(hMutexGDI==NULL) return -1; } if(WaitForSingleObject(hMutexGDI,timeout)==WAIT_FAILED){ return -1; } return 0; } int gdi_lock(void) { return gdi_lock_ex ( INFINITE ); } extern int gdi_unlock(void) { //lock_num--; //ctl->cmsg(CMSG_INFO, VERB_VERBOSE, // "gdi_unlock<%d %d>", GetCurrentThreadId(),lock_num ); if(hMutexGDI!=NULL){ ReleaseMutex(hMutexGDI); } return 0; } TiMidity++-2.13.2/interface/w32g_playlist.c0100644004711200001440000004623607474352016017527 0ustar tamukiusers/* TiMidity -- Experimental MIDI to WAVE converter Copyright (C) 1999-2002 Masanao Izumo Copyright (C) 1995 Tuukka Toivonen 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ #include #include #include #include #include #undef RC_NONE #include "timidity.h" #include "common.h" #include "instrum.h" #include "playmidi.h" #include "readmidi.h" #include "controls.h" #include "w32g.h" #include "w32g_res.h" #define W32G_RANDOM_IS_SHUFFLE void SetNumListWnd(int cursel, int nfiles); // playlist typedef struct _PlayListEntry { char *filename; // malloc char *title; // shared with midi_file_info struct midi_file_info *info; } PlayListEntry; static struct { int nfiles; int selected; /* 0..nfiles-1 */ int allocated; /* number of PlayListEntry is allocated */ PlayListEntry *list; } playlist = {0, 0, 0, NULL}; static HWND playlist_box(void) { if(!hListWnd) return 0; return GetDlgItem(hListWnd, IDC_LISTBOX_PLAYLIST); } static int w32g_add_playlist1(char *filename, int uniq, int refine) { PlayListEntry *entry; char *title; struct midi_file_info *info; if(uniq) { int i; for(i = 0; i < playlist.nfiles; i++) if(pathcmp(filename, playlist.list[i].filename, 0) == 0) return 0; } title = get_midi_title(filename); info = get_midi_file_info(filename, 1); if(refine && info->format < 0) return 0; if(playlist.allocated == 0) { playlist.allocated = 32; playlist.list = (PlayListEntry *)safe_malloc(playlist.allocated * sizeof(PlayListEntry)); } else if(playlist.nfiles == playlist.allocated) { playlist.allocated *= 2; playlist.list = (PlayListEntry *)safe_realloc(playlist.list, playlist.allocated * sizeof(PlayListEntry)); } entry = &playlist.list[playlist.nfiles]; entry->filename = safe_strdup(filename); entry->title = title; entry->info = info; playlist.nfiles++; w32g_shuffle_playlist_reset(1); return 1; } int w32g_add_playlist(int nfiles, char **files, int expand_flag, int uniq, int refine) { char **new_files1; char **new_files2; int i, n; extern int SeachDirRecursive; extern char **FilesExpandDir(int *, char **); if(nfiles == 0) return 0; if(SeachDirRecursive) { new_files1 = FilesExpandDir(&nfiles, files); if(new_files1 == NULL) return 0; expand_flag = 1; } else new_files1 = files; if(!expand_flag) new_files2 = new_files1; else { new_files2 = expand_file_archives(new_files1, &nfiles); if(new_files2 == NULL) { if(new_files1 != files) { free(new_files1[0]); free(new_files1); } return 0; } } n = 0; for(i = 0; i < nfiles; i++) n += w32g_add_playlist1(new_files2[i], uniq, refine); if(new_files2 != new_files1) { free(new_files2[0]); free(new_files2); } if(new_files1 != files) { free(new_files1[0]); free(new_files1); } if(n > 0) w32g_update_playlist(); return n; } int w32g_next_playlist(int skip_invalid_file) { while(playlist.selected + 1 < playlist.nfiles) { playlist.selected++; if(!skip_invalid_file || playlist.list[playlist.selected].info->file_type != IS_ERROR_FILE) { w32g_update_playlist(); return 1; } } return 0; } int w32g_prev_playlist(int skip_invalid_file) { while(playlist.selected > 0) { playlist.selected--; if(!skip_invalid_file || playlist.list[playlist.selected].info->file_type != IS_ERROR_FILE) { w32g_update_playlist(); return 1; } } return 0; } int w32g_random_playlist(int skip_invalid_file) { int old_selected_index = playlist.selected; int select; int err = 0; for(;;) { if ( playlist.nfiles == 1) { select = old_selected_index; } else { if ( playlist.nfiles <= 1 ) select = 0; else if ( playlist.nfiles == 2 ) select = 1; else select = int_rand(playlist.nfiles - 1); select += old_selected_index; if ( select >= playlist.nfiles ) select -= playlist.nfiles; if ( select < 0 ) select = 0; } playlist.selected = select; if(!skip_invalid_file || playlist.list[playlist.selected].info->file_type != IS_ERROR_FILE) { w32g_update_playlist(); return 1; } if ( playlist.nfiles == 2 ) { playlist.selected = old_selected_index; if(!skip_invalid_file || playlist.list[playlist.selected].info->file_type != IS_ERROR_FILE) { w32g_update_playlist(); return 1; } } // for safety. if (playlist.selected == old_selected_index) break; err++; if (err > playlist.nfiles + 10) break; } return 0; } static struct playlist_shuffle_ { int * volatile list; int volatile cur; int volatile allocated; int volatile max; } playlist_shuffle; static int playlist_shuffle_init = 0; #define PLAYLIST_SHUFFLE_LIST_SIZE 1024 int w32g_shuffle_playlist_reset(int preserve ) { int i; int cur_old = -1; int max_old = 0; int max = playlist.nfiles; int allocate_min; if ( max < 0 ) max = 0; if ( playlist_shuffle_init == 0 ){ playlist_shuffle.list = NULL; playlist_shuffle.allocated = 0; playlist_shuffle.cur = -1; playlist_shuffle.max = 0; playlist_shuffle_init = 1; } if ( preserve ) { cur_old = playlist_shuffle.cur; max_old = playlist_shuffle.max; } allocate_min = playlist_shuffle.allocated - PLAYLIST_SHUFFLE_LIST_SIZE; if ( allocate_min < 0 ) allocate_min = 0; if ( playlist_shuffle.list == NULL || max < allocate_min || playlist_shuffle.allocated < max ) { playlist_shuffle.allocated = (max/PLAYLIST_SHUFFLE_LIST_SIZE + 1) * PLAYLIST_SHUFFLE_LIST_SIZE; playlist_shuffle.list = (int *) realloc ( playlist_shuffle.list, (playlist_shuffle.allocated + 1) * sizeof(int) ); if ( playlist_shuffle.list == NULL ) { playlist_shuffle_init = 0; playlist_shuffle.cur = -1; playlist_shuffle.max = 0; return 0; } } for ( i = max_old; i < max; i ++ ){ playlist_shuffle.list[i] = i; } playlist_shuffle.list[max] = -1; playlist_shuffle.cur = cur_old; playlist_shuffle.max = max; return 1; } int w32g_shuffle_playlist_next(int skip_invalid_file) { if ( !playlist_shuffle_init ) { if ( !w32g_shuffle_playlist_reset(0) ) return 0; } for ( playlist_shuffle.cur ++ ; playlist_shuffle.cur < playlist_shuffle.max; playlist_shuffle.cur ++ ) { int n = int_rand(playlist_shuffle.max - playlist_shuffle.cur) + playlist_shuffle.cur; int temp = playlist_shuffle.list[playlist_shuffle.cur]; if ( n > playlist_shuffle.max ) n = playlist_shuffle.max; playlist_shuffle.list[playlist_shuffle.cur] = playlist_shuffle.list[n]; playlist_shuffle.list[n] = temp; if ( playlist_shuffle.list[playlist_shuffle.cur] < playlist.nfiles ) { playlist.selected = playlist_shuffle.list[playlist_shuffle.cur]; if(!skip_invalid_file || playlist.list[playlist.selected].info->file_type != IS_ERROR_FILE) { w32g_update_playlist(); return 1; } } } return 0; } // void w32g_rotate_playlist(int dest) p static int w32g_shuffle_playlist_rotate(int dest, int i1, int i2) { int i, save; if ( i2 >= playlist_shuffle.max ) i2 = playlist_shuffle.max - 1; if(i1 >= i2) return 1; if(dest > 0) { save = playlist_shuffle.list[i2]; for(i = i2; i > i1; i--) /* i: i2 -> i1 */ playlist_shuffle.list[i] = playlist_shuffle.list[i - 1]; playlist_shuffle.list[i] = save; } else { save = playlist_shuffle.list[i1]; for(i = i1; i < i2; i++) /* i: i1 -> i2 */ playlist_shuffle.list[i] = playlist_shuffle.list[i + 1]; playlist_shuffle.list[i] = save; } return 0; } // int w32g_delete_playlist(int pos) p static int w32g_shuffle_playlist_delete(int n) { int i; int delete_flag = 0; for ( i = 0; i < playlist_shuffle.max; i++ ) { if ( playlist_shuffle.list[i] == n ) { delete_flag = 1; break; } } for ( ; i < playlist_shuffle.max; i++ ) { playlist_shuffle.list[i-1] = playlist_shuffle.list[i]; } for ( i = 0; i < playlist_shuffle.max; i++ ) { if ( playlist_shuffle.list[i] >= n ) playlist_shuffle.list[i]--; } if ( delete_flag ) playlist_shuffle.max--; return 0; } void w32g_first_playlist(int skip_invalid_file) { playlist.selected = 0; if(skip_invalid_file) { while(playlist.selected < playlist.nfiles && playlist.list[playlist.selected].info->file_type == IS_ERROR_FILE) playlist.selected++; if(playlist.selected == playlist.nfiles) playlist.selected = 0; } w32g_update_playlist(); } int w32g_goto_playlist(int num, int skip_invalid_file) { if(0 <= num && num < playlist.nfiles) { playlist.selected = num; if(skip_invalid_file) { while(playlist.selected < playlist.nfiles && playlist.list[playlist.selected].info->file_type == IS_ERROR_FILE) playlist.selected++; if(playlist.selected == playlist.nfiles) playlist.selected = num; } w32g_update_playlist(); return 1; } return 0; } int w32g_isempty_playlist(void) { return playlist.nfiles == 0; } #if 0 char *w32g_curr_playlist(void) { if(!playlist.nfiles) return NULL; return playlist.list[playlist.selected].filename; } #endif // Update an only list at the position. void w32g_update_playlist_pos(int pos) { int i, cur, modified; HWND hListBox; if(!(hListBox = playlist_box())) return; cur = ListBox_GetCurSel(hListBox); modified = 0; i = pos; if(i >= 0 && i < playlist.nfiles) { char *filename, *title, *item1, *item2; int maxlen, item2_len; int notitle = 0; filename = playlist.list[i].filename; title = playlist.list[i].title; if(title == NULL || title[0] == '\0') { if(playlist.list[i].info->file_type == IS_ERROR_FILE) title = " --SKIP-- "; else { // title = " -------- "; title = playlist.list[i].filename; notitle = 1; } } maxlen = strlen(filename) + strlen(title) + 32 + 80; item1 = (char *)new_segment(&tmpbuffer, maxlen); if(!notitle) { if(i == playlist.selected) snprintf(item1, maxlen, "==>%-80s ==>(%s)", title, filename); else snprintf(item1, maxlen, " %-80s (%s)", title, filename); } else { if(i == playlist.selected) snprintf(item1, maxlen, "==>%-80s ==>(%s)", title, filename); else snprintf(item1, maxlen, " %-80s (%s)", title, filename); } item2_len = ListBox_GetTextLen(hListBox, i); item2 = (char *)new_segment(&tmpbuffer, item2_len + 1); ListBox_GetText(hListBox, i, item2); if(strcmp(item1, item2) != 0) { ListBox_DeleteString(hListBox, i); ListBox_InsertString(hListBox, i, item1); modified = 1; } reuse_mblock(&tmpbuffer); } if(modified && cur==pos) { if(cur < 0) cur = playlist.selected; else if(cur >= playlist.nfiles - 1) cur = playlist.nfiles - 1; ListBox_SetCurSel(hListBox, cur); SetNumListWnd(cur,playlist.nfiles); } } void w32g_update_playlist(void) { #if 0 int i, cur, modified; HWND hListBox; if(!(hListBox = playlist_box())) return; cur = ListBox_GetCurSel(hListBox); modified = 0; for(i = 0; i < playlist.nfiles; i++) { char *filename, *title, *item1, *item2; int maxlen, item2_len; filename = playlist.list[i].filename; title = playlist.list[i].title; if(title == NULL || title[0] == '\0') { if(playlist.list[i].info->file_type == IS_ERROR_FILE) title = " --SKIP-- "; else title = " -------- "; } maxlen = strlen(filename) + strlen(title) + 32; item1 = (char *)new_segment(&tmpbuffer, maxlen); if(i == playlist.selected) snprintf(item1, maxlen, "==>%04d %s (%s)", i + 1, title, filename); else snprintf(item1, maxlen, " %04d %s (%s)", i + 1, title, filename); item2_len = ListBox_GetTextLen(hListBox, i); item2 = (char *)new_segment(&tmpbuffer, item2_len + 1); ListBox_GetText(hListBox, i, item2); if(strcmp(item1, item2) != 0) { ListBox_DeleteString(hListBox, i); ListBox_InsertString(hListBox, i, item1); modified = 1; } reuse_mblock(&tmpbuffer); } if(modified) { if(cur < 0) cur = playlist.selected; else if(cur >= playlist.nfiles - 1) cur = playlist.nfiles - 1; ListBox_SetCurSel(hListBox, cur); SetNumListWnd(cur,playlist.nfiles); } #else int i, cur, modified; HWND hListBox; if(!(hListBox = playlist_box())) return; cur = ListBox_GetCurSel(hListBox); modified = 0; for(i = 0; i < playlist.nfiles; i++) { w32g_update_playlist_pos(i); } if(modified) { if(cur < 0) cur = playlist.selected; else if(cur >= playlist.nfiles - 1) cur = playlist.nfiles - 1; ListBox_SetCurSel(hListBox, cur); SetNumListWnd(cur,playlist.nfiles); } #endif } void w32g_get_playlist_index(int *selected, int *nfiles, int *cursel) { if(selected != NULL) *selected = playlist.selected; if(nfiles != NULL) *nfiles = playlist.nfiles; if(cursel != NULL) { HWND hListBox; hListBox = playlist_box(); if(hListBox) *cursel = ListBox_GetCurSel(hListBox); else *cursel = 0; } } int w32g_delete_playlist(int pos) { int i; HWND hListBox; if(!(hListBox = playlist_box())) return 0; if(pos >= playlist.nfiles) return 0; #ifdef W32G_RANDOM_IS_SHUFFLE w32g_shuffle_playlist_delete(pos); #endif ListBox_DeleteString(hListBox, pos); free(playlist.list[pos].filename); playlist.nfiles--; for(i = pos; i < playlist.nfiles; i++) playlist.list[i] = playlist.list[i + 1]; if(pos < playlist.selected || pos == playlist.nfiles) { playlist.selected--; if(playlist.selected < 0){ playlist.selected = 0; SetNumListWnd(playlist.selected,playlist.nfiles); } else w32g_update_playlist_pos(playlist.selected); } if(playlist.nfiles > 0) { if(pos == playlist.nfiles) pos--; ListBox_SetCurSel(hListBox, pos); SetNumListWnd(pos,playlist.nfiles); } return 1; } int w32g_ismidi_playlist(int n) { if(n < 0 || n >= playlist.nfiles) return 0; return playlist.list[n].info->format >= 0; } int w32g_nvalid_playlist(void) { int i, n; n = 0; for(i = 0; i < playlist.nfiles; i++) if(w32g_ismidi_playlist(i)) n++; return n; } void w32g_setcur_playlist(void) { HWND hListBox; if(!(hListBox = playlist_box())) return; ListBox_SetCurSel(hListBox, playlist.selected); SetNumListWnd(playlist.selected,playlist.nfiles); } int w32g_uniq_playlist(int *is_selected_removed) { int nremoved; int i, n, j1, j2, cursel; HWND hListBox; hListBox = playlist_box(); if(hListBox) cursel = ListBox_GetCurSel(hListBox); else cursel = -1; if(is_selected_removed != NULL) *is_selected_removed = 0; nremoved = 0; n = playlist.nfiles; for(i = 0; i < n - 1; i++) { int save_n; /* remove list[i] from list[i+1 .. n-1] */ j1 = j2 = i + 1; save_n = n; while(j2 < save_n) /* j1 <= j2 */ { if(pathcmp(playlist.list[i].filename, playlist.list[j2].filename, 0) == 0) { nremoved++; n--; free(playlist.list[j2].filename); if(j2 == playlist.selected && is_selected_removed != NULL && !*is_selected_removed) { *is_selected_removed = 1; playlist.selected = j1; } if(j2 < playlist.selected) playlist.selected--; if(j2 < cursel) cursel--; } else { playlist.list[j1] = playlist.list[j2]; j1++; } j2++; } } if(nremoved) { for(i = 0; i < nremoved; i++) ListBox_DeleteString(hListBox, --playlist.nfiles); if(cursel >= 0){ ListBox_SetCurSel(hListBox, cursel); SetNumListWnd(cursel,playlist.nfiles); } w32g_update_playlist(); } return nremoved; } int w32g_refine_playlist(int *is_selected_removed) { int nremoved; int i, j1, j2, cursel; HWND hListBox; hListBox = playlist_box(); if(hListBox) cursel = ListBox_GetCurSel(hListBox); else cursel = -1; if(is_selected_removed != NULL) *is_selected_removed = 0; nremoved = 0; j1 = j2 = 0; while(j2 < playlist.nfiles) /* j1 <= j2 */ { if(playlist.list[j2].info->format < 0) { nremoved++; free(playlist.list[j2].filename); if(j2 == playlist.selected && is_selected_removed != NULL && !*is_selected_removed) { *is_selected_removed = 1; playlist.selected = j1; } if(j2 < playlist.selected) playlist.selected--; if(j2 < cursel) cursel--; } else { playlist.list[j1] = playlist.list[j2]; j1++; } j2++; } if(nremoved) { for(i = 0; i < nremoved; i++) ListBox_DeleteString(hListBox, --playlist.nfiles); if(cursel >= playlist.nfiles) cursel = playlist.nfiles - 1; if(cursel >= 0){ ListBox_SetCurSel(hListBox, cursel); SetNumListWnd(cursel,playlist.nfiles); } w32g_update_playlist(); } return nremoved; } void w32g_clear_playlist(void) { HWND hListBox; hListBox = playlist_box(); while(playlist.nfiles > 0) { playlist.nfiles--; free(playlist.list[playlist.nfiles].filename); #if 0 if(hListBox) ListBox_DeleteString(hListBox, playlist.nfiles); #endif } // LB_RESETCONTENT if(hListBox) ListBox_ResetContent(hListBox); playlist.selected = 0; SetNumListWnd(0,0); } void w32g_rotate_playlist(int dest) { int i, i1, i2; HWND hListBox; PlayListEntry save; char temp[1024]; if(playlist.nfiles == 0) return; if(!(hListBox = playlist_box())) return; i1 = ListBox_GetCurSel(hListBox); i2 = playlist.nfiles - 1; if(i1 >= i2) return; #ifdef W32G_RANDOM_IS_SHUFFLE w32g_shuffle_playlist_rotate(dest,i1,i2); #endif if(dest > 0) { save = playlist.list[i2]; for(i = i2; i > i1; i--) /* i: i2 -> i1 */ playlist.list[i] = playlist.list[i - 1]; playlist.list[i] = save; ListBox_GetText(hListBox,i2,temp); ListBox_DeleteString(hListBox,i2); ListBox_InsertString(hListBox,i1,temp); ListBox_SetCurSel(hListBox,i1); if(playlist.selected == i2){ playlist.selected = i1; w32g_update_playlist_pos(playlist.selected); } else if(i1 <= playlist.selected && playlist.selected < i2){ playlist.selected++; w32g_update_playlist_pos(playlist.selected); } } else { save = playlist.list[i1]; for(i = i1; i < i2; i++) /* i: i1 -> i2 */ playlist.list[i] = playlist.list[i + 1]; playlist.list[i] = save; ListBox_GetText(hListBox,i1,temp); ListBox_DeleteString(hListBox,i1); ListBox_InsertString(hListBox,-1,temp); ListBox_SetCurSel(hListBox,i1); if(playlist.selected == i1){ playlist.selected = i2; w32g_update_playlist_pos(playlist.selected); } else if(i1 < playlist.selected && playlist.selected <= i2){ playlist.selected--; w32g_update_playlist_pos(playlist.selected); } } } char *w32g_get_playlist(int idx) { if(idx < 0 || idx >= playlist.nfiles) return NULL; return playlist.list[idx].filename; } TiMidity++-2.13.2/interface/w32g_pref.c0100644004711200001440000035671710057342074016624 0ustar tamukiusers/* TiMidity++ -- MIDI to WAVE converter and player Copyright (C) 1999-2002 Masanao Izumo Copyright (C) 1995 Tuukka Toivonen 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA w32g_pref.c: Written by Daisuke Aoki */ #ifdef HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ #include "interface.h" #include #include #include #include #include #undef RC_NONE #include #ifndef NO_STRING_H #include #else #include #endif #include "timidity.h" #include "common.h" #include "instrum.h" #include "playmidi.h" #include "readmidi.h" #include "output.h" #include "controls.h" #include "tables.h" #include "miditrace.h" #include "reverb.h" #ifdef SUPPORT_SOUNDSPEC #include "soundspec.h" #endif /* SUPPORT_SOUNDSPEC */ #include "recache.h" #include "arc.h" #include "strtab.h" #include "wrd.h" #include "mid.defs" #include "w32g.h" #include "w32g_res.h" #include "w32g_utl.h" #include "w32g_pref.h" #ifdef AU_GOGO /* #include /* for gogo */ #include /* for gogo */ #include "gogo_a.h" #endif /* TiMidity Win32GUI preference / PropertySheet */ #ifndef IA_W32G_SYN extern void w32g_restart(void); #endif extern void set_gogo_opts_use_commandline_options(char *commandline); extern void restore_voices(int save_voices); extern void TracerWndApplyQuietChannel( ChannelBitMask quietchannels_ ); volatile int PrefWndDoing = 0; static void PrefSettingApply(void); static volatile int PrefWndSetOK = 0; static HWND hPrefWnd = NULL; static BOOL APIENTRY CALLBACK PrefWndDialogProc(HWND hwnd, UINT uMess, WPARAM wParam, LPARAM lParam); static BOOL APIENTRY PrefPlayerDialogProc(HWND hwnd, UINT uMess, WPARAM wParam, LPARAM lParam); static BOOL APIENTRY PrefTiMidity1DialogProc(HWND hwnd, UINT uMess, WPARAM wParam, LPARAM lParam); static BOOL APIENTRY PrefTiMidity2DialogProc(HWND hwnd, UINT uMess, WPARAM wParam, LPARAM lParam); static BOOL APIENTRY PrefTiMidity3DialogProc(HWND hwnd, UINT uMess, WPARAM wParam, LPARAM lParam); static BOOL APIENTRY PrefTiMidity4DialogProc(HWND hwnd, UINT uMess, WPARAM wParam, LPARAM lParam); #ifdef IA_W32G_SYN static BOOL APIENTRY PrefSyn1DialogProc(HWND hwnd, UINT uMess, WPARAM wParam, LPARAM lParam); #endif static int DlgOpenConfigFile(char *Filename, HWND hwnd); static int DlgOpenOutputFile(char *Filename, HWND hwnd); static int vorbisCofigDialog(void); static int gogoCofigDialog(void); //#if defined(__CYGWIN32__) || defined(__MINGW32__) #if 0 /* New version of mingw */ //#define pszTemplate u1.pszTemplate //#define pszIcon u2.pszIcon #ifndef NONAMELESSUNION #define NONAMELESSUNION #endif #ifndef DUMMYUNIONNAME #define DUMMYUNIONNAME u1 #endif #ifndef DUMMYUNIONNAME2 #define DUMMYUNIONNAME2 u2 #endif #ifndef DUMMYUNIONNAME3 #define DUMMYUNIONNAME3 u3 #endif #endif #ifdef IA_W32G_SYN static char **GetMidiINDrivers ( void ); #endif #define WM_MYSAVE (WM_USER + 100) #define WM_MYRESTORE (WM_USER + 101) typedef struct pref_page_t_ { int index; char *title; HWND hwnd; UINT control; DLGPROC dlgproc; int opt; } pref_page_t; static pref_page_t pref_pages_ja[] = { { 0, "vC", (HWND)NULL, IDD_PREF_PLAYER, (DLGPROC) PrefPlayerDialogProc, 0 }, { 1, "GtFNg", (HWND)NULL, IDD_PREF_TIMIDITY1, (DLGPROC) PrefTiMidity1DialogProc, 0 }, { 2, "̑", (HWND)NULL, IDD_PREF_TIMIDITY2, (DLGPROC) PrefTiMidity2DialogProc, 0 }, { 3, "o", (HWND)NULL, IDD_PREF_TIMIDITY3, (DLGPROC) PrefTiMidity3DialogProc, 0 }, { 4, "`l", (HWND)NULL, IDD_PREF_TIMIDITY4, (DLGPROC) PrefTiMidity4DialogProc, 0 }, #ifdef IA_W32G_SYN { 5, "VZTCU", (HWND)NULL, IDD_PREF_SYN1, (DLGPROC) PrefSyn1DialogProc, 0 }, #endif }; static pref_page_t pref_pages_en[] = { { 0, "Player", (HWND)NULL, IDD_PREF_PLAYER_EN, (DLGPROC) PrefPlayerDialogProc, 0 }, { 1, "Effect", (HWND)NULL, IDD_PREF_TIMIDITY1_EN, (DLGPROC) PrefTiMidity1DialogProc, 0 }, { 2, "Misc", (HWND)NULL, IDD_PREF_TIMIDITY2_EN, (DLGPROC) PrefTiMidity2DialogProc, 0 }, { 3, "Output", (HWND)NULL, IDD_PREF_TIMIDITY3_EN, (DLGPROC) PrefTiMidity3DialogProc, 0 }, { 4, "Channel", (HWND)NULL, IDD_PREF_TIMIDITY4_EN, (DLGPROC) PrefTiMidity4DialogProc, 0 }, #ifdef IA_W32G_SYN { 5, "Synthesizer", (HWND)NULL, IDD_PREF_SYN1_EN, (DLGPROC) PrefSyn1DialogProc, 0 }, #endif }; #ifndef IA_W32G_SYN #define PREF_PAGE_MAX 5 #else #define PREF_PAGE_MAX 6 #endif static pref_page_t *pref_pages; static void PrefWndCreatePage ( HWND hwnd ) { int i; RECT rc; HWND hwnd_tab; #ifdef IA_W32G_SYN GetMidiINDrivers (); #endif switch(PlayerLanguage) { case LANGUAGE_JAPANESE: pref_pages = pref_pages_ja; break; default: case LANGUAGE_ENGLISH: pref_pages = pref_pages_en; break; } hwnd_tab = GetDlgItem ( hwnd, IDC_TAB_MAIN ); for ( i = 0; i < PREF_PAGE_MAX; i++ ) { TC_ITEM tci; tci.mask = TCIF_TEXT; tci.pszText = pref_pages[i].title; tci.cchTextMax = strlen ( pref_pages[i].title ); SendMessage ( hwnd_tab, TCM_INSERTITEM, (WPARAM)i, (LPARAM)&tci ); } GetClientRect ( hwnd_tab, &rc ); SendDlgItemMessage ( hwnd, IDC_TAB_MAIN, TCM_ADJUSTRECT, (WPARAM)0, (LPARAM)&rc ); for ( i = 0; i < PREF_PAGE_MAX; i++ ) { pref_pages[i].hwnd = CreateDialog ( hInst, MAKEINTRESOURCE(pref_pages[i].control), hwnd, pref_pages[i].dlgproc ); ShowWindow ( pref_pages[i].hwnd, SW_HIDE ); MoveWindow ( pref_pages[i].hwnd, rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top, TRUE ); } } void PrefWndCreate(HWND hwnd) { VOLATILE_TOUCH(PrefWndDoing); if(PrefWndDoing) return; PrefWndDoing = 1; PrefWndSetOK = 1; switch(PlayerLanguage) { case LANGUAGE_JAPANESE: DialogBox ( hInst, MAKEINTRESOURCE(IDD_DIALOG_PREF), hwnd, PrefWndDialogProc ); break; default: case LANGUAGE_ENGLISH: DialogBox ( hInst, MAKEINTRESOURCE(IDD_DIALOG_PREF_EN), hwnd, PrefWndDialogProc ); break; } hPrefWnd = NULL; PrefWndSetOK = 0; PrefWndDoing = 0; return; } static BOOL APIENTRY CALLBACK PrefWndDialogProc(HWND hwnd, UINT uMess, WPARAM wParam, LPARAM lParam) { int i; switch (uMess){ case WM_INITDIALOG: { hPrefWnd = hwnd; PrefWndCreatePage ( hwnd ); SendDlgItemMessage ( hwnd, IDC_TAB_MAIN, TCM_SETCURSEL, (WPARAM)0, (LPARAM)0 ); ShowWindow ( pref_pages[0].hwnd, TRUE ); return TRUE; } case WM_COMMAND: switch (LOWORD(wParam)) { case IDOK: for ( i = 0; i < PREF_PAGE_MAX; i++ ) { SendMessage ( pref_pages[i].hwnd, WM_MYSAVE, (WPARAM)0, (LPARAM)0 ); } PrefSettingApply(); SetWindowLong(hwnd, DWL_MSGRESULT, TRUE); EndDialog ( hwnd, TRUE ); return TRUE; case IDCANCEL: SetWindowLong(hwnd, DWL_MSGRESULT, FALSE); EndDialog ( hwnd, FALSE ); return TRUE; case IDC_BUTTON_APPLY: for ( i = 0; i < PREF_PAGE_MAX; i++ ) { SendMessage ( pref_pages[i].hwnd, WM_MYSAVE, (WPARAM)0, (LPARAM)0 ); } PrefSettingApply(); #ifndef IA_W32G_SYN TracerWndApplyQuietChannel(st_temp->quietchannels); #endif SetWindowLong(hwnd, DWL_MSGRESULT, TRUE); return TRUE; } break; case WM_NOTIFY: { int idCtrl = (int) wParam; LPNMHDR pnmh = (LPNMHDR) lParam; if ( pnmh->idFrom == IDC_TAB_MAIN ) { switch ( pnmh->code ) { case TCN_SELCHANGE: { int nIndex = SendDlgItemMessage ( hwnd, IDC_TAB_MAIN, TCM_GETCURSEL, (WPARAM)0, (LPARAM)0); for ( i = 0; i < PREF_PAGE_MAX; i++ ) { if ( nIndex == i ) { ShowWindow ( pref_pages[i].hwnd, TRUE ); } else { ShowWindow ( pref_pages[i].hwnd, FALSE ); } } } return TRUE; } } break; } case WM_SIZE: { RECT rc; HWND hwnd_tab = GetDlgItem ( hwnd, IDC_TAB_MAIN ); GetClientRect ( hwnd_tab, &rc ); SendDlgItemMessage ( hwnd, IDC_TAB_MAIN, TCM_ADJUSTRECT, (WPARAM)TRUE, (LPARAM)&rc ); for ( i = 0; i < PREF_PAGE_MAX; i++ ) { MoveWindow ( pref_pages[i].hwnd, rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top, TRUE ); } return TRUE; } case WM_CLOSE: break; default: break; } return FALSE; } // SetWindowLong(hwnd, DWL_MSGRESULT, FALSE); #define DLG_CHECKBUTTON_TO_FLAG(hwnd,ctlid,x) \ ((SendDlgItemMessage((hwnd),(ctlid),BM_GETCHECK,0,0))?((x)=1):((x)=0)) #define DLG_FLAG_TO_CHECKBUTTON(hwnd,ctlid,x) \ ((x)?(SendDlgItemMessage((hwnd),(ctlid),BM_SETCHECK,1,0)):\ (SendDlgItemMessage((hwnd),(ctlid),BM_SETCHECK,0,0))) extern void TracerWndApplyQuietChannel( ChannelBitMask quietchannels_ ); #ifndef IA_W32G_SYN /* st_temp, sp_temp Kp * : MainThread ̌Ăяo֎~A댯I */ void PrefSettingApplyReally(void) { int restart; extern int IniFileAutoSave; free_instruments(1); if(play_mode->fd != -1) play_mode->close_output(); restart = (PlayerLanguage != sp_temp->PlayerLanguage); // restart |= (strcmp(sp_temp->ConfigFile,ConfigFile) != 0); if(sp_temp->PlayerLanguage == LANGUAGE_JAPANESE) strcpy(st_temp->output_text_code, "SJIS"); else strcpy(st_temp->output_text_code, "ASCII"); ApplySettingPlayer(sp_temp); ApplySettingTiMidity(st_temp); SaveSettingPlayer(sp_current); SaveSettingTiMidity(st_current); memcpy(sp_temp, sp_current, sizeof(SETTING_PLAYER)); memcpy(st_temp, st_current, sizeof(SETTING_TIMIDITY)); restore_voices(1); PrefWndSetOK = 0; if(IniFileAutoSave) SaveIniFile(sp_current, st_current); if(restart && MessageBox(hListWnd,"Restart TiMidity?", "TiMidity", MB_YESNO)==IDYES) { w32g_restart(); // PrefWndDoing = 0; } } #endif #ifdef IA_W32G_SYN extern int w32g_syn_do_before_pref_apply ( void ); extern int w32g_syn_do_after_pref_apply ( void ); #endif extern int IniFileAutoSave; static void PrefSettingApply(void) { #ifndef IA_W32G_SYN w32g_send_rc(RC_EXT_APPLY_SETTING, 0); #else int before_pref_apply_ok; before_pref_apply_ok = ( w32g_syn_do_before_pref_apply () == 0 ); ApplySettingPlayer(sp_temp); ApplySettingTiMidity(st_temp); SaveSettingPlayer(sp_current); SaveSettingTiMidity(st_current); memcpy(sp_temp, sp_current, sizeof(SETTING_PLAYER)); memcpy(st_temp, st_current, sizeof(SETTING_TIMIDITY)); if(IniFileAutoSave) SaveIniFile(sp_current, st_current); if ( before_pref_apply_ok ) w32g_syn_do_after_pref_apply (); PrefWndSetOK = 0; // PrefWndDoing = 0; #endif } void reload_cfg(void) { free_instrument_map(); clean_up_pathlist(); free_instruments(0); tmdy_free_config(); timidity_start_initialize(); read_config_file ( sp_temp->ConfigFile, 0 ); PrefSettingApply(); #ifndef IA_W32G_SYN TracerWndApplyQuietChannel(st_temp->quietchannels); #endif } static BOOL APIENTRY PrefPlayerDialogProc(HWND hwnd, UINT uMess, WPARAM wParam, LPARAM lParam) { static int initflag = 1; switch (uMess){ case WM_INITDIALOG: SetDlgItemText(hwnd,IDC_EDIT_CONFIG_FILE,TEXT(sp_temp->ConfigFile)); { char buff[64]; sprintf(buff,"%d",sp_temp->SubWindowMax); SetDlgItemText(hwnd,IDC_EDIT_SUBWINDOW_MAX,TEXT(buff)); } switch(sp_temp->PlayerLanguage){ case LANGUAGE_ENGLISH: CheckRadioButton(hwnd,IDC_RADIOBUTTON_JAPANESE,IDC_RADIOBUTTON_ENGLISH, IDC_RADIOBUTTON_ENGLISH); break; default: case LANGUAGE_JAPANESE: CheckRadioButton(hwnd,IDC_RADIOBUTTON_JAPANESE,IDC_RADIOBUTTON_ENGLISH, IDC_RADIOBUTTON_JAPANESE); break; } DLG_FLAG_TO_CHECKBUTTON(hwnd,IDC_CHECKBOX_AUTOQUIT, strchr(st_temp->opt_ctl + 1, 'x')); DLG_FLAG_TO_CHECKBUTTON(hwnd,IDC_CHECKBOX_AUTOUNIQ, strchr(st_temp->opt_ctl + 1, 'u')); DLG_FLAG_TO_CHECKBUTTON(hwnd,IDC_CHECKBOX_AUTOREFINE, strchr(st_temp->opt_ctl + 1, 'R')); DLG_FLAG_TO_CHECKBUTTON(hwnd,IDC_CHECKBOX_AUTOSTART, strchr(st_temp->opt_ctl + 1, 'a')); DLG_FLAG_TO_CHECKBUTTON(hwnd,IDC_CHECKBOX_NOT_CONTINUE, strchr(st_temp->opt_ctl + 1, 'C')); DLG_FLAG_TO_CHECKBUTTON(hwnd,IDC_CHECKBOX_NOT_DRAG_START, !strchr(st_temp->opt_ctl + 1, 'd')); DLG_FLAG_TO_CHECKBUTTON(hwnd,IDC_CHECKBOX_NOT_LOOPING, !strchr(st_temp->opt_ctl + 1, 'l')); DLG_FLAG_TO_CHECKBUTTON(hwnd,IDC_CHECKBOX_RANDOM, strchr(st_temp->opt_ctl + 1, 'r')); DLG_FLAG_TO_CHECKBUTTON(hwnd,IDC_CHECK_SEACHDIRRECURSIVE, sp_temp->SeachDirRecursive); DLG_FLAG_TO_CHECKBUTTON(hwnd,IDC_CHECK_DOCWNDINDEPENDENT, sp_temp->DocWndIndependent); DLG_FLAG_TO_CHECKBUTTON(hwnd,IDC_CHECK_DOCWNDAUTOPOPUP, sp_temp->DocWndAutoPopup); DLG_FLAG_TO_CHECKBUTTON(hwnd,IDC_CHECK_INIFILE_AUTOSAVE, sp_temp->IniFileAutoSave); DLG_FLAG_TO_CHECKBUTTON(hwnd,IDC_CHECK_AUTOLOAD_PLAYLIST, sp_temp->AutoloadPlaylist); DLG_FLAG_TO_CHECKBUTTON(hwnd,IDC_CHECK_AUTOSAVE_PLAYLIST, sp_temp->AutosavePlaylist); DLG_FLAG_TO_CHECKBUTTON(hwnd,IDC_CHECK_POS_SIZE_SAVE, sp_temp->PosSizeSave); initflag = 0; break; case WM_COMMAND: switch (LOWORD(wParam)) { case IDC_BUTTON_CONFIG_FILE: { char filename[MAXPATH+1]; filename[0] = '\0'; SendDlgItemMessage(hwnd,IDC_EDIT_CONFIG_FILE,WM_GETTEXT, (WPARAM)MAX_PATH,(LPARAM)TEXT(filename)); if(!DlgOpenConfigFile(filename,hwnd)) if(filename[0]!='\0') SetDlgItemText(hwnd,IDC_EDIT_CONFIG_FILE,TEXT(filename)); } break; case IDC_BUTTON_CFG_EDIT: ShellExecute(NULL, "open", "notepad.exe", ConfigFile, NULL, SW_SHOWNORMAL); break; /* case IDC_BUTTON_CFG_DIR: ShellExecute(NULL, "open", ConfigFileOpenDir, NULL, NULL, SW_SHOWNORMAL); break;*/ case IDC_BUTTON_CFG_RELOAD: { int i; for (i = 0; i < PREF_PAGE_MAX; i++ ) { SendMessage ( pref_pages[i].hwnd, WM_MYSAVE, (WPARAM)0, (LPARAM)0 ); } reload_cfg(); SetWindowLong(hwnd, DWL_MSGRESULT, TRUE); } break; case IDC_RADIOBUTTON_JAPANESE: case IDC_RADIOBUTTON_ENGLISH: break; default: break; } PrefWndSetOK = 1; break; case WM_MYSAVE: { if ( initflag ) break; SendDlgItemMessage(hwnd,IDC_EDIT_CONFIG_FILE,WM_GETTEXT, (WPARAM)MAX_PATH,(LPARAM)TEXT(sp_temp->ConfigFile)); { char buff[64]; SendDlgItemMessage(hwnd,IDC_EDIT_SUBWINDOW_MAX,WM_GETTEXT, (WPARAM)60,(LPARAM)TEXT(buff)); sp_temp->SubWindowMax = atoi(buff); if ( sp_temp->SubWindowMax < 1 ) sp_temp->SubWindowMax = 1; if ( sp_temp->SubWindowMax > 10 ) sp_temp->SubWindowMax = 10; } if(SendDlgItemMessage(hwnd,IDC_RADIOBUTTON_ENGLISH,BM_GETCHECK,0,0)){ sp_temp->PlayerLanguage = LANGUAGE_ENGLISH; } else if(SendDlgItemMessage(hwnd,IDC_RADIOBUTTON_JAPANESE,BM_GETCHECK,0,0)){ sp_temp->PlayerLanguage = LANGUAGE_JAPANESE; } { int flag; SettingCtlFlag(st_temp, 'x', DLG_CHECKBUTTON_TO_FLAG(hwnd,IDC_CHECKBOX_AUTOQUIT,flag)); SettingCtlFlag(st_temp, 'u', DLG_CHECKBUTTON_TO_FLAG(hwnd,IDC_CHECKBOX_AUTOUNIQ,flag)); SettingCtlFlag(st_temp, 'R', DLG_CHECKBUTTON_TO_FLAG(hwnd,IDC_CHECKBOX_AUTOREFINE,flag)); SettingCtlFlag(st_temp, 'a', DLG_CHECKBUTTON_TO_FLAG(hwnd,IDC_CHECKBOX_AUTOSTART,flag)); SettingCtlFlag(st_temp, 'C', DLG_CHECKBUTTON_TO_FLAG(hwnd,IDC_CHECKBOX_NOT_CONTINUE,flag)); SettingCtlFlag(st_temp, 'd', !DLG_CHECKBUTTON_TO_FLAG(hwnd,IDC_CHECKBOX_NOT_DRAG_START,flag)); SettingCtlFlag(st_temp, 'l', !DLG_CHECKBUTTON_TO_FLAG(hwnd,IDC_CHECKBOX_NOT_LOOPING,flag)); SettingCtlFlag(st_temp, 'r', DLG_CHECKBUTTON_TO_FLAG(hwnd,IDC_CHECKBOX_RANDOM,flag)); } DLG_CHECKBUTTON_TO_FLAG(hwnd,IDC_CHECK_SEACHDIRRECURSIVE, sp_temp->SeachDirRecursive); DLG_CHECKBUTTON_TO_FLAG(hwnd,IDC_CHECK_DOCWNDINDEPENDENT, sp_temp->DocWndIndependent); DLG_CHECKBUTTON_TO_FLAG(hwnd,IDC_CHECK_DOCWNDAUTOPOPUP, sp_temp->DocWndAutoPopup); DLG_CHECKBUTTON_TO_FLAG(hwnd,IDC_CHECK_INIFILE_AUTOSAVE, sp_temp->IniFileAutoSave); DLG_CHECKBUTTON_TO_FLAG(hwnd,IDC_CHECK_AUTOLOAD_PLAYLIST, sp_temp->AutoloadPlaylist); DLG_CHECKBUTTON_TO_FLAG(hwnd,IDC_CHECK_AUTOSAVE_PLAYLIST, sp_temp->AutosavePlaylist); DLG_CHECKBUTTON_TO_FLAG(hwnd,IDC_CHECK_POS_SIZE_SAVE, sp_temp->PosSizeSave); SetWindowLong(hwnd,DWL_MSGRESULT,FALSE); } break; case WM_SIZE: return FALSE; case WM_CLOSE: break; default: break; } return FALSE; } // IDC_COMBO_REVERB #define cb_num_IDC_COMBO_REVERB 5 static char *cb_info_IDC_COMBO_REVERB_en[] = { "No Reverb", "Standard Reverb", "Global Old Reverb", "New Reverb", "Global New Reverb", }; static char *cb_info_IDC_COMBO_REVERB_jp[] = { "o[uȂ", "Wo[u", "Wo[uiO[oj", "Vo[u", "Vo[uiO[oj", }; // IDC_COMBO_CHORUS #define cb_num_IDC_COMBO_CHORUS 3 static char *cb_info_IDC_COMBO_CHORUS_en[] = { "No Chorus", "Standard Chorus", "Surround Chorus", }; static char *cb_info_IDC_COMBO_CHORUS_jp[] = { "R[XȂ", "WR[X", "TEhR[X", }; // IDC_COMBO_DELAY #define cb_num_IDC_COMBO_DELAY 2 static char *cb_info_IDC_COMBO_DELAY_en[] = { "No Delay", "Standard Delay", }; static char *cb_info_IDC_COMBO_DELAY_jp[] = { "fBCȂ", "WfBC", }; // IDC_COMBO_LPF #define cb_num_IDC_COMBO_LPF 3 static char *cb_info_IDC_COMBO_LPF_en[] = { "No Filter", "Lowpass Filter (12dB/oct)", "Lowpass Filter (24dB/oct)", }; static char *cb_info_IDC_COMBO_LPF_jp[] = { "tB^Ȃ", "LPF (12dB/oct)", "LPF (24dB/oct)", }; // IDC_COMBO_MODULE struct _ModuleList { int num; char *name; }; static struct _ModuleList cb_info_IDC_COMBO_MODULE[] = { MODULE_TIMIDITY_DEFAULT, "TiMidity++ Default", MODULE_SC55, "SC-55", MODULE_SC88, "SC-88", MODULE_SC88PRO, "SC-88Pro", MODULE_SC8850, "SC-8850", MODULE_MU50, "MU-50", MODULE_MU80, "MU-80", MODULE_MU90, "MU-90", MODULE_MU100, "MU-100", MODULE_SBLIVE, "Sound Blaster Live!", MODULE_SBAUDIGY, "Sound Blaster Audigy", MODULE_TIMIDITY_SPECIAL1, "TiMidity++ Special 1", MODULE_TIMIDITY_DEBUG, "TiMidity++ Debug", }; #define cb_num_IDC_COMBO_MODULE (sizeof(cb_info_IDC_COMBO_MODULE) / sizeof(struct _ModuleList)) static int find_combo_module_item(int val) { int i; for (i = 0; i < cb_num_IDC_COMBO_MODULE; i++) if (val == cb_info_IDC_COMBO_MODULE[i].num) {return i;} return 0; } static BOOL APIENTRY PrefTiMidity1DialogProc(HWND hwnd, UINT uMess, WPARAM wParam, LPARAM lParam) { static int initflag = 1; int i; char **cb_info; switch (uMess){ case WM_INITDIALOG: // CHORUS if (PlayerLanguage == LANGUAGE_JAPANESE) cb_info = cb_info_IDC_COMBO_CHORUS_jp; else cb_info = cb_info_IDC_COMBO_CHORUS_en; for (i = 0; i < cb_num_IDC_COMBO_CHORUS; i++) SendDlgItemMessage(hwnd, IDC_COMBO_CHORUS, CB_INSERTSTRING, (WPARAM) -1, (LPARAM) cb_info[i]); if(GetDlgItemInt(hwnd, IDC_EDIT_CHORUS, NULL, FALSE)==0) SetDlgItemInt(hwnd, IDC_EDIT_CHORUS, 1, TRUE); if (st_temp->opt_surround_chorus) i = 2; else i = st_temp->opt_chorus_control; if (i >= 0) { SendDlgItemMessage(hwnd, IDC_COMBO_CHORUS, CB_SETCURSEL, (WPARAM) i, (LPARAM) 0); SendDlgItemMessage(hwnd, IDC_CHECKBOX_CHORUS_LEVEL, BM_SETCHECK, 0, 0); } else { SendDlgItemMessage(hwnd, IDC_COMBO_CHORUS, CB_SETCURSEL, (WPARAM) ((-i) / 128 + 1), (LPARAM) 0); SendDlgItemMessage(hwnd, IDC_CHECKBOX_CHORUS_LEVEL, BM_SETCHECK, 1, 0); SetDlgItemInt(hwnd, IDC_EDIT_CHORUS, -i, TRUE); } SendMessage(hwnd, WM_COMMAND, IDC_CHECKBOX_CHORUS_LEVEL, 0); // REVERB if (PlayerLanguage == LANGUAGE_JAPANESE) cb_info = cb_info_IDC_COMBO_REVERB_jp; else cb_info = cb_info_IDC_COMBO_REVERB_en; for (i = 0; i < cb_num_IDC_COMBO_REVERB; i++) SendDlgItemMessage(hwnd, IDC_COMBO_REVERB, CB_INSERTSTRING, (WPARAM) -1, (LPARAM) cb_info[i]); if(GetDlgItemInt(hwnd, IDC_EDIT_REVERB, NULL, FALSE)==0) SetDlgItemInt(hwnd, IDC_EDIT_REVERB, 1, TRUE); if (st_temp->opt_reverb_control >= 0) { SendDlgItemMessage(hwnd, IDC_COMBO_REVERB, CB_SETCURSEL, (WPARAM) st_temp->opt_reverb_control, (LPARAM) 0); SendDlgItemMessage(hwnd, IDC_CHECKBOX_REVERB_LEVEL, BM_SETCHECK, 0, 0); } else { SendDlgItemMessage(hwnd, IDC_COMBO_REVERB, CB_SETCURSEL, (WPARAM) ((-st_temp->opt_reverb_control) / 128 + 1), (LPARAM) 0); SendDlgItemMessage(hwnd, IDC_CHECKBOX_REVERB_LEVEL, BM_SETCHECK, 1, 0); SetDlgItemInt(hwnd, IDC_EDIT_REVERB, (-st_temp->opt_reverb_control) % 128, TRUE); } SendMessage(hwnd, WM_COMMAND, IDC_CHECKBOX_REVERB_LEVEL, 0); // DELAY if (PlayerLanguage == LANGUAGE_JAPANESE) cb_info = cb_info_IDC_COMBO_DELAY_jp; else cb_info = cb_info_IDC_COMBO_DELAY_en; for (i = 0; i < cb_num_IDC_COMBO_DELAY; i++) SendDlgItemMessage(hwnd, IDC_COMBO_DELAY, CB_INSERTSTRING, (WPARAM) -1, (LPARAM) cb_info[i]); SendDlgItemMessage(hwnd, IDC_COMBO_DELAY, CB_SETCURSEL, (WPARAM) st_temp->opt_delay_control, (LPARAM) 0); // DEFAULT MODULE for (i = 0; i < cb_num_IDC_COMBO_MODULE; i++) SendDlgItemMessage(hwnd, IDC_COMBO_MODULE, CB_INSERTSTRING, (WPARAM) -1, (LPARAM) cb_info_IDC_COMBO_MODULE[i].name); SendDlgItemMessage(hwnd, IDC_COMBO_MODULE, CB_SETCURSEL, (WPARAM) find_combo_module_item(st_temp->opt_default_module), (LPARAM) 0); // LPF if (PlayerLanguage == LANGUAGE_JAPANESE) cb_info = cb_info_IDC_COMBO_LPF_jp; else cb_info = cb_info_IDC_COMBO_LPF_en; for (i = 0; i < cb_num_IDC_COMBO_LPF; i++) SendDlgItemMessage(hwnd, IDC_COMBO_LPF, CB_INSERTSTRING, (WPARAM) -1, (LPARAM) cb_info[i]); SendDlgItemMessage(hwnd, IDC_COMBO_LPF, CB_SETCURSEL, (WPARAM) st_temp->opt_lpf_def, (LPARAM) 0); // L&R DELAY SetDlgItemInt(hwnd,IDC_EDIT_DELAY,st_temp->effect_lr_delay_msec,TRUE); if(st_temp->effect_lr_mode<0){ SendDlgItemMessage(hwnd,IDC_CHECKBOX_DELAY,BM_SETCHECK,0,0); } else { SendDlgItemMessage(hwnd,IDC_CHECKBOX_DELAY,BM_SETCHECK,1,0); switch(st_temp->effect_lr_mode){ case 0: CheckRadioButton(hwnd,IDC_RADIOBUTTON_DELAY_LEFT,IDC_RADIOBUTTON_DELAY_CENTER, IDC_RADIOBUTTON_DELAY_LEFT); break; case 1: CheckRadioButton(hwnd,IDC_RADIOBUTTON_DELAY_LEFT,IDC_RADIOBUTTON_DELAY_CENTER, IDC_RADIOBUTTON_DELAY_RIGHT); break; case 2: default: CheckRadioButton(hwnd,IDC_RADIOBUTTON_DELAY_LEFT,IDC_RADIOBUTTON_DELAY_CENTER, IDC_RADIOBUTTON_DELAY_CENTER); break; } } SendMessage(hwnd,WM_COMMAND,IDC_CHECKBOX_DELAY,0); // NOISESHARPING SetDlgItemInt(hwnd,IDC_EDIT_NOISESHARPING,st_temp->noise_sharp_type,TRUE); // Misc DLG_FLAG_TO_CHECKBUTTON(hwnd,IDC_CHECKBOX_MODWHEEL,st_temp->opt_modulation_wheel); DLG_FLAG_TO_CHECKBUTTON(hwnd,IDC_CHECKBOX_PORTAMENTO,st_temp->opt_portamento); DLG_FLAG_TO_CHECKBUTTON(hwnd,IDC_CHECKBOX_NRPNVIB,st_temp->opt_nrpn_vibrato); DLG_FLAG_TO_CHECKBUTTON(hwnd,IDC_CHECKBOX_CHPRESS,st_temp->opt_channel_pressure); DLG_FLAG_TO_CHECKBUTTON(hwnd,IDC_CHECKBOX_OVOICE,st_temp->opt_overlap_voice_allow); DLG_FLAG_TO_CHECKBUTTON(hwnd,IDC_CHECKBOX_TRACETEXT,st_temp->opt_trace_text_meta_event); DLG_FLAG_TO_CHECKBUTTON(hwnd,IDC_CHECKBOX_TVAA,st_temp->opt_tva_attack); DLG_FLAG_TO_CHECKBUTTON(hwnd,IDC_CHECKBOX_TVAD,st_temp->opt_tva_decay); DLG_FLAG_TO_CHECKBUTTON(hwnd,IDC_CHECKBOX_TVAR,st_temp->opt_tva_release); DLG_FLAG_TO_CHECKBUTTON(hwnd,IDC_CHECKBOX_DRUM_EFFECT,st_temp->opt_drum_effect); DLG_FLAG_TO_CHECKBUTTON(hwnd,IDC_CHECKBOX_MOD_ENV,st_temp->opt_modulation_envelope); DLG_FLAG_TO_CHECKBUTTON(hwnd,IDC_CHECKBOX_PAN_DELAY,st_temp->opt_pan_delay); DLG_FLAG_TO_CHECKBUTTON(hwnd,IDC_CHECKBOX_EQ,st_temp->opt_eq_control); DLG_FLAG_TO_CHECKBUTTON(hwnd,IDC_CHECKBOX_IEFFECT,st_temp->opt_insertion_effect); SetDlgItemInt(hwnd,IDC_EDIT_MODIFY_RELEASE,st_temp->modify_release,TRUE); initflag = 0; break; case WM_COMMAND: switch (LOWORD(wParam)) { case IDCLOSE: break; case IDC_CHECKBOX_CHORUS_LEVEL: if(SendDlgItemMessage(hwnd, IDC_CHECKBOX_CHORUS_LEVEL, BM_GETCHECK, 0, 0)){ EnableWindow(GetDlgItem(hwnd, IDC_EDIT_CHORUS), TRUE); } else { EnableWindow(GetDlgItem(hwnd, IDC_EDIT_CHORUS), FALSE); } break; case IDC_CHECKBOX_REVERB_LEVEL: if(SendDlgItemMessage(hwnd, IDC_CHECKBOX_REVERB_LEVEL, BM_GETCHECK, 0, 0)){ EnableWindow(GetDlgItem(hwnd, IDC_EDIT_REVERB), TRUE); } else { EnableWindow(GetDlgItem(hwnd, IDC_EDIT_REVERB), FALSE); } break; case IDC_CHECKBOX_DELAY: case IDC_RADIOBUTTON_DELAY_LEFT: case IDC_RADIOBUTTON_DELAY_RIGHT: case IDC_RADIOBUTTON_DELAY_CENTER: if(!SendDlgItemMessage(hwnd,IDC_RADIOBUTTON_DELAY_LEFT,BM_GETCHECK,0,0)) if(!SendDlgItemMessage(hwnd,IDC_RADIOBUTTON_DELAY_RIGHT,BM_GETCHECK,0,0)) if(!SendDlgItemMessage(hwnd,IDC_RADIOBUTTON_DELAY_CENTER,BM_GETCHECK,0,0)) CheckRadioButton(hwnd,IDC_RADIOBUTTON_DELAY_LEFT,IDC_RADIOBUTTON_DELAY_CENTER,IDC_RADIOBUTTON_DELAY_CENTER); if(SendDlgItemMessage(hwnd,IDC_CHECKBOX_DELAY,BM_GETCHECK,0,0)){ EnableWindow(GetDlgItem(hwnd,IDC_RADIOBUTTON_DELAY_LEFT),TRUE); EnableWindow(GetDlgItem(hwnd,IDC_RADIOBUTTON_DELAY_RIGHT),TRUE); EnableWindow(GetDlgItem(hwnd,IDC_RADIOBUTTON_DELAY_CENTER),TRUE); EnableWindow(GetDlgItem(hwnd,IDC_EDIT_DELAY),TRUE); } else { EnableWindow(GetDlgItem(hwnd,IDC_RADIOBUTTON_DELAY_LEFT),FALSE); EnableWindow(GetDlgItem(hwnd,IDC_RADIOBUTTON_DELAY_RIGHT),FALSE); EnableWindow(GetDlgItem(hwnd,IDC_RADIOBUTTON_DELAY_CENTER),FALSE); EnableWindow(GetDlgItem(hwnd,IDC_EDIT_DELAY),FALSE); } break; default: PrefWndSetOK = 1; return FALSE; break; } PrefWndSetOK = 1; break; case WM_MYSAVE: { if ( initflag ) break; // CHORUS st_temp->opt_chorus_control = (int)SendDlgItemMessage(hwnd, IDC_COMBO_CHORUS, CB_GETCURSEL, 0, 0); if (st_temp->opt_chorus_control && SendDlgItemMessage(hwnd, IDC_CHECKBOX_CHORUS_LEVEL, BM_GETCHECK, 0, 0)) { st_temp->opt_chorus_control = -(int)GetDlgItemInt(hwnd, IDC_EDIT_CHORUS, NULL, TRUE); } if (st_temp->opt_chorus_control == 2) { st_temp->opt_chorus_control = 1; st_temp->opt_surround_chorus = 1; } else { st_temp->opt_surround_chorus = 0; } // REVERB st_temp->opt_reverb_control = (int)SendDlgItemMessage(hwnd, IDC_COMBO_REVERB, CB_GETCURSEL, 0, 0); if(st_temp->opt_reverb_control && SendDlgItemMessage(hwnd, IDC_CHECKBOX_REVERB_LEVEL, BM_GETCHECK, 0, 0)) { st_temp->opt_reverb_control = -(int)GetDlgItemInt(hwnd, IDC_EDIT_REVERB, NULL, TRUE) - (st_temp->opt_reverb_control - 1) * 128; } // DELAY st_temp->opt_delay_control = (int)SendDlgItemMessage(hwnd, IDC_COMBO_DELAY, CB_GETCURSEL, 0, 0); // DEFAULT MODULE st_temp->opt_default_module = cb_info_IDC_COMBO_MODULE[(int)SendDlgItemMessage(hwnd, IDC_COMBO_MODULE, CB_GETCURSEL, 0, 0)].num; // LPF st_temp->opt_lpf_def = (int)SendDlgItemMessage(hwnd, IDC_COMBO_LPF, CB_GETCURSEL, 0, 0); // L&R DELAY st_temp->effect_lr_delay_msec = GetDlgItemInt(hwnd,IDC_EDIT_DELAY,NULL,FALSE); if(SendDlgItemMessage(hwnd,IDC_CHECKBOX_DELAY,BM_GETCHECK,0,0)){ if(SendDlgItemMessage(hwnd,IDC_RADIOBUTTON_DELAY_LEFT,BM_GETCHECK,0,0)){ st_temp->effect_lr_mode = 0; } else if(SendDlgItemMessage(hwnd,IDC_RADIOBUTTON_DELAY_RIGHT,BM_GETCHECK,0,0)){ st_temp->effect_lr_mode = 1; } else { st_temp->effect_lr_mode = 2; } } else { st_temp->effect_lr_mode = -1; } // NOISESHARPING st_temp->noise_sharp_type = GetDlgItemInt(hwnd,IDC_EDIT_NOISESHARPING,NULL,FALSE); // Misc DLG_CHECKBUTTON_TO_FLAG(hwnd,IDC_CHECKBOX_MODWHEEL,st_temp->opt_modulation_wheel); DLG_CHECKBUTTON_TO_FLAG(hwnd,IDC_CHECKBOX_PORTAMENTO,st_temp->opt_portamento); DLG_CHECKBUTTON_TO_FLAG(hwnd,IDC_CHECKBOX_NRPNVIB,st_temp->opt_nrpn_vibrato); DLG_CHECKBUTTON_TO_FLAG(hwnd,IDC_CHECKBOX_CHPRESS,st_temp->opt_channel_pressure); DLG_CHECKBUTTON_TO_FLAG(hwnd,IDC_CHECKBOX_OVOICE,st_temp->opt_overlap_voice_allow); DLG_CHECKBUTTON_TO_FLAG(hwnd,IDC_CHECKBOX_TRACETEXT,st_temp->opt_trace_text_meta_event); st_temp->modify_release = GetDlgItemInt(hwnd,IDC_EDIT_MODIFY_RELEASE,NULL,FALSE); DLG_CHECKBUTTON_TO_FLAG(hwnd,IDC_CHECKBOX_TVAA,st_temp->opt_tva_attack); DLG_CHECKBUTTON_TO_FLAG(hwnd,IDC_CHECKBOX_TVAD,st_temp->opt_tva_decay); DLG_CHECKBUTTON_TO_FLAG(hwnd,IDC_CHECKBOX_TVAR,st_temp->opt_tva_release); DLG_CHECKBUTTON_TO_FLAG(hwnd,IDC_CHECKBOX_DRUM_EFFECT,st_temp->opt_drum_effect); DLG_CHECKBUTTON_TO_FLAG(hwnd,IDC_CHECKBOX_MOD_ENV,st_temp->opt_modulation_envelope); DLG_CHECKBUTTON_TO_FLAG(hwnd,IDC_CHECKBOX_PAN_DELAY,st_temp->opt_pan_delay); DLG_CHECKBUTTON_TO_FLAG(hwnd,IDC_CHECKBOX_EQ,st_temp->opt_eq_control); DLG_CHECKBUTTON_TO_FLAG(hwnd,IDC_CHECKBOX_IEFFECT,st_temp->opt_insertion_effect); SetWindowLong(hwnd,DWL_MSGRESULT,FALSE); } break; case WM_SIZE: return FALSE; case WM_CLOSE: break; default: break; } return FALSE; } static int char_count(char *s, int c) { int n = 0; while(*s) n += (*s++ == c); return n; } // IDC_COMBO_(INIT|FORCE)_KEYSIG static char *cb_info_IDC_COMBO_KEYSIG[] = { "Cb Maj / Ab Min (b7)", "Gb Maj / Eb Min (b6)", "Db Maj / Bb Min (b5)", "Ab Maj / F Min (b4)", "Eb Maj / C Min (b3)", "Bb Maj / G Min (b2)", "F Maj / D Min (b1)", "C Maj / A Min (0)", "G Maj / E Min (#1)", "D Maj / B Min (#2)", "A Maj / F# Min (#3)", "E Maj / C# Min (#4)", "B Maj / G# Min (#5)", "F# Maj / D# Min (#6)", "C# Maj / A# Min (#7)" }; static BOOL APIENTRY PrefTiMidity2DialogProc(HWND hwnd, UINT uMess, WPARAM wParam, LPARAM lParam) { int i; static int initflag = 1; switch (uMess){ case WM_INITDIALOG: SetDlgItemInt(hwnd,IDC_EDIT_VOICES,st_temp->voices,FALSE); SetDlgItemInt(hwnd,IDC_EDIT_AMPLIFICATION,st_temp->amplification,FALSE); DLG_FLAG_TO_CHECKBUTTON(hwnd,IDC_CHECKBOX_FREE_INST,st_temp->free_instruments_afterwards); DLG_FLAG_TO_CHECKBUTTON(hwnd,IDC_CHECKBOX_ANTIALIAS,st_temp->antialiasing_allowed); DLG_FLAG_TO_CHECKBUTTON(hwnd,IDC_CHECKBOX_LOADINST_PLAYING,st_temp->opt_realtime_playing); SetDlgItemInt(hwnd,IDC_EDIT_CACHE_SIZE,st_temp->allocate_cache_size,FALSE); SetDlgItemInt(hwnd,IDC_EDIT_REDUCE_VOICE,st_temp->reduce_voice_threshold,TRUE); SendDlgItemMessage(hwnd,IDC_CHECKBOX_REDUCE_VOICE,BM_SETCHECK,st_temp->reduce_voice_threshold,0); SetDlgItemInt(hwnd,IDC_EDIT_DEFAULT_TONEBANK,st_temp->default_tonebank,FALSE); SetDlgItemInt(hwnd,IDC_EDIT_SPECIAL_TONEBANK,st_temp->special_tonebank,TRUE); if(st_temp->special_tonebank<0){ SendDlgItemMessage(hwnd,IDC_CHECKBOX_SPECIAL_TONEBANK,BM_SETCHECK,0,0); } else { SendDlgItemMessage(hwnd,IDC_CHECKBOX_SPECIAL_TONEBANK,BM_SETCHECK,1,0); } SendMessage(hwnd,WM_COMMAND,IDC_CHECKBOX_SPECIAL_TONEBANK,0); switch(st_temp->opt_default_mid){ case 0x41: CheckRadioButton(hwnd,IDC_RADIOBUTTON_GM,IDC_RADIOBUTTON_XG,IDC_RADIOBUTTON_GS); break; case 0x43: CheckRadioButton(hwnd,IDC_RADIOBUTTON_GM,IDC_RADIOBUTTON_XG,IDC_RADIOBUTTON_XG); break; default: case 0x7e: CheckRadioButton(hwnd,IDC_RADIOBUTTON_GM,IDC_RADIOBUTTON_XG,IDC_RADIOBUTTON_GM); break; } DLG_FLAG_TO_CHECKBUTTON(hwnd,IDC_CHECKBOX_CTL_TRACE_PLAYING, strchr(st_temp->opt_ctl + 1, 't')); SetDlgItemInt(hwnd,IDC_EDIT_CTL_VEBOSITY, char_count(st_temp->opt_ctl + 1, 'v') - char_count(st_temp->opt_ctl + 1, 'q') + 1, TRUE); SetDlgItemInt(hwnd,IDC_EDIT_CONTROL_RATIO,st_temp->control_ratio,FALSE); SetDlgItemInt(hwnd,IDC_EDIT_DRUM_POWER,st_temp->opt_drum_power,FALSE); DLG_FLAG_TO_CHECKBUTTON(hwnd,IDC_CHECKBOX_AMP_COMPENSATION,st_temp->opt_amp_compensation); DLG_FLAG_TO_CHECKBUTTON(hwnd, IDC_CHECKBOX_PURE_INTONATION, st_temp->opt_pure_intonation); SendMessage(hwnd, WM_COMMAND, IDC_CHECKBOX_PURE_INTONATION, 0); DLG_FLAG_TO_CHECKBUTTON(hwnd, IDC_CHECKBOX_INIT_KEYSIG, (st_temp->opt_init_keysig != 8)); SendMessage(hwnd, WM_COMMAND, IDC_CHECKBOX_PURE_INTONATION, 0); for (i = 0; i < 15; i++) SendDlgItemMessage(hwnd, IDC_COMBO_INIT_KEYSIG, CB_INSERTSTRING, (WPARAM) -1, (LPARAM) cb_info_IDC_COMBO_KEYSIG[i]); if (st_temp->opt_init_keysig == 8) { SendDlgItemMessage(hwnd, IDC_COMBO_INIT_KEYSIG, CB_SETCURSEL, (WPARAM) 7, (LPARAM) 0); SendDlgItemMessage(hwnd, IDC_CHECKBOX_INIT_MI, BM_SETCHECK, 0, 0); } else { SendDlgItemMessage(hwnd, IDC_COMBO_INIT_KEYSIG, CB_SETCURSEL, (WPARAM) st_temp->opt_init_keysig + 7 & 0x0f, (LPARAM) 0); SendDlgItemMessage(hwnd, IDC_CHECKBOX_INIT_MI, BM_SETCHECK, (st_temp->opt_init_keysig + 7 & 0x10) ? 1 : 0, 0); } SetDlgItemInt(hwnd, IDC_EDIT_KEY_ADJUST, st_temp->key_adjust, TRUE); DLG_FLAG_TO_CHECKBUTTON(hwnd, IDC_CHECKBOX_FORCE_KEYSIG, (st_temp->opt_force_keysig != 8)); SendMessage(hwnd, WM_COMMAND, IDC_CHECKBOX_FORCE_KEYSIG, 0); for (i = 0; i < 15; i++) SendDlgItemMessage(hwnd, IDC_COMBO_FORCE_KEYSIG, CB_INSERTSTRING, (WPARAM) -1, (LPARAM) cb_info_IDC_COMBO_KEYSIG[i]); if (st_temp->opt_force_keysig == 8) SendDlgItemMessage(hwnd, IDC_COMBO_FORCE_KEYSIG, CB_SETCURSEL, (WPARAM) 7, (LPARAM) 0); else SendDlgItemMessage(hwnd, IDC_COMBO_FORCE_KEYSIG, CB_SETCURSEL, (WPARAM) st_temp->opt_force_keysig + 7, (LPARAM) 0); initflag = 0; break; case WM_COMMAND: switch (LOWORD(wParam)) { case IDCLOSE: break; case IDC_CHECKBOX_SPECIAL_TONEBANK: if (SendDlgItemMessage(hwnd, IDC_CHECKBOX_SPECIAL_TONEBANK, BM_GETCHECK, 0, 0)) EnableWindow(GetDlgItem(hwnd, IDC_EDIT_SPECIAL_TONEBANK), TRUE); else EnableWindow(GetDlgItem(hwnd, IDC_EDIT_SPECIAL_TONEBANK), FALSE); break; case IDC_CHECKBOX_PURE_INTONATION: if (SendDlgItemMessage(hwnd, IDC_CHECKBOX_PURE_INTONATION, BM_GETCHECK, 0, 0)) { EnableWindow(GetDlgItem(hwnd, IDC_CHECKBOX_INIT_KEYSIG), TRUE); if (SendDlgItemMessage(hwnd, IDC_CHECKBOX_INIT_KEYSIG, BM_GETCHECK, 0, 0)) { EnableWindow(GetDlgItem(hwnd, IDC_COMBO_INIT_KEYSIG), TRUE); EnableWindow(GetDlgItem(hwnd, IDC_CHECKBOX_INIT_MI), TRUE); } else { EnableWindow(GetDlgItem(hwnd, IDC_COMBO_INIT_KEYSIG), FALSE); EnableWindow(GetDlgItem(hwnd, IDC_CHECKBOX_INIT_MI), FALSE); } } else { EnableWindow(GetDlgItem(hwnd, IDC_CHECKBOX_INIT_KEYSIG), FALSE); EnableWindow(GetDlgItem(hwnd, IDC_COMBO_INIT_KEYSIG), FALSE); EnableWindow(GetDlgItem(hwnd, IDC_CHECKBOX_INIT_MI), FALSE); } break; case IDC_CHECKBOX_INIT_KEYSIG: if (SendDlgItemMessage(hwnd, IDC_CHECKBOX_INIT_KEYSIG, BM_GETCHECK, 0, 0)) { EnableWindow(GetDlgItem(hwnd, IDC_COMBO_INIT_KEYSIG), TRUE); EnableWindow(GetDlgItem(hwnd, IDC_CHECKBOX_INIT_MI), TRUE); } else { EnableWindow(GetDlgItem(hwnd, IDC_COMBO_INIT_KEYSIG), FALSE); EnableWindow(GetDlgItem(hwnd, IDC_CHECKBOX_INIT_MI), FALSE); } break; case IDC_COMBO_INIT_KEYSIG: case IDC_CHECKBOX_INIT_MI: st_temp->opt_init_keysig = SendDlgItemMessage(hwnd, IDC_COMBO_INIT_KEYSIG, CB_GETCURSEL, (WPARAM) 0, (LPARAM) 0) + ((SendDlgItemMessage(hwnd, IDC_CHECKBOX_INIT_MI, BM_GETCHECK, 0, 0)) ? 16 : 0) - 7; break; case IDC_CHECKBOX_FORCE_KEYSIG: if (SendDlgItemMessage(hwnd, IDC_CHECKBOX_FORCE_KEYSIG, BM_GETCHECK, 0, 0)) EnableWindow(GetDlgItem(hwnd, IDC_COMBO_FORCE_KEYSIG), TRUE); else EnableWindow(GetDlgItem(hwnd, IDC_COMBO_FORCE_KEYSIG), FALSE); break; case IDC_COMBO_FORCE_KEYSIG: st_temp->opt_force_keysig = SendDlgItemMessage(hwnd, IDC_COMBO_FORCE_KEYSIG, CB_GETCURSEL, (WPARAM) 0, (LPARAM) 0) - 7; break; default: break; } PrefWndSetOK = 1; break; case WM_MYSAVE: if ( initflag ) break; { int i; char *p; st_temp->voices = GetDlgItemInt(hwnd,IDC_EDIT_VOICES,NULL,FALSE); st_temp->amplification = GetDlgItemInt(hwnd,IDC_EDIT_AMPLIFICATION,NULL,FALSE); DLG_CHECKBUTTON_TO_FLAG(hwnd,IDC_CHECKBOX_FREE_INST,st_temp->free_instruments_afterwards); DLG_CHECKBUTTON_TO_FLAG(hwnd,IDC_CHECKBOX_ANTIALIAS,st_temp->antialiasing_allowed); DLG_CHECKBUTTON_TO_FLAG(hwnd,IDC_CHECKBOX_LOADINST_PLAYING,st_temp->opt_realtime_playing); st_temp->allocate_cache_size = GetDlgItemInt(hwnd,IDC_EDIT_CACHE_SIZE,NULL,FALSE); if(SendDlgItemMessage(hwnd,IDC_CHECKBOX_REDUCE_VOICE,BM_GETCHECK,0,0)) { st_temp->reduce_voice_threshold = -1; st_temp->auto_reduce_polyphony = 1; } else { st_temp->reduce_voice_threshold = 0; st_temp->auto_reduce_polyphony = 0; } st_temp->default_tonebank = GetDlgItemInt(hwnd,IDC_EDIT_DEFAULT_TONEBANK,NULL,FALSE); if(SendDlgItemMessage(hwnd,IDC_CHECKBOX_SPECIAL_TONEBANK,BM_GETCHECK,0,0)){ st_temp->special_tonebank = GetDlgItemInt(hwnd,IDC_EDIT_SPECIAL_TONEBANK,NULL,TRUE); } else { st_temp->special_tonebank = -1; } if(SendDlgItemMessage(hwnd,IDC_RADIOBUTTON_GS,BM_GETCHECK,0,0)){ st_temp->opt_default_mid = 0x41; } else if(SendDlgItemMessage(hwnd,IDC_RADIOBUTTON_XG,BM_GETCHECK,0,0)){ st_temp->opt_default_mid = 0x43; } else st_temp->opt_default_mid = 0x7e; SettingCtlFlag(st_temp, 't', DLG_CHECKBUTTON_TO_FLAG(hwnd,IDC_CHECKBOX_CTL_TRACE_PLAYING,i)); /* remove 'v' and 'q' from st_temp->opt_ctl */ while(strchr(st_temp->opt_ctl + 1, 'v')) SettingCtlFlag(st_temp, 'v', 0); while(strchr(st_temp->opt_ctl + 1, 'q')) SettingCtlFlag(st_temp, 'q', 0); /* append 'v' or 'q' */ p = st_temp->opt_ctl + strlen(st_temp->opt_ctl); i = GetDlgItemInt(hwnd,IDC_EDIT_CTL_VEBOSITY,NULL,TRUE); while(i > 1) { *p++ = 'v'; i--; } while(i < 1) { *p++ = 'q'; i++; } st_temp->control_ratio = GetDlgItemInt(hwnd,IDC_EDIT_CONTROL_RATIO,NULL,FALSE); st_temp->opt_drum_power = GetDlgItemInt(hwnd,IDC_EDIT_DRUM_POWER,NULL,FALSE); DLG_CHECKBUTTON_TO_FLAG(hwnd,IDC_CHECKBOX_AMP_COMPENSATION,st_temp->opt_amp_compensation); DLG_CHECKBUTTON_TO_FLAG(hwnd, IDC_CHECKBOX_PURE_INTONATION, st_temp->opt_pure_intonation); if (SendDlgItemMessage(hwnd, IDC_CHECKBOX_PURE_INTONATION, BM_GETCHECK, 0, 0) && SendDlgItemMessage(hwnd, IDC_CHECKBOX_INIT_KEYSIG, BM_GETCHECK, 0, 0)) st_temp->opt_init_keysig = SendDlgItemMessage(hwnd, IDC_COMBO_INIT_KEYSIG, CB_GETCURSEL, (WPARAM) 0, (LPARAM) 0) + ((SendDlgItemMessage(hwnd, IDC_CHECKBOX_INIT_MI, BM_GETCHECK, 0, 0)) ? 16 : 0) - 7; else st_temp->opt_init_keysig = 8; st_temp->key_adjust = GetDlgItemInt(hwnd, IDC_EDIT_KEY_ADJUST, NULL, TRUE); if (SendDlgItemMessage(hwnd, IDC_CHECKBOX_FORCE_KEYSIG, BM_GETCHECK, 0, 0)) st_temp->opt_force_keysig = SendDlgItemMessage(hwnd, IDC_COMBO_FORCE_KEYSIG, CB_GETCURSEL, (WPARAM) 0, (LPARAM) 0) - 7; else st_temp->opt_force_keysig = 8; SetWindowLong(hwnd,DWL_MSGRESULT,FALSE); } break; case WM_SIZE: return FALSE; case WM_CLOSE: break; default: break; } return FALSE; } // IDC_COMBO_SAMPLE_RATE #define cb_num_IDC_COMBO_SAMPLE_RATE 10 static char *cb_info_IDC_COMBO_SAMPLE_RATE[] = { "4000", "8000", "11025", "16000", "22050", "24000", "32000", "40000", "44100", "48000", }; // IDC_COMBO_BANDWIDTH #define cb_num_IDC_COMBO_BANDWIDTH 3 enum { BANDWIDTH_8BIT = 0, BANDWIDTH_16BIT = 1, BANDWIDTH_24BIT = 2, }; static char *cb_info_IDC_COMBO_BANDWIDTH_en[] = { "8-bit", "16-bit", "24-bit", }; static char *cb_info_IDC_COMBO_BANDWIDTH_jp[] = { "8rbg", "16rbg", "24rbg", }; static char **cb_info_IDC_COMBO_BANDWIDTH; // IDC_COMBO_OUTPUT_MODE static char *cb_info_IDC_COMBO_OUTPUT_MODE_jp[]= { "ȉ̃t@Cɏo",(char *)0, #if defined(__CYGWIN32__) || defined(__MINGW32__) "t@CŌ肵A\\[XƓtH_ɏo",(char *)1, #else "t@CŌ肵A\[XƓtH_ɏo",(char *)1, #endif "t@CŌ肵Aȉ̃tH_ɏo",(char *)2, "t@CŌ肵Aȉ̃tH_ɏo(tH_t)",(char *)3, NULL }; static char *cb_info_IDC_COMBO_OUTPUT_MODE_en[]= { "next output file",(char *)0, "auto filename",(char *)1, "auto filename and output in next dir",(char *)2, "auto filename and output in next dir (with folder name)",(char *)3, NULL }; static char **cb_info_IDC_COMBO_OUTPUT_MODE; static BOOL APIENTRY PrefTiMidity3DialogProc(HWND hwnd, UINT uMess, WPARAM wParam, LPARAM lParam) { static int initflag = 1; switch (uMess){ case WM_INITDIALOG: { int i; SendDlgItemMessage(hwnd,IDC_COMBO_OUTPUT,CB_RESETCONTENT,(WPARAM)0,(LPARAM)0); for(i=0;play_mode_list[i]!=0;i++){ SendDlgItemMessage(hwnd,IDC_COMBO_OUTPUT,CB_INSERTSTRING,(WPARAM)-1,(LPARAM)play_mode_list[i]->id_name); } if (PlayerLanguage == LANGUAGE_JAPANESE) cb_info_IDC_COMBO_OUTPUT_MODE = cb_info_IDC_COMBO_OUTPUT_MODE_jp; else cb_info_IDC_COMBO_OUTPUT_MODE = cb_info_IDC_COMBO_OUTPUT_MODE_en; for(i=0;cb_info_IDC_COMBO_OUTPUT_MODE[i];i+=2){ SendDlgItemMessage(hwnd,IDC_COMBO_OUTPUT_MODE,CB_INSERTSTRING,(WPARAM)-1,(LPARAM)cb_info_IDC_COMBO_OUTPUT_MODE[i]); } { int cb_num; for(cb_num=0;(int)cb_info_IDC_COMBO_OUTPUT_MODE[cb_num];cb_num+=2){ SendDlgItemMessage(hwnd,IDC_COMBO_OUTPUT_MODE,CB_SETCURSEL,(WPARAM)0,(LPARAM)0); if(st_temp->auto_output_mode==(int)cb_info_IDC_COMBO_OUTPUT_MODE[cb_num+1]){ SendDlgItemMessage(hwnd,IDC_COMBO_OUTPUT_MODE,CB_SETCURSEL,(WPARAM)cb_num/2,(LPARAM)0); break; } } } } { char *opt; int num = 0; int i; for(i=0;play_mode_list[i]!=0;i++){ if(st_temp->opt_playmode[0]==play_mode_list[i]->id_character){ num = i; break; } } SendDlgItemMessage(hwnd,IDC_COMBO_OUTPUT,CB_SETCURSEL,(WPARAM)num,(LPARAM)0); if(st_temp->auto_output_mode==0){ if(st_temp->OutputName[0]=='\0') SetDlgItemText(hwnd,IDC_EDIT_OUTPUT_FILE,TEXT("output.wav")); else SetDlgItemText(hwnd,IDC_EDIT_OUTPUT_FILE,TEXT(st_temp->OutputName)); } else SetDlgItemText(hwnd,IDC_EDIT_OUTPUT_FILE,st_temp->OutputDirName); opt = st_temp->opt_playmode + 1; if(strchr(opt, 'U')){ SendDlgItemMessage(hwnd,IDC_CHECKBOX_ULAW,BM_SETCHECK,1,0); SendDlgItemMessage(hwnd,IDC_CHECKBOX_ALAW,BM_SETCHECK,0,0); SendDlgItemMessage(hwnd,IDC_CHECKBOX_LINEAR,BM_SETCHECK,0,0); } else if(strchr(opt, 'A')){ SendDlgItemMessage(hwnd,IDC_CHECKBOX_ULAW,BM_SETCHECK,0,0); SendDlgItemMessage(hwnd,IDC_CHECKBOX_ALAW,BM_SETCHECK,1,0); SendDlgItemMessage(hwnd,IDC_CHECKBOX_LINEAR,BM_SETCHECK,0,0); } else { SendDlgItemMessage(hwnd,IDC_CHECKBOX_ULAW,BM_SETCHECK,0,0); SendDlgItemMessage(hwnd,IDC_CHECKBOX_ALAW,BM_SETCHECK,0,0); SendDlgItemMessage(hwnd,IDC_CHECKBOX_LINEAR,BM_SETCHECK,1,0); } // BANDWIDTH if (PlayerLanguage == LANGUAGE_JAPANESE) cb_info_IDC_COMBO_BANDWIDTH = cb_info_IDC_COMBO_BANDWIDTH_jp; else cb_info_IDC_COMBO_BANDWIDTH = cb_info_IDC_COMBO_BANDWIDTH_en; for (i = 0; i < cb_num_IDC_COMBO_BANDWIDTH; i++) SendDlgItemMessage(hwnd, IDC_COMBO_BANDWIDTH, CB_INSERTSTRING, (WPARAM) -1, (LPARAM) cb_info_IDC_COMBO_BANDWIDTH[i]); if (strchr(opt, '2')) { // 24-bit SendDlgItemMessage(hwnd, IDC_COMBO_BANDWIDTH, CB_SETCURSEL, (WPARAM) BANDWIDTH_24BIT, (LPARAM) 0); } else if (strchr(opt, '1')) { // 16-bit SendDlgItemMessage(hwnd, IDC_COMBO_BANDWIDTH, CB_SETCURSEL, (WPARAM) BANDWIDTH_16BIT, (LPARAM) 0); } else { // 8-bit SendDlgItemMessage(hwnd, IDC_COMBO_BANDWIDTH, CB_SETCURSEL, (WPARAM) BANDWIDTH_8BIT, (LPARAM) 0); } if(strchr(opt, 's')){ SendDlgItemMessage(hwnd,IDC_CHECKBOX_SIGNED,BM_SETCHECK,1,0); SendDlgItemMessage(hwnd,IDC_CHECKBOX_UNSIGNED,BM_SETCHECK,0,0); } else { SendDlgItemMessage(hwnd,IDC_CHECKBOX_SIGNED,BM_SETCHECK,0,0); SendDlgItemMessage(hwnd,IDC_CHECKBOX_UNSIGNED,BM_SETCHECK,1,0); } if(strchr(opt, 'x')){ SendDlgItemMessage(hwnd,IDC_CHECKBOX_BYTESWAP,BM_SETCHECK,1,0); } else { SendDlgItemMessage(hwnd,IDC_CHECKBOX_BYTESWAP,BM_SETCHECK,0,0); } if(strchr(opt, 'M')){ SendDlgItemMessage(hwnd,IDC_RADIO_STEREO,BM_SETCHECK,0,0); SendDlgItemMessage(hwnd,IDC_RADIO_MONO,BM_SETCHECK,1,0); } else { SendDlgItemMessage(hwnd,IDC_RADIO_STEREO,BM_SETCHECK,1,0); SendDlgItemMessage(hwnd,IDC_RADIO_MONO,BM_SETCHECK,0,0); } // SAMPLE_RATE for (i = 0; i < cb_num_IDC_COMBO_SAMPLE_RATE; i++) SendDlgItemMessage(hwnd, IDC_COMBO_SAMPLE_RATE, CB_INSERTSTRING, (WPARAM) -1, (LPARAM) cb_info_IDC_COMBO_SAMPLE_RATE[i]); SetDlgItemInt(hwnd, IDC_COMBO_SAMPLE_RATE, st_temp->output_rate, FALSE); } initflag = 0; break; case WM_COMMAND: switch (LOWORD(wParam)) { case IDCLOSE: break; case IDC_BUTTON_OUTPUT_FILE: { char filename[MAXPATH+1]; filename[0] = '\0'; SendDlgItemMessage(hwnd,IDC_EDIT_OUTPUT_FILE,WM_GETTEXT, (WPARAM)MAX_PATH,(LPARAM)TEXT(filename)); if(!DlgOpenOutputFile(filename,hwnd)) if(filename[0]!='\0') SetDlgItemText(hwnd,IDC_EDIT_OUTPUT_FILE,TEXT(filename)); } break; case IDC_BUTTON_OUTPUT_FILE_DEL: { char filename[MAXPATH+1]; DWORD res; if(st_temp->auto_output_mode>0){ break; } GetDlgItemText(hwnd,IDC_EDIT_OUTPUT_FILE,filename,(WPARAM)MAX_PATH); res = GetFileAttributes(filename); if(res!=0xFFFFFFFF && !(res & FILE_ATTRIBUTE_DIRECTORY)){ if(DeleteFile(filename)!=TRUE){ char buffer[MAXPATH + 1024]; sprintf(buffer,"Can't delete file %s !",filename); MessageBox(NULL,buffer,"Error!", MB_OK); } else { char buffer[MAXPATH + 1024]; sprintf(buffer,"Delete file %s !",filename); MessageBox(NULL,buffer,"Delete!", MB_OK); } } } break; case IDC_CHECKBOX_ULAW: if(SendDlgItemMessage(hwnd,IDC_CHECKBOX_ULAW,BM_GETCHECK,0,0)){ SendDlgItemMessage(hwnd,IDC_CHECKBOX_ULAW,BM_SETCHECK,1,0); SendDlgItemMessage(hwnd,IDC_CHECKBOX_ALAW,BM_SETCHECK,0,0); SendDlgItemMessage(hwnd,IDC_CHECKBOX_LINEAR,BM_SETCHECK,0,0); SendDlgItemMessage(hwnd, IDC_COMBO_BANDWIDTH, CB_SETCURSEL, (WPARAM) BANDWIDTH_8BIT, (LPARAM) 0); SendDlgItemMessage(hwnd,IDC_CHECKBOX_SIGNED,BM_SETCHECK,0,0); SendDlgItemMessage(hwnd,IDC_CHECKBOX_UNSIGNED,BM_SETCHECK,1,0); SendDlgItemMessage(hwnd,IDC_CHECKBOX_BYTESWAP,BM_SETCHECK,0,0); } else { SendDlgItemMessage(hwnd,IDC_CHECKBOX_ULAW,BM_SETCHECK,0,0); SendDlgItemMessage(hwnd,IDC_CHECKBOX_ALAW,BM_SETCHECK,0,0); SendDlgItemMessage(hwnd,IDC_CHECKBOX_LINEAR,BM_SETCHECK,1,0); } break; case IDC_CHECKBOX_ALAW: if(SendDlgItemMessage(hwnd,IDC_CHECKBOX_ALAW,BM_GETCHECK,0,0)){ SendDlgItemMessage(hwnd,IDC_CHECKBOX_ULAW,BM_SETCHECK,0,0); SendDlgItemMessage(hwnd,IDC_CHECKBOX_ALAW,BM_SETCHECK,1,0); SendDlgItemMessage(hwnd,IDC_CHECKBOX_LINEAR,BM_SETCHECK,0,0); SendDlgItemMessage(hwnd, IDC_COMBO_BANDWIDTH, CB_SETCURSEL, (WPARAM) BANDWIDTH_8BIT, (LPARAM) 0); SendDlgItemMessage(hwnd,IDC_CHECKBOX_SIGNED,BM_SETCHECK,0,0); SendDlgItemMessage(hwnd,IDC_CHECKBOX_UNSIGNED,BM_SETCHECK,1,0); SendDlgItemMessage(hwnd,IDC_CHECKBOX_BYTESWAP,BM_SETCHECK,0,0); } else { SendDlgItemMessage(hwnd,IDC_CHECKBOX_ULAW,BM_SETCHECK,0,0); SendDlgItemMessage(hwnd,IDC_CHECKBOX_ALAW,BM_SETCHECK,0,0); SendDlgItemMessage(hwnd,IDC_CHECKBOX_LINEAR,BM_SETCHECK,1,0); } break; case IDC_CHECKBOX_LINEAR: if(SendDlgItemMessage(hwnd,IDC_CHECKBOX_LINEAR,BM_GETCHECK,0,0)){ SendDlgItemMessage(hwnd,IDC_CHECKBOX_ULAW,BM_SETCHECK,0,0); SendDlgItemMessage(hwnd,IDC_CHECKBOX_ALAW,BM_SETCHECK,0,0); SendDlgItemMessage(hwnd,IDC_CHECKBOX_LINEAR,BM_SETCHECK,1,0); } else { SendDlgItemMessage(hwnd,IDC_CHECKBOX_LINEAR,BM_SETCHECK,1,0); } break; case IDC_CHECKBOX_SIGNED: if(SendDlgItemMessage(hwnd,IDC_CHECKBOX_SIGNED,BM_GETCHECK,0,0)){ SendDlgItemMessage(hwnd,IDC_CHECKBOX_SIGNED,BM_SETCHECK,1,0); SendDlgItemMessage(hwnd,IDC_CHECKBOX_UNSIGNED,BM_SETCHECK,0,0); SendDlgItemMessage(hwnd,IDC_CHECKBOX_ULAW,BM_SETCHECK,0,0); SendDlgItemMessage(hwnd,IDC_CHECKBOX_ALAW,BM_SETCHECK,0,0); SendDlgItemMessage(hwnd,IDC_CHECKBOX_LINEAR,BM_SETCHECK,1,0); } else { SendDlgItemMessage(hwnd,IDC_CHECKBOX_SIGNED,BM_SETCHECK,0,0); SendDlgItemMessage(hwnd,IDC_CHECKBOX_UNSIGNED,BM_SETCHECK,1,0); SendDlgItemMessage(hwnd,IDC_CHECKBOX_ULAW,BM_SETCHECK,0,0); SendDlgItemMessage(hwnd,IDC_CHECKBOX_ALAW,BM_SETCHECK,0,0); SendDlgItemMessage(hwnd,IDC_CHECKBOX_LINEAR,BM_SETCHECK,1,0); } break; case IDC_CHECKBOX_UNSIGNED: if(SendDlgItemMessage(hwnd,IDC_CHECKBOX_UNSIGNED,BM_GETCHECK,0,0)){ SendDlgItemMessage(hwnd,IDC_CHECKBOX_SIGNED,BM_SETCHECK,0,0); SendDlgItemMessage(hwnd,IDC_CHECKBOX_UNSIGNED,BM_SETCHECK,1,0); SendDlgItemMessage(hwnd,IDC_CHECKBOX_ULAW,BM_SETCHECK,0,0); SendDlgItemMessage(hwnd,IDC_CHECKBOX_ALAW,BM_SETCHECK,0,0); SendDlgItemMessage(hwnd,IDC_CHECKBOX_LINEAR,BM_SETCHECK,1,0); } else { SendDlgItemMessage(hwnd,IDC_CHECKBOX_SIGNED,BM_SETCHECK,1,0); SendDlgItemMessage(hwnd,IDC_CHECKBOX_UNSIGNED,BM_SETCHECK,0,0); SendDlgItemMessage(hwnd,IDC_CHECKBOX_ULAW,BM_SETCHECK,0,0); SendDlgItemMessage(hwnd,IDC_CHECKBOX_ALAW,BM_SETCHECK,0,0); SendDlgItemMessage(hwnd,IDC_CHECKBOX_LINEAR,BM_SETCHECK,1,0); } break; case IDC_CHECKBOX_BYTESWAP: if(SendDlgItemMessage(hwnd,IDC_CHECKBOX_BYTESWAP,BM_GETCHECK,0,0)){ SendDlgItemMessage(hwnd,IDC_CHECKBOX_BYTESWAP,BM_SETCHECK,1,0); SendDlgItemMessage(hwnd,IDC_CHECKBOX_ULAW,BM_SETCHECK,0,0); SendDlgItemMessage(hwnd,IDC_CHECKBOX_ALAW,BM_SETCHECK,0,0); SendDlgItemMessage(hwnd,IDC_CHECKBOX_LINEAR,BM_SETCHECK,1,0); } else { SendDlgItemMessage(hwnd,IDC_CHECKBOX_BYTESWAP,BM_SETCHECK,0,0); SendDlgItemMessage(hwnd,IDC_CHECKBOX_ULAW,BM_SETCHECK,0,0); SendDlgItemMessage(hwnd,IDC_CHECKBOX_ALAW,BM_SETCHECK,0,0); SendDlgItemMessage(hwnd,IDC_CHECKBOX_LINEAR,BM_SETCHECK,1,0); } break; case IDC_RADIO_STEREO: if(SendDlgItemMessage(hwnd,IDC_RADIO_STEREO,BM_GETCHECK,0,0)){ SendDlgItemMessage(hwnd,IDC_RADIO_STEREO,BM_SETCHECK,1,0); SendDlgItemMessage(hwnd,IDC_RADIO_MONO,BM_SETCHECK,0,0); } else { SendDlgItemMessage(hwnd,IDC_RADIO_STEREO,BM_SETCHECK,0,0); SendDlgItemMessage(hwnd,IDC_RADIO_MONO,BM_SETCHECK,1,0); } break; case IDC_RADIO_MONO: if(SendDlgItemMessage(hwnd,IDC_RADIO_MONO,BM_GETCHECK,0,0)){ SendDlgItemMessage(hwnd,IDC_RADIO_STEREO,BM_SETCHECK,0,0); SendDlgItemMessage(hwnd,IDC_RADIO_MONO,BM_SETCHECK,1,0); } else { SendDlgItemMessage(hwnd,IDC_RADIO_STEREO,BM_SETCHECK,1,0); SendDlgItemMessage(hwnd,IDC_RADIO_MONO,BM_SETCHECK,0,0); } break; case IDC_BUTTON_OUTPUT_OPTIONS: { int num; num = SendDlgItemMessage(hwnd,IDC_COMBO_OUTPUT,CB_GETCURSEL,(WPARAM)0,(LPARAM)0); if(num>=0){ st_temp->opt_playmode[0]=play_mode_list[num]->id_character; } else { st_temp->opt_playmode[0]='d'; } #ifdef AU_VORBIS if(st_temp->opt_playmode[0]=='v'){ vorbisConfigDialog(); } #endif #ifdef AU_GOGO if(st_temp->opt_playmode[0]=='g'){ gogoConfigDialog(); } #endif } break; case IDC_COMBO_OUTPUT_MODE: { int cb_num1, cb_num2; cb_num1 = SendDlgItemMessage(hwnd,IDC_COMBO_OUTPUT_MODE,CB_GETCURSEL,(WPARAM)0,(LPARAM)0); if (PlayerLanguage == LANGUAGE_JAPANESE) cb_info_IDC_COMBO_OUTPUT_MODE = cb_info_IDC_COMBO_OUTPUT_MODE_jp; else cb_info_IDC_COMBO_OUTPUT_MODE = cb_info_IDC_COMBO_OUTPUT_MODE_en; for(cb_num2=0;(int)cb_info_IDC_COMBO_OUTPUT_MODE[cb_num2];cb_num2+=2){ if(cb_num1*2==cb_num2){ st_temp->auto_output_mode = (int)cb_info_IDC_COMBO_OUTPUT_MODE[cb_num2+1]; break; } } if (PlayerLanguage == LANGUAGE_JAPANESE) { if(st_temp->auto_output_mode>0){ SendDlgItemMessage(hwnd,IDC_BUTTON_OUTPUT_FILE,WM_SETTEXT,0,(LPARAM)"o͐"); SetDlgItemText(hwnd,IDC_EDIT_OUTPUT_FILE,st_temp->OutputDirName); } else { SendDlgItemMessage(hwnd,IDC_BUTTON_OUTPUT_FILE,WM_SETTEXT,0,(LPARAM)"o̓t@C"); SetDlgItemText(hwnd,IDC_EDIT_OUTPUT_FILE,st_temp->OutputName); } } else { if(st_temp->auto_output_mode>0){ SendDlgItemMessage(hwnd,IDC_BUTTON_OUTPUT_FILE,WM_SETTEXT,0,(LPARAM)"Output File"); SetDlgItemText(hwnd,IDC_EDIT_OUTPUT_FILE,st_temp->OutputDirName); } else { SendDlgItemMessage(hwnd,IDC_BUTTON_OUTPUT_FILE,WM_SETTEXT,0,(LPARAM)"Output File"); SetDlgItemText(hwnd,IDC_EDIT_OUTPUT_FILE,st_temp->OutputName); } } } break; default: break; } PrefWndSetOK = 1; break; case WM_MYSAVE: if ( initflag ) break; { int i = 0; int num; num = SendDlgItemMessage(hwnd,IDC_COMBO_OUTPUT,CB_GETCURSEL,(WPARAM)0,(LPARAM)0); if(num>=0){ st_temp->opt_playmode[i]=play_mode_list[num]->id_character; } else { st_temp->opt_playmode[i]='d'; } i++; if(SendDlgItemMessage(hwnd,IDC_CHECKBOX_ULAW,BM_GETCHECK,0,0)) st_temp->opt_playmode[i++] = 'U'; if(SendDlgItemMessage(hwnd,IDC_CHECKBOX_ALAW,BM_GETCHECK,0,0)) st_temp->opt_playmode[i++] = 'A'; if(SendDlgItemMessage(hwnd,IDC_CHECKBOX_LINEAR,BM_GETCHECK,0,0)) st_temp->opt_playmode[i++] = 'l'; num = SendDlgItemMessage(hwnd, IDC_COMBO_BANDWIDTH, CB_GETCURSEL, (WPARAM)0, (LPARAM)0); if(num == BANDWIDTH_8BIT) st_temp->opt_playmode[i++] = '8'; else if(num == BANDWIDTH_24BIT) st_temp->opt_playmode[i++] = '2'; else // 16-bit st_temp->opt_playmode[i++] = '1'; if(SendDlgItemMessage(hwnd,IDC_CHECKBOX_SIGNED,BM_GETCHECK,0,0)) st_temp->opt_playmode[i++] = 's'; if(SendDlgItemMessage(hwnd,IDC_CHECKBOX_UNSIGNED,BM_GETCHECK,0,0)) st_temp->opt_playmode[i++] = 'u'; if(SendDlgItemMessage(hwnd,IDC_CHECKBOX_BYTESWAP,BM_GETCHECK,0,0)) st_temp->opt_playmode[i++] = 'x'; if(SendDlgItemMessage(hwnd,IDC_RADIO_STEREO,BM_GETCHECK,0,0)) st_temp->opt_playmode[i++] = 'S'; if(SendDlgItemMessage(hwnd,IDC_RADIO_MONO,BM_GETCHECK,0,0)) st_temp->opt_playmode[i++] = 'M'; st_temp->opt_playmode[i] = '\0'; st_temp->output_rate = GetDlgItemInt(hwnd, IDC_COMBO_SAMPLE_RATE, NULL, FALSE); if(st_temp->auto_output_mode==0) GetDlgItemText(hwnd,IDC_EDIT_OUTPUT_FILE,st_temp->OutputName,(WPARAM)sizeof(st_temp->OutputName)); else GetDlgItemText(hwnd,IDC_EDIT_OUTPUT_FILE,st_temp->OutputDirName,(WPARAM)sizeof(st_temp->OutputDirName)); SetWindowLong(hwnd,DWL_MSGRESULT,FALSE); } break; break; case WM_SIZE: return FALSE; case WM_CLOSE: break; default: break; } return FALSE; } #define PREF_CHANNEL_MODE_DRUM_CHANNEL 1 #define PREF_CHANNEL_MODE_DRUM_CHANNEL_MASK 2 #define PREF_CHANNEL_MODE_QUIET_CHANNEL 3 static BOOL APIENTRY PrefTiMidity4DialogProc(HWND hwnd, UINT uMess, WPARAM wParam, LPARAM lParam) { static int initflag = 1; static int pref_channel_mode; switch (uMess){ case WM_INITDIALOG: pref_channel_mode = PREF_CHANNEL_MODE_DRUM_CHANNEL; SendMessage(hwnd,WM_MYRESTORE,(WPARAM)0,(LPARAM)0); DLG_FLAG_TO_CHECKBUTTON(hwnd,IDC_CHECKBOX_TEMPER_EQUAL, st_temp->temper_type_mute & 1 << 0); DLG_FLAG_TO_CHECKBUTTON(hwnd,IDC_CHECKBOX_TEMPER_PYTHA, st_temp->temper_type_mute & 1 << 1); DLG_FLAG_TO_CHECKBUTTON(hwnd,IDC_CHECKBOX_TEMPER_MEANTONE, st_temp->temper_type_mute & 1 << 2); DLG_FLAG_TO_CHECKBUTTON(hwnd,IDC_CHECKBOX_TEMPER_PUREINT, st_temp->temper_type_mute & 1 << 3); DLG_FLAG_TO_CHECKBUTTON(hwnd,IDC_CHECKBOX_TEMPER_USER0, st_temp->temper_type_mute & 1 << 4); DLG_FLAG_TO_CHECKBUTTON(hwnd,IDC_CHECKBOX_TEMPER_USER1, st_temp->temper_type_mute & 1 << 5); DLG_FLAG_TO_CHECKBUTTON(hwnd,IDC_CHECKBOX_TEMPER_USER2, st_temp->temper_type_mute & 1 << 6); DLG_FLAG_TO_CHECKBUTTON(hwnd,IDC_CHECKBOX_TEMPER_USER3, st_temp->temper_type_mute & 1 << 7); initflag = 0; break; case WM_MYRESTORE: { ChannelBitMask channelbitmask; switch(pref_channel_mode){ case PREF_CHANNEL_MODE_DRUM_CHANNEL_MASK: SendDlgItemMessage(hwnd,IDC_CHECKBOX_DRUM_CHANNEL,BM_SETCHECK,0,0); SendDlgItemMessage(hwnd,IDC_CHECKBOX_DRUM_CHANNEL_MASK,BM_SETCHECK,1,0); SendDlgItemMessage(hwnd,IDC_CHECKBOX_QUIET_CHANNEL,BM_SETCHECK,0,0); channelbitmask = st_temp->default_drumchannel_mask; break; case PREF_CHANNEL_MODE_QUIET_CHANNEL: SendDlgItemMessage(hwnd,IDC_CHECKBOX_DRUM_CHANNEL,BM_SETCHECK,0,0); SendDlgItemMessage(hwnd,IDC_CHECKBOX_DRUM_CHANNEL_MASK,BM_SETCHECK,0,0); SendDlgItemMessage(hwnd,IDC_CHECKBOX_QUIET_CHANNEL,BM_SETCHECK,1,0); channelbitmask = st_temp->quietchannels; break; default: case PREF_CHANNEL_MODE_DRUM_CHANNEL: SendDlgItemMessage(hwnd,IDC_CHECKBOX_DRUM_CHANNEL,BM_SETCHECK,1,0); SendDlgItemMessage(hwnd,IDC_CHECKBOX_DRUM_CHANNEL_MASK,BM_SETCHECK,0,0); SendDlgItemMessage(hwnd,IDC_CHECKBOX_QUIET_CHANNEL,BM_SETCHECK,0,0); channelbitmask = st_temp->default_drumchannels; break; } DLG_FLAG_TO_CHECKBUTTON(hwnd,IDC_CHECKBOX_CH01,IS_SET_CHANNELMASK(channelbitmask,0)); DLG_FLAG_TO_CHECKBUTTON(hwnd,IDC_CHECKBOX_CH02,IS_SET_CHANNELMASK(channelbitmask,1)); DLG_FLAG_TO_CHECKBUTTON(hwnd,IDC_CHECKBOX_CH03,IS_SET_CHANNELMASK(channelbitmask,2)); DLG_FLAG_TO_CHECKBUTTON(hwnd,IDC_CHECKBOX_CH04,IS_SET_CHANNELMASK(channelbitmask,3)); DLG_FLAG_TO_CHECKBUTTON(hwnd,IDC_CHECKBOX_CH05,IS_SET_CHANNELMASK(channelbitmask,4)); DLG_FLAG_TO_CHECKBUTTON(hwnd,IDC_CHECKBOX_CH06,IS_SET_CHANNELMASK(channelbitmask,5)); DLG_FLAG_TO_CHECKBUTTON(hwnd,IDC_CHECKBOX_CH07,IS_SET_CHANNELMASK(channelbitmask,6)); DLG_FLAG_TO_CHECKBUTTON(hwnd,IDC_CHECKBOX_CH08,IS_SET_CHANNELMASK(channelbitmask,7)); DLG_FLAG_TO_CHECKBUTTON(hwnd,IDC_CHECKBOX_CH09,IS_SET_CHANNELMASK(channelbitmask,8)); DLG_FLAG_TO_CHECKBUTTON(hwnd,IDC_CHECKBOX_CH10,IS_SET_CHANNELMASK(channelbitmask,9)); DLG_FLAG_TO_CHECKBUTTON(hwnd,IDC_CHECKBOX_CH11,IS_SET_CHANNELMASK(channelbitmask,10)); DLG_FLAG_TO_CHECKBUTTON(hwnd,IDC_CHECKBOX_CH12,IS_SET_CHANNELMASK(channelbitmask,11)); DLG_FLAG_TO_CHECKBUTTON(hwnd,IDC_CHECKBOX_CH13,IS_SET_CHANNELMASK(channelbitmask,12)); DLG_FLAG_TO_CHECKBUTTON(hwnd,IDC_CHECKBOX_CH14,IS_SET_CHANNELMASK(channelbitmask,13)); DLG_FLAG_TO_CHECKBUTTON(hwnd,IDC_CHECKBOX_CH15,IS_SET_CHANNELMASK(channelbitmask,14)); DLG_FLAG_TO_CHECKBUTTON(hwnd,IDC_CHECKBOX_CH16,IS_SET_CHANNELMASK(channelbitmask,15)); DLG_FLAG_TO_CHECKBUTTON(hwnd,IDC_CHECKBOX_CH17,IS_SET_CHANNELMASK(channelbitmask,16)); DLG_FLAG_TO_CHECKBUTTON(hwnd,IDC_CHECKBOX_CH18,IS_SET_CHANNELMASK(channelbitmask,17)); DLG_FLAG_TO_CHECKBUTTON(hwnd,IDC_CHECKBOX_CH19,IS_SET_CHANNELMASK(channelbitmask,18)); DLG_FLAG_TO_CHECKBUTTON(hwnd,IDC_CHECKBOX_CH20,IS_SET_CHANNELMASK(channelbitmask,19)); DLG_FLAG_TO_CHECKBUTTON(hwnd,IDC_CHECKBOX_CH21,IS_SET_CHANNELMASK(channelbitmask,20)); DLG_FLAG_TO_CHECKBUTTON(hwnd,IDC_CHECKBOX_CH22,IS_SET_CHANNELMASK(channelbitmask,21)); DLG_FLAG_TO_CHECKBUTTON(hwnd,IDC_CHECKBOX_CH23,IS_SET_CHANNELMASK(channelbitmask,22)); DLG_FLAG_TO_CHECKBUTTON(hwnd,IDC_CHECKBOX_CH24,IS_SET_CHANNELMASK(channelbitmask,23)); DLG_FLAG_TO_CHECKBUTTON(hwnd,IDC_CHECKBOX_CH25,IS_SET_CHANNELMASK(channelbitmask,24)); DLG_FLAG_TO_CHECKBUTTON(hwnd,IDC_CHECKBOX_CH26,IS_SET_CHANNELMASK(channelbitmask,25)); DLG_FLAG_TO_CHECKBUTTON(hwnd,IDC_CHECKBOX_CH27,IS_SET_CHANNELMASK(channelbitmask,26)); DLG_FLAG_TO_CHECKBUTTON(hwnd,IDC_CHECKBOX_CH28,IS_SET_CHANNELMASK(channelbitmask,27)); DLG_FLAG_TO_CHECKBUTTON(hwnd,IDC_CHECKBOX_CH29,IS_SET_CHANNELMASK(channelbitmask,28)); DLG_FLAG_TO_CHECKBUTTON(hwnd,IDC_CHECKBOX_CH30,IS_SET_CHANNELMASK(channelbitmask,29)); DLG_FLAG_TO_CHECKBUTTON(hwnd,IDC_CHECKBOX_CH31,IS_SET_CHANNELMASK(channelbitmask,30)); DLG_FLAG_TO_CHECKBUTTON(hwnd,IDC_CHECKBOX_CH32,IS_SET_CHANNELMASK(channelbitmask,31)); } break; case WM_COMMAND: switch (LOWORD(wParam)) { case IDCLOSE: break; case IDC_CHECKBOX_DRUM_CHANNEL: { SendMessage(hwnd,WM_MYSAVE,(WPARAM)0,(LPARAM)0); pref_channel_mode = PREF_CHANNEL_MODE_DRUM_CHANNEL; SendDlgItemMessage(hwnd,IDC_CHECKBOX_DRUM_CHANNEL,BM_SETCHECK,1,0); SendDlgItemMessage(hwnd,IDC_CHECKBOX_DRUM_CHANNEL_MASK,BM_SETCHECK,0,0); SendDlgItemMessage(hwnd,IDC_CHECKBOX_QUIET_CHANNEL,BM_SETCHECK,0,0); SendMessage(hwnd,WM_MYRESTORE,(WPARAM)0,(LPARAM)0); } break; case IDC_CHECKBOX_DRUM_CHANNEL_MASK: { SendMessage(hwnd,WM_MYSAVE,(WPARAM)0,(LPARAM)0); pref_channel_mode = PREF_CHANNEL_MODE_DRUM_CHANNEL_MASK; SendDlgItemMessage(hwnd,IDC_CHECKBOX_DRUM_CHANNEL,BM_SETCHECK,0,0); SendDlgItemMessage(hwnd,IDC_CHECKBOX_DRUM_CHANNEL_MASK,BM_SETCHECK,1,0); SendDlgItemMessage(hwnd,IDC_CHECKBOX_QUIET_CHANNEL,BM_SETCHECK,0,0); SendMessage(hwnd,WM_MYRESTORE,(WPARAM)0,(LPARAM)0); } break; case IDC_CHECKBOX_QUIET_CHANNEL: { SendMessage(hwnd,WM_MYSAVE,(WPARAM)0,(LPARAM)0); pref_channel_mode = PREF_CHANNEL_MODE_QUIET_CHANNEL; SendDlgItemMessage(hwnd,IDC_CHECKBOX_DRUM_CHANNEL,BM_SETCHECK,0,0); SendDlgItemMessage(hwnd,IDC_CHECKBOX_DRUM_CHANNEL_MASK,BM_SETCHECK,0,0); SendDlgItemMessage(hwnd,IDC_CHECKBOX_QUIET_CHANNEL,BM_SETCHECK,1,0); SendMessage(hwnd,WM_MYRESTORE,(WPARAM)0,(LPARAM)0); } break; case IDC_BUTTON_REVERSE: { SendMessage(hwnd,WM_MYSAVE,(WPARAM)0,(LPARAM)0); switch(pref_channel_mode){ case PREF_CHANNEL_MODE_DRUM_CHANNEL_MASK: REVERSE_CHANNELMASK(st_temp->default_drumchannel_mask); break; case PREF_CHANNEL_MODE_QUIET_CHANNEL: REVERSE_CHANNELMASK(st_temp->quietchannels); break; default: case PREF_CHANNEL_MODE_DRUM_CHANNEL: REVERSE_CHANNELMASK(st_temp->default_drumchannels); break; } SendMessage(hwnd,WM_MYRESTORE,(WPARAM)0,(LPARAM)0); } break; default: break; } PrefWndSetOK = 1; break; case WM_MYSAVE: if ( initflag ) break; { ChannelBitMask channelbitmask; int tmp; #define PREF_CHECKBUTTON_SET_CHANNELMASK(hwnd,ctlid,channelbitmask,ch,tmp) \ { if(DLG_CHECKBUTTON_TO_FLAG((hwnd),(ctlid),(tmp))) SET_CHANNELMASK((channelbitmask),(ch)); \ else UNSET_CHANNELMASK((channelbitmask),(ch)); } PREF_CHECKBUTTON_SET_CHANNELMASK(hwnd,IDC_CHECKBOX_CH01,channelbitmask,0,tmp); PREF_CHECKBUTTON_SET_CHANNELMASK(hwnd,IDC_CHECKBOX_CH02,channelbitmask,1,tmp); PREF_CHECKBUTTON_SET_CHANNELMASK(hwnd,IDC_CHECKBOX_CH03,channelbitmask,2,tmp); PREF_CHECKBUTTON_SET_CHANNELMASK(hwnd,IDC_CHECKBOX_CH04,channelbitmask,3,tmp); PREF_CHECKBUTTON_SET_CHANNELMASK(hwnd,IDC_CHECKBOX_CH05,channelbitmask,4,tmp); PREF_CHECKBUTTON_SET_CHANNELMASK(hwnd,IDC_CHECKBOX_CH06,channelbitmask,5,tmp); PREF_CHECKBUTTON_SET_CHANNELMASK(hwnd,IDC_CHECKBOX_CH07,channelbitmask,6,tmp); PREF_CHECKBUTTON_SET_CHANNELMASK(hwnd,IDC_CHECKBOX_CH08,channelbitmask,7,tmp); PREF_CHECKBUTTON_SET_CHANNELMASK(hwnd,IDC_CHECKBOX_CH09,channelbitmask,8,tmp); PREF_CHECKBUTTON_SET_CHANNELMASK(hwnd,IDC_CHECKBOX_CH10,channelbitmask,9,tmp); PREF_CHECKBUTTON_SET_CHANNELMASK(hwnd,IDC_CHECKBOX_CH11,channelbitmask,10,tmp); PREF_CHECKBUTTON_SET_CHANNELMASK(hwnd,IDC_CHECKBOX_CH12,channelbitmask,11,tmp); PREF_CHECKBUTTON_SET_CHANNELMASK(hwnd,IDC_CHECKBOX_CH13,channelbitmask,12,tmp); PREF_CHECKBUTTON_SET_CHANNELMASK(hwnd,IDC_CHECKBOX_CH14,channelbitmask,13,tmp); PREF_CHECKBUTTON_SET_CHANNELMASK(hwnd,IDC_CHECKBOX_CH15,channelbitmask,14,tmp); PREF_CHECKBUTTON_SET_CHANNELMASK(hwnd,IDC_CHECKBOX_CH16,channelbitmask,15,tmp); PREF_CHECKBUTTON_SET_CHANNELMASK(hwnd,IDC_CHECKBOX_CH17,channelbitmask,16,tmp); PREF_CHECKBUTTON_SET_CHANNELMASK(hwnd,IDC_CHECKBOX_CH18,channelbitmask,17,tmp); PREF_CHECKBUTTON_SET_CHANNELMASK(hwnd,IDC_CHECKBOX_CH19,channelbitmask,18,tmp); PREF_CHECKBUTTON_SET_CHANNELMASK(hwnd,IDC_CHECKBOX_CH20,channelbitmask,19,tmp); PREF_CHECKBUTTON_SET_CHANNELMASK(hwnd,IDC_CHECKBOX_CH21,channelbitmask,20,tmp); PREF_CHECKBUTTON_SET_CHANNELMASK(hwnd,IDC_CHECKBOX_CH22,channelbitmask,21,tmp); PREF_CHECKBUTTON_SET_CHANNELMASK(hwnd,IDC_CHECKBOX_CH23,channelbitmask,22,tmp); PREF_CHECKBUTTON_SET_CHANNELMASK(hwnd,IDC_CHECKBOX_CH24,channelbitmask,23,tmp); PREF_CHECKBUTTON_SET_CHANNELMASK(hwnd,IDC_CHECKBOX_CH25,channelbitmask,24,tmp); PREF_CHECKBUTTON_SET_CHANNELMASK(hwnd,IDC_CHECKBOX_CH26,channelbitmask,25,tmp); PREF_CHECKBUTTON_SET_CHANNELMASK(hwnd,IDC_CHECKBOX_CH27,channelbitmask,26,tmp); PREF_CHECKBUTTON_SET_CHANNELMASK(hwnd,IDC_CHECKBOX_CH28,channelbitmask,27,tmp); PREF_CHECKBUTTON_SET_CHANNELMASK(hwnd,IDC_CHECKBOX_CH29,channelbitmask,28,tmp); PREF_CHECKBUTTON_SET_CHANNELMASK(hwnd,IDC_CHECKBOX_CH30,channelbitmask,29,tmp); PREF_CHECKBUTTON_SET_CHANNELMASK(hwnd,IDC_CHECKBOX_CH31,channelbitmask,30,tmp); PREF_CHECKBUTTON_SET_CHANNELMASK(hwnd,IDC_CHECKBOX_CH32,channelbitmask,31,tmp); switch(pref_channel_mode){ case PREF_CHANNEL_MODE_DRUM_CHANNEL_MASK: st_temp->default_drumchannel_mask = channelbitmask; break; case PREF_CHANNEL_MODE_QUIET_CHANNEL: st_temp->quietchannels = channelbitmask; break; default: case PREF_CHANNEL_MODE_DRUM_CHANNEL: st_temp->default_drumchannels = channelbitmask; break; } } st_temp->temper_type_mute = 0; if (SendDlgItemMessage(hwnd, IDC_CHECKBOX_TEMPER_EQUAL, BM_GETCHECK, 0, 0)) st_temp->temper_type_mute |= 1 << 0; if (SendDlgItemMessage(hwnd, IDC_CHECKBOX_TEMPER_PYTHA, BM_GETCHECK, 0, 0)) st_temp->temper_type_mute |= 1 << 1; if (SendDlgItemMessage(hwnd, IDC_CHECKBOX_TEMPER_MEANTONE, BM_GETCHECK, 0, 0)) st_temp->temper_type_mute |= 1 << 2; if (SendDlgItemMessage(hwnd, IDC_CHECKBOX_TEMPER_PUREINT, BM_GETCHECK, 0, 0)) st_temp->temper_type_mute |= 1 << 3; if (SendDlgItemMessage(hwnd, IDC_CHECKBOX_TEMPER_USER0, BM_GETCHECK, 0, 0)) st_temp->temper_type_mute |= 1 << 4; if (SendDlgItemMessage(hwnd, IDC_CHECKBOX_TEMPER_USER1, BM_GETCHECK, 0, 0)) st_temp->temper_type_mute |= 1 << 5; if (SendDlgItemMessage(hwnd, IDC_CHECKBOX_TEMPER_USER2, BM_GETCHECK, 0, 0)) st_temp->temper_type_mute |= 1 << 6; if (SendDlgItemMessage(hwnd, IDC_CHECKBOX_TEMPER_USER3, BM_GETCHECK, 0, 0)) st_temp->temper_type_mute |= 1 << 7; SetWindowLong(hwnd,DWL_MSGRESULT,FALSE); break; case WM_SIZE: return FALSE; case WM_CLOSE: break; default: break; } return FALSE; } #ifdef IA_W32G_SYN extern int syn_ThreadPriority; static char **MidiINDrivers = NULL; // 0 MIDI Mapper -1 // 1 MIDI IN Driver 0 // 2 MIDI IN Driver 1 static char **GetMidiINDrivers ( void ) { int i; int max = midiInGetNumDevs (); if ( MidiINDrivers != NULL ) { for ( i = 0; MidiINDrivers[i] != NULL; i ++ ) { free ( MidiINDrivers[i] ); } free ( MidiINDrivers ); MidiINDrivers = NULL; } MidiINDrivers = ( char ** ) malloc ( sizeof ( char * ) * ( max + 2 ) ); if ( MidiINDrivers == NULL ) return MidiINDrivers; MidiINDrivers[0] = strdup ( "MIDI Mapper" ); for ( i = 1; i <= max; i ++ ) { MIDIINCAPS mic; if ( midiInGetDevCaps ( i - 1, &mic, sizeof ( MIDIINCAPS ) ) == 0 ) { MidiINDrivers[i] = strdup ( mic.szPname ); if ( MidiINDrivers[i] == NULL ) break; } else { MidiINDrivers[i] = NULL; break; } MidiINDrivers[max+1] = NULL; } return MidiINDrivers; } static BOOL APIENTRY PrefSyn1DialogProc(HWND hwnd, UINT uMess, WPARAM wParam, LPARAM lParam) { int i; static int initflag = 1; switch (uMess){ case WM_INITDIALOG: for ( i = 0; i <= MAX_PORT; i ++ ) { char buff[32]; sprintf ( buff, "%d", i ); SendDlgItemMessage(hwnd, IDC_COMBO_PORT_NUM, CB_INSERTSTRING, (WPARAM) -1, (LPARAM) buff ); } if ( MidiINDrivers != NULL ) { for ( i = 0; MidiINDrivers[i] != NULL; i ++ ) { SendDlgItemMessage(hwnd, IDC_COMBO_IDPORT0, CB_INSERTSTRING, (WPARAM) -1, (LPARAM) MidiINDrivers[i] ); SendDlgItemMessage(hwnd, IDC_COMBO_IDPORT1, CB_INSERTSTRING, (WPARAM) -1, (LPARAM) MidiINDrivers[i] ); SendDlgItemMessage(hwnd, IDC_COMBO_IDPORT2, CB_INSERTSTRING, (WPARAM) -1, (LPARAM) MidiINDrivers[i] ); SendDlgItemMessage(hwnd, IDC_COMBO_IDPORT3, CB_INSERTSTRING, (WPARAM) -1, (LPARAM) MidiINDrivers[i] ); } } DLG_FLAG_TO_CHECKBUTTON(hwnd, IDC_CHECK_SYN_AUTOSTART, st_temp->syn_AutoStart); if (PlayerLanguage == LANGUAGE_JAPANESE) { SendDlgItemMessage(hwnd, IDC_COMBO_PROCESS_PRIORITY, CB_INSERTSTRING, (WPARAM) -1, (LPARAM) "Ⴂ" ); SendDlgItemMessage(hwnd, IDC_COMBO_PROCESS_PRIORITY, CB_INSERTSTRING, (WPARAM) -1, (LPARAM) "Ⴂ" ); SendDlgItemMessage(hwnd, IDC_COMBO_PROCESS_PRIORITY, CB_INSERTSTRING, (WPARAM) -1, (LPARAM) "" ); SendDlgItemMessage(hwnd, IDC_COMBO_PROCESS_PRIORITY, CB_INSERTSTRING, (WPARAM) -1, (LPARAM) "" ); SendDlgItemMessage(hwnd, IDC_COMBO_PROCESS_PRIORITY, CB_INSERTSTRING, (WPARAM) -1, (LPARAM) "" ); SendDlgItemMessage(hwnd, IDC_COMBO_PROCESS_PRIORITY, CB_INSERTSTRING, (WPARAM) -1, (LPARAM) "A^C" ); SendDlgItemMessage(hwnd, IDC_COMBO_SYN_THREAD_PRIORITY, CB_INSERTSTRING, (WPARAM) -1, (LPARAM) "Ⴂ" ); SendDlgItemMessage(hwnd, IDC_COMBO_SYN_THREAD_PRIORITY, CB_INSERTSTRING, (WPARAM) -1, (LPARAM) "Ⴂ" ); SendDlgItemMessage(hwnd, IDC_COMBO_SYN_THREAD_PRIORITY, CB_INSERTSTRING, (WPARAM) -1, (LPARAM) "" ); SendDlgItemMessage(hwnd, IDC_COMBO_SYN_THREAD_PRIORITY, CB_INSERTSTRING, (WPARAM) -1, (LPARAM) "" ); SendDlgItemMessage(hwnd, IDC_COMBO_SYN_THREAD_PRIORITY, CB_INSERTSTRING, (WPARAM) -1, (LPARAM) "" ); SendDlgItemMessage(hwnd, IDC_COMBO_SYN_THREAD_PRIORITY, CB_INSERTSTRING, (WPARAM) -1, (LPARAM) "^CNeBJ" ); } else { SendDlgItemMessage(hwnd, IDC_COMBO_PROCESS_PRIORITY, CB_INSERTSTRING, (WPARAM) -1, (LPARAM) "Lowest" ); SendDlgItemMessage(hwnd, IDC_COMBO_PROCESS_PRIORITY, CB_INSERTSTRING, (WPARAM) -1, (LPARAM) "Below normal" ); SendDlgItemMessage(hwnd, IDC_COMBO_PROCESS_PRIORITY, CB_INSERTSTRING, (WPARAM) -1, (LPARAM) "Normal" ); SendDlgItemMessage(hwnd, IDC_COMBO_PROCESS_PRIORITY, CB_INSERTSTRING, (WPARAM) -1, (LPARAM) "Above nomal" ); SendDlgItemMessage(hwnd, IDC_COMBO_PROCESS_PRIORITY, CB_INSERTSTRING, (WPARAM) -1, (LPARAM) "Highest" ); SendDlgItemMessage(hwnd, IDC_COMBO_PROCESS_PRIORITY, CB_INSERTSTRING, (WPARAM) -1, (LPARAM) "Realtime" ); SendDlgItemMessage(hwnd, IDC_COMBO_SYN_THREAD_PRIORITY, CB_INSERTSTRING, (WPARAM) -1, (LPARAM) "Lowest" ); SendDlgItemMessage(hwnd, IDC_COMBO_SYN_THREAD_PRIORITY, CB_INSERTSTRING, (WPARAM) -1, (LPARAM) "Below normal" ); SendDlgItemMessage(hwnd, IDC_COMBO_SYN_THREAD_PRIORITY, CB_INSERTSTRING, (WPARAM) -1, (LPARAM) "Normal" ); SendDlgItemMessage(hwnd, IDC_COMBO_SYN_THREAD_PRIORITY, CB_INSERTSTRING, (WPARAM) -1, (LPARAM) "Above nomal" ); SendDlgItemMessage(hwnd, IDC_COMBO_SYN_THREAD_PRIORITY, CB_INSERTSTRING, (WPARAM) -1, (LPARAM) "Highest" ); SendDlgItemMessage(hwnd, IDC_COMBO_SYN_THREAD_PRIORITY, CB_INSERTSTRING, (WPARAM) -1, (LPARAM) "Time critical" ); } SendDlgItemMessage(hwnd, IDC_COMBO_PORT_NUM, CB_SETCURSEL, (WPARAM) st_temp->SynPortNum, (LPARAM) 0 ); SendDlgItemMessage(hwnd, IDC_COMBO_IDPORT0, CB_SETCURSEL, (WPARAM) st_temp->SynIDPort[0], (LPARAM) 0 ); SendDlgItemMessage(hwnd, IDC_COMBO_IDPORT1, CB_SETCURSEL, (WPARAM) st_temp->SynIDPort[1], (LPARAM) 0 ); SendDlgItemMessage(hwnd, IDC_COMBO_IDPORT2, CB_SETCURSEL, (WPARAM) st_temp->SynIDPort[2], (LPARAM) 0 ); SendDlgItemMessage(hwnd, IDC_COMBO_IDPORT3, CB_SETCURSEL, (WPARAM) st_temp->SynIDPort[3], (LPARAM) 0 ); { int index; // Select process priority if ( st_temp->processPriority == IDLE_PRIORITY_CLASS ) index = 0; else if ( st_temp->processPriority == BELOW_NORMAL_PRIORITY_CLASS ) index = 1; else if ( st_temp->processPriority == NORMAL_PRIORITY_CLASS ) index = 2; else if ( st_temp->processPriority == ABOVE_NORMAL_PRIORITY_CLASS ) index = 3; else if ( st_temp->processPriority == HIGH_PRIORITY_CLASS ) index = 4; else if ( st_temp->processPriority == REALTIME_PRIORITY_CLASS ) index = 5; SendDlgItemMessage(hwnd, IDC_COMBO_PROCESS_PRIORITY, CB_SETCURSEL, (WPARAM) index, (LPARAM) 0 ); // Select thread priority if ( st_temp->syn_ThreadPriority == THREAD_PRIORITY_LOWEST ) index = 0; else if ( st_temp->syn_ThreadPriority == THREAD_PRIORITY_BELOW_NORMAL ) index = 1; else if ( st_temp->syn_ThreadPriority == THREAD_PRIORITY_NORMAL ) index = 2; else if ( st_temp->syn_ThreadPriority == THREAD_PRIORITY_ABOVE_NORMAL ) index = 3; else if ( st_temp->syn_ThreadPriority == THREAD_PRIORITY_HIGHEST ) index = 4; else if ( st_temp->syn_ThreadPriority == THREAD_PRIORITY_TIME_CRITICAL ) index = 5; SendDlgItemMessage(hwnd, IDC_COMBO_SYN_THREAD_PRIORITY, CB_SETCURSEL, (WPARAM) index, (LPARAM) 0 ); } SetDlgItemInt(hwnd,IDC_EDIT_SYN_SH_TIME,st_temp->SynShTime,FALSE); initflag = 0; break; case WM_COMMAND: switch (LOWORD(wParam)) { case IDC_RADIOBUTTON_JAPANESE: case IDC_RADIOBUTTON_ENGLISH: break; default: break; } PrefWndSetOK = 1; break; case WM_MYSAVE: if ( initflag ) break; { int res; res = SendDlgItemMessage ( hwnd, IDC_COMBO_PORT_NUM, CB_GETCURSEL, 0, 0 ); if ( res != CB_ERR ) st_temp->SynPortNum = res; res = SendDlgItemMessage ( hwnd, IDC_COMBO_IDPORT0, CB_GETCURSEL, 0, 0 ); if ( res != CB_ERR ) st_temp->SynIDPort[0] = res; res = SendDlgItemMessage ( hwnd, IDC_COMBO_IDPORT1, CB_GETCURSEL, 0, 0 ); if ( res != CB_ERR ) st_temp->SynIDPort[1] = res; res = SendDlgItemMessage ( hwnd, IDC_COMBO_IDPORT2, CB_GETCURSEL, 0, 0 ); if ( res != CB_ERR ) st_temp->SynIDPort[2] = res; res = SendDlgItemMessage ( hwnd, IDC_COMBO_IDPORT3, CB_GETCURSEL, 0, 0 ); if ( res != CB_ERR ) st_temp->SynIDPort[3] = res; SetWindowLong(hwnd,DWL_MSGRESULT,FALSE); DLG_CHECKBUTTON_TO_FLAG(hwnd, IDC_CHECK_SYN_AUTOSTART, st_temp->syn_AutoStart); // Set process priority res = SendDlgItemMessage ( hwnd, IDC_COMBO_PROCESS_PRIORITY, CB_GETCURSEL, 0, 0 ); if ( res != CB_ERR ) { switch ( res ) { case 0: st_temp->processPriority = IDLE_PRIORITY_CLASS; break; case 1: st_temp->processPriority = BELOW_NORMAL_PRIORITY_CLASS; break; default: case 2: st_temp->processPriority = NORMAL_PRIORITY_CLASS; break; case 3: st_temp->processPriority = ABOVE_NORMAL_PRIORITY_CLASS; break; case 4: st_temp->processPriority = HIGH_PRIORITY_CLASS; break; case 5: st_temp->processPriority = REALTIME_PRIORITY_CLASS; break; } } // Set thread priority res = SendDlgItemMessage ( hwnd, IDC_COMBO_SYN_THREAD_PRIORITY, CB_GETCURSEL, 0, 0 ); if ( res != CB_ERR ) { switch ( res ) { case 0: st_temp->syn_ThreadPriority = THREAD_PRIORITY_LOWEST; break; case 1: st_temp->syn_ThreadPriority = THREAD_PRIORITY_BELOW_NORMAL; break; default: case 2: st_temp->syn_ThreadPriority = THREAD_PRIORITY_NORMAL; break; case 3: st_temp->syn_ThreadPriority = THREAD_PRIORITY_ABOVE_NORMAL; break; case 4: st_temp->syn_ThreadPriority = THREAD_PRIORITY_HIGHEST; break; case 5: st_temp->syn_ThreadPriority = THREAD_PRIORITY_TIME_CRITICAL; break; } } st_temp->SynShTime = GetDlgItemInt(hwnd,IDC_EDIT_SYN_SH_TIME,NULL,FALSE); if ( st_temp->SynShTime < 0 ) st_temp->SynShTime = 0; } break; case WM_SIZE: return FALSE; case WM_CLOSE: break; default: break; } return FALSE; } #endif void ShowPrefWnd ( void ) { if ( IsWindow ( (HWND)hPrefWnd ) ) ShowWindow ( (HWND)hPrefWnd, SW_SHOW ); } void HidePrefWnd ( void ) { if ( IsWindow ( (HWND)hPrefWnd ) ) ShowWindow ( (HWND)hPrefWnd, SW_HIDE ); } BOOL IsVisiblePrefWnd ( void ) { return IsWindowVisible ( (HWND)hPrefWnd ); } static int DlgOpenConfigFile(char *Filename, HWND hwnd) { OPENFILENAME ofn; char filename[MAXPATH + 256]; char dir[MAXPATH + 256]; int res; strncpy(dir,ConfigFileOpenDir,MAXPATH); dir[MAXPATH-1] = '\0'; strncpy(filename,Filename,MAXPATH); filename[MAXPATH-1] = '\0'; memset(&ofn, 0, sizeof(OPENFILENAME)); ofn.lStructSize = sizeof(OPENFILENAME); ofn.hwndOwner = hwnd; ofn.hInstance = hInst ; ofn.lpstrFilter = "config file\0*.cfg;*.config\0" "all files\0*.*\0" "\0\0"; ofn.lpstrCustomFilter = NULL; ofn.nMaxCustFilter = 0; ofn.nFilterIndex = 1 ; ofn.lpstrFile = filename; ofn.nMaxFile = 256; ofn.lpstrFileTitle = NULL; ofn.nMaxFileTitle = 0; if(dir[0] != '\0') ofn.lpstrInitialDir = dir; else ofn.lpstrInitialDir = 0; ofn.lpstrTitle = "Open Config File"; ofn.Flags = OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST | OFN_EXPLORER | OFN_READONLY | OFN_HIDEREADONLY; ofn.lpstrDefExt = 0; ofn.lCustData = 0; ofn.lpfnHook = 0; ofn.lpTemplateName= 0; res = GetOpenFileName(&ofn); strncpy(ConfigFileOpenDir,dir,MAXPATH); ConfigFileOpenDir[MAXPATH-1] = '\0'; if(res==TRUE){ strncpy(Filename,filename,MAXPATH); Filename[MAXPATH-1] = '\0'; return 0; } else { Filename[0] = '\0'; return -1; } } static int DlgOpenOutputFile(char *Filename, HWND hwnd) { OPENFILENAME ofn; char filename[MAXPATH + 256]; char dir[MAXPATH + 256]; int res; static char OutputFileOpenDir[MAXPATH+256]; static int initflag = 1; if(initflag){ OutputFileOpenDir[0] = '\0'; initflag = 0; } strncpy(dir,OutputFileOpenDir,MAXPATH); dir[MAXPATH-1] = '\0'; strncpy(filename,Filename,MAXPATH); filename[MAXPATH-1] = '\0'; memset(&ofn, 0, sizeof(OPENFILENAME)); ofn.lStructSize = sizeof(OPENFILENAME); ofn.hwndOwner = hwnd; ofn.hInstance = hInst ; ofn.lpstrFilter = "wave file\0*.wav;*.wave;*.aif;*.aiff;*.aifc;*.au;*.snd;*.audio\0" "all files\0*.*\0" "\0\0"; ofn.lpstrCustomFilter = NULL; ofn.nMaxCustFilter = 0; ofn.nFilterIndex = 1 ; ofn.lpstrFile = filename; ofn.nMaxFile = 256; ofn.lpstrFileTitle = NULL; ofn.nMaxFileTitle = 0; if(dir[0] != '\0') ofn.lpstrInitialDir = dir; else ofn.lpstrInitialDir = 0; ofn.lpstrTitle = "Output File"; ofn.Flags = OFN_EXPLORER | OFN_HIDEREADONLY; ofn.lpstrDefExt = 0; ofn.lCustData = 0; ofn.lpfnHook = 0; ofn.lpTemplateName= 0; res = GetSaveFileName(&ofn); strncpy(OutputFileOpenDir,dir,MAXPATH); OutputFileOpenDir[MAXPATH-1] = '\0'; if(res==TRUE){ strncpy(Filename,filename,MAXPATH); Filename[MAXPATH-1] = '\0'; return 0; } else { Filename[0] = '\0'; return -1; } } volatile int w32g_interactive_id3_tag_set = 0; int w32g_gogo_id3_tag_dialog(void) { return 0; } #ifdef AU_GOGO /////////////////////////////////////////////////////////////////////// // // gogo ConfigDialog // /////////////////////////////////////////////////////////////////////// // id ̃R{{bNX̏̒` #define CB_INFO_TYPE1_BEGIN(id) static int cb_info_ ## id [] = { #define CB_INFO_TYPE1_END }; #define CB_INFO_TYPE2_BEGIN(id) static char * cb_info_ ## id [] = { #define CB_INFO_TYPE2_END }; // cb_info_type1_hc cb_info_type2_hc ƂӂɂȂB // IDC_COMBO_OUTPUT_FORMAT CB_INFO_TYPE2_BEGIN(IDC_COMBO_OUTPUT_FORMAT) "MP3+TAG",(char *)MC_OUTPUT_NORMAL, "RIFF/WAVE",(char *)MC_OUTPUT_RIFF_WAVE, "RIFF/RMP",(char *)MC_OUTPUT_RIFF_RMP, NULL CB_INFO_TYPE2_END // IDC_COMBO_MPEG1_AUDIO_BITRATE CB_INFO_TYPE1_BEGIN(IDC_COMBO_MPEG1_AUDIO_BITRATE) 32,40,48,56,64,80,96,112,128,160,192,224,256,320,-1 CB_INFO_TYPE1_END // IDC_COMBO_MPEG2_AUDIO_BITRATE CB_INFO_TYPE1_BEGIN(IDC_COMBO_MPEG2_AUDIO_BITRATE) 8,16,24,32,40,48,56,64,80,96,112,128,144,160,-1 CB_INFO_TYPE1_END // IDC_COMBO_ENCODE_MODE CB_INFO_TYPE2_BEGIN(IDC_COMBO_ENCODE_MODE) "monoral",(char *)MC_MODE_MONO, "stereo",(char *)MC_MODE_STEREO, "joint stereo",(char *)MC_MODE_JOINT, "mid/side stereo",(char *)MC_MODE_MSSTEREO, "dual channel",(char *)MC_MODE_DUALCHANNEL, NULL CB_INFO_TYPE2_END // IDC_COMBO_EMPHASIS_TYPE CB_INFO_TYPE2_BEGIN(IDC_COMBO_EMPHASIS_TYPE) "NONE",(char *)MC_EMP_NONE, "50/15ms (normal CD-DA emphasis)",(char *)MC_EMP_5015MS, "CCITT",(char *)MC_EMP_CCITT, NULL CB_INFO_TYPE2_END // IDC_COMBO_VBR_BITRATE_LOW CB_INFO_TYPE1_BEGIN(IDC_COMBO_VBR_BITRATE_LOW) 32,40,48,56,64,80,96,112,128,160,192,224,256,320,-1 CB_INFO_TYPE1_END // IDC_COMBO_VBR_BITRATE_HIGH CB_INFO_TYPE1_BEGIN(IDC_COMBO_VBR_BITRATE_HIGH) 32,40,48,56,64,80,96,112,128,160,192,224,256,320,-1 CB_INFO_TYPE1_END // IDC_COMBO_VBR CB_INFO_TYPE2_BEGIN(IDC_COMBO_VBR) "Quality 0 (320 - 32 kbps)",(char *)0, "Quality 1 (256 - 32 kbps)",(char *)1, "Quality 2 (256 - 32 kbps)",(char *)2, "Quality 3 (256 - 32 kbps)",(char *)3, "Quality 4 (256 - 32 kbps)",(char *)4, "Quality 5 (224 - 32 kbps)",(char *)5, "Quality 6 (192 - 32 kbps)",(char *)6, "Quality 7 (160 - 32 kbps)",(char *)7, "Quality 8 (128 - 32 kbps)",(char *)8, "Quality 9 (128 - 32 kbps)",(char *)9, NULL CB_INFO_TYPE2_END // id ̃R{{bNXI̐ݒ肷B #define CB_SETCURSEL_TYPE1(id) \ { \ int cb_num; \ for(cb_num=0;(int)cb_info_ ## id [cb_num]>=0;cb_num++){ \ SendDlgItemMessage(hwnd,id,CB_SETCURSEL,(WPARAM)0,(LPARAM)0); \ if(gogo_ConfigDialogInfo.opt ## id == (int) cb_info_ ## id [cb_num]){ \ SendDlgItemMessage(hwnd,id,CB_SETCURSEL,(WPARAM)cb_num,(LPARAM)0); \ break; \ } \ } \ } #define CB_SETCURSEL_TYPE2(id) \ { \ int cb_num; \ for(cb_num=0;(int)cb_info_ ## id [cb_num];cb_num+=2){ \ SendDlgItemMessage(hwnd,id,CB_SETCURSEL,(WPARAM)0,(LPARAM)0); \ if(gogo_ConfigDialogInfo.opt ## id == (int) cb_info_ ## id [cb_num+1]){ \ SendDlgItemMessage(hwnd,id,CB_SETCURSEL,(WPARAM)cb_num/2,(LPARAM)0); \ break; \ } \ } \ } // id ̃R{{bNX̑IϐɑB #define CB_GETCURSEL_TYPE1(id) \ { \ int cb_num1, cb_num2; \ cb_num1 = SendDlgItemMessage(hwnd,id,CB_GETCURSEL,(WPARAM)0,(LPARAM)0); \ for(cb_num2=0;(int)cb_info_ ## id [cb_num2]>=0;cb_num2++) \ if(cb_num1==cb_num2){ \ gogo_ConfigDialogInfo.opt ## id = (int)cb_info_ ## id [cb_num2]; \ break; \ } \ } #define CB_GETCURSEL_TYPE2(id) \ { \ int cb_num1, cb_num2; \ cb_num1 = SendDlgItemMessage(hwnd,id,CB_GETCURSEL,(WPARAM)0,(LPARAM)0); \ for(cb_num2=0;(int)cb_info_ ## id [cb_num2];cb_num2+=2) \ if(cb_num1*2==cb_num2){ \ gogo_ConfigDialogInfo.opt ## id = (int)cb_info_ ## id [cb_num2+1]; \ break; \ } \ } // `FbNĂ邩B #define IS_CHECK(id) SendDlgItemMessage(hwnd,id,BM_GETCHECK,0,0) // `FbNB #define CHECK(id) SendDlgItemMessage(hwnd,id,BM_SETCHECK,1,0) // `FbN͂B #define UNCHECK(id) SendDlgItemMessage(hwnd,id,BM_SETCHECK,0,0) // id ̃`FbN{bNXݒ肷B #define CHECKBOX_SET(id) \ if(gogo_ConfigDialogInfo.opt ## id>0) \ SendDlgItemMessage(hwnd,id,BM_SETCHECK,1,0); \ else \ SendDlgItemMessage(hwnd,id,BM_SETCHECK,0,0); \ // id ̃`FbN{bNXϐɑB #define CHECKBOX_GET(id) \ if(SendDlgItemMessage(hwnd,id,BM_GETCHECK,0,0)) \ gogo_ConfigDialogInfo.opt ## id = 1; \ else \ gogo_ConfigDialogInfo.opt ## id = 0; \ // id ̃GfBbgݒ肷B #define EDIT_SET(id) SendDlgItemMessage(hwnd,id,WM_SETTEXT,0,(LPARAM)gogo_ConfigDialogInfo.opt ## id); // id ̃GfBbgϐɑB #define EDIT_GET(id,size) SendDlgItemMessage(hwnd,id,WM_GETTEXT,(WPARAM)size,(LPARAM)gogo_ConfigDialogInfo.opt ## id); #define EDIT_GET_RANGE(id,size,min,max) \ { \ char tmpbuf[1024]; \ int value; \ SendDlgItemMessage(hwnd,id,WM_GETTEXT,(WPARAM)size,(LPARAM)gogo_ConfigDialogInfo.opt ## id); \ value = atoi((char *)gogo_ConfigDialogInfo.opt ## id); \ if(valuemax) value = max; \ sprintf(tmpbuf,"%d",value); \ strncpy((char *)gogo_ConfigDialogInfo.opt ## id,tmpbuf,size); \ (gogo_ConfigDialogInfo.opt ## id)[size] = '\0'; \ } // Rg[̗L #define ENABLE_CONTROL(id) EnableWindow(GetDlgItem(hwnd,id),TRUE); // Rg[̖ #define DISABLE_CONTROL(id) EnableWindow(GetDlgItem(hwnd,id),FALSE); static void gogoConfigDialogProcControlEnableDisable(HWND hwnd); static void gogoConfigDialogProcControlApply(HWND hwnd); static void gogoConfigDialogProcControlReset(HWND hwnd); static int gogo_ConfigDialogInfoLock(); static int gogo_ConfigDialogInfoUnLock(); static HANDLE hgogoConfigDailog = NULL; static BOOL APIENTRY gogoConfigDialogProc(HWND hwnd, UINT uMess, WPARAM wParam, LPARAM lParam) { char buff[1024]; switch (uMess){ case WM_INITDIALOG: { int i; // R{{bNX̏ for(i=0;cb_info_IDC_COMBO_OUTPUT_FORMAT[i];i+=2){ SendDlgItemMessage(hwnd,IDC_COMBO_OUTPUT_FORMAT,CB_INSERTSTRING,(WPARAM)-1,(LPARAM)cb_info_IDC_COMBO_OUTPUT_FORMAT[i]); } for(i=0;cb_info_IDC_COMBO_MPEG1_AUDIO_BITRATE[i]>=0;i++){ sprintf(buff,"%d kbit/sec",cb_info_IDC_COMBO_MPEG1_AUDIO_BITRATE[i]); SendDlgItemMessage(hwnd,IDC_COMBO_MPEG1_AUDIO_BITRATE,CB_INSERTSTRING,(WPARAM)-1,(LPARAM)buff); } for(i=0;cb_info_IDC_COMBO_MPEG2_AUDIO_BITRATE[i]>=0;i++){ sprintf(buff,"%d kbit/sec",cb_info_IDC_COMBO_MPEG2_AUDIO_BITRATE[i]); SendDlgItemMessage(hwnd,IDC_COMBO_MPEG2_AUDIO_BITRATE,CB_INSERTSTRING,(WPARAM)-1,(LPARAM)buff); } for(i=0;cb_info_IDC_COMBO_ENCODE_MODE[i];i+=2){ SendDlgItemMessage(hwnd,IDC_COMBO_ENCODE_MODE,CB_INSERTSTRING,(WPARAM)-1,(LPARAM)cb_info_IDC_COMBO_ENCODE_MODE[i]); } for(i=0;cb_info_IDC_COMBO_EMPHASIS_TYPE[i];i+=2){ SendDlgItemMessage(hwnd,IDC_COMBO_EMPHASIS_TYPE,CB_INSERTSTRING,(WPARAM)-1,(LPARAM)cb_info_IDC_COMBO_EMPHASIS_TYPE[i]); } for(i=0;cb_info_IDC_COMBO_VBR_BITRATE_LOW[i]>=0;i++){ sprintf(buff,"%d kbit/sec",cb_info_IDC_COMBO_VBR_BITRATE_LOW[i]); SendDlgItemMessage(hwnd,IDC_COMBO_VBR_BITRATE_LOW,CB_INSERTSTRING,(WPARAM)-1,(LPARAM)buff); } for(i=0;cb_info_IDC_COMBO_VBR_BITRATE_HIGH[i]>=0;i++){ sprintf(buff,"%d kbit/sec",cb_info_IDC_COMBO_VBR_BITRATE_HIGH[i]); SendDlgItemMessage(hwnd,IDC_COMBO_VBR_BITRATE_HIGH,CB_INSERTSTRING,(WPARAM)-1,(LPARAM)buff); } for(i=0;cb_info_IDC_COMBO_VBR[i];i+=2){ SendDlgItemMessage(hwnd,IDC_COMBO_VBR,CB_INSERTSTRING,(WPARAM)-1,(LPARAM)cb_info_IDC_COMBO_VBR[i]); } // ݒ gogoConfigDialogProcControlReset(hwnd); } break; case WM_COMMAND: switch (LOWORD(wParam)) { case IDCLOSE: SendMessage(hwnd,WM_CLOSE,(WPARAM)0,(LPARAM)0); break; case IDOK: gogoConfigDialogProcControlApply(hwnd); SendMessage(hwnd,WM_CLOSE,(WPARAM)0,(LPARAM)0); break; case IDCANCEL: SendMessage(hwnd,WM_CLOSE,(WPARAM)0,(LPARAM)0); break; case IDC_BUTTON_APPLY: gogoConfigDialogProcControlApply(hwnd); break; case IDC_CHECK_DEFAULT: gogoConfigDialogProcControlEnableDisable(hwnd); break; case IDC_CHECK_COMMANDLINE_OPTS: gogoConfigDialogProcControlEnableDisable(hwnd); break; case IDC_EDIT_COMMANDLINE_OPTION: break; case IDC_CHECK_OUTPUT_FORMAT: gogoConfigDialogProcControlEnableDisable(hwnd); break; case IDC_COMBO_OUTPUT_FORMAT: break; case IDC_CHECK_MPEG1AUDIOBITRATE: if(IS_CHECK(IDC_CHECK_MPEG1AUDIOBITRATE)){ CHECK(IDC_CHECK_MPEG2AUDIOBITRATE); UNCHECK(IDC_CHECK_VBR); UNCHECK(IDC_CHECK_VBR_BITRATE); } else { UNCHECK(IDC_CHECK_MPEG2AUDIOBITRATE); } gogoConfigDialogProcControlEnableDisable(hwnd); break; case IDC_COMBO_MPEG1_AUDIO_BITRATE: break; case IDC_CHECK_MPEG2AUDIOBITRATE: if(IS_CHECK(IDC_CHECK_MPEG2AUDIOBITRATE)){ CHECK(IDC_CHECK_MPEG1AUDIOBITRATE); UNCHECK(IDC_CHECK_VBR); UNCHECK(IDC_CHECK_VBR_BITRATE); } else { UNCHECK(IDC_CHECK_MPEG1AUDIOBITRATE); } gogoConfigDialogProcControlEnableDisable(hwnd); break; case IDC_COMBO_MPEG2_AUDIO_BITRATE: break; case IDC_CHECK_ENHANCED_LOW_PASS_FILTER: if(IS_CHECK(IDC_CHECK_ENHANCED_LOW_PASS_FILTER)){ UNCHECK(IDC_CHECK_16KHZ_LOW_PASS_FILTER); } gogoConfigDialogProcControlEnableDisable(hwnd); break; case IDC_EDIT_LPF_PARA1: break; case IDC_EDIT_LPF_PARA2: break; case IDC_CHECK_ENCODE_MODE: gogoConfigDialogProcControlEnableDisable(hwnd); break; case IDC_COMBO_ENCODE_MODE: break; case IDC_CHECK_EMPHASIS_TYPE: gogoConfigDialogProcControlEnableDisable(hwnd); break; case IDC_COMBO_EMPHASIS_TYPE: break; case IDC_CHECK_OUTFREQ: gogoConfigDialogProcControlEnableDisable(hwnd); break; case IDC_EDIT_OUTFREQ: break; case IDC_CHECK_MSTHRESHOLD: gogoConfigDialogProcControlEnableDisable(hwnd); break; case IDC_EDIT_MSTHRESHOLD_THRESHOLD: break; case IDC_EDIT_MSTHRESHOLD_MSPOWER: break; case IDC_CHECK_USE_CPU_OPTS: gogoConfigDialogProcControlEnableDisable(hwnd); break; case IDC_CHECK_CPUMMX: break; case IDC_CHECK_CPUSSE: break; case IDC_CHECK_CPU3DNOW: break; case IDC_CHECK_CPUE3DNOW: break; case IDC_CHECK_CPUCMOV: break; case IDC_CHECK_CPUEMMX: break; case IDC_CHECK_CPUSSE2: break; case IDC_CHECK_VBR: if(IS_CHECK(IDC_CHECK_VBR)){ UNCHECK(IDC_COMBO_MPEG1_AUDIO_BITRATE); UNCHECK(IDC_COMBO_MPEG2_AUDIO_BITRATE); } gogoConfigDialogProcControlEnableDisable(hwnd); break; case IDC_COMBO_VBR: break; case IDC_CHECK_VBR_BITRATE: if(IS_CHECK(IDC_CHECK_VBR_BITRATE)){ CHECK(IDC_CHECK_VBR); UNCHECK(IDC_COMBO_MPEG1_AUDIO_BITRATE); UNCHECK(IDC_COMBO_MPEG2_AUDIO_BITRATE); } gogoConfigDialogProcControlEnableDisable(hwnd); break; case IDC_COMBO_VBR_BITRATE_LOW: break; case IDC_COMBO_VBR_BITRATE_HIGH: break; case IDC_CHECK_USEPSY: break; case IDC_CHECK_VERIFY: break; case IDC_CHECK_16KHZ_LOW_PASS_FILTER: if(IS_CHECK(IDC_CHECK_16KHZ_LOW_PASS_FILTER)){ UNCHECK(IDC_CHECK_ENHANCED_LOW_PASS_FILTER); } gogoConfigDialogProcControlEnableDisable(hwnd); break; default: break; } break; case WM_NOTIFY: break; case WM_SIZE: return FALSE; case WM_CLOSE: gogo_ConfigDialogInfoSaveINI(); //MessageBox(NULL,"CLOSE","CLOSE",MB_OK); DestroyWindow(hwnd); break; case WM_DESTROY: hgogoConfigDailog = NULL; //MessageBox(NULL,"DESTROY","DESTROY",MB_OK); break; default: break; } return FALSE; } // Rg[̗L / static void gogoConfigDialogProcControlEnableDisable(HWND hwnd) { ENABLE_CONTROL(IDC_CHECK_DEFAULT); if(IS_CHECK(IDC_CHECK_DEFAULT)){ DISABLE_CONTROL(IDC_CHECK_COMMANDLINE_OPTS); DISABLE_CONTROL(IDC_EDIT_COMMANDLINE_OPTION); DISABLE_CONTROL(IDC_CHECK_OUTPUT_FORMAT); DISABLE_CONTROL(IDC_COMBO_OUTPUT_FORMAT); DISABLE_CONTROL(IDC_CHECK_MPEG1AUDIOBITRATE); DISABLE_CONTROL(IDC_COMBO_MPEG1_AUDIO_BITRATE); DISABLE_CONTROL(IDC_CHECK_MPEG2AUDIOBITRATE); DISABLE_CONTROL(IDC_COMBO_MPEG2_AUDIO_BITRATE); DISABLE_CONTROL(IDC_CHECK_ENHANCED_LOW_PASS_FILTER); DISABLE_CONTROL(IDC_EDIT_LPF_PARA1); DISABLE_CONTROL(IDC_EDIT_LPF_PARA2); DISABLE_CONTROL(IDC_CHECK_ENCODE_MODE); DISABLE_CONTROL(IDC_COMBO_ENCODE_MODE); DISABLE_CONTROL(IDC_CHECK_EMPHASIS_TYPE); DISABLE_CONTROL(IDC_COMBO_EMPHASIS_TYPE); DISABLE_CONTROL(IDC_CHECK_OUTFREQ); DISABLE_CONTROL(IDC_EDIT_OUTFREQ); DISABLE_CONTROL(IDC_CHECK_MSTHRESHOLD); DISABLE_CONTROL(IDC_EDIT_MSTHRESHOLD_THRESHOLD); DISABLE_CONTROL(IDC_EDIT_MSTHRESHOLD_MSPOWER); DISABLE_CONTROL(IDC_CHECK_USE_CPU_OPTS); DISABLE_CONTROL(IDC_CHECK_CPUMMX); DISABLE_CONTROL(IDC_CHECK_CPUSSE); DISABLE_CONTROL(IDC_CHECK_CPU3DNOW); DISABLE_CONTROL(IDC_CHECK_CPUE3DNOW); DISABLE_CONTROL(IDC_CHECK_CPUCMOV); DISABLE_CONTROL(IDC_CHECK_CPUEMMX); DISABLE_CONTROL(IDC_CHECK_CPUSSE2); DISABLE_CONTROL(IDC_CHECK_VBR); DISABLE_CONTROL(IDC_COMBO_VBR); DISABLE_CONTROL(IDC_CHECK_VBR_BITRATE); DISABLE_CONTROL(IDC_COMBO_VBR_BITRATE_LOW); DISABLE_CONTROL(IDC_COMBO_VBR_BITRATE_HIGH); DISABLE_CONTROL(IDC_CHECK_USEPSY); DISABLE_CONTROL(IDC_CHECK_VERIFY); DISABLE_CONTROL(IDC_CHECK_16KHZ_LOW_PASS_FILTER); } else { ENABLE_CONTROL(IDC_CHECK_COMMANDLINE_OPTS); if(IS_CHECK(IDC_CHECK_COMMANDLINE_OPTS)){ ENABLE_CONTROL(IDC_EDIT_COMMANDLINE_OPTION); DISABLE_CONTROL(IDC_CHECK_OUTPUT_FORMAT); DISABLE_CONTROL(IDC_COMBO_OUTPUT_FORMAT); DISABLE_CONTROL(IDC_CHECK_MPEG1AUDIOBITRATE); DISABLE_CONTROL(IDC_COMBO_MPEG1_AUDIO_BITRATE); DISABLE_CONTROL(IDC_CHECK_MPEG2AUDIOBITRATE); DISABLE_CONTROL(IDC_COMBO_MPEG2_AUDIO_BITRATE); DISABLE_CONTROL(IDC_CHECK_ENHANCED_LOW_PASS_FILTER); DISABLE_CONTROL(IDC_EDIT_LPF_PARA1); DISABLE_CONTROL(IDC_EDIT_LPF_PARA2); DISABLE_CONTROL(IDC_CHECK_ENCODE_MODE); DISABLE_CONTROL(IDC_COMBO_ENCODE_MODE); DISABLE_CONTROL(IDC_CHECK_EMPHASIS_TYPE); DISABLE_CONTROL(IDC_COMBO_EMPHASIS_TYPE); DISABLE_CONTROL(IDC_CHECK_OUTFREQ); DISABLE_CONTROL(IDC_EDIT_OUTFREQ); DISABLE_CONTROL(IDC_CHECK_MSTHRESHOLD); DISABLE_CONTROL(IDC_EDIT_MSTHRESHOLD_THRESHOLD); DISABLE_CONTROL(IDC_EDIT_MSTHRESHOLD_MSPOWER); DISABLE_CONTROL(IDC_CHECK_USE_CPU_OPTS); DISABLE_CONTROL(IDC_CHECK_CPUMMX); DISABLE_CONTROL(IDC_CHECK_CPUSSE); DISABLE_CONTROL(IDC_CHECK_CPU3DNOW); DISABLE_CONTROL(IDC_CHECK_CPUE3DNOW); DISABLE_CONTROL(IDC_CHECK_CPUCMOV); DISABLE_CONTROL(IDC_CHECK_CPUEMMX); DISABLE_CONTROL(IDC_CHECK_CPUSSE2); DISABLE_CONTROL(IDC_CHECK_VBR); DISABLE_CONTROL(IDC_COMBO_VBR); DISABLE_CONTROL(IDC_CHECK_VBR_BITRATE); DISABLE_CONTROL(IDC_COMBO_VBR_BITRATE_LOW); DISABLE_CONTROL(IDC_COMBO_VBR_BITRATE_HIGH); DISABLE_CONTROL(IDC_CHECK_USEPSY); DISABLE_CONTROL(IDC_CHECK_VERIFY); DISABLE_CONTROL(IDC_CHECK_16KHZ_LOW_PASS_FILTER); } else { DISABLE_CONTROL(IDC_EDIT_COMMANDLINE_OPTION); ENABLE_CONTROL(IDC_CHECK_OUTPUT_FORMAT); if(IS_CHECK(IDC_CHECK_OUTPUT_FORMAT)){ ENABLE_CONTROL(IDC_COMBO_OUTPUT_FORMAT); } else { DISABLE_CONTROL(IDC_COMBO_OUTPUT_FORMAT); } ENABLE_CONTROL(IDC_CHECK_16KHZ_LOW_PASS_FILTER); ENABLE_CONTROL(IDC_CHECK_ENHANCED_LOW_PASS_FILTER); if(IS_CHECK(IDC_CHECK_16KHZ_LOW_PASS_FILTER)){ UNCHECK(IDC_CHECK_ENHANCED_LOW_PASS_FILTER); DISABLE_CONTROL(IDC_EDIT_LPF_PARA1); DISABLE_CONTROL(IDC_EDIT_LPF_PARA2); } else { if(IS_CHECK(IDC_CHECK_ENHANCED_LOW_PASS_FILTER)){ UNCHECK(IDC_CHECK_16KHZ_LOW_PASS_FILTER); ENABLE_CONTROL(IDC_EDIT_LPF_PARA1); ENABLE_CONTROL(IDC_EDIT_LPF_PARA2); } else { DISABLE_CONTROL(IDC_EDIT_LPF_PARA1); DISABLE_CONTROL(IDC_EDIT_LPF_PARA2); } } ENABLE_CONTROL(IDC_CHECK_ENCODE_MODE); if(IS_CHECK(IDC_CHECK_ENCODE_MODE)){ ENABLE_CONTROL(IDC_COMBO_ENCODE_MODE); } else { DISABLE_CONTROL(IDC_COMBO_ENCODE_MODE); } ENABLE_CONTROL(IDC_CHECK_EMPHASIS_TYPE); if(IS_CHECK(IDC_CHECK_EMPHASIS_TYPE)){ ENABLE_CONTROL(IDC_COMBO_EMPHASIS_TYPE); } else { DISABLE_CONTROL(IDC_COMBO_EMPHASIS_TYPE); } ENABLE_CONTROL(IDC_CHECK_OUTFREQ); if(IS_CHECK(IDC_CHECK_OUTFREQ)){ ENABLE_CONTROL(IDC_EDIT_OUTFREQ); } else { DISABLE_CONTROL(IDC_EDIT_OUTFREQ); } ENABLE_CONTROL(IDC_CHECK_MSTHRESHOLD); if(IS_CHECK(IDC_CHECK_MSTHRESHOLD)){ ENABLE_CONTROL(IDC_EDIT_MSTHRESHOLD_THRESHOLD); ENABLE_CONTROL(IDC_EDIT_MSTHRESHOLD_MSPOWER); } else { DISABLE_CONTROL(IDC_EDIT_MSTHRESHOLD_THRESHOLD); DISABLE_CONTROL(IDC_EDIT_MSTHRESHOLD_MSPOWER); } ENABLE_CONTROL(IDC_CHECK_USE_CPU_OPTS); if(IS_CHECK(IDC_CHECK_USE_CPU_OPTS)){ ENABLE_CONTROL(IDC_CHECK_CPUMMX); ENABLE_CONTROL(IDC_CHECK_CPUSSE); ENABLE_CONTROL(IDC_CHECK_CPU3DNOW); ENABLE_CONTROL(IDC_CHECK_CPUE3DNOW); ENABLE_CONTROL(IDC_CHECK_CPUCMOV); ENABLE_CONTROL(IDC_CHECK_CPUEMMX); ENABLE_CONTROL(IDC_CHECK_CPUSSE2); } else { DISABLE_CONTROL(IDC_CHECK_CPUMMX); DISABLE_CONTROL(IDC_CHECK_CPUSSE); DISABLE_CONTROL(IDC_CHECK_CPU3DNOW); DISABLE_CONTROL(IDC_CHECK_CPUE3DNOW); DISABLE_CONTROL(IDC_CHECK_CPUCMOV); DISABLE_CONTROL(IDC_CHECK_CPUEMMX); DISABLE_CONTROL(IDC_CHECK_CPUSSE2); } ENABLE_CONTROL(IDC_CHECK_VBR); ENABLE_CONTROL(IDC_CHECK_MPEG1AUDIOBITRATE); ENABLE_CONTROL(IDC_CHECK_MPEG2AUDIOBITRATE); if(IS_CHECK(IDC_CHECK_VBR)){ ENABLE_CONTROL(IDC_COMBO_VBR); ENABLE_CONTROL(IDC_CHECK_VBR_BITRATE); if(IS_CHECK(IDC_CHECK_VBR_BITRATE)){ ENABLE_CONTROL(IDC_COMBO_VBR_BITRATE_LOW); ENABLE_CONTROL(IDC_COMBO_VBR_BITRATE_HIGH); } else { DISABLE_CONTROL(IDC_COMBO_VBR_BITRATE_LOW); DISABLE_CONTROL(IDC_COMBO_VBR_BITRATE_HIGH); } UNCHECK(IDC_CHECK_MPEG1AUDIOBITRATE); UNCHECK(IDC_CHECK_MPEG2AUDIOBITRATE); DISABLE_CONTROL(IDC_COMBO_MPEG1_AUDIO_BITRATE); DISABLE_CONTROL(IDC_COMBO_MPEG2_AUDIO_BITRATE); } else { UNCHECK(IDC_CHECK_VBR_BITRATE); DISABLE_CONTROL(IDC_COMBO_VBR); DISABLE_CONTROL(IDC_CHECK_VBR_BITRATE); DISABLE_CONTROL(IDC_COMBO_VBR_BITRATE_LOW); DISABLE_CONTROL(IDC_COMBO_VBR_BITRATE_HIGH); if(IS_CHECK(IDC_CHECK_MPEG1AUDIOBITRATE)){ ENABLE_CONTROL(IDC_COMBO_MPEG1_AUDIO_BITRATE); } else { DISABLE_CONTROL(IDC_COMBO_MPEG1_AUDIO_BITRATE); } if(IS_CHECK(IDC_CHECK_MPEG2AUDIOBITRATE)){ ENABLE_CONTROL(IDC_COMBO_MPEG2_AUDIO_BITRATE); } else { DISABLE_CONTROL(IDC_COMBO_MPEG2_AUDIO_BITRATE); } } ENABLE_CONTROL(IDC_CHECK_USEPSY); ENABLE_CONTROL(IDC_CHECK_VERIFY); } } } static void gogoConfigDialogProcControlReset(HWND hwnd) { // R{{bNX̑Iݒ CB_SETCURSEL_TYPE2(IDC_COMBO_OUTPUT_FORMAT) CB_SETCURSEL_TYPE1(IDC_COMBO_MPEG1_AUDIO_BITRATE) CB_SETCURSEL_TYPE1(IDC_COMBO_MPEG2_AUDIO_BITRATE) CB_SETCURSEL_TYPE2(IDC_COMBO_ENCODE_MODE) CB_SETCURSEL_TYPE2(IDC_COMBO_EMPHASIS_TYPE) CB_SETCURSEL_TYPE1(IDC_COMBO_VBR_BITRATE_LOW) CB_SETCURSEL_TYPE1(IDC_COMBO_VBR_BITRATE_HIGH) CB_SETCURSEL_TYPE2(IDC_COMBO_VBR) // `FbN{bNX̐ݒ CHECKBOX_SET(IDC_CHECK_DEFAULT) CHECKBOX_SET(IDC_CHECK_COMMANDLINE_OPTS) CHECKBOX_SET(IDC_CHECK_OUTPUT_FORMAT) CHECKBOX_SET(IDC_CHECK_MPEG1AUDIOBITRATE) CHECKBOX_SET(IDC_CHECK_MPEG2AUDIOBITRATE) CHECKBOX_SET(IDC_CHECK_ENHANCED_LOW_PASS_FILTER) CHECKBOX_SET(IDC_CHECK_ENCODE_MODE) CHECKBOX_SET(IDC_CHECK_EMPHASIS_TYPE) CHECKBOX_SET(IDC_CHECK_OUTFREQ) CHECKBOX_SET(IDC_CHECK_MSTHRESHOLD) CHECKBOX_SET(IDC_CHECK_USE_CPU_OPTS) CHECKBOX_SET(IDC_CHECK_CPUMMX) CHECKBOX_SET(IDC_CHECK_CPUSSE) CHECKBOX_SET(IDC_CHECK_CPU3DNOW) CHECKBOX_SET(IDC_CHECK_CPUE3DNOW) CHECKBOX_SET(IDC_CHECK_CPUCMOV) CHECKBOX_SET(IDC_CHECK_CPUEMMX) CHECKBOX_SET(IDC_CHECK_CPUSSE2) CHECKBOX_SET(IDC_CHECK_VBR) CHECKBOX_SET(IDC_CHECK_VBR_BITRATE) CHECKBOX_SET(IDC_CHECK_USEPSY) CHECKBOX_SET(IDC_CHECK_VERIFY) CHECKBOX_SET(IDC_CHECK_16KHZ_LOW_PASS_FILTER) // GfBbg̐ݒ EDIT_SET(IDC_EDIT_OUTFREQ) EDIT_SET(IDC_EDIT_MSTHRESHOLD_THRESHOLD) EDIT_SET(IDC_EDIT_MSTHRESHOLD_MSPOWER) EDIT_SET(IDC_EDIT_COMMANDLINE_OPTION) EDIT_SET(IDC_EDIT_LPF_PARA1) EDIT_SET(IDC_EDIT_LPF_PARA2) // Rg[̗L / gogoConfigDialogProcControlEnableDisable(hwnd); } static void gogoConfigDialogProcControlApply(HWND hwnd) { // R{{bNX̑Iݒ CB_GETCURSEL_TYPE2(IDC_COMBO_OUTPUT_FORMAT) CB_GETCURSEL_TYPE1(IDC_COMBO_MPEG1_AUDIO_BITRATE) CB_GETCURSEL_TYPE1(IDC_COMBO_MPEG2_AUDIO_BITRATE) CB_GETCURSEL_TYPE2(IDC_COMBO_ENCODE_MODE) CB_GETCURSEL_TYPE2(IDC_COMBO_EMPHASIS_TYPE) CB_GETCURSEL_TYPE1(IDC_COMBO_VBR_BITRATE_LOW) CB_GETCURSEL_TYPE1(IDC_COMBO_VBR_BITRATE_HIGH) CB_GETCURSEL_TYPE2(IDC_COMBO_VBR) // `FbN{bNX̐ݒ CHECKBOX_GET(IDC_CHECK_DEFAULT) CHECKBOX_GET(IDC_CHECK_COMMANDLINE_OPTS) CHECKBOX_GET(IDC_CHECK_OUTPUT_FORMAT) CHECKBOX_GET(IDC_CHECK_MPEG1AUDIOBITRATE) CHECKBOX_GET(IDC_CHECK_MPEG2AUDIOBITRATE) CHECKBOX_GET(IDC_CHECK_ENHANCED_LOW_PASS_FILTER) CHECKBOX_GET(IDC_CHECK_ENCODE_MODE) CHECKBOX_GET(IDC_CHECK_EMPHASIS_TYPE) CHECKBOX_GET(IDC_CHECK_OUTFREQ) CHECKBOX_GET(IDC_CHECK_MSTHRESHOLD) CHECKBOX_GET(IDC_CHECK_USE_CPU_OPTS) CHECKBOX_GET(IDC_CHECK_CPUMMX) CHECKBOX_GET(IDC_CHECK_CPUSSE) CHECKBOX_GET(IDC_CHECK_CPU3DNOW) CHECKBOX_GET(IDC_CHECK_CPUE3DNOW) CHECKBOX_GET(IDC_CHECK_CPUCMOV) CHECKBOX_GET(IDC_CHECK_CPUEMMX) CHECKBOX_GET(IDC_CHECK_CPUSSE2) CHECKBOX_GET(IDC_CHECK_VBR) CHECKBOX_GET(IDC_CHECK_VBR_BITRATE) CHECKBOX_GET(IDC_CHECK_USEPSY) CHECKBOX_GET(IDC_CHECK_VERIFY) CHECKBOX_GET(IDC_CHECK_16KHZ_LOW_PASS_FILTER) // GfBbg̐ݒ EDIT_GET_RANGE(IDC_EDIT_OUTFREQ,6,MIN_OUTPUT_RATE,MAX_OUTPUT_RATE) EDIT_GET_RANGE(IDC_EDIT_MSTHRESHOLD_THRESHOLD,4,0,100) EDIT_GET_RANGE(IDC_EDIT_MSTHRESHOLD_MSPOWER,4,0,100) EDIT_GET(IDC_EDIT_COMMANDLINE_OPTION,1024) EDIT_GET_RANGE(IDC_EDIT_LPF_PARA1,4,0,100) EDIT_GET_RANGE(IDC_EDIT_LPF_PARA2,4,0,100) // Rg[̗L / gogoConfigDialogProcControlEnableDisable(hwnd); // Zbg gogoConfigDialogProcControlReset(hwnd); } #undef CB_INFO_TYPE1_BEGIN #undef CB_INFO_TYPE1_END #undef CB_INFO_TYPE2_BEGIN #undef CB_INFO_TYPE2_END #undef CB_SETCURSEL_TYPE1 #undef CB_SETCURSEL_TYPE2 #undef CB_GETCURSEL_TYPE1 #undef CB_GETCURSEL_TYPE2 #undef CHECKBOX_SET #undef CHECKBOX_GET #undef EDIT_SET #undef EDIT_GET #undef EDIT_GET_RANGE #endif int gogoConfigDialog(void) { #ifdef AU_GOGO if(!IsWindow(hgogoConfigDailog)) { if (PlayerLanguage == LANGUAGE_JAPANESE) hgogoConfigDailog = CreateDialog(hInst,MAKEINTRESOURCE(IDD_DIALOG_GOGO),(HWND)hPrefWnd,gogoConfigDialogProc); else hgogoConfigDailog = CreateDialog(hInst,MAKEINTRESOURCE(IDD_DIALOG_GOGO_EN),(HWND)hPrefWnd,gogoConfigDialogProc); } ShowWindow(hgogoConfigDailog,SW_SHOW); #endif return 0; } #ifdef AU_GOGO static int gogo_ConfigDialogInfoLock() { return 0; } static int gogo_ConfigDialogInfoUnLock() { return 0; } volatile gogo_ConfigDialogInfo_t gogo_ConfigDialogInfo; int gogo_ConfigDialogInfoInit(void) { gogo_ConfigDialogInfo.optIDC_CHECK_DEFAULT = 1; gogo_ConfigDialogInfo.optIDC_CHECK_COMMANDLINE_OPTS = 0; gogo_ConfigDialogInfo.optIDC_EDIT_COMMANDLINE_OPTION[0] = '\0'; gogo_ConfigDialogInfo.optIDC_CHECK_OUTPUT_FORMAT = 1; gogo_ConfigDialogInfo.optIDC_COMBO_OUTPUT_FORMAT = MC_OUTPUT_NORMAL; gogo_ConfigDialogInfo.optIDC_CHECK_MPEG1AUDIOBITRATE = 1; gogo_ConfigDialogInfo.optIDC_COMBO_MPEG1_AUDIO_BITRATE = 160; gogo_ConfigDialogInfo.optIDC_CHECK_MPEG2AUDIOBITRATE = 1; gogo_ConfigDialogInfo.optIDC_COMBO_MPEG2_AUDIO_BITRATE = 80; gogo_ConfigDialogInfo.optIDC_CHECK_ENHANCED_LOW_PASS_FILTER = 0; strcpy((char *)gogo_ConfigDialogInfo.optIDC_EDIT_LPF_PARA1,"55"); strcpy((char *)gogo_ConfigDialogInfo.optIDC_EDIT_LPF_PARA2,"70"); gogo_ConfigDialogInfo.optIDC_CHECK_ENCODE_MODE = 1; gogo_ConfigDialogInfo.optIDC_COMBO_ENCODE_MODE = MC_MODE_STEREO; gogo_ConfigDialogInfo.optIDC_CHECK_EMPHASIS_TYPE = 1; gogo_ConfigDialogInfo.optIDC_COMBO_EMPHASIS_TYPE = MC_EMP_NONE; gogo_ConfigDialogInfo.optIDC_CHECK_OUTFREQ = 0; strcpy((char *)gogo_ConfigDialogInfo.optIDC_EDIT_OUTFREQ,"44100"); gogo_ConfigDialogInfo.optIDC_CHECK_MSTHRESHOLD = 0; strcpy((char *)gogo_ConfigDialogInfo.optIDC_EDIT_MSTHRESHOLD_THRESHOLD,"75"); strcpy((char *)gogo_ConfigDialogInfo.optIDC_EDIT_MSTHRESHOLD_MSPOWER,"66"); gogo_ConfigDialogInfo.optIDC_CHECK_USE_CPU_OPTS = 0; gogo_ConfigDialogInfo.optIDC_CHECK_CPUMMX = 0; gogo_ConfigDialogInfo.optIDC_CHECK_CPUSSE = 0; gogo_ConfigDialogInfo.optIDC_CHECK_CPU3DNOW = 0; gogo_ConfigDialogInfo.optIDC_CHECK_CPUE3DNOW = 0; gogo_ConfigDialogInfo.optIDC_CHECK_CPUCMOV = 0; gogo_ConfigDialogInfo.optIDC_CHECK_CPUEMMX = 0; gogo_ConfigDialogInfo.optIDC_CHECK_CPUSSE2 = 0; gogo_ConfigDialogInfo.optIDC_CHECK_VBR = 0; gogo_ConfigDialogInfo.optIDC_COMBO_VBR = 0; gogo_ConfigDialogInfo.optIDC_CHECK_VBR_BITRATE = 0; gogo_ConfigDialogInfo.optIDC_COMBO_VBR_BITRATE_LOW = 32; gogo_ConfigDialogInfo.optIDC_COMBO_VBR_BITRATE_HIGH = 320; gogo_ConfigDialogInfo.optIDC_CHECK_USEPSY = 1; gogo_ConfigDialogInfo.optIDC_CHECK_VERIFY = 0; gogo_ConfigDialogInfo.optIDC_CHECK_16KHZ_LOW_PASS_FILTER = 1; return 0; } int gogo_ConfigDialogInfoApply(void) { gogo_ConfigDialogInfoLock(); if(gogo_ConfigDialogInfo.optIDC_CHECK_DEFAULT>0){ gogo_opts_reset(); gogo_ConfigDialogInfoUnLock(); return 0; } if(gogo_ConfigDialogInfo.optIDC_CHECK_COMMANDLINE_OPTS>0){ gogo_opts_reset(); set_gogo_opts_use_commandline_options((char *)gogo_ConfigDialogInfo.optIDC_EDIT_COMMANDLINE_OPTION); gogo_ConfigDialogInfoUnLock(); return 0; } if(gogo_ConfigDialogInfo.optIDC_CHECK_OUTPUT_FORMAT>0){ gogo_opts.optOUTPUT_FORMAT = gogo_ConfigDialogInfo.optIDC_COMBO_OUTPUT_FORMAT; } if(gogo_ConfigDialogInfo.optIDC_CHECK_MPEG1AUDIOBITRATE>0){ gogo_opts.optBITRATE1 = gogo_ConfigDialogInfo.optIDC_COMBO_MPEG1_AUDIO_BITRATE; } if(gogo_ConfigDialogInfo.optIDC_CHECK_MPEG2AUDIOBITRATE>0){ gogo_opts.optBITRATE2 = gogo_ConfigDialogInfo.optIDC_COMBO_MPEG2_AUDIO_BITRATE; } if(gogo_ConfigDialogInfo.optIDC_CHECK_ENHANCED_LOW_PASS_FILTER>0){ gogo_opts.optENHANCEDFILTER_A = atoi((char *)gogo_ConfigDialogInfo.optIDC_EDIT_LPF_PARA1); gogo_opts.optENHANCEDFILTER_B = atoi((char *)gogo_ConfigDialogInfo.optIDC_EDIT_LPF_PARA2); } if(gogo_ConfigDialogInfo.optIDC_CHECK_ENCODE_MODE>0){ gogo_opts.optENCODEMODE = gogo_ConfigDialogInfo.optIDC_COMBO_ENCODE_MODE; } if(gogo_ConfigDialogInfo.optIDC_CHECK_EMPHASIS_TYPE>0){ gogo_opts.optEMPHASIS = gogo_ConfigDialogInfo.optIDC_COMBO_EMPHASIS_TYPE; } if(gogo_ConfigDialogInfo.optIDC_CHECK_OUTFREQ>0){ gogo_opts.optOUTFREQ = atoi((char *)gogo_ConfigDialogInfo.optIDC_EDIT_OUTFREQ); } if(gogo_ConfigDialogInfo.optIDC_CHECK_MSTHRESHOLD>0){ gogo_opts.optMSTHRESHOLD_threshold = atoi((char *)gogo_ConfigDialogInfo.optIDC_EDIT_MSTHRESHOLD_THRESHOLD); gogo_opts.optMSTHRESHOLD_mspower = atoi((char *)gogo_ConfigDialogInfo.optIDC_EDIT_MSTHRESHOLD_MSPOWER); } if(gogo_ConfigDialogInfo.optIDC_CHECK_USE_CPU_OPTS>0){ gogo_opts.optUSECPUOPT = 1; gogo_opts.optUSEMMX = gogo_ConfigDialogInfo.optIDC_CHECK_CPUMMX; gogo_opts.optUSEKNI = gogo_ConfigDialogInfo.optIDC_CHECK_CPUSSE; gogo_opts.optUSE3DNOW = gogo_ConfigDialogInfo.optIDC_CHECK_CPU3DNOW; gogo_opts.optUSEE3DNOW = gogo_ConfigDialogInfo.optIDC_CHECK_CPUE3DNOW; gogo_opts.optUSESSE = gogo_ConfigDialogInfo.optIDC_CHECK_CPUSSE; gogo_opts.optUSECMOV = gogo_ConfigDialogInfo.optIDC_CHECK_CPUCMOV; gogo_opts.optUSEEMMX = gogo_ConfigDialogInfo.optIDC_CHECK_CPUEMMX; gogo_opts.optUSESSE2 = gogo_ConfigDialogInfo.optIDC_CHECK_CPUSSE2; } else { gogo_opts.optUSECPUOPT = 0; } if(gogo_ConfigDialogInfo.optIDC_CHECK_VBR>0){ gogo_opts.optVBR = gogo_ConfigDialogInfo.optIDC_COMBO_VBR; } if(gogo_ConfigDialogInfo.optIDC_CHECK_VBR_BITRATE>0){ gogo_opts.optVBRBITRATE_low = gogo_ConfigDialogInfo.optIDC_COMBO_VBR_BITRATE_LOW; gogo_opts.optVBRBITRATE_high = gogo_ConfigDialogInfo.optIDC_COMBO_VBR_BITRATE_HIGH; } if(gogo_ConfigDialogInfo.optIDC_CHECK_USEPSY>0){ gogo_opts.optUSEPSY = TRUE; } if(gogo_ConfigDialogInfo.optIDC_CHECK_VERIFY>0){ gogo_opts.optVERIFY = TRUE; } if(gogo_ConfigDialogInfo.optIDC_CHECK_16KHZ_LOW_PASS_FILTER>0){ gogo_opts.optUSELPF16 = TRUE; } // gogo_opts.optINPFREQ; // SYSTEM USE(VXeŎgp邩włȂ) // gogo_opts.optSTARTOFFSET; // SYSTEM USE // gogo_opts.optADDTAGnum; // SYSTEM USE // gogo_opts.optADDTAG_len[64]; // SYSTEM USE // gogo_opts.optADDTAG_buf[64]; // SYSTEM USE // gogo_opts.optCPU; // PREPAIRING() // gogo_opts.optBYTE_SWAP; // SYSTEM USE // gogo_opts.opt8BIT_PCM; // SYSTEM USE // gogo_opts.optMONO_PCM; // SYSTEM USE // gogo_opts.optTOWNS_SND; // SYSTEM USE // gogo_opts.optTHREAD_PRIORITY; // PREPARING // gogo_opts.optREADTHREAD_PRIORITY; // PREPARING // gogo_opts.optOUTPUTDIR[1024]; // SYSTEM USE // gogo_opts.output_name[1024]; // SYSTEM USE gogo_ConfigDialogInfoUnLock(); return 0; } #define SEC_GOGO "gogo" int gogo_ConfigDialogInfoSaveINI(void) { char *section = SEC_GOGO; char *inifile = timidity_output_inifile; char buffer[1024]; #if defined(__MINGW32__) || defined(__CYGWIN__) #define NUMSAVE(name) \ sprintf(buffer,"%d",gogo_ConfigDialogInfo.name ); \ WritePrivateProfileString(section, #name ,buffer,inifile); #define STRSAVE(name) \ WritePrivateProfileString(section,(char *) #name ,(char *)gogo_ConfigDialogInfo.name ,inifile); #else #define NUMSAVE(name) \ sprintf(buffer,"%d",gogo_ConfigDialogInfo. ## name ); \ WritePrivateProfileString(section, #name ,buffer,inifile); #define STRSAVE(name) \ WritePrivateProfileString(section,(char *) #name ,(char *)gogo_ConfigDialogInfo. ## name ,inifile); #endif NUMSAVE(optIDC_CHECK_DEFAULT) NUMSAVE(optIDC_CHECK_COMMANDLINE_OPTS) STRSAVE(optIDC_EDIT_COMMANDLINE_OPTION) NUMSAVE(optIDC_CHECK_OUTPUT_FORMAT) NUMSAVE(optIDC_COMBO_OUTPUT_FORMAT) NUMSAVE(optIDC_CHECK_MPEG1AUDIOBITRATE) NUMSAVE(optIDC_COMBO_MPEG1_AUDIO_BITRATE) NUMSAVE(optIDC_CHECK_MPEG2AUDIOBITRATE) NUMSAVE(optIDC_COMBO_MPEG2_AUDIO_BITRATE) NUMSAVE(optIDC_CHECK_ENHANCED_LOW_PASS_FILTER) STRSAVE(optIDC_EDIT_LPF_PARA1) STRSAVE(optIDC_EDIT_LPF_PARA2) NUMSAVE(optIDC_CHECK_ENCODE_MODE) NUMSAVE(optIDC_COMBO_ENCODE_MODE) NUMSAVE(optIDC_CHECK_EMPHASIS_TYPE) NUMSAVE(optIDC_COMBO_EMPHASIS_TYPE) NUMSAVE(optIDC_CHECK_OUTFREQ) STRSAVE(optIDC_EDIT_OUTFREQ) NUMSAVE(optIDC_CHECK_MSTHRESHOLD) STRSAVE(optIDC_EDIT_MSTHRESHOLD_THRESHOLD) STRSAVE(optIDC_EDIT_MSTHRESHOLD_MSPOWER) NUMSAVE(optIDC_CHECK_USE_CPU_OPTS) NUMSAVE(optIDC_CHECK_CPUMMX) NUMSAVE(optIDC_CHECK_CPUSSE) NUMSAVE(optIDC_CHECK_CPU3DNOW) NUMSAVE(optIDC_CHECK_CPUE3DNOW) NUMSAVE(optIDC_CHECK_CPUCMOV) NUMSAVE(optIDC_CHECK_CPUEMMX) NUMSAVE(optIDC_CHECK_CPUSSE2) NUMSAVE(optIDC_CHECK_VBR) NUMSAVE(optIDC_COMBO_VBR) NUMSAVE(optIDC_CHECK_VBR_BITRATE) NUMSAVE(optIDC_COMBO_VBR_BITRATE_LOW) NUMSAVE(optIDC_COMBO_VBR_BITRATE_HIGH) NUMSAVE(optIDC_CHECK_USEPSY) NUMSAVE(optIDC_CHECK_VERIFY) NUMSAVE(optIDC_CHECK_16KHZ_LOW_PASS_FILTER) WritePrivateProfileString(NULL,NULL,NULL,inifile); // Write Flush #undef NUMSAVE #undef STRSAVE return 0; } int gogo_ConfigDialogInfoLoadINI(void) { char *section = SEC_GOGO; char *inifile = timidity_output_inifile; int num; char buffer[1024]; #if defined(__MINGW32__) || defined(__CYGWIN__) #define NUMLOAD(name) \ num = GetPrivateProfileInt(section, #name ,-1,inifile); \ if(num!=-1) gogo_ConfigDialogInfo.name = num; #define STRLOAD(name,len) \ GetPrivateProfileString(section,(char *) #name ,"",buffer,len,inifile); \ buffer[len-1] = '\0'; \ if(buffer[0]!=0) \ strcpy((char *)gogo_ConfigDialogInfo.name ,buffer); #else #define NUMLOAD(name) \ num = GetPrivateProfileInt(section, #name ,-1,inifile); \ if(num!=-1) gogo_ConfigDialogInfo. ## name = num; #define STRLOAD(name,len) \ GetPrivateProfileString(section,(char *) #name ,"",buffer,len,inifile); \ buffer[len-1] = '\0'; \ if(buffer[0]!=0) \ strcpy((char *)gogo_ConfigDialogInfo. ## name ,buffer); #endif gogo_ConfigDialogInfoLock(); NUMLOAD(optIDC_CHECK_DEFAULT) NUMLOAD(optIDC_CHECK_COMMANDLINE_OPTS) STRLOAD(optIDC_EDIT_COMMANDLINE_OPTION,1024) NUMLOAD(optIDC_CHECK_OUTPUT_FORMAT) NUMLOAD(optIDC_COMBO_OUTPUT_FORMAT) NUMLOAD(optIDC_CHECK_MPEG1AUDIOBITRATE) NUMLOAD(optIDC_COMBO_MPEG1_AUDIO_BITRATE) NUMLOAD(optIDC_CHECK_MPEG2AUDIOBITRATE) NUMLOAD(optIDC_COMBO_MPEG2_AUDIO_BITRATE) NUMLOAD(optIDC_CHECK_ENHANCED_LOW_PASS_FILTER) STRLOAD(optIDC_EDIT_LPF_PARA1,4) STRLOAD(optIDC_EDIT_LPF_PARA2,4) NUMLOAD(optIDC_CHECK_ENCODE_MODE) NUMLOAD(optIDC_COMBO_ENCODE_MODE) NUMLOAD(optIDC_CHECK_EMPHASIS_TYPE) NUMLOAD(optIDC_COMBO_EMPHASIS_TYPE) NUMLOAD(optIDC_CHECK_OUTFREQ) STRLOAD(optIDC_EDIT_OUTFREQ,6) NUMLOAD(optIDC_CHECK_MSTHRESHOLD) STRLOAD(optIDC_EDIT_MSTHRESHOLD_THRESHOLD,4) STRLOAD(optIDC_EDIT_MSTHRESHOLD_MSPOWER,4) NUMLOAD(optIDC_CHECK_USE_CPU_OPTS) NUMLOAD(optIDC_CHECK_CPUMMX) NUMLOAD(optIDC_CHECK_CPUSSE) NUMLOAD(optIDC_CHECK_CPU3DNOW) NUMLOAD(optIDC_CHECK_CPUE3DNOW) NUMLOAD(optIDC_CHECK_CPUCMOV) NUMLOAD(optIDC_CHECK_CPUEMMX) NUMLOAD(optIDC_CHECK_CPUSSE2) NUMLOAD(optIDC_CHECK_VBR) NUMLOAD(optIDC_COMBO_VBR) NUMLOAD(optIDC_CHECK_VBR_BITRATE) NUMLOAD(optIDC_COMBO_VBR_BITRATE_LOW) NUMLOAD(optIDC_COMBO_VBR_BITRATE_HIGH) NUMLOAD(optIDC_CHECK_USEPSY) NUMLOAD(optIDC_CHECK_VERIFY) NUMLOAD(optIDC_CHECK_16KHZ_LOW_PASS_FILTER) #undef NUMLOAD #undef STRLOAD gogo_ConfigDialogInfoUnLock(); return 0; } #endif // AU_GOGO #ifdef AU_VORBIS /////////////////////////////////////////////////////////////////////// // // vorbis ConfigDialog // /////////////////////////////////////////////////////////////////////// volatile vorbis_ConfigDialogInfo_t vorbis_ConfigDialogInfo; // id ̃R{{bNX̏̒` #define CB_INFO_TYPE1_BEGIN(id) static int cb_info_ ## id [] = { #define CB_INFO_TYPE1_END }; #define CB_INFO_TYPE2_BEGIN(id) static char * cb_info_ ## id [] = { #define CB_INFO_TYPE2_END }; // cb_info_type1_hc cb_info_type2_hc ƂӂɂȂB // IDC_COMBO_MODE_jp CB_INFO_TYPE2_BEGIN(IDC_COMBO_MODE_jp) "VBR i 1 ()",(char *)1, "VBR i 2",(char *)2, "VBR i 3",(char *)3, "VBR i 4",(char *)4, "VBR i 4.99",(char *)499, "VBR i 5",(char *)5, "VBR i 6",(char *)6, "VBR i 7",(char *)7, "VBR i 8 (ftHg)",(char *)8, "VBR i 9",(char *)9, "VBR i 10 ()",(char *)10, #if 0 "ftHg(128kbps VBR)",(char *)0, "112kbps VBR",(char *)1, "128kbps VBR",(char *)2, "160kbps VBR",(char *)3, "192kbps VBR",(char *)4, "256kbps VBR",(char *)5, "350kbps VBR",(char *)6, #endif NULL CB_INFO_TYPE2_END // IDC_COMBO_MODE_en CB_INFO_TYPE2_BEGIN(IDC_COMBO_MODE_en) "VBR Quality 1 (low)",(char *)1, "VBR Quality 2",(char *)2, "VBR Quality 3",(char *)3, "VBR Quality 4",(char *)4, "VBR Quality 4.99",(char *)499, "VBR Quality 5",(char *)5, "VBR Quality 6",(char *)6, "VBR Quality 7",(char *)7, "VBR Quality 8 (default)",(char *)8, "VBR Quality 9",(char *)9, "VBR Quality 10 (high)",(char *)10, #if 0 "Default (About 128kbps VBR)",(char *)0, "About 112kbps VBR",(char *)1, "About 128kbps VBR",(char *)2, "About 160kbps VBR",(char *)3, "About 192kbps VBR",(char *)4, "About 256kbps VBR",(char *)5, "About 350kbps VBR",(char *)6, #endif NULL CB_INFO_TYPE2_END static char **cb_info_IDC_COMBO_MODE; // id ̃R{{bNXI̐ݒ肷B #define CB_SETCURSEL_TYPE1(id) \ { \ int cb_num; \ for(cb_num=0;(int)cb_info_ ## id [cb_num]>=0;cb_num++){ \ SendDlgItemMessage(hwnd,id,CB_SETCURSEL,(WPARAM)0,(LPARAM)0); \ if(vorbis_ConfigDialogInfo.opt ## id == (int) cb_info_ ## id [cb_num]){ \ SendDlgItemMessage(hwnd,id,CB_SETCURSEL,(WPARAM)cb_num,(LPARAM)0); \ break; \ } \ } \ } #define CB_SETCURSEL_TYPE2(id) \ { \ int cb_num; \ for(cb_num=0;(int)cb_info_ ## id [cb_num];cb_num+=2){ \ SendDlgItemMessage(hwnd,id,CB_SETCURSEL,(WPARAM)0,(LPARAM)0); \ if(vorbis_ConfigDialogInfo.opt ## id == (int) cb_info_ ## id [cb_num+1]){ \ SendDlgItemMessage(hwnd,id,CB_SETCURSEL,(WPARAM)cb_num/2,(LPARAM)0); \ break; \ } \ } \ } // id ̃R{{bNX̑IϐɑB #define CB_GETCURSEL_TYPE1(id) \ { \ int cb_num1, cb_num2; \ cb_num1 = SendDlgItemMessage(hwnd,id,CB_GETCURSEL,(WPARAM)0,(LPARAM)0); \ for(cb_num2=0;(int)cb_info_ ## id [cb_num2]>=0;cb_num2++) \ if(cb_num1==cb_num2){ \ vorbis_ConfigDialogInfo.opt ## id = (int)cb_info_ ## id [cb_num2]; \ break; \ } \ } #define CB_GETCURSEL_TYPE2(id) \ { \ int cb_num1, cb_num2; \ cb_num1 = SendDlgItemMessage(hwnd,id,CB_GETCURSEL,(WPARAM)0,(LPARAM)0); \ for(cb_num2=0;(int)cb_info_ ## id [cb_num2];cb_num2+=2) \ if(cb_num1*2==cb_num2){ \ vorbis_ConfigDialogInfo.opt ## id = (int)cb_info_ ## id [cb_num2+1]; \ break; \ } \ } // `FbNĂ邩B #define IS_CHECK(id) SendDlgItemMessage(hwnd,id,BM_GETCHECK,0,0) // `FbNB #define CHECK(id) SendDlgItemMessage(hwnd,id,BM_SETCHECK,1,0) // `FbN͂B #define UNCHECK(id) SendDlgItemMessage(hwnd,id,BM_SETCHECK,0,0) // id ̃`FbN{bNXݒ肷B #define CHECKBOX_SET(id) \ if(vorbis_ConfigDialogInfo.opt ## id>0) \ SendDlgItemMessage(hwnd,id,BM_SETCHECK,1,0); \ else \ SendDlgItemMessage(hwnd,id,BM_SETCHECK,0,0); \ // id ̃`FbN{bNXϐɑB #define CHECKBOX_GET(id) \ if(SendDlgItemMessage(hwnd,id,BM_GETCHECK,0,0)) \ vorbis_ConfigDialogInfo.opt ## id = 1; \ else \ vorbis_ConfigDialogInfo.opt ## id = 0; \ // id ̃GfBbgݒ肷B #define EDIT_SET(id) SendDlgItemMessage(hwnd,id,WM_SETTEXT,0,(LPARAM)vorbis_ConfigDialogInfo.opt ## id); // id ̃GfBbgϐɑB #define EDIT_GET(id,size) SendDlgItemMessage(hwnd,id,WM_GETTEXT,(WPARAM)size,(LPARAM)vorbis_ConfigDialogInfo.opt ## id); #define EDIT_GET_RANGE(id,size,min,max) \ { \ char tmpbuf[1024]; \ int value; \ SendDlgItemMessage(hwnd,id,WM_GETTEXT,(WPARAM)size,(LPARAM)vorbis_ConfigDialogInfo.opt ## id); \ value = atoi((char *)vorbis_ConfigDialogInfo.opt ## id); \ if(valuemax) value = max; \ sprintf(tmpbuf,"%d",value); \ strncpy((char *)vorbis_ConfigDialogInfo.opt ## id,tmpbuf,size); \ (vorbis_ConfigDialogInfo.opt ## id)[size] = '\0'; \ } // Rg[̗L #define ENABLE_CONTROL(id) EnableWindow(GetDlgItem(hwnd,id),TRUE); // Rg[̖ #define DISABLE_CONTROL(id) EnableWindow(GetDlgItem(hwnd,id),FALSE); static void vorbisConfigDialogProcControlEnableDisable(HWND hwnd); static void vorbisConfigDialogProcControlApply(HWND hwnd); static void vorbisConfigDialogProcControlReset(HWND hwnd); static int vorbis_ConfigDialogInfoLock(); static int vorbis_ConfigDialogInfoUnLock(); static HANDLE hvorbisConfigDailog = NULL; static BOOL APIENTRY vorbisConfigDialogProc(HWND hwnd, UINT uMess, WPARAM wParam, LPARAM lParam) { switch (uMess){ case WM_INITDIALOG: { int i; // R{{bNX̏ if (PlayerLanguage == LANGUAGE_JAPANESE) cb_info_IDC_COMBO_MODE = cb_info_IDC_COMBO_MODE_jp; else cb_info_IDC_COMBO_MODE = cb_info_IDC_COMBO_MODE_en; for(i=0;cb_info_IDC_COMBO_MODE[i];i+=2){ SendDlgItemMessage(hwnd,IDC_COMBO_MODE,CB_INSERTSTRING,(WPARAM)-1,(LPARAM)cb_info_IDC_COMBO_MODE[i]); } // ݒ vorbisConfigDialogProcControlReset(hwnd); } break; case WM_COMMAND: switch (LOWORD(wParam)) { case IDCLOSE: SendMessage(hwnd,WM_CLOSE,(WPARAM)0,(LPARAM)0); break; case IDOK: vorbisConfigDialogProcControlApply(hwnd); SendMessage(hwnd,WM_CLOSE,(WPARAM)0,(LPARAM)0); break; case IDCANCEL: SendMessage(hwnd,WM_CLOSE,(WPARAM)0,(LPARAM)0); break; case IDC_BUTTON_APPLY: vorbisConfigDialogProcControlApply(hwnd); break; case IDC_CHECK_DEFAULT: vorbisConfigDialogProcControlEnableDisable(hwnd); break; case IDC_COMBO_MODE: break; default: break; } break; case WM_NOTIFY: break; case WM_SIZE: return FALSE; case WM_CLOSE: vorbis_ConfigDialogInfoSaveINI(); DestroyWindow(hwnd); break; case WM_DESTROY: hvorbisConfigDailog = NULL; break; default: break; } return FALSE; } // Rg[̗L / static void vorbisConfigDialogProcControlEnableDisable(HWND hwnd) { ENABLE_CONTROL(IDC_CHECK_DEFAULT); if(IS_CHECK(IDC_CHECK_DEFAULT)){ DISABLE_CONTROL(IDC_COMBO_MODE); } else { ENABLE_CONTROL(IDC_COMBO_MODE); } } static void vorbisConfigDialogProcControlReset(HWND hwnd) { // R{{bNX̑Iݒ CB_SETCURSEL_TYPE2(IDC_COMBO_MODE) // `FbN{bNX̐ݒ CHECKBOX_SET(IDC_CHECK_DEFAULT) // GfBbg̐ݒ // Rg[̗L / vorbisConfigDialogProcControlEnableDisable(hwnd); } static void vorbisConfigDialogProcControlApply(HWND hwnd) { // R{{bNX̑Iݒ CB_GETCURSEL_TYPE2(IDC_COMBO_MODE) // `FbN{bNX̐ݒ CHECKBOX_GET(IDC_CHECK_DEFAULT) // GfBbg̐ݒ // Rg[̗L / vorbisConfigDialogProcControlEnableDisable(hwnd); // Zbg vorbisConfigDialogProcControlReset(hwnd); } #undef CB_INFO_TYPE1_BEGIN #undef CB_INFO_TYPE1_END #undef CB_INFO_TYPE2_BEGIN #undef CB_INFO_TYPE2_END #undef CB_SETCURSEL_TYPE1 #undef CB_SETCURSEL_TYPE2 #undef CB_GETCURSEL_TYPE1 #undef CB_GETCURSEL_TYPE2 #undef CHECKBOX_SET #undef CHECKBOX_GET #undef EDIT_SET #undef EDIT_GET #undef EDIT_GET_RANGE #endif int vorbisConfigDialog(void) { #ifdef AU_VORBIS if(!IsWindow(hvorbisConfigDailog)) { if (PlayerLanguage == LANGUAGE_JAPANESE) hvorbisConfigDailog = CreateDialog(hInst,MAKEINTRESOURCE(IDD_DIALOG_VORBIS),(HWND)hPrefWnd,vorbisConfigDialogProc); else hvorbisConfigDailog = CreateDialog(hInst,MAKEINTRESOURCE(IDD_DIALOG_VORBIS_EN),(HWND)hPrefWnd,vorbisConfigDialogProc); } ShowWindow(hvorbisConfigDailog,SW_SHOW); #endif return 0; } #ifdef AU_VORBIS static int vorbis_ConfigDialogInfoLock() { return 0; } static int vorbis_ConfigDialogInfoUnLock() { return 0; } int vorbis_ConfigDialogInfoInit(void) { vorbis_ConfigDialogInfo.optIDC_CHECK_DEFAULT = 1; vorbis_ConfigDialogInfo.optIDC_COMBO_MODE = 0; return 0; } extern volatile int ogg_vorbis_mode; int vorbis_ConfigDialogInfoApply(void) { vorbis_ConfigDialogInfoLock(); if(vorbis_ConfigDialogInfo.optIDC_CHECK_DEFAULT>0){ // vorbis_opts_reset(); vorbis_ConfigDialogInfoUnLock(); return 0; } ogg_vorbis_mode = vorbis_ConfigDialogInfo.optIDC_COMBO_MODE; vorbis_ConfigDialogInfoUnLock(); return 0; } #define SEC_VORBIS "vorbis" int vorbis_ConfigDialogInfoSaveINI(void) { char *section = SEC_VORBIS; char *inifile = timidity_output_inifile; char buffer[1024]; // int len; #if defined(__MINGW32__) || defined(__CYGWIN__) #define NUMSAVE(name) \ sprintf(buffer,"%d",vorbis_ConfigDialogInfo.name ); \ WritePrivateProfileString(section, #name ,buffer,inifile); //#define STRSAVE(name,len) \ // WritePrivateProfileString(section,(char *) #name ,(char *)vorbis_ConfigDialogInfo.name ,inifile); #else #define NUMSAVE(name) \ sprintf(buffer,"%d",vorbis_ConfigDialogInfo. ## name ); \ WritePrivateProfileString(section, #name ,buffer,inifile); //#define STRSAVE(name,len) \ // WritePrivateProfileString(section,(char *) #name ,(char *)vorbis_ConfigDialogInfo. ## name ,inifile); #endif NUMSAVE(optIDC_CHECK_DEFAULT) NUMSAVE(optIDC_COMBO_MODE) WritePrivateProfileString(NULL,NULL,NULL,inifile); // Write Flush #undef NUMSAVE //#undef STRSAVE return 0; } int vorbis_ConfigDialogInfoLoadINI(void) { char *section = SEC_VORBIS; char *inifile = timidity_output_inifile; int num; // char buffer[1024]; #if defined(__MINGW32__) || defined(__CYGWIN__) #define NUMLOAD(name) \ num = GetPrivateProfileInt(section, #name ,-1,inifile); \ if(num!=-1) vorbis_ConfigDialogInfo.name = num; //#define STRLOAD(name,len) \ // GetPrivateProfileString(section,(char *) #name ,"",buffer,len,inifile); \ // buffer[len-1] = '\0'; \ // if(buffer[0]!=0) \ // strcpy((char *)vorbis_ConfigDialogInfo.name ,buffer); #else #define NUMLOAD(name) \ num = GetPrivateProfileInt(section, #name ,-1,inifile); \ if(num!=-1) vorbis_ConfigDialogInfo. ## name = num; //#define STRLOAD(name,len) \ // GetPrivateProfileString(section,(char *) #name ,"",buffer,len,inifile); \ // buffer[len-1] = '\0'; \ // if(buffer[0]!=0) \ // strcpy((char *)vorbis_ConfigDialogInfo. ## name ,buffer); #endif vorbis_ConfigDialogInfoLock(); NUMLOAD(optIDC_CHECK_DEFAULT) NUMLOAD(optIDC_COMBO_MODE) #undef NUMLOAD //#undef STRLOAD vorbis_ConfigDialogInfoUnLock(); return 0; } #endif // AU_VORBIS TiMidity++-2.13.2/interface/w32g_pref.h0100644004711200001440000000610607422304760016613 0ustar tamukiusers/* TiMidity++ -- MIDI to WAVE converter and player Copyright (C) 1999-2002 Masanao Izumo Copyright (C) 1995 Tuukka Toivonen 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef __W32G2_PREF_H__ #define __W32G2_PREF_H__ extern volatile int PrefWndDoing; void PrefWndCreate(HWND hwnd); #ifdef AU_GOGO // _CAȌقƂǂ̂܂ܕۑB // R{{bNXɂ‚Ă Index ͖ӖȂ̂ŒlۑB typedef struct gogo_ConfigDialogInfo_t_ { int optIDC_CHECK_DEFAULT; int optIDC_CHECK_COMMANDLINE_OPTS; char optIDC_EDIT_COMMANDLINE_OPTION[1024+1]; int optIDC_CHECK_OUTPUT_FORMAT; int optIDC_COMBO_OUTPUT_FORMAT; int optIDC_CHECK_MPEG1AUDIOBITRATE; int optIDC_COMBO_MPEG1_AUDIO_BITRATE; int optIDC_CHECK_MPEG2AUDIOBITRATE; int optIDC_COMBO_MPEG2_AUDIO_BITRATE; int optIDC_CHECK_ENHANCED_LOW_PASS_FILTER; char optIDC_EDIT_LPF_PARA1[4+1]; char optIDC_EDIT_LPF_PARA2[4+1]; int optIDC_CHECK_ENCODE_MODE; int optIDC_COMBO_ENCODE_MODE; int optIDC_CHECK_EMPHASIS_TYPE; int optIDC_COMBO_EMPHASIS_TYPE; int optIDC_CHECK_OUTFREQ; char optIDC_EDIT_OUTFREQ[6+1]; int optIDC_CHECK_MSTHRESHOLD; char optIDC_EDIT_MSTHRESHOLD_THRESHOLD[4+1]; char optIDC_EDIT_MSTHRESHOLD_MSPOWER[4+1]; int optIDC_CHECK_USE_CPU_OPTS; int optIDC_CHECK_CPUMMX; int optIDC_CHECK_CPUSSE; int optIDC_CHECK_CPU3DNOW; int optIDC_CHECK_CPUE3DNOW; int optIDC_CHECK_CPUCMOV; int optIDC_CHECK_CPUEMMX; int optIDC_CHECK_CPUSSE2; int optIDC_CHECK_VBR; int optIDC_COMBO_VBR; int optIDC_CHECK_VBR_BITRATE; int optIDC_COMBO_VBR_BITRATE_LOW; int optIDC_COMBO_VBR_BITRATE_HIGH; int optIDC_CHECK_USEPSY; int optIDC_CHECK_VERIFY; int optIDC_CHECK_16KHZ_LOW_PASS_FILTER; } gogo_ConfigDialogInfo_t; extern volatile gogo_ConfigDialogInfo_t gogo_ConfigDialogInfo; extern int gogo_ConfigDialogInfoInit(void); extern int gogo_ConfigDialogInfoApply(void); extern int gogo_ConfigDialogInfoSaveINI(void); extern int gogo_ConfigDialogInfoLoadINI(void); extern int gogoConfigDialog(void); #endif // AU_GOGO #ifdef AU_VORBIS typedef struct vorbis_ConfigDialogInfo_t_ { int optIDC_CHECK_DEFAULT; int optIDC_COMBO_MODE; } vorbis_ConfigDialogInfo_t; extern int vorbis_ConfigDialogInfoInit(void); extern int vorbis_ConfigDialogInfoApply(void); extern int vorbis_ConfigDialogInfoSaveINI(void); extern int vorbis_ConfigDialogInfoLoadINI(void); extern int vorbisConfigDialog(void); #endif // AU_VORBIS #endif /* __W32G2_PREF_H__ */ TiMidity++-2.13.2/interface/w32g_subwin.c0100644004711200001440000014025210016663264017162 0ustar tamukiusers/* TiMidity++ -- MIDI to WAVE converter and player Copyright (C) 1999-2002 Masanao Izumo Copyright (C) 1995 Tuukka Toivonen 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA w32g_subwin.c: Written by Daisuke Aoki */ #ifdef HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ #include #include #include #include #ifndef NO_STRING_H #include #else #include #endif #include "timidity.h" #include "common.h" #include "instrum.h" #include "playmidi.h" #include "readmidi.h" #include "output.h" #include "controls.h" #include "tables.h" #include "miditrace.h" #include "reverb.h" #ifdef SUPPORT_SOUNDSPEC #include "soundspec.h" #endif /* SUPPORT_SOUNDSPEC */ #include "recache.h" #include "arc.h" #include "strtab.h" #include "wrd.h" #include "mid.defs" #include "w32g.h" #include #include #include #include "w32g_res.h" #include "w32g_utl.h" #include "w32g_pref.h" #include "w32g_subwin.h" #include "w32g_ut2.h" #if defined(__CYGWIN32__) || defined(__MINGW32__) #ifndef TPM_TOPALIGN #define TPM_TOPALIGN 0x0000L #endif #endif extern void MainWndToggleConsoleButton(void); extern void MainWndUpdateConsoleButton(void); extern void MainWndToggleTracerButton(void); extern void MainWndUpdateTracerButton(void); extern void MainWndToggleListButton(void); extern void MainWndUpdateListButton(void); extern void MainWndToggleDocButton(void); extern void MainWndUpdateDocButton(void); extern void MainWndToggleWrdButton(void); extern void MainWndUpdateWrdButton(void); extern void MainWndToggleSoundSpecButton(void); extern void MainWndUpdateSoundSpecButton(void); extern void ShowSubWindow(HWND hwnd,int showflag); extern void ToggleSubWindow(HWND hwnd); extern void VprintfEditCtlWnd(HWND hwnd, char *fmt, va_list argList); extern void PrintfEditCtlWnd(HWND hwnd, char *fmt, ...); extern void PutsEditCtlWnd(HWND hwnd, char *str); extern void ClearEditCtlWnd(HWND hwnd); extern char *nkf_convert(char *si,char *so,int maxsize,char *in_mode,char *out_mode); void InitListSearchWnd(HWND hParentWnd); void ShowListSearch(void); void HideListSearch(void); // *************************************************************************** // // Console Window // // *************************************************************************** // --------------------------------------------------------------------------- // variables static int ConsoleWndMaxSize = 64 * 1024; static HFONT hFontConsoleWnd = NULL; CONSOLEWNDINFO ConsoleWndInfo; // --------------------------------------------------------------------------- // prototypes of functions static BOOL CALLBACK ConsoleWndProc(HWND hwnd, UINT uMess, WPARAM wParam, LPARAM lParam); static void ConsoleWndAllUpdate(void); static void ConsoleWndVerbosityUpdate(void); static void ConsoleWndVerbosityApply(void); static void ConsoleWndValidUpdate(void); static void ConsoleWndValidApply(void); static void ConsoleWndVerbosityApplyIncDec(int num); static int ConsoleWndInfoReset(HWND hwnd); static int ConsoleWndInfoApply(void); // --------------------------------------------------------------------------- // Global Functions // Initialization void InitConsoleWnd(HWND hParentWnd) { if (hConsoleWnd != NULL) { DestroyWindow(hConsoleWnd); hConsoleWnd = NULL; } INILoadConsoleWnd(); switch(PlayerLanguage){ case LANGUAGE_ENGLISH: hConsoleWnd = CreateDialog (hInst,MAKEINTRESOURCE(IDD_DIALOG_CONSOLE_EN),hParentWnd,ConsoleWndProc); break; default: case LANGUAGE_JAPANESE: hConsoleWnd = CreateDialog (hInst,MAKEINTRESOURCE(IDD_DIALOG_CONSOLE),hParentWnd,ConsoleWndProc); break; } ConsoleWndInfoReset(hConsoleWnd); ShowWindow(hConsoleWnd,SW_HIDE); ConsoleWndInfoReset(hConsoleWnd); UpdateWindow(hConsoleWnd); ConsoleWndVerbosityApplyIncDec(0); CheckDlgButton(hConsoleWnd, IDC_CHECKBOX_VALID, ConsoleWndFlag); Edit_LimitText(GetDlgItem(hConsoleWnd,IDC_EDIT), ConsoleWndMaxSize); ConsoleWndInfoApply(); } // Window Procedure static BOOL CALLBACK ConsoleWndProc(HWND hwnd, UINT uMess, WPARAM wParam, LPARAM lParam) { switch (uMess){ case WM_INITDIALOG: PutsConsoleWnd("Console Window\n"); ConsoleWndAllUpdate(); SetWindowPosSize(GetDesktopWindow(),hwnd,ConsoleWndInfo.PosX, ConsoleWndInfo.PosY ); return FALSE; case WM_COMMAND: switch (LOWORD(wParam)) { case IDCLOSE: ShowWindow(hwnd, SW_HIDE); MainWndUpdateConsoleButton(); break; case IDCLEAR: ClearConsoleWnd(); break; case IDC_CHECKBOX_VALID: ConsoleWndValidApply(); break; case IDC_BUTTON_VERBOSITY: ConsoleWndVerbosityApply(); break; case IDC_BUTTON_INC: ConsoleWndVerbosityApplyIncDec(1); break; case IDC_BUTTON_DEC: ConsoleWndVerbosityApplyIncDec(-1); break; default: break; } switch (HIWORD(wParam)) { case EN_ERRSPACE: ClearConsoleWnd(); PutsConsoleWnd("### EN_ERRSPACE -> Clear! ###\n"); break; default: break; } break; case WM_SIZE: ConsoleWndAllUpdate(); return FALSE; case WM_MOVE: // ConsoleWndInfo.PosX = (int) LOWORD(lParam); // ConsoleWndInfo.PosY = (int) HIWORD(lParam); { RECT rc; GetWindowRect(hwnd,&rc); ConsoleWndInfo.PosX = rc.left; ConsoleWndInfo.PosY = rc.top; } break; // See PreDispatchMessage() in w32g2_main.c case WM_SYSKEYDOWN: case WM_KEYDOWN: { int nVirtKey = (int)wParam; switch(nVirtKey){ case VK_ESCAPE: SendMessage(hwnd,WM_CLOSE,0,0); break; } } break; case WM_DESTROY: INISaveConsoleWnd(); break; case WM_CLOSE: ShowSubWindow(hConsoleWnd,0); // ShowWindow(hConsoleWnd, SW_HIDE); MainWndUpdateConsoleButton(); break; case WM_SETFOCUS: HideCaret(hwnd); break; case WM_KILLFOCUS: ShowCaret(hwnd); break; default: return FALSE; } return FALSE; } // puts() void PutsConsoleWnd(char *str) { HWND hwnd; if(!IsWindow(hConsoleWnd) || !ConsoleWndFlag) return; hwnd = GetDlgItem(hConsoleWnd,IDC_EDIT); PutsEditCtlWnd(hwnd,str); } // printf() void PrintfConsoleWnd(char *fmt, ...) { HWND hwnd; va_list ap; if(!IsWindow(hConsoleWnd) || !ConsoleWndFlag) return; hwnd = GetDlgItem(hConsoleWnd,IDC_EDIT); va_start(ap, fmt); VprintfEditCtlWnd(hwnd,fmt,ap); va_end(ap); } // Clear void ClearConsoleWnd(void) { HWND hwnd; if(!IsWindow(hConsoleWnd)) return; hwnd = GetDlgItem(hConsoleWnd,IDC_EDIT); ClearEditCtlWnd(hwnd); } // --------------------------------------------------------------------------- // Static Functions static void ConsoleWndAllUpdate(void) { ConsoleWndVerbosityUpdate(); ConsoleWndValidUpdate(); Edit_LimitText(GetDlgItem(hConsoleWnd,IDC_EDIT_VERBOSITY),3); Edit_LimitText(GetDlgItem(hConsoleWnd,IDC_EDIT),ConsoleWndMaxSize); } static void ConsoleWndValidUpdate(void) { if(ConsoleWndFlag) CheckDlgButton(hConsoleWnd, IDC_CHECKBOX_VALID, 1); else CheckDlgButton(hConsoleWnd, IDC_CHECKBOX_VALID, 0); } static void ConsoleWndValidApply(void) { if(IsDlgButtonChecked(hConsoleWnd,IDC_CHECKBOX_VALID)) ConsoleWndFlag = 1; else ConsoleWndFlag = 0; } static void ConsoleWndVerbosityUpdate(void) { SetDlgItemInt(hConsoleWnd,IDC_EDIT_VERBOSITY,(UINT)ctl->verbosity, TRUE); } static void ConsoleWndVerbosityApply(void) { char buffer[64]; HWND hwnd; hwnd = GetDlgItem(hConsoleWnd,IDC_EDIT_VERBOSITY); if(!IsWindow(hConsoleWnd)) return; if(Edit_GetText(hwnd,buffer,60)<=0) return; ctl->verbosity = atoi(buffer); ConsoleWndVerbosityUpdate(); } static void ConsoleWndVerbosityApplyIncDec(int num) { if(!IsWindow(hConsoleWnd)) return; ctl->verbosity += num; RANGE(ctl->verbosity, -1, 4); ConsoleWndVerbosityUpdate(); } static int ConsoleWndInfoReset(HWND hwnd) { memset(&ConsoleWndInfo,0,sizeof(CONSOLEWNDINFO)); ConsoleWndInfo.PosX = - 1; ConsoleWndInfo.PosY = - 1; return 0; } static int ConsoleWndInfoApply(void) { return 0; } // **************************************************************************** // // List Window // // **************************************************************************** // --------------------------------------------------------------------------- // Macros #define IDM_LISTWND_REMOVE 4101 #define IDM_LISTWND_PLAY 4102 #define IDM_LISTWND_REFINE 4103 #define IDM_LISTWND_UNIQ 4104 #define IDM_LISTWND_CLEAR 4105 #define IDM_LISTWND_CHOOSEFONT 4106 #define IDM_LISTWND_CURRENT 4107 #define IDM_LISTWND_SEARCH 4108 // --------------------------------------------------------------------------- // Variables LISTWNDINFO ListWndInfo; HWND hListSearchWnd = NULL; // --------------------------------------------------------------------------- // Prototypes static BOOL CALLBACK ListWndProc(HWND hwnd, UINT uMess, WPARAM wParam, LPARAM lParam); static int ListWndInfoReset(HWND hwnd); static int ListWndInfoApply(void); static int ListWndSetFontListBox(char *fontName, int fontWidth, int fontHeght); static int ResetListWnd(void); static int ClearListWnd(void); static int UniqListWnd(void); static int RefineListWnd(void); static int DelListWnd(int nth); // --------------------------------------------------------------------------- // Grobal Functions void InitListWnd(HWND hParentWnd) { if (hListWnd != NULL) { DestroyWindow(hListWnd); hListWnd = NULL; } ListWndInfoReset(hListWnd); INILoadListWnd(); switch(PlayerLanguage){ case LANGUAGE_ENGLISH: hListWnd = CreateDialog (hInst,MAKEINTRESOURCE(IDD_DIALOG_SIMPLE_LIST_EN),hParentWnd,ListWndProc); break; default: case LANGUAGE_JAPANESE: hListWnd = CreateDialog (hInst,MAKEINTRESOURCE(IDD_DIALOG_SIMPLE_LIST),hParentWnd,ListWndProc); break; } ListWndInfoReset(hListWnd); ListWndInfo.hPopupMenu = CreatePopupMenu(); switch(PlayerLanguage){ case LANGUAGE_JAPANESE: AppendMenu(ListWndInfo.hPopupMenu,MF_STRING,IDM_LISTWND_PLAY,"t"); AppendMenu(ListWndInfo.hPopupMenu,MF_STRING,IDC_BUTTON_DOC,"hLg"); AppendMenu(ListWndInfo.hPopupMenu,MF_SEPARATOR,0,0); AppendMenu(ListWndInfo.hPopupMenu,MF_STRING,IDM_LISTWND_CURRENT,"݈ʒu"); AppendMenu(ListWndInfo.hPopupMenu,MF_STRING,IDM_LISTWND_SEARCH,""); AppendMenu(ListWndInfo.hPopupMenu,MF_SEPARATOR,0,0); AppendMenu(ListWndInfo.hPopupMenu,MF_STRING,IDM_LISTWND_REMOVE,"폜"); AppendMenu(ListWndInfo.hPopupMenu,MF_SEPARATOR,0,0); AppendMenu(ListWndInfo.hPopupMenu,MF_STRING,IDM_LISTWND_CHOOSEFONT,"tHg̑I"); break; default: case LANGUAGE_ENGLISH: AppendMenu(ListWndInfo.hPopupMenu,MF_STRING,IDM_LISTWND_PLAY,"Play"); AppendMenu(ListWndInfo.hPopupMenu,MF_STRING,IDC_BUTTON_DOC,"Doc"); AppendMenu(ListWndInfo.hPopupMenu,MF_SEPARATOR,0,0); AppendMenu(ListWndInfo.hPopupMenu,MF_STRING,IDM_LISTWND_CURRENT,"Current item"); AppendMenu(ListWndInfo.hPopupMenu,MF_STRING,IDM_LISTWND_SEARCH,"Search"); AppendMenu(ListWndInfo.hPopupMenu,MF_SEPARATOR,0,0); AppendMenu(ListWndInfo.hPopupMenu,MF_STRING,IDM_LISTWND_REMOVE,"Remove"); AppendMenu(ListWndInfo.hPopupMenu,MF_SEPARATOR,0,0); AppendMenu(ListWndInfo.hPopupMenu,MF_STRING,IDM_LISTWND_CHOOSEFONT,"Choose Font"); break; } INILoadListWnd(); ListWndInfoApply(); ShowWindow(ListWndInfo.hwnd,SW_HIDE); UpdateWindow(ListWndInfo.hwnd); w32g_send_rc(RC_EXT_UPDATE_PLAYLIST, 0); } // --------------------------------------------------------------------------- // Static Functions void SetNumListWnd(int cursel, int nfiles); #define WM_CHOOSEFONT_DIAG (WM_APP+100) #define WM_LIST_SEARCH_DIAG (WM_APP+101) #define LISTWND_HORIZONTALEXTENT 1600 static BOOL CALLBACK ListWndProc(HWND hwnd, UINT uMess, WPARAM wParam, LPARAM lParam) { static BOOL ListSearchWndShow; switch (uMess){ case WM_INITDIALOG: ListSearchWndShow = 0; InitListSearchWnd(hwnd); SendDlgItemMessage(hwnd,IDC_LISTBOX_PLAYLIST, LB_SETHORIZONTALEXTENT,(WPARAM)LISTWND_HORIZONTALEXTENT,0); w32g_send_rc(RC_EXT_UPDATE_PLAYLIST, 0); SetWindowPosSize(GetDesktopWindow(),hwnd,ListWndInfo.PosX, ListWndInfo.PosY ); return FALSE; case WM_DESTROY: { RECT rc; GetWindowRect(hwnd,&rc); ListWndInfo.Width = rc.right - rc.left; ListWndInfo.Height = rc.bottom - rc.top; } DestroyMenu(ListWndInfo.hPopupMenu); ListWndInfo.hPopupMenu = NULL; INISaveListWnd(); break; /* }EX͂Lv`ĂȂ߂̏ */ case WM_SETCURSOR: switch(HIWORD(lParam)){ case WM_RBUTTONDOWN: if(LOWORD(lParam)!=HTCAPTION){ // ^Cgo[ɂȂƂ POINT point; int res; GetCursorPos(&point); SetForegroundWindow ( hwnd ); res = TrackPopupMenu(ListWndInfo.hPopupMenu,TPM_TOPALIGN|TPM_LEFTALIGN, point.x,point.y,0,hwnd,NULL); PostMessage ( hwnd, WM_NULL, 0, 0 ); return TRUE; } break; default: break; } break; case WM_CHOOSEFONT_DIAG: { char fontName[64]; int fontHeight; int fontWidth; strcpy(fontName,ListWndInfo.fontName); fontHeight = ListWndInfo.fontHeight; fontWidth = ListWndInfo.fontWidth; if(DlgChooseFont(hwnd,fontName,&fontHeight,&fontWidth)==0){ ListWndSetFontListBox(fontName,fontWidth,fontHeight); } } break; case WM_LIST_SEARCH_DIAG: ShowListSearch(); break; case WM_COMMAND: switch (HIWORD(wParam)) { case IDCLOSE: ShowWindow(hwnd, SW_HIDE); MainWndUpdateListButton(); break; case LBN_DBLCLK: SendMessage(hwnd,WM_COMMAND,(WPARAM)IDM_LISTWND_PLAY,0); return FALSE; case LBN_SELCHANGE: { int idListBox = (int) LOWORD(wParam); HWND hwndListBox = (HWND) lParam; int selected, nfiles, cursel; w32g_get_playlist_index(&selected,&nfiles,&cursel); SetNumListWnd(cursel,nfiles); return FALSE; } default: break; } switch (LOWORD(wParam)) { case IDC_BUTTON_CLEAR: if(MessageBox(hListWnd,"Clear playlist?","Playlist", MB_YESNO)==IDYES) w32g_send_rc(RC_EXT_CLEAR_PLAYLIST, 0); return FALSE; case IDC_BUTTON_REFINE: if(MessageBox(hListWnd, "Remove unsupported file types from the playlist?", "Playlist",MB_YESNO) == IDYES) w32g_send_rc(RC_EXT_REFINE_PLAYLIST, 0); return FALSE; case IDC_BUTTON_UNIQ: if(MessageBox(hListWnd, "Remove the same files from the playlist and make files of the playlist unique?", "Playlist",MB_YESNO)==IDYES) w32g_send_rc(RC_EXT_UNIQ_PLAYLIST, 0); return FALSE; case IDM_LISTWND_REMOVE: w32g_send_rc(RC_EXT_DELETE_PLAYLIST, 0); break; case IDC_BUTTON_DOC: { int cursel; w32g_get_playlist_index(NULL, NULL, &cursel); w32g_send_rc(RC_EXT_OPEN_DOC, cursel); } break; case IDM_LISTWND_PLAY: { int new_cursel = SendDlgItemMessage(hwnd,IDC_LISTBOX_PLAYLIST,LB_GETCURSEL,0,0); int selected, nfiles, cursel; w32g_get_playlist_index(&selected, &nfiles, &cursel); if ( nfiles <= new_cursel ) new_cursel = nfiles - 1; if ( new_cursel >= 0 ) w32g_send_rc(RC_EXT_JUMP_FILE, new_cursel ); } return FALSE; case IDM_LISTWND_CHOOSEFONT: { SendMessage(hwnd,WM_CHOOSEFONT_DIAG,0,0); } return FALSE; case IDM_LISTWND_CURRENT: { int selected, nfiles, cursel; w32g_get_playlist_index(&selected, &nfiles, &cursel); SendDlgItemMessage(hwnd,IDC_LISTBOX_PLAYLIST, LB_SETCURSEL,(WPARAM)selected,0); SetNumListWnd(selected,nfiles); } return FALSE; case IDM_LISTWND_SEARCH: { SendMessage(hwnd,WM_LIST_SEARCH_DIAG,0,0); } return FALSE; default: break; } break; case WM_VKEYTOITEM: { UINT vkey = (UINT)LOWORD(wParam); int nCaretPos = (int)HIWORD(wParam); switch(vkey){ case VK_SPACE: case VK_RETURN: w32g_send_rc(RC_EXT_JUMP_FILE, nCaretPos); return -2; case 0x50: // VK_P SendMessage(hMainWnd,WM_COMMAND,MAKEWPARAM(IDM_PREV,0),0); return -2; case 0x4e: // VK_N SendMessage(hMainWnd,WM_COMMAND,MAKEWPARAM(IDM_NEXT,0),0); return -2; case 0x45: // VK_E SendMessage(hMainWnd,WM_COMMAND,MAKEWPARAM(IDM_STOP,0),0); return -2; case 0x53: // VK_S SendMessage(hMainWnd,WM_COMMAND,MAKEWPARAM(IDM_PAUSE,0),0); return -2; case VK_ESCAPE: SendMessage(hListWnd,WM_COMMAND,MAKEWPARAM(0,IDCLOSE),0); return -2; case 0x51: // VK_Q if(MessageBox(hListWnd,"Quit TiMidity?","TiMidity",MB_ICONQUESTION|MB_YESNO)==IDYES) SendMessage(hMainWnd,WM_CLOSE,0,0); return -2; case VK_BACK: w32g_send_rc(RC_EXT_DELETE_PLAYLIST, -1); return -2; case 0x44: // VK_D w32g_send_rc(RC_EXT_DELETE_PLAYLIST, 0); return -2; case VK_DELETE: w32g_send_rc(RC_EXT_ROTATE_PLAYLIST, -1); return -2; case VK_INSERT: w32g_send_rc(RC_EXT_ROTATE_PLAYLIST, 1); return -2; case 0x46: // VK_F return -2; case 0x42: // VK_B return -2; case 0x4D: // VK_M SendMessage(hListWnd,WM_COMMAND,MAKEWPARAM(IDC_BUTTON_REFINE,0),0); return -2; case 0x43: // VK_C SendMessage(hListWnd,WM_COMMAND,MAKEWPARAM(IDC_BUTTON_CLEAR,0),0); return -2; case 0x55: // VK_U SendMessage(hListWnd,WM_COMMAND,MAKEWPARAM(IDC_BUTTON_UNIQ,0),0); return -2; case 0x56: // VK_V SendMessage(hListWnd,WM_COMMAND,MAKEWPARAM(IDC_BUTTON_DOC,0),0); return -2; case 0x57: // VK_W SendMessage(hMainWnd,WM_COMMAND,MAKEWPARAM(IDM_WRD,0),0); return -2; case VK_F1: case 0x48: // VK_H if ( PlayerLanguage == LANGUAGE_JAPANESE ){ MessageBox(hListWnd, "L[R}h\n" "XgEChER}h\n" " ESC: wv‚ H: wvo\n" " V: hLg W: WRD EChEJ\n" "vC[R}h\n" " SPACE/ENTER: tJn E: ~ S: ꎞ~\n" " P: Ő N: ̋\n" "vCXgR}h\n" " M: MIDIt@CȊO폜 U: dt@C폜\n" " C: vCXg̃NA\n" " D: J[\̋Ȃ폜 BS: J[\̑ŐȂ폜\n" " INS: J[\̋ȂXg̍ŌɈڂ (Push)\n" " DEL: Xg̍Ō̋ȂJ[\̑Oɑ} (Pop)\n" "TiMidity R}h\n" " Q: I\n" ,"wv", MB_OK); } else { MessageBox(hListWnd, "Usage of key.\n" "List window command.\n" " ESC: Close Help H: Help\n" " V: View Document W: Open WRD window\n" "Player command.\n" " SPACE/ENTER: PLAY E: Stop S: Pause\n" " P: Prev N: Next\n" "Playlist command.\n" " M: Refine playlist U: Uniq playlist\n" " C: Clear playlist\n" " D: Remove playlist BS: Remove previous playlist\n" " INS: Push Playlist DEL: Pop Playlist\n" "TiMidity command.\n" " Q: Quit\n" ,"Help", MB_OK); } return -2; default: break; } return -1; } case WM_SIZE: switch(wParam){ case SIZE_MAXIMIZED: case SIZE_RESTORED: { // Ȃ񂩈ӖȂʓ|(^^;; int x,y,cx,cy; int maxHeight = 0; int center, idControl; HWND hwndChild; RECT rcParent, rcChild, rcRest; int nWidth = LOWORD(lParam); int nHeight = HIWORD(lParam); GetWindowRect(hwnd,&rcParent); cx = rcParent.right-rcParent.left; cy = rcParent.bottom-rcParent.top; if(cx < 380) MoveWindow(hwnd,rcParent.left,rcParent.top,380,cy,TRUE); if(cy < 200) MoveWindow(hwnd,rcParent.left,rcParent.top,cx,200,TRUE); GetClientRect(hwnd,&rcParent); rcRest.left = rcParent.left; rcRest.right = rcParent.right; // IDC_EDIT_NUM idControl = IDC_EDIT_NUM; hwndChild = GetDlgItem(hwnd,idControl); GetWindowRect(hwndChild,&rcChild); cx = rcChild.right-rcChild.left; cy = rcChild.bottom-rcChild.top; x = rcParent.left; y = rcParent.bottom - cy; MoveWindow(hwndChild,x,y,cx,cy,TRUE); if(cy>maxHeight) maxHeight = cy; rcRest.left += cx; // IDC_BUTTON_DOC idControl = IDC_BUTTON_DOC; hwndChild = GetDlgItem(hwnd,idControl); GetWindowRect(hwndChild,&rcChild); cx = rcChild.right-rcChild.left; cy = rcChild.bottom-rcChild.top; x = rcRest.left + 10; y = rcParent.bottom - cy; MoveWindow(hwndChild,x,y,cx,cy,TRUE); if(cy>maxHeight) maxHeight = cy; rcRest.left += cx; // IDC_BUTTON_CLEAR idControl = IDC_BUTTON_CLEAR; hwndChild = GetDlgItem(hwnd,idControl); GetWindowRect(hwndChild,&rcChild); cx = rcChild.right-rcChild.left; cy = rcChild.bottom-rcChild.top; x = rcParent.right - cx - 5; y = rcParent.bottom - cy ; MoveWindow(hwndChild,x,y,cx,cy,TRUE); if(cy>maxHeight) maxHeight = cy; rcRest.right -= cx + 5; // IDC_BUTTON_UNIQ center = rcRest.left + (int)((rcRest.right - rcRest.left)*0.52); idControl = IDC_BUTTON_UNIQ; hwndChild = GetDlgItem(hwnd,idControl); GetWindowRect(hwndChild,&rcChild); cx = rcChild.right-rcChild.left; cy = rcChild.bottom-rcChild.top; x = center - cx; y = rcParent.bottom - cy; MoveWindow(hwndChild,x,y,cx,cy,TRUE); if(cy>maxHeight) maxHeight = cy; // IDC_BUTTON_REFINE idControl = IDC_BUTTON_REFINE; hwndChild = GetDlgItem(hwnd,idControl); GetWindowRect(hwndChild,&rcChild); cx = rcChild.right-rcChild.left; cy = rcChild.bottom-rcChild.top; x = center + 3; y = rcParent.bottom - cy; MoveWindow(hwndChild,x,y,cx,cy,TRUE); if(cy>maxHeight) maxHeight = cy; // IDC_LISTBOX_PLAYLIST idControl = IDC_LISTBOX_PLAYLIST; hwndChild = GetDlgItem(hwnd,idControl); cx = rcParent.right - rcParent.left; cy = rcParent.bottom - rcParent.top - maxHeight - 3; x = rcParent.left; y = rcParent.top; MoveWindow(hwndChild,x,y,cx,cy,TRUE); InvalidateRect(hwnd,&rcParent,FALSE); UpdateWindow(hwnd); GetWindowRect(hwnd,&rcParent); ListWndInfo.Width = rcParent.right - rcParent.left; ListWndInfo.Height = rcParent.bottom - rcParent.top; break; } case SIZE_MINIMIZED: case SIZE_MAXHIDE: case SIZE_MAXSHOW: default: break; } break; case WM_MOVE: // ListWndInfo.PosX = (int) LOWORD(lParam); // ListWndInfo.PosY = (int) HIWORD(lParam); { RECT rc; GetWindowRect(hwnd,&rc); ListWndInfo.PosX = rc.left; ListWndInfo.PosY = rc.top; } break; // See PreDispatchMessage() in w32g2_main.c case WM_SYSKEYDOWN: case WM_KEYDOWN: { int nVirtKey = (int)wParam; switch(nVirtKey){ case VK_ESCAPE: SendMessage(hwnd,WM_CLOSE,0,0); break; } } break; case WM_CLOSE: ShowSubWindow(hListWnd,0); // ShowWindow(hListWnd, SW_HIDE); MainWndUpdateListButton(); break; case WM_SHOWWINDOW: { BOOL fShow = (BOOL)wParam; if ( fShow ) { if ( ListSearchWndShow ) { ShowListSearch(); } else { HideListSearch(); } } else { if ( IsWindowVisible ( hListSearchWnd ) ) ListSearchWndShow = TRUE; else ListSearchWndShow = FALSE; HideListSearch(); } } break; case WM_DROPFILES: SendMessage(hMainWnd,WM_DROPFILES,wParam,lParam); return 0; default: return FALSE; } return FALSE; } static int ListWndInfoReset(HWND hwnd) { memset(&ListWndInfo,0,sizeof(LISTWNDINFO)); ListWndInfo.PosX = - 1; ListWndInfo.PosY = - 1; ListWndInfo.Height = 400; ListWndInfo.Width = 400; ListWndInfo.hPopupMenu = NULL; ListWndInfo.hwnd = hwnd; if ( hwnd != NULL ) ListWndInfo.hwndListBox = GetDlgItem(hwnd,IDC_LISTBOX_PLAYLIST); strcpy(ListWndInfo.fontNameEN,"Times New Roman"); strcpy(ListWndInfo.fontNameJA,"lr "); ListWndInfo.fontHeight = 12; ListWndInfo.fontWidth = 6; ListWndInfo.fontFlags = FONT_FLAGS_FIXED; switch(PlayerLanguage){ case LANGUAGE_ENGLISH: ListWndInfo.fontName = ListWndInfo.fontNameEN; break; default: case LANGUAGE_JAPANESE: ListWndInfo.fontName = ListWndInfo.fontNameJA; break; } return 0; } static int ListWndInfoApply(void) { RECT rc; HFONT hFontPre = NULL; DWORD fdwPitch = (ListWndInfo.fontFlags&FONT_FLAGS_FIXED)?FIXED_PITCH:VARIABLE_PITCH; DWORD fdwItalic = (ListWndInfo.fontFlags&FONT_FLAGS_ITALIC)?TRUE:FALSE; HFONT hFont = CreateFont(ListWndInfo.fontHeight,ListWndInfo.fontWidth,0,0,FW_DONTCARE,fdwItalic,FALSE,FALSE, DEFAULT_CHARSET,OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY, fdwPitch | FF_DONTCARE,ListWndInfo.fontName); if(hFont != NULL){ hFontPre = ListWndInfo.hFontListBox; ListWndInfo.hFontListBox = hFont; SendMessage(ListWndInfo.hwndListBox,WM_SETFONT,(WPARAM)ListWndInfo.hFontListBox,(LPARAM)MAKELPARAM(TRUE,0)); } GetWindowRect(ListWndInfo.hwnd,&rc); MoveWindow(ListWndInfo.hwnd,rc.left,rc.top,ListWndInfo.Width,ListWndInfo.Height,TRUE); // InvalidateRect(hwnd,&rc,FALSE); // UpdateWindow(hwnd); if(hFontPre!=NULL) CloseHandle(hFontPre); INISaveListWnd(); return 0; } static int ListWndSetFontListBox(char *fontName, int fontWidth, int fontHeight) { strcpy(ListWndInfo.fontName,fontName); ListWndInfo.fontWidth = fontWidth; ListWndInfo.fontHeight = fontHeight; ListWndInfoApply(); return 0; } void SetNumListWnd(int cursel, int nfiles) { char buff[64]; sprintf(buff,"%04d/%04d",cursel+1,nfiles); SetDlgItemText(hListWnd,IDC_EDIT_NUM,buff); } #if 0 // *************************************************************************** // Tracer Window BOOL CALLBACK TracerWndProc(HWND hwnd, UINT uMess, WPARAM wParam, LPARAM lParam); void InitTracerWnd(HWND hParentWnd) { if (hTracerWnd != NULL) { DestroyWindow(hTracerWnd); hTracerWnd = NULL; } hTracerWnd = CreateDialog (hInst,MAKEINTRESOURCE(IDD_DIALOG_TRACER),hParentWnd,TracerWndProc); ShowWindow(hTracerWnd,SW_HIDE); UpdateWindow(hTracerWnd); } BOOL CALLBACK TracerWndProc(HWND hwnd, UINT uMess, WPARAM wParam, LPARAM lParam) { switch (uMess){ case WM_INITDIALOG: return FALSE; case WM_COMMAND: switch (LOWORD(wParam)) { case IDCLOSE: ShowWindow(hwnd, SW_HIDE); MainWndUpdateTracerButton(); break; default: return FALSE; } case WM_SIZE: return FALSE; case WM_CLOSE: ShowWindow(hTracerWnd, SW_HIDE); MainWndUpdateTracerButton(); break; default: return FALSE; } return FALSE; } #endif //**************************************************************************** // Doc Window #define IDM_DOCWND_CHOOSEFONT 4232 int DocWndIndependent = 0; /* Independent document viewer mode.(ƗhLgr[[h) */ int DocWndAutoPopup = 0; DOCWNDINFO DocWndInfo; static BOOL CALLBACK DocWndProc(HWND hwnd, UINT uMess, WPARAM wParam, LPARAM lParam); static void InitDocEditWnd(HWND hParentWnd); static void DocWndConvertText(char *in, int in_size, char *out, int out_size); static void DocWndSetText(char *text, int text_size); static void DocWndSetInfo(char *info, char *filename); static void DocWndInfoInit(void); static int DocWndInfoLock(void); static void DocWndInfoUnLock(void); void InitDocWnd(HWND hParentWnd); void DocWndInfoReset(void); void DocWndAddDocFile(char *filename); void DocWndSetMidifile(char *filename); void DocWndReadDoc(int num); void DocWndReadDocNext(void); void DocWndReadDocPrev(void); static int DocWndInfoReset2(HWND hwnd); static int DocWndInfoApply(void); static int DocWndSetFontEdit(char *fontName, int fontWidth, int fontHeight); void InitDocWnd(HWND hParentWnd) { HMENU hMenu; HICON hIcon; if (hDocWnd != NULL) { DestroyWindow(hDocWnd); hDocWnd = NULL; } DocWndInfoReset2(hDocWnd); INILoadDocWnd(); switch(PlayerLanguage){ case LANGUAGE_ENGLISH: hDocWnd = CreateDialog (hInst,MAKEINTRESOURCE(IDD_DIALOG_DOC_EN),hParentWnd,DocWndProc); break; default: case LANGUAGE_JAPANESE: hDocWnd = CreateDialog (hInst,MAKEINTRESOURCE(IDD_DIALOG_DOC),hParentWnd,DocWndProc); break; } hIcon = LoadImage(hInst, MAKEINTRESOURCE(IDI_ICON_TIMIDITY), IMAGE_ICON, 16, 16, 0); if (hIcon!=NULL) SendMessage(hDocWnd,WM_SETICON,FALSE,(LPARAM)hIcon); DocWndInfoReset2(hDocWnd); hMenu = GetSystemMenu(DocWndInfo.hwnd,FALSE); switch(PlayerLanguage){ case LANGUAGE_JAPANESE: AppendMenu(hMenu,MF_SEPARATOR,0,0); AppendMenu(hMenu,MF_STRING,IDM_DOCWND_CHOOSEFONT,"tHg̑I"); break; default: case LANGUAGE_ENGLISH: AppendMenu(hMenu,MF_SEPARATOR,0,0); AppendMenu(hMenu,MF_STRING,IDM_DOCWND_CHOOSEFONT,"Choose Font"); break; } DocWndInfoReset2(hDocWnd); INILoadDocWnd(); DocWndInfoApply(); ShowWindow(hDocWnd,SW_HIDE); UpdateWindow(hDocWnd); EnableWindow(GetDlgItem(hDocWnd,IDC_BUTTON_PREV),FALSE); EnableWindow(GetDlgItem(hDocWnd,IDC_BUTTON_NEXT),FALSE); } static BOOL CALLBACK DocWndProc(HWND hwnd, UINT uMess, WPARAM wParam, LPARAM lParam) { switch (uMess){ case WM_INITDIALOG: PutsDocWnd("Doc Window\n"); DocWndInfoInit(); SetWindowPosSize(GetDesktopWindow(),hwnd,DocWndInfo.PosX, DocWndInfo.PosY ); return FALSE; case WM_DESTROY: { RECT rc; GetWindowRect(hwnd,&rc); DocWndInfo.Width = rc.right - rc.left; DocWndInfo.Height = rc.bottom - rc.top; } INISaveDocWnd(); break; case WM_SYSCOMMAND: switch(wParam){ case IDM_DOCWND_CHOOSEFONT: { char fontName[64]; int fontHeight; int fontWidth; strcpy(fontName,DocWndInfo.fontName); fontHeight = DocWndInfo.fontHeight; fontWidth = DocWndInfo.fontWidth; if(DlgChooseFont(hwnd,fontName,&fontHeight,&fontWidth)==0){ DocWndSetFontEdit(fontName,fontWidth,fontHeight); } break; } break; default: break; } case WM_COMMAND: switch (LOWORD(wParam)) { case IDCLOSE: ShowWindow(hwnd, SW_HIDE); MainWndUpdateDocButton(); break; case IDCLEAR: ClearDocWnd(); break; default: break; } switch (LOWORD(wParam)) { case IDC_BUTTON_NEXT: DocWndReadDocNext(); break; case IDC_BUTTON_PREV: DocWndReadDocPrev(); break; default: break; } return FALSE; // See PreDispatchMessage() in w32g2_main.c case WM_SYSKEYDOWN: case WM_KEYDOWN: { int nVirtKey = (int)wParam; switch(nVirtKey){ case VK_ESCAPE: SendMessage(hwnd,WM_CLOSE,0,0); break; } } break; case WM_CLOSE: ShowSubWindow(hDocWnd,0); // ShowWindow(hDocWnd, SW_HIDE); MainWndUpdateDocButton(); break; case WM_SIZE: switch(wParam){ case SIZE_MAXIMIZED: case SIZE_RESTORED: { // Ȃ񂩈ӖȂʓ|(^^;; int x,y,cx,cy; int max = 0; int width; RECT rcParent; RECT rcEDIT_INFO, rcEDIT_FILENAME, rcBUTTON_PREV, rcBUTTON_NEXT, rcEDIT; HWND hwndEDIT_INFO, hwndEDIT_FILENAME, hwndBUTTON_PREV, hwndBUTTON_NEXT, hwndEDIT; int nWidth = LOWORD(lParam); int nHeight = HIWORD(lParam); GetWindowRect(hwnd,&rcParent); cx = rcParent.right-rcParent.left; cy = rcParent.bottom-rcParent.top; if(cx < 300) MoveWindow(hwnd,rcParent.left,rcParent.top,300,cy,TRUE); if(cy < 200) MoveWindow(hwnd,rcParent.left,rcParent.top,cx,200,TRUE); GetClientRect(hwnd,&rcParent); hwndEDIT = GetDlgItem(hwnd,IDC_EDIT); hwndEDIT_INFO = GetDlgItem(hwnd,IDC_EDIT_INFO); hwndEDIT_FILENAME = GetDlgItem(hwnd,IDC_EDIT_FILENAME); hwndBUTTON_PREV = GetDlgItem(hwnd,IDC_BUTTON_PREV); hwndBUTTON_NEXT = GetDlgItem(hwnd,IDC_BUTTON_NEXT); GetWindowRect(hwndEDIT,&rcEDIT); GetWindowRect(hwndEDIT_INFO,&rcEDIT_INFO); GetWindowRect(hwndEDIT_FILENAME,&rcEDIT_FILENAME); GetWindowRect(hwndBUTTON_PREV,&rcBUTTON_PREV); GetWindowRect(hwndBUTTON_NEXT,&rcBUTTON_NEXT); width = rcParent.right - rcParent.left; cx = rcBUTTON_NEXT.right-rcBUTTON_NEXT.left; cy = rcBUTTON_NEXT.bottom-rcBUTTON_NEXT.top; x = rcParent.right - cx - 5; y = rcParent.bottom - cy; MoveWindow(hwndBUTTON_NEXT,x,y,cx,cy,TRUE); width -= cx + 5; if(cy>max) max = cy; cx = rcBUTTON_PREV.right-rcBUTTON_PREV.left; cy = rcBUTTON_PREV.bottom-rcBUTTON_PREV.top; x -= cx + 5; y = rcParent.bottom - cy; MoveWindow(hwndBUTTON_PREV,x,y,cx,cy,TRUE); width -= cx; if(cy>max) max = cy; width -= 5; // cx = rcEDIT_INFO.right-rcEDIT_INFO.left; cx = (int)(width * 0.36); cy = rcEDIT_INFO.bottom-rcEDIT_INFO.top; x = rcParent.left; y = rcParent.bottom - cy; MoveWindow(hwndEDIT_INFO,x,y,cx,cy,TRUE); if(cy>max) max = cy; x += cx + 5; // cx = rcEDIT_FILENAME.right-rcEDIT_FILENAME.left; cx = (int)(width * 0.56); cy = rcEDIT_FILENAME.bottom-rcEDIT_FILENAME.top; y = rcParent.bottom - cy; MoveWindow(hwndEDIT_FILENAME,x,y,cx,cy,TRUE); if(cy>max) max = cy; cx = rcParent.right - rcParent.left; cy = rcParent.bottom - rcParent.top - max - 5; x = rcParent.left; y = rcParent.top; MoveWindow(hwndEDIT,x,y,cx,cy,TRUE); InvalidateRect(hwnd,&rcParent,FALSE); UpdateWindow(hwnd); GetWindowRect(hwnd,&rcParent); DocWndInfo.Width = rcParent.right - rcParent.left; DocWndInfo.Height = rcParent.bottom - rcParent.top; break; } case SIZE_MINIMIZED: case SIZE_MAXHIDE: case SIZE_MAXSHOW: default: break; } break; case WM_MOVE: // DocWndInfo.PosX = (int) LOWORD(lParam); // DocWndInfo.PosY = (int) HIWORD(lParam); { RECT rc; GetWindowRect(hwnd,&rc); DocWndInfo.PosX = rc.left; DocWndInfo.PosY = rc.top; } break; default: return FALSE; } return FALSE; } static int DocWndInfoReset2(HWND hwnd) { // memset(&DocWndInfo,0,sizeof(DOCWNDINFO)); DocWndInfo.PosX = - 1; DocWndInfo.PosY = - 1; DocWndInfo.Height = 400; DocWndInfo.Width = 400; DocWndInfo.hPopupMenu = NULL; DocWndInfo.hwnd = hwnd; if ( hwnd != NULL ) DocWndInfo.hwndEdit = GetDlgItem(hwnd,IDC_EDIT); strcpy(DocWndInfo.fontNameEN,"Times New Roman"); strcpy(DocWndInfo.fontNameJA,"lr "); DocWndInfo.fontHeight = 12; DocWndInfo.fontWidth = 6; DocWndInfo.fontFlags = FONT_FLAGS_FIXED; switch(PlayerLanguage){ case LANGUAGE_ENGLISH: DocWndInfo.fontName = DocWndInfo.fontNameEN; break; default: case LANGUAGE_JAPANESE: DocWndInfo.fontName = DocWndInfo.fontNameJA; break; } return 0; } static int DocWndInfoApply(void) { RECT rc; HFONT hFontPre = NULL; DWORD fdwPitch = (DocWndInfo.fontFlags&FONT_FLAGS_FIXED)?FIXED_PITCH:VARIABLE_PITCH; DWORD fdwItalic = (DocWndInfo.fontFlags&FONT_FLAGS_ITALIC)?TRUE:FALSE; HFONT hFont = CreateFont(DocWndInfo.fontHeight,DocWndInfo.fontWidth,0,0,FW_DONTCARE,fdwItalic,FALSE,FALSE, DEFAULT_CHARSET,OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY, fdwPitch | FF_DONTCARE,DocWndInfo.fontName); if(hFont != NULL){ hFontPre = DocWndInfo.hFontEdit; DocWndInfo.hFontEdit = hFont; SendMessage(DocWndInfo.hwndEdit,WM_SETFONT,(WPARAM)DocWndInfo.hFontEdit,(LPARAM)MAKELPARAM(TRUE,0)); } GetWindowRect(DocWndInfo.hwnd,&rc); MoveWindow(DocWndInfo.hwnd,rc.left,rc.top,DocWndInfo.Width,DocWndInfo.Height,TRUE); // InvalidateRect(hwnd,&rc,FALSE); // UpdateWindow(hwnd); if(hFontPre!=NULL) CloseHandle(hFontPre); INISaveDocWnd(); return 0; } static int DocWndSetFontEdit(char *fontName, int fontWidth, int fontHeight) { strcpy(DocWndInfo.fontName,fontName); DocWndInfo.fontWidth = fontWidth; DocWndInfo.fontHeight = fontHeight; DocWndInfoApply(); return 0; } static char ControlCode[] = "@ABCDEFGHIJKLMNOPQRS"; static void DocWndConvertText(char *in, int in_size, char *out, int out_size) { char *buffer = (char *)safe_malloc(sizeof(char)*out_size); int buffer_size = out_size; int i=0, j=0; int nl = 0; // Convert Return Code CR, LF -> CR+LF , // Control Code -> ^? (^@, ^A, ^B, ...). // stage1: for(;;){ if(i>=in_size || j>=buffer_size-1) goto stage1_end; if(nl==13){ if(in[i]==13){ if(j>=buffer_size-2) goto stage1_end; buffer[j++] = 13; buffer[j++] = 10; i++; nl = 13; continue; } if(in[i]==10){ if(j>=buffer_size-2) goto stage1_end; buffer[j++] = 13; buffer[j++] = 10; i++; nl = 0; continue; } if(j>=buffer_size-2) goto stage1_end; buffer[j++] = 13; buffer[j++] = 10; if(in[i]>=0 && in[i]<=0x1f && in[i]!='\t'){ if(j>=buffer_size-2) goto stage1_end; buffer[j++] = '^'; buffer[j++] = ControlCode[in[i]]; } else { if(j>=buffer_size-1) goto stage1_end; buffer[j++] = in[i]; } i++; nl = 0; continue; } if(nl==10){ if(in[i]==13||in[i]==10){ if(j>=buffer_size-2) goto stage1_end; buffer[j++] = 13; buffer[j++] = 10; nl = in[i]; i++; continue; } if(j>=buffer_size-2) goto stage1_end; buffer[j++] = 13; buffer[j++] = 10; if(in[i]>=0 && in[i]<=0x1f && in[i]!='\t'){ if(j>=buffer_size-2) goto stage1_end; buffer[j++] = '^'; buffer[j++] = ControlCode[in[i]]; } else { if(j>=buffer_size-1) goto stage1_end; buffer[j++] = in[i]; } i++; nl = 0; continue; } if(in[i]==13||in[i]==10){ nl = in[i]; i++; continue; } if(in[i]>=0 && in[i]<=0x1f && in[i]!='\t'){ if(j>=buffer_size-2) goto stage1_end; buffer[j++] = '^'; buffer[j++] = ControlCode[in[i]]; } else { if(j>=buffer_size-1) goto stage1_end; buffer[j++] = in[i]; } i++; nl = 0; continue; } stage1_end: buffer[j] = '\0'; // Convert KANJI Code. // stage2: #ifndef MAX2 #define MAX2(x,y) ((x)>=(y)?(x):(y)) #endif switch(PlayerLanguage){ case LANGUAGE_ENGLISH: default: strncpy(out,buffer,MAX2(buffer_size-1,out_size-1)); out[out_size-1] = '\0'; break; case LANGUAGE_JAPANESE: strncpy(out,buffer,MAX2(buffer_size-1,out_size-1)); nkf_convert(buffer,out,out_size-1,NULL,"SJIS"); out[out_size-1] = '\0'; break; } } #define BUFFER_SIZE (1024*64) static void DocWndSetText(char *text, int text_size) { char buffer[BUFFER_SIZE]; int buffer_size = BUFFER_SIZE; if(!IsWindow(hDocWnd) || !DocWndFlag) return; if(DocWndInfoLock()==FALSE) return; // Edit_SetText(GetDlgItem(hDocWnd,IDC_EDIT),text); DocWndConvertText(text,text_size,buffer,buffer_size); Edit_SetText(GetDlgItem(hDocWnd,IDC_EDIT),buffer); DocWndInfoUnLock(); } static void DocWndSetInfo(char *info, char *filename) { int buffer_size = BUFFER_SIZE; if(!IsWindow(hDocWnd) || !DocWndFlag) return; if(DocWndInfoLock()==FALSE) return; Edit_SetText(GetDlgItem(hDocWnd,IDC_EDIT_INFO),info); Edit_SetText(GetDlgItem(hDocWnd,IDC_EDIT_FILENAME),filename); DocWndInfoUnLock(); } // *.doc *.txt *.hed archive#*.doc archive#*.txt archive#*.hed static void DocWndInfoInit(void) { // DocWndInfo.hMutex = NULL; // DocWndInfo.hMutex = CreateMutex(NULL,TRUE,NULL); DocWndInfo.DocFileCur = 0; DocWndInfo.DocFileMax = 0; DocWndInfo.Text = NULL; DocWndInfo.TextSize = 0; EnableWindow(GetDlgItem(hDocWnd,IDC_BUTTON_PREV),FALSE); EnableWindow(GetDlgItem(hDocWnd,IDC_BUTTON_NEXT),FALSE); // if(DocWndInfo.hMutex!=NULL) // DocWndInfoUnLock(); } // Success -> TRUE Failure -> FALSE static int DocWndInfoLock(void) { #if 0 DWORD dwRes; if(DocWndInfo.hMutex==NULL) return FALSE; dwRes = WaitForSingleObject(DocWndInfo.hMutex,10000); if(dwRes==WAIT_OBJECT_0 || dwRes==WAIT_ABANDONED) return TRUE; else return FALSE; #else return TRUE; #endif } static void DocWndInfoUnLock(void) { // ReleaseMutex(DocWndInfo.hMutex); } void DocWndInfoReset(void) { if(DocWndInfoLock()==FALSE) return; DocWndInfo.DocFileCur = 0; DocWndInfo.DocFileMax = 0; if(DocWndInfo.Text!=NULL){ free(DocWndInfo.Text); DocWndInfo.Text = NULL; } DocWndInfo.TextSize = 0; DocWndSetInfo("",""); DocWndSetText("",0); // end: DocWndInfoUnLock(); } void DocWndAddDocFile(char *filename) { struct timidity_file *tf = open_file(filename,0,0); #ifdef W32GUI_DEBUG PrintfDebugWnd("DocWndAddDocFile <- [%s]\n",filename); #endif if(tf==NULL) return; close_file(tf); if(DocWndInfoLock()==FALSE) return; if(DocWndInfo.DocFileMax>=DOCWND_DOCFILEMAX-1) goto end; DocWndInfo.DocFileMax++; strncpy(DocWndInfo.DocFile[DocWndInfo.DocFileMax-1],filename,MAXPATH); DocWndInfo.DocFile[DocWndInfo.DocFileMax-1][MAXPATH-1] = '\0'; if(DocWndInfo.DocFileCur==1) EnableWindow(GetDlgItem(hDocWnd,IDC_BUTTON_PREV),FALSE); else EnableWindow(GetDlgItem(hDocWnd,IDC_BUTTON_PREV),TRUE); if(DocWndInfo.DocFileCur==DocWndInfo.DocFileMax) EnableWindow(GetDlgItem(hDocWnd,IDC_BUTTON_NEXT),FALSE); else EnableWindow(GetDlgItem(hDocWnd,IDC_BUTTON_NEXT),TRUE); #ifdef W32GUI_DEBUG PrintfDebugWnd("DocWndAddDocFile -> (%d)[%s]\n",DocWndInfo.DocFileMax-1,DocWndInfo.DocFile[DocWndInfo.DocFileMax-1]); #endif end: DocWndInfoUnLock(); } void DocWndSetMidifile(char *filename) { char buffer[MAXPATH+10]; char *p; if(DocWndInfoLock()==FALSE) return; strncpy(buffer,filename,MAXPATH-1); buffer[MAXPATH-1] = '\0'; p = strrchr(buffer,'.'); if(p==NULL) goto end; *p = '\0'; strcat(buffer,".txt"); DocWndAddDocFile(buffer); *p = '\0'; strcat(buffer,".doc"); DocWndAddDocFile(buffer); *p = '\0'; strcat(buffer,".hed"); DocWndAddDocFile(buffer); p = strrchr(buffer,'#'); if(p==NULL) goto end; *p = '\0'; strcat(buffer,"readme.txt"); DocWndAddDocFile(buffer); *p = '\0'; strcat(buffer,"readme.1st"); DocWndAddDocFile(buffer); *p = '\0'; strcat(buffer,"̎.txt"); DocWndAddDocFile(buffer); end: DocWndInfoUnLock(); } #define DOCWNDDOCSIZEMAX (64*1024) void DocWndReadDoc(int num) { struct timidity_file *tf; if(DocWndInfoLock()==FALSE) return; if(num<1) num = 1; if(num>DocWndInfo.DocFileMax) num = DocWndInfo.DocFileMax; if(num==DocWndInfo.DocFileCur) goto end; DocWndInfo.DocFileCur = num; tf = open_file(DocWndInfo.DocFile[DocWndInfo.DocFileCur-1],1,10); if(tf==NULL) goto end; if(DocWndInfo.Text!=NULL){ free(DocWndInfo.Text); DocWndInfo.Text = NULL; } DocWndInfo.Text = (char *)safe_malloc(sizeof(char)*DOCWNDDOCSIZEMAX); DocWndInfo.Text[0] = '\0'; DocWndInfo.TextSize = tf_read(DocWndInfo.Text,1,DOCWNDDOCSIZEMAX-1,tf); DocWndInfo.Text[DocWndInfo.TextSize] = '\0'; close_file(tf); { char info[1024]; char *filename; char *p1, *p2, *p3; p1 = DocWndInfo.DocFile[DocWndInfo.DocFileCur-1]; p2 = pathsep_strrchr(p1); p3 = strrchr(p1,'#'); if(p3!=NULL){ sprintf(info,"(%02d/%02d) %s",DocWndInfo.DocFileCur,DocWndInfo.DocFileMax,p3+1); filename = p2 + 1; } else if(p2!=NULL){ sprintf(info,"(%02d/%02d) %s",DocWndInfo.DocFileCur,DocWndInfo.DocFileMax,p2+1); filename = p2 + 1; } else { sprintf(info,"(%02d/%02d) %s",DocWndInfo.DocFileCur,DocWndInfo.DocFileMax,p1+1); filename = p1; } DocWndSetInfo(info,filename); } DocWndSetText(DocWndInfo.Text,DocWndInfo.TextSize); end: if(DocWndInfo.DocFileCur==1) EnableWindow(GetDlgItem(hDocWnd,IDC_BUTTON_PREV),FALSE); else EnableWindow(GetDlgItem(hDocWnd,IDC_BUTTON_PREV),TRUE); if(DocWndInfo.DocFileCur==DocWndInfo.DocFileMax) EnableWindow(GetDlgItem(hDocWnd,IDC_BUTTON_NEXT),FALSE); else EnableWindow(GetDlgItem(hDocWnd,IDC_BUTTON_NEXT),TRUE); DocWndInfoUnLock(); } void DocWndReadDocNext(void) { int num; if(DocWndInfoLock()==FALSE) return; num = DocWndInfo.DocFileCur + 1; if(num>DocWndInfo.DocFileMax) num = DocWndInfo.DocFileMax; DocWndReadDoc(num); DocWndInfoUnLock(); } void DocWndReadDocPrev(void) { int num; if(DocWndInfoLock()==FALSE) return; num = DocWndInfo.DocFileCur - 1; if(num<1) num = 1; DocWndReadDoc(num); DocWndInfoUnLock(); } void PutsDocWnd(char *str) { HWND hwnd; if(!IsWindow(hDocWnd) || !DocWndFlag) return; hwnd = GetDlgItem(hDocWnd,IDC_EDIT); PutsEditCtlWnd(hwnd,str); } void PrintfDocWnd(char *fmt, ...) { HWND hwnd; va_list ap; if(!IsWindow(hDocWnd) || !DocWndFlag) return; hwnd = GetDlgItem(hDocWnd,IDC_EDIT); va_start(ap, fmt); VprintfEditCtlWnd(hwnd,fmt,ap); va_end(ap); } void ClearDocWnd(void) { HWND hwnd; if(!IsWindow(hDocWnd)) return; hwnd = GetDlgItem(hDocWnd,IDC_EDIT); ClearEditCtlWnd(hwnd); } //**************************************************************************** // List Search Dialog #define ListSearchStringMax 256 static char ListSearchString[ListSearchStringMax]; BOOL CALLBACK ListSearchWndProc(HWND hwnd, UINT uMess, WPARAM wParam, LPARAM lParam); void InitListSearchWnd(HWND hParentWnd) { strcpy(ListSearchString,""); if (hListSearchWnd != NULL) { DestroyWindow(hListSearchWnd); hListSearchWnd = NULL; } switch(PlayerLanguage){ case LANGUAGE_JAPANESE: hListSearchWnd = CreateDialog (hInst,MAKEINTRESOURCE(IDD_DIALOG_ONE_LINE),hParentWnd,ListSearchWndProc); break; default: case LANGUAGE_ENGLISH: hListSearchWnd = CreateDialog (hInst,MAKEINTRESOURCE(IDD_DIALOG_ONE_LINE_EN),hParentWnd,ListSearchWndProc); break; } ShowWindow(hListSearchWnd,SW_HIDE); UpdateWindow(hListSearchWnd); } #define ListSearchStringBuffSize 1024*2 BOOL CALLBACK ListSearchWndProc(HWND hwnd, UINT uMess, WPARAM wParam, LPARAM lParam) { switch (uMess){ case WM_INITDIALOG: switch(PlayerLanguage){ case LANGUAGE_JAPANESE: SendMessage(hwnd,WM_SETTEXT,0,(LPARAM)"vCXǧ"); SendMessage(GetDlgItem(hwnd,IDC_STATIC_HEAD),WM_SETTEXT,0,(LPARAM)"L[[hĂB"); SendMessage(GetDlgItem(hwnd,IDC_STATIC_TAIL),WM_SETTEXT,0,(LPARAM)""); SendMessage(GetDlgItem(hwnd,IDC_BUTTON_1),WM_SETTEXT,0,(LPARAM)""); SendMessage(GetDlgItem(hwnd,IDC_BUTTON_2),WM_SETTEXT,0,(LPARAM)""); SendMessage(GetDlgItem(hwnd,IDC_BUTTON_3),WM_SETTEXT,0,(LPARAM)"‚"); break; default: case LANGUAGE_ENGLISH: SendMessage(hwnd,WM_SETTEXT,0,(LPARAM)"Playlist Search"); SendMessage(GetDlgItem(hwnd,IDC_STATIC_HEAD),WM_SETTEXT,0,(LPARAM)"Enter search keyword."); SendMessage(GetDlgItem(hwnd,IDC_STATIC_TAIL),WM_SETTEXT,0,(LPARAM)""); SendMessage(GetDlgItem(hwnd,IDC_BUTTON_1),WM_SETTEXT,0,(LPARAM)"SEACH"); SendMessage(GetDlgItem(hwnd,IDC_BUTTON_2),WM_SETTEXT,0,(LPARAM)"NEXT SEARCH"); SendMessage(GetDlgItem(hwnd,IDC_BUTTON_3),WM_SETTEXT,0,(LPARAM)"CLOSE"); break; } return FALSE; case WM_COMMAND: switch (LOWORD(wParam)) { case IDCLOSE: ShowWindow(hwnd, SW_HIDE); break; case IDC_BUTTON_1: case IDC_BUTTON_2: { int selected, nfiles, cursel; SendDlgItemMessage(hwnd,IDC_EDIT_ONE_LINE, WM_GETTEXT,(WPARAM)250,(LPARAM)ListSearchString); w32g_get_playlist_index(&selected, &nfiles, &cursel); if ( LOWORD(wParam) == IDC_BUTTON_2 ) cursel++; if ( strlen ( ListSearchString ) > 0 ) { char buff[ListSearchStringBuffSize]; for ( ; cursel < nfiles; cursel ++ ) { int result = SendDlgItemMessage(hListWnd,IDC_LISTBOX_PLAYLIST, LB_GETTEXTLEN,(WPARAM)cursel, 0 ); if ( result < ListSearchStringBuffSize ) { result = SendDlgItemMessage(hListWnd,IDC_LISTBOX_PLAYLIST, LB_GETTEXT,(WPARAM)cursel,(LPARAM)buff); if ( result == LB_ERR ) { cursel = LB_ERR; break; } if ( strstr ( buff, ListSearchString ) != NULL ) { break; } } else if ( result == LB_ERR ) { cursel = LB_ERR; break; } } if ( cursel >= nfiles ) { cursel = LB_ERR; } } else { cursel = LB_ERR; } if ( cursel != LB_ERR ) { SendDlgItemMessage(hListWnd,IDC_LISTBOX_PLAYLIST, LB_SETCURSEL,(WPARAM)cursel,0); SetNumListWnd(cursel,nfiles); if ( LOWORD(wParam) == IDC_BUTTON_1 ) HideListSearch(); } } break; case IDC_BUTTON_3: HideListSearch(); break; default: return FALSE; } break; case WM_CLOSE: ShowWindow(hListSearchWnd, SW_HIDE); break; default: return FALSE; } return FALSE; } void ShowListSearch(void) { ShowWindow(hListSearchWnd, SW_SHOW); } void HideListSearch(void) { ShowWindow(hListSearchWnd, SW_HIDE); } //**************************************************************************** // SoundSpec Window BOOL CALLBACK SoundSpecWndProc(HWND hwnd, UINT uMess, WPARAM wParam, LPARAM lParam); void InitSoundSpecWnd(HWND hParentWnd) { if (hSoundSpecWnd != NULL) { DestroyWindow(hSoundSpecWnd); hSoundSpecWnd = NULL; } hSoundSpecWnd = CreateDialog (hInst,MAKEINTRESOURCE(IDD_DIALOG_SOUNDSPEC),hParentWnd,SoundSpecWndProc); ShowWindow(hSoundSpecWnd,SW_HIDE); UpdateWindow(hSoundSpecWnd); } BOOL CALLBACK SoundSpecWndProc(HWND hwnd, UINT uMess, WPARAM wParam, LPARAM lParam) { switch (uMess){ case WM_INITDIALOG: return FALSE; case WM_COMMAND: switch (LOWORD(wParam)) { case IDCLOSE: ShowWindow(hwnd, SW_HIDE); MainWndUpdateSoundSpecButton(); break; default: return FALSE; } case WM_SIZE: return FALSE; case WM_CLOSE: ShowWindow(hSoundSpecWnd, SW_HIDE); MainWndUpdateSoundSpecButton(); break; default: return FALSE; } return FALSE; } void w32g_open_doc(int close_if_no_doc) { if(close_if_no_doc==1 && DocWndInfo.DocFileMax <= 0) ShowSubWindow(hDocWnd, 0); else { DocWndReadDoc(1); if(close_if_no_doc!=2) ShowSubWindow(hDocWnd, 1); } } void w32g_setup_doc(int idx) { char *filename; DocWndInfoReset(); if((filename = w32g_get_playlist(idx)) == NULL) return; DocWndSetMidifile(filename); } TiMidity++-2.13.2/interface/w32g_subwin.h0100644004711200001440000000351507421005040017153 0ustar tamukiusers/* TiMidity++ -- MIDI to WAVE converter and player Copyright (C) 1999-2002 Masanao Izumo Copyright (C) 1995 Tuukka Toivonen 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef ___W32G_SUBWIN_H_ #define ___W32G_SUBWIN_H_ // Console Window void InitConsoleWnd(HWND hParentWnd); void PutsConsoleWnd(char *str); void PrintfConsoleWnd(char *fmt, ...); void ClearConsoleWnd(void); // Tracer Window void InitTracerWnd(HWND hParentWnd); // List Window void InitListWnd(HWND hParentWnd); // Doc Window extern int DocWndIndependent; extern int DocWndAutoPopup; void InitDocWnd(HWND hParentWnd); void DocWndInfoReset(void); void DocWndAddDocFile(char *filename); void DocWndSetMidifile(char *filename); void DocWndReadDoc(int num); void DocWndReadDocNext(void); void DocWndReadDocPrev(void); void PutsDocWnd(char *str); void PrintfDocWnd(char *fmt, ...); void ClearDocWnd(void); // Wrd Window void InitWrdWnd(HWND hParentWnd); // SoundSpec Window void InitSoundSpecWnd(HWND hParentWnd); void w32g_setup_doc(int idx); void w32g_open_doc(int close_if_no_doc); #endif /* ___W32G_SUBWIN_H_ */ TiMidity++-2.13.2/interface/w32g_syn.c0100644004711200001440000015214410052566502016464 0ustar tamukiusers/* TiMidity++ -- MIDI to WAVE converter and player Copyright (C) 1999-2004 Masanao Izumo Copyright (C) 1995 Tuukka Toivonen 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA w32g_syn.c: Written by Daisuke Aoki */ #ifdef HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ #include "interface.h" #include #include #include #include #include #undef RC_NONE #include #if defined(__CYGWIN32__) || defined(__MINGW32__) #ifndef HAVE_NEW_MMSYSTEM #include #ifndef TPM_TOPALIGN #define TPM_TOPALIGN 0x0000L /* for old version of cygwin */ #endif #define TIME_ONESHOT 0 #define TIME_PERIODIC 1 int WINAPI timeSetEvent(UINT uDelay, UINT uResolution, void *fptc, DWORD dwUser, UINT fuEvent); int WINAPI timeKillEvent(UINT uTimerID); #endif #else #include #endif /* __CYGWIN32__ */ #include #ifndef NO_STRING_H #include #else #include #endif #include #include /* There is no on CYGWIN. * Edit_* and ListBox_* are defined in * */ #ifdef TWSYNSRV #include //#include #include #endif #include "timidity.h" #include "common.h" #include "instrum.h" #include "playmidi.h" #include "readmidi.h" #include "output.h" #include "controls.h" #if defined(__CYGWIN32__) || defined(__MINGW32__) #define WIN32GCC WINAPI void InitCommonControls(void); #endif #include "w32g.h" #include "w32g_utl.h" #include "w32g_pref.h" #include "w32g_res.h" #ifdef IA_W32G_SYN typedef struct w32g_syn_t_ { UINT nid_uID; #ifndef TWSYNSRV HWND nid_hWnd; HICON hIcon; #endif int argc; char **argv; HANDLE gui_hThread; DWORD gui_dwThreadId; HANDLE syn_hThread; DWORD syn_dwThreadId; // int syn_ThreadPriority; HANDLE hMutex; int volatile quit_state; } w32g_syn_t; static w32g_syn_t w32g_syn; // eϐ (^^;;; HINSTANCE hInst = NULL; int PlayerLanguage = LANGUAGE_ENGLISH; int IniFileAutoSave = 1; char *IniFile; char *ConfigFile; char *PlaylistFile; char *PlaylistHistoryFile; char *MidiFileOpenDir; char *ConfigFileOpenDir; char *PlaylistFileOpenDir; int SecondMode = 0; BOOL PosSizeSave = TRUE; int DocMaxSize; char *DocFileExt; int AutoloadPlaylist = 0; int AutosavePlaylist = 0; int SeachDirRecursive = 0; int DocWndIndependent = 0; int DocWndAutoPopup = 0; int TraceGraphicFlag; int PlayerThreadPriority; int MidiPlayerThreadPriority; int MainThreadPriority; int GUIThreadPriority; int TracerThreadPriority; int WrdThreadPriority; int SubWindowMax = 5; int InitMinimizeFlag = 0; int DebugWndStartFlag = 1; int ConsoleWndStartFlag = 0; int ListWndStartFlag = 0; int TracerWndStartFlag = 0; int DocWndStartFlag = 0; int WrdWndStartFlag = 0; int DebugWndFlag = 1; int ConsoleWndFlag = 1; int ListWndFlag = 1; int TracerWndFlag = 0; int DocWndFlag = 1; int WrdWndFlag = 0; int SoundSpecWndFlag = 0; int WrdGraphicFlag; int TraceGraphicFlag; int w32g_auto_output_mode = 0; char *w32g_output_dir = NULL; extern void CmdLineToArgv(LPSTR lpCmdLine, int *argc, CHAR ***argv); static int start_syn_thread ( void ); static void WINAPI syn_thread ( void ); #ifndef TWSYNSRV // Task tray version here static LRESULT CALLBACK SynWinProc ( HWND hwnd, UINT uMess, WPARAM wParam, LPARAM lParam ); static void VersionWnd(HWND hParentWnd); static void TiMidityWnd(HWND hParentWnd); static int w32g_syn_create_win ( void ); #define HAVE_SYN_CONSOLE #define MYWM_NOTIFYICON (WM_USER+501) #define MYWM_QUIT (WM_USER+502) #define W32G_SYNWIN_CLASSNAME "TWSYNTH GUI" #define W32G_SYN_TIP "TWSYNTH GUI" // |bvAbvj[ #define IDM_NOTHING 100 #define IDM_QUIT 101 #define IDM_START 102 // #define IDM_STOP 103 #define IDM_SYSTEM_RESET 104 #define IDM_GM_SYSTEM_RESET 105 #define IDM_GS_SYSTEM_RESET 106 #define IDM_XG_SYSTEM_RESET 107 #define IDM_CHANGE_GM_SYSTEM 108 #define IDM_CHANGE_GS_SYSTEM 109 #define IDM_CHANGE_XG_SYSTEM 110 #define IDM_CHANGE_DEFAULT_SYSTEM 111 #define IDM_PREFERENCE 112 #define IDM_CONSOLE_WND 113 #define IDM_PROCESS_PRIORITY_LOWEST 131 #define IDM_PROCESS_PRIORITY_BELOW_NORMAL 132 #define IDM_PROCESS_PRIORITY_NORMAL 133 #define IDM_PROCESS_PRIORITY_ABOVE_NORMAL 134 #define IDM_PROCESS_PRIORITY_HIGHEST 135 #define IDM_PROCESS_PRIORITY_REALTIME 136 #define IDM_SYN_THREAD_PRIORITY_LOWEST 121 #define IDM_SYN_THREAD_PRIORITY_BELOW_NORMAL 122 #define IDM_SYN_THREAD_PRIORITY_NORMAL 123 #define IDM_SYN_THREAD_PRIORITY_ABOVE_NORMAL 124 #define IDM_SYN_THREAD_PRIORITY_HIGHEST 125 #define IDM_SYN_THREAD_PRIORITY_TIMECRITICAL 137 #define IDM_VERSION 126 #define IDM_TIMIDITY 127 #ifdef HAVE_SYN_CONSOLE static HWND hConsoleWnd; void InitConsoleWnd(HWND hParentWnd); #endif // HAVE_SYN_CONSOLE #else // !TWSYNSRV // Windows service version here #undef HAVE_SYN_CONSOLE static SERVICE_STATUS_HANDLE serviceStatusHandle; static DWORD currentServiceStatus; static const char *serviceName = "Timidity"; static const char *serviceDescription = "Realtime synthesize midi message"; static const char *regKeyTwSynSrv = "SYSTEM\\CurrentControlSet\\Services\\Timidity"; static BOOL InstallService(); static BOOL UninstallService(); #endif // !TWSYNSRV #define W32G_SYN_NID_UID 12301 #define W32G_MUTEX_NAME "TWSYNTH MUTEX" #define W32G_SYN_MESSAGE_MAX 100 #define W32G_SYN_NONE 0 #define W32G_SYN_QUIT 10 #define W32G_SYN_START 11 // tԂֈڍs #define W32G_SYN_STOP 12 // t~Ԃֈڍs #define W32G_SYN_GS_SYSTEM_RESET 21 #define W32G_SYN_XG_SYSTEM_RESET 22 #define W32G_SYN_SYSTEM_RESET 23 #define W32G_SYN_GM_SYSTEM_RESET 24 #define W32G_SYN_CHANGE_GS_SYSTEM 25 #define W32G_SYN_CHANGE_XG_SYSTEM 26 #define W32G_SYN_CHANGE_GM_SYSTEM 27 #define W32G_SYN_CHANGE_DEFAULT_SYSTEM 28 typedef struct w32g_syn_message_t_ { int cmd; } w32g_syn_message_t; static volatile enum { stop, run, quit, none } w32g_syn_status, w32g_syn_status_prev; #ifndef MAX_PORT #define MAX_PORT 4 #endif int w32g_syn_id_port[MAX_PORT]; int w32g_syn_port_num = 2; extern int win_main(int argc, char **argv); extern int ctl_pass_playing_list2(int n, char *args[]); extern void winplaymidi(void); w32g_syn_message_t msg_loopbuf[W32G_SYN_MESSAGE_MAX]; int msg_loopbuf_start = -1; int msg_loopbuf_end = -1; extern int rtsyn_system_mode; HANDLE msg_loopbuf_hMutex = NULL; // rp int syn_AutoStart; // VZN DWORD processPriority; // vZX̃vCIeB DWORD syn_ThreadPriority; // VZXbh̃vCIeB extern int volatile stream_max_compute; // play_event() compute_data() ŌvZő厞ԁB static int w32g_syn_main ( void ); static int start_syn_thread ( void ); static void WINAPI syn_thread ( void ); static void terminate_syn_thread ( void ); static int wait_for_termination_of_syn_thread ( void ); int w32g_message_set ( int cmd ); int w32g_message_get ( w32g_syn_message_t *msg ); void w32g_syn_ctl_pass_playing_list ( int n_, char *args_[] ); int w32g_syn_do_before_pref_apply ( void ); int w32g_syn_do_after_pref_apply ( void ); /* \ @CXbhFGUĨbZ[W[v @VZTCU[XbhF */ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { HANDLE hMutex; int i; // ̂ƂQdN͂łȂ悤ɂƂB hMutex = OpenMutex ( 0, FALSE, W32G_MUTEX_NAME ); if ( hMutex != NULL ) { CloseHandle ( hMutex ); return 0; } w32g_syn.hMutex = CreateMutex ( NULL, TRUE, W32G_MUTEX_NAME ); if ( w32g_syn.hMutex == NULL ) { return 0; } CmdLineToArgv(lpCmdLine, &w32g_syn.argc, &w32g_syn.argv); #ifdef TWSYNSRV // Service install and uninstall handling for (i = 1; i < w32g_syn.argc; i++) { if (stricmp(w32g_syn.argv[i], "/INSTALL") == 0) { InstallService(); ReleaseMutex ( w32g_syn.hMutex ); CloseHandle ( w32g_syn.hMutex ); return 0; } else if (stricmp(w32g_syn.argv[i], "/UNINSTALL") == 0) { UninstallService(); ReleaseMutex ( w32g_syn.hMutex ); CloseHandle ( w32g_syn.hMutex ); return 0; } } #endif // wrdt=wrdt_list[0]; hInst = hInstance; w32g_syn.gui_hThread = GetCurrentThread(); w32g_syn.gui_dwThreadId = GetCurrentThreadId(); w32g_syn.quit_state = 0; w32g_syn_main (); ReleaseMutex ( w32g_syn.hMutex ); CloseHandle ( w32g_syn.hMutex ); return 0; } #ifndef TWSYNSRV // Task tray version here static int w32g_syn_create_win ( void ) { WNDCLASSEX wndclass ; wndclass.cbSize = sizeof(WNDCLASSEX); wndclass.style = CS_HREDRAW | CS_VREDRAW; wndclass.lpfnWndProc = SynWinProc ; wndclass.cbClsExtra = 0 ; wndclass.cbWndExtra = 0 ; wndclass.hInstance = hInst ; wndclass.hIcon = w32g_syn.hIcon; wndclass.hIconSm = w32g_syn.hIcon; wndclass.hCursor = LoadCursor(0,IDC_ARROW) ; wndclass.hbrBackground = (HBRUSH)(COLOR_SCROLLBAR + 1); wndclass.lpszMenuName = NULL; wndclass.lpszClassName = W32G_SYNWIN_CLASSNAME; RegisterClassEx(&wndclass); w32g_syn.nid_hWnd = CreateWindowEx ( WS_EX_TOOLWINDOW, W32G_SYNWIN_CLASSNAME, 0, WS_CLIPCHILDREN, CW_USEDEFAULT,0, 10, 10,0,0,hInst,0 ); if ( w32g_syn.nid_hWnd == NULL ) { return -1; } ShowWindow ( w32g_syn.nid_hWnd, SW_HIDE ); UpdateWindow ( w32g_syn.nid_hWnd ); // KvȂƎv񂾂ǁB return 0; } // return // 0 : OK // -1 : FATAL ERROR static int w32g_syn_main ( void ) { int i; MSG msg; InitCommonControls(); w32g_syn.nid_uID = W32G_SYN_NID_UID; w32g_syn.nid_hWnd = NULL; w32g_syn.hIcon = LoadImage(hInst, MAKEINTRESOURCE(IDI_ICON_TIMIDITY), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR); processPriority = NORMAL_PRIORITY_CLASS; syn_ThreadPriority = THREAD_PRIORITY_NORMAL; for ( i = 0; i <= MAX_PORT; i ++ ) { w32g_syn_id_port[i] = i + 1; } if ( w32g_syn_create_win() ) { MessageBox ( NULL, "Fatal Error", "ERROR", MB_OK ); return -1; } while( GetMessage(&msg,NULL,0,0) ){ if ( msg.message == MYWM_QUIT ) { if ( w32g_syn.quit_state < 1 ) w32g_syn.quit_state = 1; if ( hConsoleWnd != NULL ) { DestroyWindow ( hConsoleWnd ); hConsoleWnd = NULL; } DestroyWindow ( w32g_syn.nid_hWnd ); w32g_syn.nid_hWnd = NULL; } TranslateMessage(&msg); DispatchMessage(&msg); } while ( w32g_syn.quit_state < 2 ) { Sleep ( 300 ); } return 0; } static VOID CALLBACK forced_exit ( HWND hwnd, UINT uMsg, UINT idEvent, DWORD dwTime ) { exit ( 0 ); } // Add the icon into the status area of the task bar. BOOL AddTasktrayIcon(HWND hwnd) { BOOL bRes; NOTIFYICONDATA nid; nid.cbSize = sizeof ( NOTIFYICONDATA ); nid.hWnd = w32g_syn.nid_hWnd = hwnd; nid.uID = w32g_syn.nid_uID; nid.uFlags = NIF_MESSAGE | NIF_ICON | NIF_TIP; nid.uCallbackMessage = MYWM_NOTIFYICON; nid.hIcon = w32g_syn.hIcon; strcpy ( nid.szTip, W32G_SYN_TIP ); bRes = Shell_NotifyIcon ( NIM_ADD, &nid ); return bRes; } // Delete the icon from the status area of the task bar. void DeleteTasktrayIcon(HWND hwnd) { BOOL bRes; NOTIFYICONDATA nid; int i; nid.cbSize = sizeof ( NOTIFYICONDATA ); nid.hWnd = w32g_syn.nid_hWnd; nid.uID = w32g_syn.nid_uID; for ( i = 1; i <= 10; i ++ ) { bRes = Shell_NotifyIcon ( NIM_DELETE, &nid ); if ( bRes == TRUE ) break; if ( i >= 10 ) { MessageBox ( NULL, "Fatal Error", "ERROR", MB_OK ); } } } static LRESULT CALLBACK SynWinProc(HWND hwnd, UINT uMess, WPARAM wParam, LPARAM lParam) { static int have_popupmenu = 0; switch (uMess) { case WM_CREATE: if ( AddTasktrayIcon(hwnd) == FALSE ) { MessageBox ( NULL, "Fatal Error", "ERROR", MB_OK ); DestroyWindow ( hwnd ); PostQuitMessage ( 0 ); return -1; } start_syn_thread (); break; case WM_DESTROY: { int i; terminate_syn_thread(); for ( i = 0; i < 4; i ++ ) { if ( wait_for_termination_of_syn_thread() ) break; } } DeleteTasktrayIcon(hwnd); PostQuitMessage ( 0 ); break; case MYWM_NOTIFYICON: { if ( (UINT)wParam == w32g_syn.nid_uID ) { if ( (UINT)lParam == WM_RBUTTONDOWN || (UINT)lParam == WM_LBUTTONDOWN) { int priority_flag[2][6]; POINT point; HMENU hMenu, hMenuReset, hMenuChange, hMenuProcessPriority, hMenuSynPriority; if ( have_popupmenu ) break; have_popupmenu = 1; // Process priority check if ( processPriority == IDLE_PRIORITY_CLASS ) priority_flag[0][0] = MF_CHECKED; else priority_flag[0][0] = 0; if ( processPriority == BELOW_NORMAL_PRIORITY_CLASS ) priority_flag[0][1] = MF_CHECKED; else priority_flag[0][1] = 0; if ( processPriority == NORMAL_PRIORITY_CLASS ) priority_flag[0][2] = MF_CHECKED; else priority_flag[0][2] = 0; if ( processPriority == ABOVE_NORMAL_PRIORITY_CLASS ) priority_flag[0][3] = MF_CHECKED; else priority_flag[0][3] = 0; if ( processPriority == HIGH_PRIORITY_CLASS ) priority_flag[0][4] = MF_CHECKED; else priority_flag[0][4] = 0; if ( processPriority == REALTIME_PRIORITY_CLASS ) priority_flag[0][5] = MF_CHECKED; else priority_flag[0][5] = 0; // Thread priority check if ( syn_ThreadPriority == THREAD_PRIORITY_LOWEST ) priority_flag[1][0] = MF_CHECKED; else priority_flag[1][0] = 0; if ( syn_ThreadPriority == THREAD_PRIORITY_BELOW_NORMAL ) priority_flag[1][1] = MF_CHECKED; else priority_flag[1][1] = 0; if ( syn_ThreadPriority == THREAD_PRIORITY_NORMAL ) priority_flag[1][2] = MF_CHECKED; else priority_flag[1][2] = 0; if ( syn_ThreadPriority == THREAD_PRIORITY_ABOVE_NORMAL ) priority_flag[1][3] = MF_CHECKED; else priority_flag[1][3] = 0; if ( syn_ThreadPriority == THREAD_PRIORITY_HIGHEST ) priority_flag[1][4] = MF_CHECKED; else priority_flag[1][4] = 0; if ( syn_ThreadPriority == THREAD_PRIORITY_TIME_CRITICAL ) priority_flag[1][5] = MF_CHECKED; else priority_flag[1][5] = 0; hMenu = CreatePopupMenu (); hMenuReset = CreateMenu (); hMenuChange = CreateMenu (); hMenuProcessPriority = CreateMenu (); hMenuSynPriority = CreateMenu (); if (PlayerLanguage == LANGUAGE_JAPANESE) { if ( w32g_syn_status == run ) { AppendMenu ( hMenu, MF_STRING, IDM_STOP, "VZ~"); } else if ( w32g_syn_status == stop ) { AppendMenu ( hMenu, MF_STRING, IDM_START, "VZJn"); } else if ( w32g_syn_status == quit ) { AppendMenu ( hMenu, MF_STRING | MF_GRAYED, IDM_START, "Icc"); } AppendMenu ( hMenu, MF_STRING, IDM_SYSTEM_RESET, "VXeZbg"); switch ( rtsyn_system_mode ) { case GM_SYSTEM_MODE: AppendMenu ( hMenuReset, MF_STRING | MF_CHECKED, IDM_GM_SYSTEM_RESET, "GM Zbg"); AppendMenu ( hMenuReset, MF_STRING, IDM_GS_SYSTEM_RESET, "GS Zbg"); AppendMenu ( hMenuReset, MF_STRING, IDM_XG_SYSTEM_RESET, "XG Zbg"); AppendMenu ( hMenuChange, MF_STRING | MF_CHECKED, IDM_CHANGE_GM_SYSTEM, "GM VXe֕ύX"); AppendMenu ( hMenuChange, MF_STRING, IDM_CHANGE_GS_SYSTEM, "GS VXe֕ύX"); AppendMenu ( hMenuChange, MF_STRING, IDM_CHANGE_XG_SYSTEM, "XG VXe֕ύX"); AppendMenu ( hMenuChange, MF_STRING, IDM_CHANGE_DEFAULT_SYSTEM, "ftHg̃VXe֕ύX"); break; case GS_SYSTEM_MODE: AppendMenu ( hMenuReset, MF_STRING, IDM_GM_SYSTEM_RESET, "GM Zbg"); AppendMenu ( hMenuReset, MF_STRING | MF_CHECKED, IDM_GS_SYSTEM_RESET, "GS Zbg"); AppendMenu ( hMenuReset, MF_STRING, IDM_XG_SYSTEM_RESET, "XG Zbg"); AppendMenu ( hMenuChange, MF_STRING, IDM_CHANGE_GM_SYSTEM, "GM VXe֕ύX"); AppendMenu ( hMenuChange, MF_STRING | MF_CHECKED, IDM_CHANGE_GS_SYSTEM, "GS VXe֕ύX"); AppendMenu ( hMenuChange, MF_STRING, IDM_CHANGE_XG_SYSTEM, "XG VXe֕ύX"); AppendMenu ( hMenuChange, MF_STRING, IDM_CHANGE_DEFAULT_SYSTEM, "ftHg̃VXe֕ύX"); break; case XG_SYSTEM_MODE: AppendMenu ( hMenuReset, MF_STRING, IDM_GM_SYSTEM_RESET, "GM Zbg"); AppendMenu ( hMenuReset, MF_STRING, IDM_GS_SYSTEM_RESET, "GS Zbg"); AppendMenu ( hMenuReset, MF_STRING | MF_CHECKED, IDM_XG_SYSTEM_RESET, "XG Zbg"); AppendMenu ( hMenuChange, MF_STRING, IDM_CHANGE_GM_SYSTEM, "GM VXe֕ύX"); AppendMenu ( hMenuChange, MF_STRING, IDM_CHANGE_GS_SYSTEM, "GS VXe֕ύX"); AppendMenu ( hMenuChange, MF_STRING | MF_CHECKED, IDM_CHANGE_XG_SYSTEM, "XG VXe֕ύX"); AppendMenu ( hMenuChange, MF_STRING, IDM_CHANGE_DEFAULT_SYSTEM, "ftHg̃VXe֕ύX"); break; default: case DEFAULT_SYSTEM_MODE: AppendMenu ( hMenuReset, MF_STRING, IDM_GM_SYSTEM_RESET, "GM Zbg"); AppendMenu ( hMenuReset, MF_STRING, IDM_GS_SYSTEM_RESET, "GS Zbg"); AppendMenu ( hMenuReset, MF_STRING, IDM_XG_SYSTEM_RESET, "XG Zbg"); AppendMenu ( hMenuChange, MF_STRING, IDM_CHANGE_GM_SYSTEM, "GM VXe֕ύX"); AppendMenu ( hMenuChange, MF_STRING, IDM_CHANGE_GS_SYSTEM, "GS VXe֕ύX"); AppendMenu ( hMenuChange, MF_STRING, IDM_CHANGE_XG_SYSTEM, "XG VXe֕ύX"); AppendMenu ( hMenuChange, MF_STRING | MF_CHECKED, IDM_CHANGE_DEFAULT_SYSTEM, "ftHg̃VXe֕ύX"); break; } AppendMenu ( hMenuProcessPriority, MF_STRING | priority_flag[0][0], IDM_PROCESS_PRIORITY_LOWEST, "Ⴂ"); AppendMenu ( hMenuProcessPriority, MF_STRING | priority_flag[0][1], IDM_PROCESS_PRIORITY_BELOW_NORMAL, "Ⴂ"); AppendMenu ( hMenuProcessPriority, MF_STRING | priority_flag[0][2], IDM_PROCESS_PRIORITY_NORMAL, ""); AppendMenu ( hMenuProcessPriority, MF_STRING | priority_flag[0][3], IDM_PROCESS_PRIORITY_ABOVE_NORMAL, ""); AppendMenu ( hMenuProcessPriority, MF_STRING | priority_flag[0][4], IDM_PROCESS_PRIORITY_HIGHEST, ""); AppendMenu ( hMenuProcessPriority, MF_SEPARATOR, 0, 0 ); AppendMenu ( hMenuProcessPriority, MF_STRING | priority_flag[0][5], IDM_PROCESS_PRIORITY_REALTIME, "A^C"); AppendMenu ( hMenuSynPriority, MF_STRING | priority_flag[1][0], IDM_SYN_THREAD_PRIORITY_LOWEST, "Ⴂ"); AppendMenu ( hMenuSynPriority, MF_STRING | priority_flag[1][1], IDM_SYN_THREAD_PRIORITY_BELOW_NORMAL, "Ⴂ"); AppendMenu ( hMenuSynPriority, MF_STRING | priority_flag[1][2], IDM_SYN_THREAD_PRIORITY_NORMAL, ""); AppendMenu ( hMenuSynPriority, MF_STRING | priority_flag[1][3], IDM_SYN_THREAD_PRIORITY_ABOVE_NORMAL, ""); AppendMenu ( hMenuSynPriority, MF_STRING | priority_flag[1][4], IDM_SYN_THREAD_PRIORITY_HIGHEST, ""); AppendMenu ( hMenuSynPriority, MF_SEPARATOR, 0, 0 ); AppendMenu ( hMenuSynPriority, MF_STRING | priority_flag[1][5], IDM_SYN_THREAD_PRIORITY_TIMECRITICAL, "^CNeBJ"); AppendMenu ( hMenu, MF_SEPARATOR, 0, 0 ); AppendMenu ( hMenu, MF_POPUP, (UINT)hMenuReset, "eVXeZbg" ); AppendMenu ( hMenu, MF_POPUP, (UINT)hMenuChange, "̃VXe֕ύX" ); AppendMenu ( hMenu, MF_SEPARATOR, 0, 0 ); AppendMenu ( hMenu, MF_POPUP, (UINT)hMenuProcessPriority, "vZXvCIeBݒ" ); AppendMenu ( hMenu, MF_POPUP, (UINT)hMenuSynPriority, "VZXbhvCIeBݒ" ); AppendMenu ( hMenu, MF_SEPARATOR, 0, 0 ); AppendMenu ( hMenu, MF_STRING, IDM_PREFERENCE, "ݒ"); AppendMenu ( hMenu, MF_STRING, IDM_CONSOLE_WND, "R\["); AppendMenu ( hMenu, MF_SEPARATOR, 0, 0 ); AppendMenu ( hMenu, MF_STRING, IDM_VERSION, "o[W"); AppendMenu ( hMenu, MF_STRING, IDM_TIMIDITY, "TiMidity++ ɂ‚"); AppendMenu ( hMenu, MF_SEPARATOR, 0, 0 ); AppendMenu ( hMenu, MF_STRING, IDM_QUIT, "I"); } else { if ( w32g_syn_status == run ) { AppendMenu ( hMenu, MF_STRING, IDM_STOP, "Stop synthesizer"); } else if ( w32g_syn_status == stop ) { AppendMenu ( hMenu, MF_STRING, IDM_START, "Start synthesizer"); } else if ( w32g_syn_status == quit ) { AppendMenu ( hMenu, MF_STRING | MF_GRAYED, IDM_START, "Quitting..."); } AppendMenu ( hMenu, MF_STRING, IDM_SYSTEM_RESET, "System Reset"); switch ( rtsyn_system_mode ) { case GM_SYSTEM_MODE: AppendMenu ( hMenuReset, MF_STRING | MF_CHECKED, IDM_GM_SYSTEM_RESET, "GM Reset"); AppendMenu ( hMenuReset, MF_STRING, IDM_GS_SYSTEM_RESET, "GS Reset"); AppendMenu ( hMenuReset, MF_STRING, IDM_XG_SYSTEM_RESET, "XG Reset"); AppendMenu ( hMenuChange, MF_STRING | MF_CHECKED, IDM_CHANGE_GM_SYSTEM, "Change GM system"); AppendMenu ( hMenuChange, MF_STRING, IDM_CHANGE_GS_SYSTEM, "Change GS system"); AppendMenu ( hMenuChange, MF_STRING, IDM_CHANGE_XG_SYSTEM, "Change XG system"); AppendMenu ( hMenuChange, MF_STRING, IDM_CHANGE_DEFAULT_SYSTEM, "Change default system"); break; case GS_SYSTEM_MODE: AppendMenu ( hMenuReset, MF_STRING, IDM_GM_SYSTEM_RESET, "GM Reset"); AppendMenu ( hMenuReset, MF_STRING | MF_CHECKED, IDM_GS_SYSTEM_RESET, "GS Reset"); AppendMenu ( hMenuReset, MF_STRING, IDM_XG_SYSTEM_RESET, "XG Reset"); AppendMenu ( hMenuChange, MF_STRING, IDM_CHANGE_GM_SYSTEM, "Change GM system"); AppendMenu ( hMenuChange, MF_STRING | MF_CHECKED, IDM_CHANGE_GS_SYSTEM, "Change GS system"); AppendMenu ( hMenuChange, MF_STRING, IDM_CHANGE_XG_SYSTEM, "Change XG system"); AppendMenu ( hMenuChange, MF_STRING, IDM_CHANGE_DEFAULT_SYSTEM, "Change default system"); break; case XG_SYSTEM_MODE: AppendMenu ( hMenuReset, MF_STRING, IDM_GM_SYSTEM_RESET, "GM Reset"); AppendMenu ( hMenuReset, MF_STRING, IDM_GS_SYSTEM_RESET, "GS Reset"); AppendMenu ( hMenuReset, MF_STRING | MF_CHECKED, IDM_XG_SYSTEM_RESET, "XG Reset"); AppendMenu ( hMenuChange, MF_STRING, IDM_CHANGE_GM_SYSTEM, "Change GM system"); AppendMenu ( hMenuChange, MF_STRING, IDM_CHANGE_GS_SYSTEM, "Change GS system"); AppendMenu ( hMenuChange, MF_STRING | MF_CHECKED, IDM_CHANGE_XG_SYSTEM, "Change XG system"); AppendMenu ( hMenuChange, MF_STRING, IDM_CHANGE_DEFAULT_SYSTEM, "Change default system"); break; default: case DEFAULT_SYSTEM_MODE: AppendMenu ( hMenuReset, MF_STRING, IDM_GM_SYSTEM_RESET, "GM Reset"); AppendMenu ( hMenuReset, MF_STRING, IDM_GS_SYSTEM_RESET, "GS Reset"); AppendMenu ( hMenuReset, MF_STRING, IDM_XG_SYSTEM_RESET, "XG Reset"); AppendMenu ( hMenuChange, MF_STRING, IDM_CHANGE_GM_SYSTEM, "Change GM system"); AppendMenu ( hMenuChange, MF_STRING, IDM_CHANGE_GS_SYSTEM, "Change GS system"); AppendMenu ( hMenuChange, MF_STRING, IDM_CHANGE_XG_SYSTEM, "Change XG system"); AppendMenu ( hMenuChange, MF_STRING | MF_CHECKED, IDM_CHANGE_DEFAULT_SYSTEM, "Change default system"); break; } AppendMenu ( hMenuProcessPriority, MF_STRING | priority_flag[0][0], IDM_PROCESS_PRIORITY_LOWEST, "lowest"); AppendMenu ( hMenuProcessPriority, MF_STRING | priority_flag[0][1], IDM_PROCESS_PRIORITY_BELOW_NORMAL, "below normal"); AppendMenu ( hMenuProcessPriority, MF_STRING | priority_flag[0][2], IDM_PROCESS_PRIORITY_NORMAL, "normal"); AppendMenu ( hMenuProcessPriority, MF_STRING | priority_flag[0][3], IDM_PROCESS_PRIORITY_ABOVE_NORMAL, "above normal"); AppendMenu ( hMenuProcessPriority, MF_STRING | priority_flag[0][4], IDM_PROCESS_PRIORITY_HIGHEST, "highest"); AppendMenu ( hMenuProcessPriority, MF_SEPARATOR, 0, 0 ); AppendMenu ( hMenuProcessPriority, MF_STRING | priority_flag[0][5], IDM_PROCESS_PRIORITY_REALTIME, "realtime"); AppendMenu ( hMenuSynPriority, MF_STRING | priority_flag[1][0], IDM_SYN_THREAD_PRIORITY_LOWEST, "lowest"); AppendMenu ( hMenuSynPriority, MF_STRING | priority_flag[1][1], IDM_SYN_THREAD_PRIORITY_BELOW_NORMAL, "below normal"); AppendMenu ( hMenuSynPriority, MF_STRING | priority_flag[1][2], IDM_SYN_THREAD_PRIORITY_NORMAL, "normal"); AppendMenu ( hMenuSynPriority, MF_STRING | priority_flag[1][3], IDM_SYN_THREAD_PRIORITY_ABOVE_NORMAL, "above normal"); AppendMenu ( hMenuSynPriority, MF_STRING | priority_flag[1][4], IDM_SYN_THREAD_PRIORITY_HIGHEST, "highest"); AppendMenu ( hMenuSynPriority, MF_SEPARATOR, 0, 0 ); AppendMenu ( hMenuSynPriority, MF_STRING | priority_flag[1][5], IDM_SYN_THREAD_PRIORITY_TIMECRITICAL, "time critical"); AppendMenu ( hMenu, MF_SEPARATOR, 0, 0 ); AppendMenu ( hMenu, MF_POPUP, (UINT)hMenuReset, "Specific system reset" ); AppendMenu ( hMenu, MF_POPUP, (UINT)hMenuChange, "Change Specific system" ); AppendMenu ( hMenu, MF_SEPARATOR, 0, 0 ); AppendMenu ( hMenu, MF_POPUP, (UINT)hMenuProcessPriority, "Change process priority" ); AppendMenu ( hMenu, MF_POPUP, (UINT)hMenuSynPriority, "Change synthesizer thread priority" ); AppendMenu ( hMenu, MF_SEPARATOR, 0, 0 ); AppendMenu ( hMenu, MF_STRING, IDM_PREFERENCE, "Preference"); AppendMenu ( hMenu, MF_STRING, IDM_CONSOLE_WND, "Console"); AppendMenu ( hMenu, MF_SEPARATOR, 0, 0 ); AppendMenu ( hMenu, MF_STRING, IDM_VERSION, "Version Info"); AppendMenu ( hMenu, MF_STRING, IDM_TIMIDITY, "About TiMidity++"); AppendMenu ( hMenu, MF_SEPARATOR, 0, 0 ); AppendMenu ( hMenu, MF_STRING, IDM_QUIT, "Quit"); } GetCursorPos ( &point ); // |bvAbvj[Ə邽߂̑B // http://support.microsoft.com/default.aspx?scid=KB;EN-US;Q135788& Q #if 0 // Win 98/2000 ȍ~pH { DWORD dwThreadID = GetWindowThreadProcessId ( hwnd, NULL ); if ( dwThreadID != w32g_syn.gui_dwThreadId ) { AttachThreadInput ( w32g_syn.gui_dwThreadId, dwThreadID, TRUE ); SetForegroundWindow ( hwnd ); AttachThreadInput ( w32g_syn.gui_dwThreadId, dwThreadID, FALSE ); } else { SetForegroundWindow ( hwnd ); } } #else // ł炵H SetForegroundWindow ( hwnd ); #endif TrackPopupMenu ( hMenu, TPM_TOPALIGN | TPM_LEFTALIGN, point.x, point.y, 0, hwnd, NULL ); PostMessage ( hwnd, WM_NULL, 0, 0 ); // |bvAbvj[̃eNjbN炵B DestroyMenu ( hMenu ); have_popupmenu = 0; return 0; } } } break; case WM_COMMAND: switch (LOWORD(wParam)) { case IDM_QUIT: #if 1/* I */ SetTimer ( NULL, 0, 20000, forced_exit ); #endif w32g_message_set (W32G_SYN_QUIT); break; case IDM_START: w32g_message_set (W32G_SYN_START); break; case IDM_STOP: w32g_message_set (W32G_SYN_STOP); break; case IDM_SYSTEM_RESET: w32g_message_set (W32G_SYN_SYSTEM_RESET); break; case IDM_GM_SYSTEM_RESET: w32g_message_set (W32G_SYN_GM_SYSTEM_RESET); break; case IDM_GS_SYSTEM_RESET: w32g_message_set (W32G_SYN_GS_SYSTEM_RESET); break; case IDM_XG_SYSTEM_RESET: w32g_message_set (W32G_SYN_XG_SYSTEM_RESET); break; case IDM_CHANGE_GM_SYSTEM: w32g_message_set (W32G_SYN_CHANGE_GM_SYSTEM); break; case IDM_CHANGE_GS_SYSTEM: w32g_message_set (W32G_SYN_CHANGE_GS_SYSTEM); break; case IDM_CHANGE_XG_SYSTEM: w32g_message_set (W32G_SYN_CHANGE_XG_SYSTEM); break; case IDM_CHANGE_DEFAULT_SYSTEM: w32g_message_set (W32G_SYN_CHANGE_DEFAULT_SYSTEM); break; case IDM_PREFERENCE: PrefWndCreate ( w32g_syn.nid_hWnd ); break; case IDM_VERSION: VersionWnd ( w32g_syn.nid_hWnd ); break; case IDM_TIMIDITY: TiMidityWnd ( w32g_syn.nid_hWnd ); break; case IDM_PROCESS_PRIORITY_LOWEST: processPriority = IDLE_PRIORITY_CLASS; if ( w32g_syn_status == run ) { SetPriorityClass(GetCurrentProcess(), processPriority); } break; case IDM_PROCESS_PRIORITY_BELOW_NORMAL: processPriority = BELOW_NORMAL_PRIORITY_CLASS; if ( w32g_syn_status == run ) { SetPriorityClass(GetCurrentProcess(), processPriority); } break; case IDM_PROCESS_PRIORITY_NORMAL: processPriority = NORMAL_PRIORITY_CLASS; if ( w32g_syn_status == run ) { SetPriorityClass(GetCurrentProcess(), processPriority); } break; case IDM_PROCESS_PRIORITY_ABOVE_NORMAL: processPriority = ABOVE_NORMAL_PRIORITY_CLASS; if ( w32g_syn_status == run ) { SetPriorityClass(GetCurrentProcess(), processPriority); } break; case IDM_PROCESS_PRIORITY_HIGHEST: processPriority = HIGH_PRIORITY_CLASS; if ( w32g_syn_status == run ) { SetPriorityClass(GetCurrentProcess(), processPriority); } break; case IDM_PROCESS_PRIORITY_REALTIME: processPriority = REALTIME_PRIORITY_CLASS; if ( w32g_syn_status == run ) { SetPriorityClass(GetCurrentProcess(), processPriority); } break; case IDM_SYN_THREAD_PRIORITY_LOWEST: syn_ThreadPriority = THREAD_PRIORITY_LOWEST; if ( w32g_syn_status == run ) { SetThreadPriority ( w32g_syn.syn_hThread, syn_ThreadPriority ); } break; case IDM_SYN_THREAD_PRIORITY_BELOW_NORMAL: syn_ThreadPriority = THREAD_PRIORITY_BELOW_NORMAL; if ( w32g_syn_status == run ) { SetThreadPriority ( w32g_syn.syn_hThread, syn_ThreadPriority ); } break; case IDM_SYN_THREAD_PRIORITY_NORMAL: syn_ThreadPriority = THREAD_PRIORITY_NORMAL; if ( w32g_syn_status == run ) { SetThreadPriority ( w32g_syn.syn_hThread, syn_ThreadPriority ); } break; case IDM_SYN_THREAD_PRIORITY_ABOVE_NORMAL: syn_ThreadPriority = THREAD_PRIORITY_ABOVE_NORMAL; if ( w32g_syn_status == run ) { SetThreadPriority ( w32g_syn.syn_hThread, syn_ThreadPriority ); } break; case IDM_SYN_THREAD_PRIORITY_HIGHEST: syn_ThreadPriority = THREAD_PRIORITY_HIGHEST; if ( w32g_syn_status == run ) { SetThreadPriority ( w32g_syn.syn_hThread, syn_ThreadPriority ); } break; case IDM_SYN_THREAD_PRIORITY_TIMECRITICAL: syn_ThreadPriority = THREAD_PRIORITY_TIME_CRITICAL; if ( w32g_syn_status == run ) { SetThreadPriority ( w32g_syn.syn_hThread, syn_ThreadPriority ); } break; #ifdef HAVE_SYN_CONSOLE case IDM_CONSOLE_WND: if ( hConsoleWnd == NULL ) { InitConsoleWnd ( w32g_syn.nid_hWnd ); } if ( IsWindowVisible ( hConsoleWnd ) ) ShowWindow ( hConsoleWnd, SW_HIDE ); else ShowWindow ( hConsoleWnd, SW_SHOW ); break; #endif default: break; } break; default: if (uMess == RegisterWindowMessage("TaskbarCreated")) { AddTasktrayIcon(hwnd); return 0; } return DefWindowProc ( hwnd, uMess, wParam, lParam ); } return 0L; } static int volatile syn_thread_started = 0; static int start_syn_thread ( void ) { w32g_syn.syn_hThread = crt_beginthreadex ( NULL, 0, (LPTHREAD_START_ROUTINE) syn_thread, NULL, 0, & w32g_syn.syn_dwThreadId ); if ( w32g_syn.syn_hThread == NULL ) { return -1; } for (;;) { if ( syn_thread_started == 1 ) break; if ( syn_thread_started == 2 ) return -1; Sleep ( 200 ); } if ( syn_thread_started == 2 ) return -1; return 0; } static void WINAPI syn_thread ( void ) { syn_thread_started = 1; win_main ( w32g_syn.argc, w32g_syn.argv ); syn_thread_started = 2; } static void terminate_syn_thread ( void ) { w32g_message_set ( W32G_SYN_QUIT ); } static int wait_for_termination_of_syn_thread ( void ) { int i; int ok = 0; for ( i = 0; i < 10; i++ ) { if ( WaitForSingleObject ( w32g_syn.syn_hThread, 200 ) == WAIT_TIMEOUT ) { w32g_message_set ( W32G_SYN_QUIT ); } else { ok = 1; break; } } return ok; } #else // !TWSYNSRV // Windows service version here // To debug output (Require attached debugger) static void OutputString(char *format, ...) { char temp[256]; va_list va; va_start(va, format); vsnprintf(temp, sizeof(temp), format, va); OutputDebugString(temp); va_end(va); } void PutsConsoleWnd(char *str) { OutputString("%s", str); } // To MessageBox Window (Require grant access windowstation) static void OutputWindow(char *format, ...) { char temp[256]; va_list va; va_start(va, format); vsnprintf(temp, sizeof(temp), format, va); MessageBox(NULL, temp, serviceName, MB_OK | MB_ICONEXCLAMATION); va_end(va); } static void OutputLastError(char *message) { LPVOID buffer; FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR)&buffer, 0, NULL); OutputDebugString(message); OutputDebugString(" : "); OutputDebugString(buffer); OutputDebugString("\n"); LocalFree(buffer); } static void OutputWindowLastError(char *message) { LPVOID buffer; char *temp; FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR)&buffer, 0, NULL); temp = (char *)malloc(strlen((const char *)buffer) + strlen(message) + 10); sprintf(temp, "%s : %s\n", message, buffer); MessageBox(NULL, temp, serviceName, MB_OK | MB_ICONEXCLAMATION); free(temp); LocalFree(buffer); } // Report service status to service control manager static BOOL ReportStatusToSCM(DWORD newServiceStatus, DWORD checkPoint, DWORD waitHint, DWORD win32ExitCode, DWORD serviceSpecificExitCode) { BOOL result; SERVICE_STATUS serviceStatus; serviceStatus.dwServiceType = SERVICE_WIN32_OWN_PROCESS; currentServiceStatus = newServiceStatus; serviceStatus.dwCurrentState = newServiceStatus; serviceStatus.dwCheckPoint = checkPoint; serviceStatus.dwWaitHint = waitHint; serviceStatus.dwWin32ExitCode = win32ExitCode; serviceStatus.dwServiceSpecificExitCode = serviceSpecificExitCode; if (newServiceStatus == SERVICE_START_PENDING) { serviceStatus.dwControlsAccepted = 0; } else { serviceStatus.dwControlsAccepted = SERVICE_ACCEPT_STOP | SERVICE_ACCEPT_PAUSE_CONTINUE | SERVICE_ACCEPT_PARAMCHANGE; } result = SetServiceStatus(serviceStatusHandle, &serviceStatus); if (result == FALSE) { OutputLastError("ReportStatusToSCM() == FALSE"); } return result; } // Report service status to service control manager (Alternate version) static BOOL PingStatusToSCM(DWORD checkPoint, DWORD waitHint) { return ReportStatusToSCM(currentServiceStatus, checkPoint, waitHint, NO_ERROR, NO_ERROR); } // Service control message from management interface (Callback from SCM) static void WINAPI ServiceCtrlHandler(DWORD state) { switch (state) { case SERVICE_CONTROL_STOP: ReportStatusToSCM(SERVICE_STOP_PENDING, 1, 0, NO_ERROR, NO_ERROR); w32g_message_set(W32G_SYN_QUIT); break; case SERVICE_CONTROL_PAUSE: ReportStatusToSCM(SERVICE_PAUSE_PENDING, 1, 0, NO_ERROR, NO_ERROR); w32g_message_set(W32G_SYN_STOP); ReportStatusToSCM(SERVICE_PAUSED, 1, 0, NO_ERROR, NO_ERROR); break; case SERVICE_CONTROL_CONTINUE: ReportStatusToSCM(SERVICE_CONTINUE_PENDING, 1, 0, NO_ERROR, NO_ERROR); w32g_message_set(W32G_SYN_START); ReportStatusToSCM(SERVICE_RUNNING, 1, 0, NO_ERROR, NO_ERROR); break; case SERVICE_CONTROL_INTERROGATE: OutputString("ServiceCtrlHandler(), SERVICE_CONTROL_INTERROGATE : oops.\n"); break; case SERVICE_CONTROL_SHUTDOWN: OutputString("ServiceCtrlHandler(), SERVICE_CONTROL_SHUTDOWN : oops.\n"); break; default: OutputString("ServiceCtrlHandler(), default handler (%d) : oops.\n", state); break; } PingStatusToSCM(0, 0); } // Register service control handler static SERVICE_STATUS_HANDLE RegisterCtrlHandler() { SERVICE_STATUS_HANDLE ssh = RegisterServiceCtrlHandler( serviceName, ServiceCtrlHandler); if (ssh == 0) { OutputLastError("RegisterServiceCtrlHandler() == 0"); return NULL; } return ssh; } // Service entry function (Callback from SCM) static void WINAPI ServiceMain(DWORD argc, LPTSTR *argv) { serviceStatusHandle = RegisterCtrlHandler(); ReportStatusToSCM(SERVICE_RUNNING, 1, 0, NO_ERROR, NO_ERROR); w32g_syn.syn_hThread = GetCurrentThread(); win_main(w32g_syn.argc, w32g_syn.argv); ReportStatusToSCM(SERVICE_STOPPED, 1, 0, NO_ERROR, NO_ERROR); } // return // 0 : OK // -1 : FATAL ERROR static int w32g_syn_main ( void ) { int i; BOOL result; SERVICE_TABLE_ENTRY ServiceTable[2]; w32g_syn.nid_uID = W32G_SYN_NID_UID; processPriority = NORMAL_PRIORITY_CLASS; syn_ThreadPriority = THREAD_PRIORITY_NORMAL; for ( i = 0; i <= MAX_PORT; i ++ ) { w32g_syn_id_port[i] = i + 1; } ServiceTable[0].lpServiceName = (LPSTR)serviceName; ServiceTable[0].lpServiceProc = ServiceMain; ServiceTable[1].lpServiceName = 0; ServiceTable[1].lpServiceProc = 0; result = StartServiceCtrlDispatcher(ServiceTable); if (result == FALSE) { #if 0 // OutputLastError("StartServiceCtrlDispatcher() == FALSE"); OutputWindowLastError("StartServiceCtrlDispatcher() == FALSE"); #else ServiceMain(0, 0); #endif return -1; } return 0; } // Service installer static BOOL InstallService() { char twSynSrvPath[_MAX_PATH], serviceLongName[40]; SC_HANDLE scm, sv; HKEY srvKey; GetModuleFileName(NULL, twSynSrvPath, _MAX_PATH); scm = OpenSCManager( NULL, SERVICES_ACTIVE_DATABASE, SC_MANAGER_CREATE_SERVICE); if (scm == NULL) { OutputWindowLastError("OpenSCManager() == NULL"); return FALSE; } strcpy(serviceLongName, serviceName); strcat(serviceLongName, (strcmp(timidity_version, "current")) ? " version " : " "); strcat(serviceLongName, timidity_version); sv = CreateService(scm, serviceName, serviceLongName, 0, SERVICE_WIN32_OWN_PROCESS, SERVICE_DEMAND_START, SERVICE_ERROR_IGNORE, twSynSrvPath, NULL, NULL, NULL, NULL, NULL); if (sv == NULL) { OutputWindowLastError("CreateService() == NULL"); CloseServiceHandle(scm); return FALSE; } CloseServiceHandle(sv); CloseServiceHandle(scm); if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, regKeyTwSynSrv, 0, KEY_WRITE | KEY_READ, &srvKey) == ERROR_SUCCESS) { if (RegSetValueEx(srvKey, "Description", NULL, REG_SZ, (const BYTE *)serviceDescription, strlen(serviceDescription)) != ERROR_SUCCESS) { OutputWindowLastError("RegSetValueEx() != ERROR_SUCCESS"); RegCloseKey(srvKey); return FALSE; } RegCloseKey(srvKey); } OutputWindow("%s : Service install successful.", serviceLongName); return TRUE; } // Service uninstaller static BOOL UninstallService() { char serviceLongName[40]; SC_HANDLE scm, sv; scm = OpenSCManager( NULL, SERVICES_ACTIVE_DATABASE, SC_MANAGER_CONNECT); if (scm == NULL) { OutputWindowLastError("OpenSCManager() == NULL"); return FALSE; } sv = OpenService(scm, serviceName, DELETE | SERVICE_STOP | SERVICE_QUERY_STATUS); if (sv == NULL) { OutputWindowLastError("OpenService() == NULL"); CloseServiceHandle(scm); return FALSE; } if (DeleteService(sv) == FALSE) { OutputWindowLastError("DeleteService() == FALSE"); CloseServiceHandle(sv); CloseServiceHandle(scm); return FALSE; } CloseServiceHandle(sv); CloseServiceHandle(scm); strcpy(serviceLongName, serviceName); strcat(serviceLongName, (strcmp(timidity_version, "current")) ? " version " : " "); strcat(serviceLongName, timidity_version); OutputWindow("%s : Service uninstall successful.", serviceLongName); return TRUE; } #endif // !TWSYNSRV // •ϒɂ\cc // 0: A1: ljłȂ int w32g_message_set ( int cmd ) { int res = 0; if ( msg_loopbuf_hMutex == NULL ) { msg_loopbuf_hMutex = CreateMutex ( NULL, TRUE, NULL ); } else { WaitForSingleObject ( msg_loopbuf_hMutex, INFINITE ); } if ( cmd == W32G_SYN_QUIT || cmd == W32G_SYN_START || cmd == W32G_SYN_STOP ) { // D悷郁bZ[WB msg_loopbuf_start = 0; msg_loopbuf_end = 0; msg_loopbuf[msg_loopbuf_end].cmd = cmd; ReleaseMutex ( msg_loopbuf_hMutex ); return res; } else if ( cmd != W32G_SYN_NONE ) { if ( msg_loopbuf_end < 0 ) { msg_loopbuf_start = 0; msg_loopbuf_end = 0; } else if ( msg_loopbuf_start <= msg_loopbuf_end ) { if ( msg_loopbuf_end < W32G_SYN_MESSAGE_MAX - 1) msg_loopbuf_end ++; else res = 1; } else if ( msg_loopbuf_end < msg_loopbuf_start - 1 ) { msg_loopbuf_end ++; } else { res = 1; } if ( res == 0 ) { msg_loopbuf[msg_loopbuf_end].cmd = cmd; } } ReleaseMutex ( msg_loopbuf_hMutex ); Sleep ( 100 ); return res; } int w32g_message_get ( w32g_syn_message_t *msg ) { int have_msg = 0; if ( msg_loopbuf_hMutex == NULL ) { msg_loopbuf_hMutex = CreateMutex ( NULL, TRUE, NULL ); } else { WaitForSingleObject ( msg_loopbuf_hMutex, INFINITE ); } if ( msg_loopbuf_start >= 0 ) { memcpy ( msg, &msg_loopbuf[msg_loopbuf_start], sizeof ( w32g_syn_message_t ) ); have_msg = 1; msg_loopbuf_start ++; if ( msg_loopbuf_end < msg_loopbuf_start ) { msg_loopbuf_start = msg_loopbuf_end = -1; } else if ( msg_loopbuf_start >= W32G_SYN_MESSAGE_MAX ) { msg_loopbuf_start = 0; } } ReleaseMutex ( msg_loopbuf_hMutex ); return have_msg; } extern int seq_quit; extern void rtsyn_play_event(MidiEvent *); void w32g_syn_doit(void) { w32g_syn_message_t msg; MidiEvent ev; DWORD sleep_time; while(seq_quit==0) { int have_msg = 0; sleep_time = 0; have_msg = w32g_message_get ( &msg ); if ( have_msg ) { switch ( msg.cmd ) { case W32G_SYN_QUIT: seq_quit=~0; w32g_syn_status = quit; sleep_time = 100; break; case W32G_SYN_START: seq_quit=~0; w32g_syn_status = run; sleep_time = 100; break; case W32G_SYN_STOP: seq_quit=~0; w32g_syn_status = stop; sleep_time = 100; break; case W32G_SYN_GM_SYSTEM_RESET: rtsyn_server_reset(); ev.type=ME_RESET; ev.a=GM_SYSTEM_MODE; rtsyn_play_event(&ev); sleep_time = 100; break; case W32G_SYN_GS_SYSTEM_RESET: rtsyn_server_reset(); ev.type=ME_RESET; ev.a=GS_SYSTEM_MODE; rtsyn_play_event(&ev); sleep_time = 100; break; case W32G_SYN_XG_SYSTEM_RESET: rtsyn_server_reset(); ev.type=ME_RESET; ev.a=XG_SYSTEM_MODE; rtsyn_play_event(&ev); sleep_time = 100; break; case W32G_SYN_SYSTEM_RESET: rtsyn_server_reset(); ev.type=ME_RESET; ev.a=rtsyn_system_mode; rtsyn_play_event(&ev); sleep_time = 100; break; case W32G_SYN_CHANGE_GM_SYSTEM: rtsyn_system_mode=GM_SYSTEM_MODE; rtsyn_server_reset(); ev.type=ME_RESET; ev.a=GM_SYSTEM_MODE; rtsyn_play_event(&ev); change_system_mode(rtsyn_system_mode); sleep_time = 100; break; case W32G_SYN_CHANGE_GS_SYSTEM: rtsyn_system_mode=GS_SYSTEM_MODE; rtsyn_server_reset(); ev.type=ME_RESET; ev.a=GS_SYSTEM_MODE; rtsyn_play_event(&ev); change_system_mode(rtsyn_system_mode); sleep_time = 100; break; case W32G_SYN_CHANGE_XG_SYSTEM: rtsyn_system_mode=XG_SYSTEM_MODE; rtsyn_server_reset(); ev.type=ME_RESET; ev.a=XG_SYSTEM_MODE; rtsyn_play_event(&ev); change_system_mode(rtsyn_system_mode); sleep_time = 100; break; case W32G_SYN_CHANGE_DEFAULT_SYSTEM: rtsyn_system_mode=DEFAULT_SYSTEM_MODE; rtsyn_server_reset(); ev.type=ME_RESET; ev.a=GS_SYSTEM_MODE; rtsyn_play_event(&ev); change_system_mode(rtsyn_system_mode); sleep_time = 100; break; default: break; } } winplaymidi(); Sleep ( sleep_time ); } } void w32g_syn_ctl_pass_playing_list ( int n_, char *args_[] ) { int i; #ifndef TWSYNSRV w32g_syn_status = syn_AutoStart ? run : stop; #else w32g_syn_status = run; #endif for (;;) { int breakflag = 0; switch ( w32g_syn_status ) { default: case quit: breakflag = 1; break; case run: { int result; char args_[MAX_PORT][10]; char *args[MAX_PORT]; if ( w32g_syn_port_num <= 0 ) { w32g_syn_status = stop; break; } else if ( w32g_syn_port_num > MAX_PORT ) { w32g_syn_port_num = MAX_PORT; } for ( i = 0; i < MAX_PORT; i ++ ) { args[i] = args_[i]; sprintf ( args[i], "%d", w32g_syn_id_port[i] ); } SetPriorityClass ( GetCurrentProcess(), processPriority ); SetThreadPriority ( w32g_syn.syn_hThread, syn_ThreadPriority ); result = ctl_pass_playing_list2 ( w32g_syn_port_num, args ); SetPriorityClass ( GetCurrentProcess(), NORMAL_PRIORITY_CLASS ); SetThreadPriority ( w32g_syn.syn_hThread, THREAD_PRIORITY_NORMAL ); if ( result == 2 ) { w32g_syn_status = stop; } } break; case stop: { w32g_syn_message_t msg; if ( w32g_message_get ( &msg ) ) { if ( msg.cmd == W32G_SYN_START ) { w32g_syn_status = run; break; } else { if ( msg.cmd == W32G_SYN_QUIT ) { w32g_syn_status = quit; break; } } } Sleep ( 500 ); } break; } if ( breakflag ) break; } #ifndef TWSYNSRV while ( w32g_syn.quit_state < 1 ) { PostThreadMessage ( w32g_syn.gui_dwThreadId, MYWM_QUIT, 0, 0 ); Sleep ( 300 ); } #endif if ( w32g_syn.quit_state < 2 ) w32g_syn.quit_state = 2; } int w32g_syn_do_before_pref_apply ( void ) { w32g_syn_status_prev = none; for (;;) { if ( w32g_syn_status == quit ) return -1; if ( msg_loopbuf_hMutex == NULL ) { msg_loopbuf_hMutex = CreateMutex ( NULL, TRUE, NULL ); } else { WaitForSingleObject ( msg_loopbuf_hMutex, INFINITE ); } if ( w32g_syn_status_prev == none ) w32g_syn_status_prev = w32g_syn_status; if ( w32g_syn_status == stop ) { return 0; } ReleaseMutex ( msg_loopbuf_hMutex ); w32g_message_set ( W32G_SYN_STOP ); Sleep ( 100 ); } } int w32g_syn_do_after_pref_apply ( void ) { ReleaseMutex ( msg_loopbuf_hMutex ); if ( w32g_syn_status_prev == run ) { w32g_message_set ( W32G_SYN_START ); Sleep ( 100 ); } return 0; } #ifdef HAVE_SYN_CONSOLE // **************************************************************************** // Edit Ctl. void VprintfEditCtlWnd(HWND hwnd, char *fmt, va_list argList) { char buffer[BUFSIZ], out[BUFSIZ]; char *in; int i; if(!IsWindow(hwnd)) return; vsnprintf(buffer, sizeof(buffer), fmt, argList); in = buffer; i = 0; for(;;){ if(*in == '\0' || i>sizeof(out)-3){ out[i] = '\0'; break; } if(*in=='\n'){ out[i] = 13; out[i+1] = 10; in++; i += 2; continue; } out[i] = *in; in++; i++; } Edit_SetSel(hwnd,-1,-1); Edit_ReplaceSel(hwnd,out); } void PrintfEditCtlWnd(HWND hwnd, char *fmt, ...) { va_list ap; va_start(ap, fmt); VprintfEditCtlWnd(hwnd,fmt,ap); va_end(ap); } #if 1 void PutsEditCtlWnd(HWND hwnd, char *str) { char *in = str; int i; char out[BUFSIZ]; i = 0; for(;;){ if(*in == '\0' || i>sizeof(out)-3){ out[i] = '\0'; break; } if(*in=='\n'){ out[i] = 13; out[i+1] = 10; in++; i += 2; continue; } out[i] = *in; in++; i++; } if(IsWindow(hwnd)){ Edit_SetSel(hwnd,-1,-1); Edit_ReplaceSel(hwnd,out); } } #else void PutsEditCtlWnd(HWND hwnd, char *str) { if(!IsWindow(hwnd)) return; PrintfEditCtlWnd(hwnd,"%s",str); } #endif void ClearEditCtlWnd(HWND hwnd) { char pszVoid[]=""; if(!IsWindow(hwnd)) return; if(IsWindow(hwnd)){ // Edit_SetSel(hwnd,0,-1); Edit_SetSel(hwnd,-1,-1); } Edit_SetText(hwnd,pszVoid); } static void VersionWnd(HWND hParentWnd) { char VersionText[2024]; sprintf(VersionText, "TiMidity++ %s%s" NLS NLS "TiMidity-0.2i by Tuukka Toivonen ." NLS "TiMidity Win32 version by Davide Moretti ." NLS "TiMidity Windows 95 port by Nicolas Witczak." NLS "Twsynth by Keishi Suenaga ." NLS "Twsynth GUI by Daisuke Aoki ." NLS " Japanese menu, dialog, etc by Saito ." NLS "TiMidity++ by Masanao Izumo ." NLS ,(strcmp(timidity_version, "current")) ? "version " : "", timidity_version); MessageBox(hParentWnd, VersionText, "Version", MB_OK); } static void TiMidityWnd(HWND hParentWnd) { char TiMidityText[2024]; sprintf(TiMidityText, " TiMidity++ %s%s -- MIDI to WAVE converter and player" NLS " Copyright (C) 1999-2002 Masanao Izumo " NLS " Copyright (C) 1995 Tuukka Toivonen " NLS NLS " Win32 version by Davide Moretti " NLS " GUI by Daisuke Aoki ." NLS " Modified by Masanao Izumo ." NLS NLS " This program is free software; you can redistribute it and/or modify" NLS " it under the terms of the GNU General Public License as published by" NLS " the Free Software Foundation; either version 2 of the License, or" NLS " (at your option) any later version." NLS NLS " This program is distributed in the hope that it will be useful," NLS " but WITHOUT ANY WARRANTY; without even the implied warranty of"NLS " MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the" NLS " GNU General Public License for more details." NLS NLS " You should have received a copy of the GNU General Public License" NLS " along with this program; if not, write to the Free Software" NLS " Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA" NLS , (strcmp(timidity_version, "current")) ? "version " : "", timidity_version ); MessageBox(hParentWnd, TiMidityText, "TiMidity", MB_OK); } // *************************************************************************** // // Console Window // // *************************************************************************** // --------------------------------------------------------------------------- // variables static int ConsoleWndMaxSize = 64 * 1024; static HFONT hFontConsoleWnd = NULL; // --------------------------------------------------------------------------- // prototypes of functions static BOOL CALLBACK ConsoleWndProc(HWND hwnd, UINT uMess, WPARAM wParam, LPARAM lParam); static void ConsoleWndAllUpdate(void); static void ConsoleWndVerbosityUpdate(void); static void ConsoleWndVerbosityApply(void); static void ConsoleWndValidUpdate(void); static void ConsoleWndValidApply(void); static void ConsoleWndVerbosityApplyIncDec(int num); static int ConsoleWndInfoReset(HWND hwnd); static int ConsoleWndInfoApply(void); void ClearConsoleWnd(void); // --------------------------------------------------------------------------- // Global Functions // Initialization void InitConsoleWnd(HWND hParentWnd) { if (hConsoleWnd != NULL) { DestroyWindow(hConsoleWnd); hConsoleWnd = NULL; } switch(PlayerLanguage){ case LANGUAGE_ENGLISH: hConsoleWnd = CreateDialog (hInst,MAKEINTRESOURCE(IDD_DIALOG_CONSOLE_EN),hParentWnd,ConsoleWndProc); break; default: case LANGUAGE_JAPANESE: hConsoleWnd = CreateDialog (hInst,MAKEINTRESOURCE(IDD_DIALOG_CONSOLE),hParentWnd,ConsoleWndProc); break; } ShowWindow(hConsoleWnd,SW_HIDE); UpdateWindow(hConsoleWnd); ConsoleWndVerbosityApplyIncDec(0); CheckDlgButton(hConsoleWnd, IDC_CHECKBOX_VALID, ConsoleWndFlag); Edit_LimitText(GetDlgItem(hConsoleWnd,IDC_EDIT), ConsoleWndMaxSize); } // Window Procedure static BOOL CALLBACK ConsoleWndProc(HWND hwnd, UINT uMess, WPARAM wParam, LPARAM lParam) { switch (uMess){ case WM_INITDIALOG: PutsConsoleWnd("Console Window\n"); ConsoleWndAllUpdate(); return FALSE; case WM_COMMAND: switch (LOWORD(wParam)) { case IDCLOSE: ShowWindow(hwnd, SW_HIDE); break; case IDCLEAR: ClearConsoleWnd(); break; case IDC_CHECKBOX_VALID: ConsoleWndValidApply(); break; case IDC_BUTTON_VERBOSITY: ConsoleWndVerbosityApply(); break; case IDC_BUTTON_INC: ConsoleWndVerbosityApplyIncDec(1); break; case IDC_BUTTON_DEC: ConsoleWndVerbosityApplyIncDec(-1); break; default: break; } switch (HIWORD(wParam)) { case EN_ERRSPACE: ClearConsoleWnd(); PutsConsoleWnd("### EN_ERRSPACE -> Clear! ###\n"); break; default: break; } break; case WM_SIZE: ConsoleWndAllUpdate(); return FALSE; case WM_MOVE: break; // See PreDispatchMessage() in w32g2_main.c case WM_SYSKEYDOWN: case WM_KEYDOWN: { int nVirtKey = (int)wParam; switch(nVirtKey){ case VK_ESCAPE: SendMessage(hwnd,WM_CLOSE,0,0); break; } } break; case WM_DESTROY: break; case WM_CLOSE: ShowWindow(hConsoleWnd, SW_HIDE); break; case WM_SETFOCUS: HideCaret(hwnd); break; case WM_KILLFOCUS: ShowCaret(hwnd); break; default: return FALSE; } return FALSE; } // puts() void PutsConsoleWnd(char *str) { HWND hwnd; if(!IsWindow(hConsoleWnd) || !ConsoleWndFlag) return; hwnd = GetDlgItem(hConsoleWnd,IDC_EDIT); PutsEditCtlWnd(hwnd,str); } // printf() void PrintfConsoleWnd(char *fmt, ...) { HWND hwnd; va_list ap; if(!IsWindow(hConsoleWnd) || !ConsoleWndFlag) return; hwnd = GetDlgItem(hConsoleWnd,IDC_EDIT); va_start(ap, fmt); VprintfEditCtlWnd(hwnd,fmt,ap); va_end(ap); } // Clear void ClearConsoleWnd(void) { HWND hwnd; if(!IsWindow(hConsoleWnd)) return; hwnd = GetDlgItem(hConsoleWnd,IDC_EDIT); ClearEditCtlWnd(hwnd); } // --------------------------------------------------------------------------- // Static Functions static void ConsoleWndAllUpdate(void) { ConsoleWndVerbosityUpdate(); ConsoleWndValidUpdate(); Edit_LimitText(GetDlgItem(hConsoleWnd,IDC_EDIT_VERBOSITY),3); Edit_LimitText(GetDlgItem(hConsoleWnd,IDC_EDIT),ConsoleWndMaxSize); } static void ConsoleWndValidUpdate(void) { if(ConsoleWndFlag) CheckDlgButton(hConsoleWnd, IDC_CHECKBOX_VALID, 1); else CheckDlgButton(hConsoleWnd, IDC_CHECKBOX_VALID, 0); } static void ConsoleWndValidApply(void) { if(IsDlgButtonChecked(hConsoleWnd,IDC_CHECKBOX_VALID)) ConsoleWndFlag = 1; else ConsoleWndFlag = 0; } static void ConsoleWndVerbosityUpdate(void) { SetDlgItemInt(hConsoleWnd,IDC_EDIT_VERBOSITY,(UINT)ctl->verbosity, TRUE); } static void ConsoleWndVerbosityApply(void) { char buffer[64]; HWND hwnd; hwnd = GetDlgItem(hConsoleWnd,IDC_EDIT_VERBOSITY); if(!IsWindow(hConsoleWnd)) return; if(Edit_GetText(hwnd,buffer,60)<=0) return; ctl->verbosity = atoi(buffer); ConsoleWndVerbosityUpdate(); } static void ConsoleWndVerbosityApplyIncDec(int num) { if(!IsWindow(hConsoleWnd)) return; ctl->verbosity += num; RANGE(ctl->verbosity, -1, 4); ConsoleWndVerbosityUpdate(); } #endif // HAVE_SYN_CONSOLE #endif // IA_W32G_SYN TiMidity++-2.13.2/interface/w32g_btn.bmp0100644004711200001440000000176607421005040016764 0ustar tamukiusersBMv(pwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwpwwwwwwwwpwwwwwwwwwwwppwwwwwwwwwwwpwwwwwpwwpwwppwpwpwwpwwwwwwwwwwwwppwwwwwwwpwwwwpwpwppwwwwpwwwwwwwwwwppwwwwwwwpwwwpwpwppppwpwwwwwwwwwwppwwwwwwwpwwppppwwwwwwwwwwppwwwwwwwpwppppppwpwwwwwwwwwwppwwwwwwwpwwppppwwwwpwwwwwwwwwwppwwwwwwwpwwwpwpwppwpwpwwpwwwwwwwwwwwwppwwwwwwwpwwwwpwpwppwwwwwwwwpwwwwwwwwwwwppwwwwwwwpwwwwwpwwpwwpwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwTiMidity++-2.13.2/interface/w32g_icon.ico0100644004711200001440000000206610017767646017145 0ustar tamukiusers(& N(   3;3?x8DDRETIDI110I_P F_ MITY562 DD RETI( @       0x8QP; 8QPp[P3[[;UU;x[P[P [P<81? ~?ǀ? g  _ Og;7TiMidity++-2.13.2/interface/w32g_sleep.bmp0100644004711200001440000001606607636346316017336 0ustar tamukiusersBM66(`@??_??????????```                                                                                                                                                                                                                                                                                                                                                                 TiMidity++-2.13.2/interface/w32g_subbtn.bmp0100644004711200001440000000136607421005040017472 0ustar tamukiusersBMv(PwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwpwpwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwppwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwpwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwpwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwpwwwwwwwwwwwwwwwwwwwpwpwwpwpwpwpwppwppwppwpwwpwwwwwwwwwwwpwppwppwppwwwwwpwwwwppwwpwppppwppwwwwwwwwwpwwpwppppwppwwwwwwwwwpwpwppppwppwwwwwwwwwppwwpwppppwppwpwwpwwwwppwwpwppwppwwwpwwwwpwpwwpwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwTiMidity++-2.13.2/interface/w32g_subwin2.c0100644004711200001440000021412310016663264017243 0ustar tamukiusers/* TiMidity++ -- MIDI to WAVE converter and player Copyright (C) 1999-2002 Masanao Izumo Copyright (C) 1995 Tuukka Toivonen 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA w32g_subwin2.c: Written by Daisuke Aoki */ #ifdef HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ #include #include #include #include #ifndef NO_STRING_H #include #else #include #endif #include "timidity.h" #include "common.h" #include "instrum.h" #include "playmidi.h" #include "readmidi.h" #include "output.h" #include "controls.h" #include "tables.h" #include "miditrace.h" #include "reverb.h" #ifdef SUPPORT_SOUNDSPEC #include "soundspec.h" #endif /* SUPPORT_SOUNDSPEC */ #include "recache.h" #include "arc.h" #include "strtab.h" #include "wrd.h" #include "mid.defs" #include "w32g.h" #include #include #include #include "w32g_res.h" #include "w32g_utl.h" #include "w32g_pref.h" #include "w32g_subwin.h" #include "w32g_ut2.h" #include "w32g_dib.h" #include "w32g_wrd.h" #include "w32g_mag.h" extern int gdi_lock_ex ( DWORD timeout ); #if 0 static int gdi_lock_result; #define GDI_LOCK_EX(timeout) ( \ ctl->cmsg(CMSG_INFO, VERB_VERBOSE, "GDI_LOCK_EX(%s: %d)", __FILE__, __LINE__ ), \ gdi_lock_result = gdi_lock_ex(timeout), \ ctl->cmsg(CMSG_INFO, VERB_VERBOSE, "GDI_LOCK_EX_RESULT(%d)", gdi_lock_result ), \ gdi_lock_result \ ) #define GDI_LOCK() { \ ctl->cmsg(CMSG_INFO, VERB_VERBOSE, "GDI_LOCK(%s: %d)", __FILE__, __LINE__ ); \ gdi_lock(); \ } #define GDI_UNLOCK() { \ ctl->cmsg(CMSG_INFO, VERB_VERBOSE, "GDI_UNLOCK(%s: %d)", __FILE__, __LINE__ ); \ gdi_unlock(); \ } #else #define GDI_LOCK() { gdi_lock(); } #define GDI_LOCK_EX(timeout) gdi_lock_ex(timeout) #define GDI_UNLOCK() { gdi_unlock(); } #endif #if defined(__CYGWIN32__) || defined(__MINGW32__) #ifndef TPM_TOPALIGN #define TPM_TOPALIGN 0x0000L #endif #endif extern void VprintfEditCtlWnd(HWND hwnd, char *fmt, va_list argList); extern void PrintfEditCtlWnd(HWND hwnd, char *fmt, ...); extern void PutsEditCtlWnd(HWND hwnd, char *str); extern void ClearEditCtlWnd(HWND hwnd); #ifndef _mbbtype #ifndef _MBC_SINGLE #define _MBC_SINGLE (0) #endif #ifndef _MBC_LEAD #define _MBC_LEAD (1) #endif #ifndef _MBC_TRAIL #define _MBC_TRAIL (2) #endif #ifndef _MBC_ILLEGAL #define _MBC_ILLEGAL (-1) #endif #define is_sjis_kanji1(x) ((((unsigned char)(x))>=0x81 && ((unsigned char)(x))<=0x9f) || (((unsigned char)(x))>=0xe0 && ((unsigned char)(x))<=0xfc)) #define is_sjis_kanji2(x) ((((unsigned char)(x))>=0x40 && ((unsigned char)(x))<=0x7e) || (((unsigned char)(x))>=0x80 && ((unsigned char)(x))<=0xfc)) static int ___sjis_mbbtype(unsigned char c, int mbtype) { if(mbtype==_MBC_LEAD){ if(is_sjis_kanji2(c)) return _MBC_TRAIL; else return _MBC_ILLEGAL; } else { if(is_sjis_kanji1(c)) return _MBC_LEAD; else return _MBC_SINGLE; } } static int _mbbtype(unsigned char c, int mbtype) { return ___sjis_mbbtype(c,mbtype); } #endif static RGBQUAD RGBtoRGBQUAD ( COLORREF color ); static COLORREF RGBQUADtoRGB ( RGBQUAD rq ); // **************************************************************************** // Wrd Window #define MAG_WORK_WIDTH 800 #define MAG_WORK_HEIGHT 640 #define COLOR_MASK_WHITE RGB(0xFF,0xFF,0xFF) #define COLOR_MASK_BLACK RGB(0x00,0x00,0x00) WRDWNDINFO WrdWndInfo; static int WrdWndInfoReset(HWND hwnd); static int WrdWndInfoApply(void); w32g_wrd_wnd_t w32g_wrd_wnd; BOOL SetWrdWndActive(void) { if ( IsWindowVisible(hWrdWnd) ) { w32g_wrd_wnd.active = TRUE; } else { w32g_wrd_wnd.active = FALSE; } return w32g_wrd_wnd.active; } static void wrd_graphic_terminate ( void ); static void wrd_graphic_init ( HDC hdc ); static void wrd_graphic_tone_change ( int index, int tone ); static void wrd_graphic_set_pal ( int index, int pal_index, COLORREF color ); static void wrd_graphic_plane_change ( int active, int display ); static void wrd_graphic_reset ( int index ); static void wrd_graphic_reset_all ( void ); static void wrd_graphic_apply ( RECT *lprc, int index, int lockflag ); static void wrd_graphic_update ( RECT *lprc, int lockflag ); static void wrd_text_update ( int x_from, int y_from, int x_to, int y_to, int lockflag ); static int volatile wrd_graphic_pal_init_flag = 0; static HANDLE volatile hMutexWrd = NULL; static BOOL wrd_wnd_lock_ex ( DWORD timeout ) { if ( hMutexWrd == NULL ) { hMutexWrd = CreateMutex ( NULL, FALSE, NULL ); if ( hMutexWrd == NULL ) return FALSE; } if ( WaitForSingleObject ( hMutexWrd, timeout )== WAIT_FAILED ) { return FALSE; } return TRUE; } static BOOL wrd_wnd_lock (void) { return wrd_wnd_lock_ex ( INFINITE ); } static void wrd_wnd_unlock (void) { ReleaseMutex ( hMutexWrd ); } BOOL CALLBACK WrdWndProc(HWND hwnd, UINT uMess, WPARAM wParam, LPARAM lParam); BOOL CALLBACK WrdCanvasWndProc(HWND hwnd, UINT uMess, WPARAM wParam, LPARAM lParam); static int volatile wrd_wnd_initflag = 1; void TerminateWrdWnd ( void ) { wrd_wnd_lock(); w32g_wrd_wnd.active = FALSE; if ( !wrd_wnd_initflag ) { DeleteDC ( w32g_wrd_wnd.hmdc ); DeleteObject ( (HGDIOBJ) w32g_wrd_wnd.hbitmap ); DeleteObject ( (HGDIOBJ) w32g_wrd_wnd.hbmp_tmask ); DeleteObject ( (HGDIOBJ) w32g_wrd_wnd.hbmp_work ); DeleteObject ( (HGDIOBJ) w32g_wrd_wnd.hNullBrush ); DeleteObject ( (HGDIOBJ) w32g_wrd_wnd.hNullPen ); } wrd_graphic_terminate (); memset ( &w32g_wrd_wnd, 0, sizeof (w32g_wrd_wnd_t) ); wrd_wnd_unlock(); } void InitWrdWnd(HWND hParentWnd) { WNDCLASS wndclass ; HICON hIcon; wrd_wnd_lock(); if ( wrd_wnd_initflag ) { memset ( &w32g_wrd_wnd, 0, sizeof (w32g_wrd_wnd_t) ); wrd_wnd_initflag = 0; } if (hWrdWnd != NULL) { DestroyWindow(hWrdWnd); hWrdWnd = NULL; } TerminateWrdWnd (); INILoadWrdWnd(); w32g_wrd_wnd.hNullBrush = GetStockObject ( NULL_BRUSH ); w32g_wrd_wnd.hNullPen = GetStockObject ( NULL_PEN ); hWrdWnd = CreateDialog (hInst,MAKEINTRESOURCE(IDD_DIALOG_WRD),hParentWnd,WrdWndProc); WrdWndInfoReset(hWrdWnd); INILoadWrdWnd(); ShowWindow(hWrdWnd,SW_HIDE); w32g_wrd_wnd.draw_skip = 0; w32g_wrd_wnd.font_height = 16; w32g_wrd_wnd.font_width = 8; w32g_wrd_wnd.row = 80; w32g_wrd_wnd.col = 25; w32g_wrd_wnd.width = w32g_wrd_wnd.font_width * w32g_wrd_wnd.row; w32g_wrd_wnd.height = w32g_wrd_wnd.font_height * w32g_wrd_wnd.col; w32g_wrd_wnd.pals[W32G_WRDWND_BLACK] = RGB ( 0x00, 0x00, 0x00 ); w32g_wrd_wnd.pals[W32G_WRDWND_RED] = RGB ( 0xFF, 0x00, 0x00 ); w32g_wrd_wnd.pals[W32G_WRDWND_BLUE] = RGB ( 0x00, 0x00, 0xFF ); w32g_wrd_wnd.pals[W32G_WRDWND_PURPLE] = RGB ( 0xFF, 0x00, 0xFF ); w32g_wrd_wnd.pals[W32G_WRDWND_GREEN] = RGB ( 0x00, 0xFF, 0x00 ); w32g_wrd_wnd.pals[W32G_WRDWND_LIGHTBLUE] = RGB ( 0x00, 0xFF, 0xFF ); w32g_wrd_wnd.pals[W32G_WRDWND_YELLOW] = RGB ( 0xFF, 0xFF, 0xFF ); w32g_wrd_wnd.pals[W32G_WRDWND_WHITE] = RGB ( 0xFF, 0xFF, 0xFF ); w32g_wrd_wnd.flag = WRD_FLAG_DEFAULT; wndclass.style = CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS | CS_CLASSDC; wndclass.lpfnWndProc = WrdCanvasWndProc ; wndclass.cbClsExtra = 0 ; wndclass.cbWndExtra = 0 ; wndclass.hInstance = hInst ; wndclass.hIcon = NULL; wndclass.hCursor = LoadCursor(0,IDC_ARROW) ; // wndclass.hbrBackground = (HBRUSH)(COLOR_SCROLLBAR + 1); wndclass.hbrBackground = w32g_wrd_wnd.hNullBrush; wndclass.lpszMenuName = NULL; wndclass.lpszClassName = "wrd canvas wnd"; RegisterClass(&wndclass); w32g_wrd_wnd.hwnd = CreateWindowEx(0,"wrd canvas wnd",0,WS_CHILD, CW_USEDEFAULT,0,w32g_wrd_wnd.width,w32g_wrd_wnd.height, hWrdWnd,0,hInst,0); w32g_wrd_wnd.hdc = GetDC(w32g_wrd_wnd.hwnd); // 匳 w32g_wrd_wnd.hbitmap = CreateCompatibleBitmap(w32g_wrd_wnd.hdc,w32g_wrd_wnd.width,w32g_wrd_wnd.height); w32g_wrd_wnd.hmdc = CreateCompatibleDC(w32g_wrd_wnd.hdc); w32g_wrd_wnd.hgdiobj_hmdcprev = SelectObject(w32g_wrd_wnd.hmdc,w32g_wrd_wnd.hbitmap); SelectObject ( w32g_wrd_wnd.hmdc, w32g_wrd_wnd.hNullBrush ); SelectObject ( w32g_wrd_wnd.hmdc, w32g_wrd_wnd.hNullPen ); // [N w32g_wrd_wnd.hbmp_work = CreateCompatibleBitmap(w32g_wrd_wnd.hdc,w32g_wrd_wnd.width,w32g_wrd_wnd.height); // eLXg}XN // w32g_wrd_wnd.hbmp_tmask = CreateBitmap ( w32g_wrd_wnd.width, w32g_wrd_wnd.height, 1, 1, NULL); w32g_wrd_wnd.hbmp_tmask = CreateCompatibleBitmap(w32g_wrd_wnd.hdc,w32g_wrd_wnd.width,w32g_wrd_wnd.height); { HDC hmdc; RECT rc; HBRUSH hbrush = CreateSolidBrush ( COLOR_MASK_BLACK ); SetRect ( &rc, 0, 0, w32g_wrd_wnd.width, w32g_wrd_wnd.height ); hmdc = CreateCompatibleDC ( w32g_wrd_wnd.hmdc ); SelectObject ( hmdc, w32g_wrd_wnd.hbmp_tmask ); FillRect ( hmdc, &rc, hbrush ); SelectObject ( hmdc, w32g_wrd_wnd.hbmp_work ); FillRect ( hmdc, &rc, hbrush ); DeleteDC ( hmdc ); DeleteObject ( hbrush ); } // OtBbN wrd_graphic_init ( w32g_wrd_wnd.hdc ); ReleaseDC(w32g_wrd_wnd.hwnd,w32g_wrd_wnd.hdc); { char fontname[1024]; if ( PlayerLanguage == LANGUAGE_JAPANESE ) strcpy(fontname,"lr "); else strcpy(fontname,"Times New Roman"); w32g_wrd_wnd.hFont = CreateFont(w32g_wrd_wnd.font_height,w32g_wrd_wnd.font_width,0,0,FW_DONTCARE,FALSE,FALSE,FALSE, DEFAULT_CHARSET,OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY, FIXED_PITCH | FF_MODERN ,fontname); } hIcon = LoadImage(hInst, MAKEINTRESOURCE(IDI_ICON_TIMIDITY), IMAGE_ICON, 16, 16, 0); if (hIcon!=NULL) SendMessage(hWrdWnd,WM_SETICON,FALSE,(LPARAM)hIcon); wrd_wnd_unlock(); WrdWndReset(); w32g_wrd_wnd.active = FALSE; MoveWindow(w32g_wrd_wnd.hwnd,0,0,w32g_wrd_wnd.width,w32g_wrd_wnd.height,TRUE); WrdWndClear ( TRUE ); ShowWindow(w32g_wrd_wnd.hwnd,SW_SHOW); UpdateWindow(w32g_wrd_wnd.hwnd); UpdateWindow(hWrdWnd); WrdWndInfoApply(); } static void wrd_graphic_terminate ( void ) { int index; wrd_wnd_lock(); GdiFlush (); for ( index = 0; index < W32G_WRDWND_GRAPHIC_PLANE_MAX; index++ ) { if ( w32g_wrd_wnd.graphic_dib[index] != NULL ) { dib_free ( w32g_wrd_wnd.graphic_dib[index] ); w32g_wrd_wnd.graphic_dib[index] = NULL; } } if ( w32g_wrd_wnd.bits_mag_work != NULL ) free ( w32g_wrd_wnd.bits_mag_work ); wrd_wnd_unlock(); } // v[ index ̃OtBbN̏ static void wrd_graphic_init ( HDC hdc ) { int index; wrd_wnd_lock(); wrd_graphic_terminate (); for ( index = 0; index < W32G_WRDWND_GRAPHIC_PLANE_MAX; index++ ) { w32g_wrd_wnd.graphic_dib[index] = dib_create ( w32g_wrd_wnd.width, w32g_wrd_wnd.height ); w32g_wrd_wnd.modified_graphic[index] = TRUE; } w32g_wrd_wnd.bits_mag_work = (char *) safe_malloc ( MAG_WORK_WIDTH * MAG_WORK_HEIGHT ); w32g_wrd_wnd.index_active = 0; w32g_wrd_wnd.index_display = 0; wrd_wnd_unlock(); wrd_graphic_reset_all (); } static void wrd_graphic_plane_change ( int active, int display ) { wrd_wnd_lock(); w32g_wrd_wnd.index_active = active; w32g_wrd_wnd.index_display = display; wrd_wnd_unlock(); } static void wrd_graphic_reset ( int index ) { RECT rc; wrd_wnd_lock(); memset ( w32g_wrd_wnd.graphic_dib[index]->bits, 0, w32g_wrd_wnd.graphic_dib[index]->width * w32g_wrd_wnd.graphic_dib[index]->height ); dib_set_pals ( w32g_wrd_wnd.graphic_dib[index], w32g_wrd_wnd.default_gpal, W32G_WRDWND_GRAPHIC_PALLETE_MAX ); SetRect ( &rc, 0, 0, w32g_wrd_wnd.width, w32g_wrd_wnd.height ); w32g_wrd_wnd.modified_graphic[index] = TRUE; wrd_wnd_unlock(); wrd_graphic_apply ( &rc, index, TRUE ); } static void wrd_graphic_reset_all ( void ) { int i; wrd_wnd_lock(); w32g_wrd_wnd.default_gpal[0] = RGBtoRGBQUAD (RGB ( 0x00, 0x00, 0x00 )); w32g_wrd_wnd.default_gpal[1] = RGBtoRGBQUAD (RGB ( 0x00, 0x00, 0x7F ) ); w32g_wrd_wnd.default_gpal[2] = RGBtoRGBQUAD (RGB ( 0x7F, 0x00, 0x00 )); w32g_wrd_wnd.default_gpal[3] = RGBtoRGBQUAD (RGB ( 0x7F, 0x00, 0x7F )); w32g_wrd_wnd.default_gpal[4] = RGBtoRGBQUAD (RGB ( 0x00, 0x7F, 0x00 )); w32g_wrd_wnd.default_gpal[5] = RGBtoRGBQUAD (RGB ( 0x00, 0x7F, 0x7F )); w32g_wrd_wnd.default_gpal[6] = RGBtoRGBQUAD (RGB ( 0x7F, 0x7F, 0x00 )); w32g_wrd_wnd.default_gpal[7] = RGBtoRGBQUAD (RGB ( 0x7F, 0x7F, 0x7F )); w32g_wrd_wnd.default_gpal[8] = RGBtoRGBQUAD (RGB ( 0x00, 0x00, 0x00 )); w32g_wrd_wnd.default_gpal[9] = RGBtoRGBQUAD (RGB ( 0x00, 0x00, 0xFF )); w32g_wrd_wnd.default_gpal[10] = RGBtoRGBQUAD (RGB ( 0xFF, 0x00, 0x00 )); w32g_wrd_wnd.default_gpal[11] = RGBtoRGBQUAD (RGB ( 0xFF, 0x00, 0xFF )); w32g_wrd_wnd.default_gpal[12] = RGBtoRGBQUAD (RGB ( 0x00, 0xFF, 0x00 )); w32g_wrd_wnd.default_gpal[13] = RGBtoRGBQUAD (RGB ( 0x00, 0xFF, 0xFF )); w32g_wrd_wnd.default_gpal[14] = RGBtoRGBQUAD (RGB ( 0xFF, 0xFF, 0x00 )); w32g_wrd_wnd.default_gpal[15] = RGBtoRGBQUAD (RGB ( 0xFF, 0xFF, 0xFF )); for ( i = 16; i < W32G_WRDWND_GRAPHIC_PALLETE_MAX; i++ ) w32g_wrd_wnd.default_gpal[i] = RGBtoRGBQUAD (RGB ( 0x00, 0x00, 0x00 )); wrd_wnd_unlock(); for ( i = 0; i < W32G_WRDWND_GRAPHIC_PLANE_MAX; i ++ ) { wrd_graphic_reset ( i ); } wrd_wnd_lock(); w32g_wrd_wnd.gmode = 0xFFFF; w32g_wrd_wnd.fade_from = -1; w32g_wrd_wnd.fade_to = -1; wrd_wnd_unlock(); } // v[ index ̃OtBbN lprc ̈ hmdc_graphic ֍XV static void wrd_graphic_apply ( RECT *lprc, int index, int lockflag ) { #if 0 if ( WrdWndInfo.GraphicStop ) return; // if ( !w32g_wrd_wnd.modified_graphic[index] ) return; if ( lockflag ) wrd_wnd_lock(); w32g_wrd_wnd.modified_graphic[index] = FALSE; if ( lockflag ) wrd_wnd_unlock(); #endif } // lprc ̈̃OtBbNXV static void wrd_graphic_update ( RECT *lprc, int lockflag ) { if ( WrdWndInfo.GraphicStop ) return; if ( w32g_wrd_wnd.draw_skip ) return; wrd_wnd_lock(); if ( lockflag ) GDI_LOCK(); // 摜֐ōsB if ( w32g_wrd_wnd.flag & WRD_FLAG_GRAPHIC ) { if ( w32g_wrd_wnd.flag & WRD_FLAG_TEXT ) { HDC hmdc_work, hmdc_tmask, hmdc_graphic; GdiFlush (); hmdc_work = CreateCompatibleDC ( w32g_wrd_wnd.hmdc ); hmdc_tmask = CreateCompatibleDC ( w32g_wrd_wnd.hmdc ); hmdc_graphic = CreateCompatibleDC ( w32g_wrd_wnd.hmdc ); SelectObject ( hmdc_work, w32g_wrd_wnd.hbmp_work ); SelectObject ( hmdc_tmask, w32g_wrd_wnd.hbmp_tmask ); SelectObject ( hmdc_graphic, w32g_wrd_wnd.graphic_dib[w32g_wrd_wnd.index_display]->hbmp ); BitBlt ( w32g_wrd_wnd.hmdc, lprc->left, lprc->top, lprc->right - lprc->left, lprc->bottom - lprc->top, hmdc_tmask, lprc->left, lprc->top, SRCAND ); BitBlt ( hmdc_work, lprc->left, lprc->top, lprc->right - lprc->left, lprc->bottom - lprc->top, hmdc_tmask, lprc->left, lprc->top, NOTSRCCOPY ); BitBlt ( hmdc_work, lprc->left, lprc->top, lprc->right - lprc->left, lprc->bottom - lprc->top, hmdc_graphic, lprc->left, lprc->top, SRCAND ); BitBlt ( w32g_wrd_wnd.hmdc, lprc->left, lprc->top, lprc->right - lprc->left, lprc->bottom - lprc->top, hmdc_work, lprc->left, lprc->top, SRCPAINT ); DeleteDC ( hmdc_work ); DeleteDC ( hmdc_tmask ); DeleteDC ( hmdc_graphic ); } else { HDC hmdc_graphic; hmdc_graphic = CreateCompatibleDC ( w32g_wrd_wnd.hmdc ); SelectObject ( hmdc_graphic, w32g_wrd_wnd.graphic_dib[w32g_wrd_wnd.index_display]->hbmp ); BitBlt ( w32g_wrd_wnd.hmdc, lprc->left, lprc->top, lprc->right - lprc->left, lprc->bottom - lprc->top, hmdc_graphic, lprc->left, lprc->top, SRCCOPY ); DeleteDC ( hmdc_graphic ); } } if ( lockflag ) GDI_UNLOCK(); wrd_wnd_unlock(); } // ̈̃eLXgXV static void wrd_text_update ( int x_from, int y_from, int x_to, int y_to, int lockflag ) { RECT rc; if ( w32g_wrd_wnd.draw_skip ) return; if ( x_from < 0 ) x_from = 0; if ( x_from >= w32g_wrd_wnd.row ) x_from = w32g_wrd_wnd.row - 1; if ( x_to < 0 ) x_to = 0; if ( x_to >= w32g_wrd_wnd.row ) x_to = w32g_wrd_wnd.row - 1; if ( y_from < 0 ) y_from = 0; if ( y_from >= w32g_wrd_wnd.row ) y_from = w32g_wrd_wnd.col - 1; if ( y_to < 0 ) y_to = 0; if ( y_to >= w32g_wrd_wnd.row ) y_to = w32g_wrd_wnd.col - 1; SetRect ( &rc, x_from * w32g_wrd_wnd.font_width, y_from * w32g_wrd_wnd.font_height, (x_to+1) * w32g_wrd_wnd.font_width, (y_to+1) * w32g_wrd_wnd.font_height); wrd_wnd_lock(); if ( lockflag ) GDI_LOCK(); if ( w32g_wrd_wnd.flag & WRD_FLAG_TEXT ) { HDC hmdc_tmask; COLORREF forecolor, backcolor, prevforecolor, prevbackcolor; char attr; HGDIOBJ hgdiobj; int x, y; forecolor = w32g_wrd_wnd.pals[w32g_wrd_wnd.curforecolor]; backcolor = w32g_wrd_wnd.pals[w32g_wrd_wnd.curbackcolor]; prevforecolor = SetTextColor( w32g_wrd_wnd.hmdc, forecolor ); prevbackcolor = SetBkColor( w32g_wrd_wnd.hmdc, backcolor ); hgdiobj = SelectObject( w32g_wrd_wnd.hmdc, w32g_wrd_wnd.hFont ); hmdc_tmask = CreateCompatibleDC ( w32g_wrd_wnd.hmdc ); SelectObject( hmdc_tmask, w32g_wrd_wnd.hbmp_tmask ); SelectObject( hmdc_tmask, w32g_wrd_wnd.hFont ); SelectObject( hmdc_tmask, w32g_wrd_wnd.hNullBrush ); SelectObject( hmdc_tmask, w32g_wrd_wnd.hNullPen ); attr = 0; SetTextColor( hmdc_tmask, COLOR_MASK_WHITE ); SetBkColor( hmdc_tmask, COLOR_MASK_BLACK ); for( y = y_from; y <= y_to; y++ ) { for( x = x_from; x <= x_to; x++ ) { char mbt = _MBC_SINGLE; RECT rc_part; if ( forecolor != w32g_wrd_wnd.pals[w32g_wrd_wnd.forecolorbuf[y][x]] ) { forecolor = w32g_wrd_wnd.pals[w32g_wrd_wnd.forecolorbuf[y][x]]; SetTextColor( w32g_wrd_wnd.hmdc, forecolor ); } if ( backcolor != w32g_wrd_wnd.pals[w32g_wrd_wnd.backcolorbuf[y][x]] ) { backcolor = w32g_wrd_wnd.pals[w32g_wrd_wnd.backcolorbuf[y][x]]; SetBkColor( w32g_wrd_wnd.hmdc, backcolor ); } if ( attr != w32g_wrd_wnd.attrbuf[y][x] ) { if ( ( attr & W32G_WRDWND_ATTR_REVERSE ) != ( w32g_wrd_wnd.attrbuf[y][x] & W32G_WRDWND_ATTR_REVERSE ) ) { if ( w32g_wrd_wnd.attrbuf[y][x] & W32G_WRDWND_ATTR_REVERSE ) { SetTextColor( hmdc_tmask, COLOR_MASK_BLACK ); SetBkColor( hmdc_tmask, COLOR_MASK_WHITE ); } else { SetTextColor( hmdc_tmask, COLOR_MASK_WHITE ); SetBkColor( hmdc_tmask, COLOR_MASK_BLACK ); } } attr = w32g_wrd_wnd.attrbuf[y][x]; } if ( PlayerLanguage == LANGUAGE_JAPANESE && _mbbtype( w32g_wrd_wnd.textbuf[y][x], _MBC_SINGLE ) == _MBC_LEAD ) { SetRect ( &rc_part, x * w32g_wrd_wnd.font_width, y * w32g_wrd_wnd.font_height, (x + 2) * w32g_wrd_wnd.font_width, (y + 1) * w32g_wrd_wnd.font_height ); if ( w32g_wrd_wnd.flag & WRD_FLAG_TEXT ) ExtTextOut( w32g_wrd_wnd.hmdc, rc_part.left, rc_part.top, ETO_OPAQUE | ETO_CLIPPED, &rc_part, w32g_wrd_wnd.textbuf[y] + x, 2, NULL); ExtTextOut( hmdc_tmask, rc_part.left, rc_part.top, ETO_OPAQUE | ETO_CLIPPED, &rc_part, w32g_wrd_wnd.textbuf[y] + x, 2, NULL); x++; } else { SetRect ( &rc_part, x * w32g_wrd_wnd.font_width, y * w32g_wrd_wnd.font_height, (x + 1) * w32g_wrd_wnd.font_width, (y + 1) * w32g_wrd_wnd.font_height ); if ( w32g_wrd_wnd.flag & WRD_FLAG_TEXT ) ExtTextOut( w32g_wrd_wnd.hmdc, rc_part.left, rc_part.top, ETO_OPAQUE | ETO_CLIPPED, &rc_part, w32g_wrd_wnd.textbuf[y] + x, 1, NULL); ExtTextOut( hmdc_tmask, rc_part.left, rc_part.top, ETO_OPAQUE | ETO_CLIPPED, &rc_part, w32g_wrd_wnd.textbuf[y] + x, 1, NULL); } } } SetTextColor( w32g_wrd_wnd.hmdc, prevforecolor); SetBkColor( w32g_wrd_wnd.hmdc, prevbackcolor); SelectObject( w32g_wrd_wnd.hmdc, hgdiobj ); DeleteDC ( hmdc_tmask ); } if ( lockflag ) GDI_UNLOCK(); wrd_wnd_unlock(); if ( ! WrdWndInfo.GraphicStop ) { wrd_graphic_apply ( &rc, w32g_wrd_wnd.index_display, TRUE ); wrd_graphic_update ( &rc, 0 ); } InvalidateRect ( w32g_wrd_wnd.hwnd, &rc, FALSE); } extern void wrd_graphic_ginit ( void ); extern void wrd_graphic_gcls ( int sw ); extern void wrd_graphic_gscreen ( int active, int display ); extern void wrd_graphic_gon ( int sw ); extern void wrd_graphic_gline ( int x1, int y1, int x2, int y2, int p1, int sw, int p2 ); extern void wrd_graphic_gcircle ( int x, int y, int r, int p1, int sw, int p2 ); extern void wrd_graphic_pload ( char *path ); extern void wrd_graphic_pal_g4r4b4 ( int p, int *g4r4b4, int max ); extern void wrd_graphic_palrev ( int p ); extern void wrd_graphic_apply_pal ( int p ); extern void wrd_graphic_fade ( int p1, int p2, int speed ); extern void wrd_graphic_fadestep ( int v ); extern void wrd_graphic_gmode ( int sw ); extern void wrd_graphic_gmove ( int x1, int y1, int x2, int y2, int xd, int yd, int vs, int vd, int sw ); extern void wrd_graphic_mag ( char *path, int x, int y, int s, int p ); extern void wrd_text_scroll ( int x1, int y1, int x2, int y2, int mode, int color, int c ); extern void wrd_start_skip ( void ); extern void wrd_end_skip ( void ); extern void wrd_graphic_xcopy ( int sx1, int sy1, int sx2, int sy2, int tx, int ty, int ss, int ts, int method, int opt1, int opt2, int opt3, int opt4, int opt5 ); void wrd_graphic_ginit ( void ) { RECT rc; int index_display_old = w32g_wrd_wnd.index_display; if ( WrdWndInfo.GraphicStop ) return; if ( !w32g_wrd_wnd.active ) return; wrd_graphic_plane_change ( 0, 0 ); wrd_graphic_reset_all (); wrd_wnd_lock(); mag_deletetab(); wrd_wnd_unlock(); SetRect ( &rc, 0, 0, w32g_wrd_wnd.width, w32g_wrd_wnd.height ); InvalidateRect ( w32g_wrd_wnd.hwnd, &rc, FALSE ); } void wrd_graphic_gcls ( int sw ) { RECT rc; int i, size; if ( WrdWndInfo.GraphicStop ) return; if ( !w32g_wrd_wnd.active ) return; wrd_wnd_lock(); GdiFlush (); size = w32g_wrd_wnd.width * w32g_wrd_wnd.height; if ( sw == 0 ) sw = 0xFF; for ( i = 0; i < size; i ++ ) { w32g_wrd_wnd.graphic_dib[w32g_wrd_wnd.index_active]->bits[i] &= ~sw; } w32g_wrd_wnd.modified_graphic[w32g_wrd_wnd.index_active] = TRUE; SetRect ( &rc, 0, 0, w32g_wrd_wnd.width, w32g_wrd_wnd.height ); wrd_wnd_unlock(); if ( w32g_wrd_wnd.index_active == w32g_wrd_wnd.index_display ) { wrd_graphic_apply ( &rc, w32g_wrd_wnd.index_display, TRUE ); wrd_graphic_update ( &rc, TRUE ); InvalidateRect ( w32g_wrd_wnd.hwnd, &rc, FALSE ); } } void wrd_graphic_gscreen ( int active, int display ) { int display_old = w32g_wrd_wnd.index_display; if ( WrdWndInfo.GraphicStop ) return; if ( !w32g_wrd_wnd.active ) return; if ( active < 0 || active >= 2 || display < 0 || display >= 2 ) return; wrd_wnd_lock(); wrd_graphic_plane_change ( active, display ); wrd_wnd_unlock(); if ( display_old != w32g_wrd_wnd.index_display ) { RECT rc; SetRect ( &rc, 0, 0, w32g_wrd_wnd.width, w32g_wrd_wnd.height ); wrd_graphic_apply ( &rc, w32g_wrd_wnd.index_display, TRUE ); wrd_graphic_update ( &rc, TRUE ); InvalidateRect ( w32g_wrd_wnd.hwnd, &rc, FALSE ); } } void wrd_graphic_gon ( int sw ) { int sw_old = w32g_wrd_wnd.flag & WRD_FLAG_GRAPHIC; if ( WrdWndInfo.GraphicStop ) return; if ( !w32g_wrd_wnd.active ) return; if ( sw && !sw_old ) { w32g_wrd_wnd.flag |= WRD_FLAG_GRAPHIC; // ɐݒ if ( w32g_wrd_wnd.index_active == w32g_wrd_wnd.index_display ) { RECT rc; SetRect ( &rc, 0, 0, w32g_wrd_wnd.width, w32g_wrd_wnd.height ); wrd_graphic_apply ( &rc, w32g_wrd_wnd.index_display, TRUE ); wrd_graphic_update ( &rc, TRUE ); InvalidateRect ( w32g_wrd_wnd.hwnd, &rc, FALSE ); } } else if ( !sw && sw_old ) { if ( w32g_wrd_wnd.index_active == w32g_wrd_wnd.index_display ) { RECT rc; SetRect ( &rc, 0, 0, w32g_wrd_wnd.width, w32g_wrd_wnd.height ); wrd_graphic_apply ( &rc, w32g_wrd_wnd.index_display, TRUE ); wrd_graphic_update ( &rc, TRUE ); InvalidateRect ( w32g_wrd_wnd.hwnd, &rc, FALSE ); } } if ( sw ) w32g_wrd_wnd.flag |= WRD_FLAG_GRAPHIC; else w32g_wrd_wnd.flag &= ~WRD_FLAG_GRAPHIC; } void wrd_graphic_gline ( int x1, int y1, int x2, int y2, int p1, int sw, int p2 ) { int x, y, i; RECT rc[10]; int rc_max = 0; char *bits = w32g_wrd_wnd.graphic_dib[w32g_wrd_wnd.index_active]->bits; if ( WrdWndInfo.GraphicStop ) return; if ( !w32g_wrd_wnd.active ) return; if ( x1 > x2 || y1 > y2 || x1 < 0 || y1 < 0 || x2 >= w32g_wrd_wnd.width || y2 >= w32g_wrd_wnd.height ) return; wrd_wnd_lock(); GdiFlush (); // w32g_wrd_wnd.gmode if ( sw >= 1 ) { for ( x = x1; x <= x2; x ++ ) bits[ y1 * w32g_wrd_wnd.width + x] = w32g_wrd_wnd.gmode & p1; SetRect ( &rc[rc_max++], x1, y1, x2+1, y1+1 ); for ( y = y1 + 1; y <= y2 - 1; y ++ ) { bits[ y * w32g_wrd_wnd.width + x1] = w32g_wrd_wnd.gmode & p1; bits[ y * w32g_wrd_wnd.width + x2] = w32g_wrd_wnd.gmode & p1; } SetRect ( &rc[rc_max++], x1, y1, x1+1, y2+1 ); SetRect ( &rc[rc_max++], x2, y1, x2+1, y2+1 ); for ( x = x1; x <= x2; x ++ ) bits[ y2 * w32g_wrd_wnd.width + x] = w32g_wrd_wnd.gmode & p1; SetRect ( &rc[rc_max++], x1, y2, x2+1, y2+1 ); if ( sw == 2 ) { for ( y = y1 + 1; y <= y2 - 1; y ++ ) for ( x = x1 + 1; x <= x2 - 1; x ++ ) bits[ y * w32g_wrd_wnd.width + x] = w32g_wrd_wnd.gmode & p2; rc_max = 0; SetRect ( &rc[rc_max++], x1, y1, x2+1, y2+1 ); } } else if ( sw == 0 ) { if ( x1 == x2 ) { for ( y = y1 ; y <= y2 ; y ++ ) bits[ y * w32g_wrd_wnd.width + x1] = w32g_wrd_wnd.gmode & p1; SetRect ( &rc[rc_max++], x1, y1, x1+1, y2+1 ); } else if ( y1 == y2 ) { for ( x = x1; x <= x2; x ++ ) bits[ y1 * w32g_wrd_wnd.width + x] = w32g_wrd_wnd.gmode & p2; SetRect ( &rc[rc_max++], x1, y1, x2+1, y1+1 ); } else if ( x2 - x1 == y2 - y1 ) { for ( y = y1; y <= y2; y ++ ) bits[ y1 * w32g_wrd_wnd.width + (y - y1) + x1] = w32g_wrd_wnd.gmode & p2; SetRect ( &rc[rc_max++], x1, y1, x2+1, y2+1 ); } else if ( x2 - x1 > y2 - y1 ) { double r = (y2 - y1) / (x2 -x1), r2; int x_min = x1; for ( y = y1; y <= y2 - 1; y ++ ) { for ( x = x_min; x <= x2; x ++ ) { r2 = r * (x - x1) - (y - y1); if ( r2 < 0.0 || r2 >= 1.0 ) { break; } else if ( r2 <= 0.5 ) { bits[ y * w32g_wrd_wnd.width + x] = w32g_wrd_wnd.gmode & p1; x_min = x + 1; } else { bits[ (y + 1) * w32g_wrd_wnd.width + x] = w32g_wrd_wnd.gmode & p1; x_min = x + 1; } } } SetRect ( &rc[rc_max++], x1, y1, x2+1, y2+1 ); } else if ( x2 - x1 < y2 - y1 ) { double r = (x2 - x1) / (y2 -y1), r2; int y_min = y1; for ( x = x1; x <= x2 - 1; x ++ ) { for ( y = y_min; y <= y2; y ++ ) { r2 = r * (y - y1) - (x - x1); if ( r2 < 0.0 || r2 >= 1.0 ) { break; } else if ( r2 <= 0.5 ) { bits[ y * w32g_wrd_wnd.width + x] = w32g_wrd_wnd.gmode & p1; y_min = y + 1; } else { bits[ y * w32g_wrd_wnd.width + x + 1] = w32g_wrd_wnd.gmode & p1; y_min = y + 1; } } } SetRect ( &rc[rc_max++], x1, y1, x2+1, y2+1 ); } } wrd_wnd_unlock(); if ( w32g_wrd_wnd.index_active == w32g_wrd_wnd.index_display ) { for ( i = 0; i < rc_max; i ++ ) { wrd_graphic_apply ( &rc[i], w32g_wrd_wnd.index_display, TRUE ); wrd_graphic_update ( &rc[i], TRUE ); InvalidateRect ( w32g_wrd_wnd.hwnd, &rc[i], FALSE ); } } } void wrd_graphic_gcircle ( int x, int y, int r, int p1, int sw, int p2 ) { if ( WrdWndInfo.GraphicStop ) return; if ( !w32g_wrd_wnd.active ) return; wrd_wnd_lock(); wrd_wnd_unlock(); // w32g_wrd_wnd.gmode } void wrd_graphic_pload ( char *path ) { int res; if ( WrdWndInfo.GraphicStop ) return; if ( !w32g_wrd_wnd.active ) return; wrd_wnd_lock(); GdiFlush (); res = pho_load_pixel ( w32g_wrd_wnd.graphic_dib[w32g_wrd_wnd.index_active]->bits, w32g_wrd_wnd.width, w32g_wrd_wnd.height, path ); wrd_wnd_unlock(); if ( res && w32g_wrd_wnd.index_active == w32g_wrd_wnd.index_display ) { RECT rc; SetRect ( &rc, 0, 0, w32g_wrd_wnd.width, w32g_wrd_wnd.height ); wrd_graphic_apply ( &rc, w32g_wrd_wnd.index_display, TRUE ); wrd_graphic_update ( &rc, TRUE ); InvalidateRect ( w32g_wrd_wnd.hwnd, &rc, FALSE ); } } static COLORREF g4r4b4_to_rgb ( int g4r4b4 ) { return RGB ( ((g4r4b4 & 0x00F0) >> 4 ) << 4, ((g4r4b4 & 0x0F00) >> 8 ) << 4, ((g4r4b4 & 0x000F) >> 0 ) << 4 ); } void wrd_graphic_pal_g4r4b4 ( int p, int *g4r4b4, int max ) { int i; if ( WrdWndInfo.GraphicStop ) return; if ( !w32g_wrd_wnd.active ) return; if ( p < 0 ) return; if ( p >= W32G_WRDWND_GRAPHIC_PALLETE_BUF_MAX ) return; wrd_wnd_lock(); if ( max > W32G_WRDWND_GRAPHIC_PALLETE_MAX ) { max = W32G_WRDWND_GRAPHIC_PALLETE_MAX; } for ( i = 0; i < max; i++ ) { w32g_wrd_wnd.gpal_buff[p][i] = RGBtoRGBQUAD ( g4r4b4_to_rgb( g4r4b4[i] ) ); } wrd_wnd_unlock(); if ( p == 0 ) { RECT rc; #if 1 for ( i = 0; i < W32G_WRDWND_GRAPHIC_PLANE_MAX; i++ ) { dib_set_pals ( w32g_wrd_wnd.graphic_dib[i], w32g_wrd_wnd.gpal_buff[p], max ); } #else dib_set_pals ( w32g_wrd_wnd.graphic_dib[w32g_wrd_wnd.index_display], w32g_wrd_wnd.gpal_buff[p], max ); #endif SetRect ( &rc, 0, 0, w32g_wrd_wnd.width, w32g_wrd_wnd.height ); wrd_graphic_apply ( &rc, w32g_wrd_wnd.index_display, TRUE ); wrd_graphic_update ( &rc, TRUE ); InvalidateRect(w32g_wrd_wnd.hwnd, &rc, FALSE); } } extern DWORD volatile dwMainThreadId; void wrd_graphic_palrev ( int p ) { int i; if ( WrdWndInfo.GraphicStop ) return; if ( !w32g_wrd_wnd.active ) return; if ( p < 0 ) return; if ( p >= W32G_WRDWND_GRAPHIC_PALLETE_BUF_MAX ) return; wrd_wnd_lock(); for ( i = 0; i = W32G_WRDWND_GRAPHIC_PALLETE_BUF_MAX ) return; wrd_wnd_lock(); #if 1 for ( i = 0; i < W32G_WRDWND_GRAPHIC_PLANE_MAX; i++ ) { dib_set_pals ( w32g_wrd_wnd.graphic_dib[i], w32g_wrd_wnd.gpal_buff[p], W32G_WRDWND_GRAPHIC_PALLETE_MAX ); } #else dib_set_pals ( w32g_wrd_wnd.graphic_dib[w32g_wrd_wnd.index_display], w32g_wrd_wnd.gpal_buff[p], W32G_WRDWND_GRAPHIC_PALLETE_MAX ); #endif SetRect ( &rc, 0, 0, w32g_wrd_wnd.width, w32g_wrd_wnd.height ); wrd_wnd_unlock(); wrd_graphic_apply ( &rc, w32g_wrd_wnd.index_display, TRUE ); wrd_graphic_update ( &rc, TRUE ); InvalidateRect ( w32g_wrd_wnd.hwnd, &rc, FALSE ); } void wrd_graphic_fade ( int p1, int p2, int speed ) { if ( WrdWndInfo.GraphicStop ) return; if ( !w32g_wrd_wnd.active ) return; if ( p1 < 0 ) return; if ( p1 >= W32G_WRDWND_GRAPHIC_PALLETE_BUF_MAX ) return; if ( p2 < 0 ) return; if ( p2 >= W32G_WRDWND_GRAPHIC_PALLETE_BUF_MAX ) return; wrd_wnd_lock(); w32g_wrd_wnd.fade_from = p1; w32g_wrd_wnd.fade_to = p2; wrd_wnd_unlock(); if ( speed == 0 ) { wrd_graphic_apply_pal ( p2 ); } else{ // wrd_graphic_apply_pal ( p1 ); } } void wrd_graphic_fadestep ( int v ) { int i; RECT rc; RGBQUAD gpal[W32G_WRDWND_GRAPHIC_PALLETE_MAX]; double v1, v2; if ( WrdWndInfo.GraphicStop ) return; if ( !w32g_wrd_wnd.active ) return; if ( w32g_wrd_wnd.fade_from < 0 || w32g_wrd_wnd.fade_to < 0 ) return; wrd_wnd_lock(); v2 = (double) v / WRD_MAXFADESTEP; v1 = 1.0 - v2; for ( i = 0; i < W32G_WRDWND_GRAPHIC_PALLETE_MAX; i++ ) { RGBQUAD *rq1 = &w32g_wrd_wnd.gpal_buff[w32g_wrd_wnd.fade_from][i]; RGBQUAD *rq2 = &w32g_wrd_wnd.gpal_buff[w32g_wrd_wnd.fade_to][i]; gpal[i].rgbBlue = (char) ( v1 * rq1->rgbBlue + v2 * rq2->rgbBlue ); gpal[i].rgbGreen = (char) ( v1 * rq1->rgbGreen + v2 * rq2->rgbGreen ); gpal[i].rgbRed = (char) ( v1 * rq1->rgbRed + v2 * rq2->rgbRed ); gpal[i].rgbReserved = 0; } #if 1 for ( i = 0; i < W32G_WRDWND_GRAPHIC_PLANE_MAX; i++ ) { dib_set_pals ( w32g_wrd_wnd.graphic_dib[i], gpal, W32G_WRDWND_GRAPHIC_PALLETE_MAX ); } #else dib_set_pals ( w32g_wrd_wnd.graphic_dib[w32g_wrd_wnd.index_display], gpal, W32G_WRDWND_GRAPHIC_PALLETE_MAX ); #endif SetRect ( &rc, 0, 0, w32g_wrd_wnd.width, w32g_wrd_wnd.height ); wrd_wnd_unlock(); wrd_graphic_apply ( &rc, w32g_wrd_wnd.index_display, TRUE ); wrd_graphic_update ( &rc, TRUE ); #if 1 InvalidateRect ( w32g_wrd_wnd.hwnd, &rc, FALSE ); #else { // pbg̕ωőSʂXVȂōςނ悤Ƀ`FbNĂ݂BǁAd̂ŕs̗pB #define BITS_DIV 10 int j; char *bits; int mod_pal[W32G_WRDWND_GRAPHIC_PALLETE_MAX]; char bits_use_pal[BITS_DIV][BITS_DIV]; for ( i = 0; i < W32G_WRDWND_GRAPHIC_PALLETE_MAX; i++ ) { if ( memcmp ( &w32g_wrd_wnd.gpal_buff[w32g_wrd_wnd.fade_from][i], &w32g_wrd_wnd.gpal_buff[w32g_wrd_wnd.fade_to][i], sizeof (RGBQUAD) ) != 0 ) mod_pal[i] = 1; else mod_pal[i] = 0; } bits = w32g_wrd_wnd.graphic_dib[w32g_wrd_wnd.index_display]->bits; for ( i = 0; i < BITS_DIV; i ++ ) { for ( j = 0; j < BITS_DIV; j ++ ) { bits_use_pal[i][j] = 0; } } for ( i = 0; i < 640; i ++ ) { for ( j = 0; j < 400; j ++ ) { char c = bits [ j * w32g_wrd_wnd.width + i ]; if ( c >= 0 && c <= 0x0F && mod_pal[ c ] ) bits_use_pal[BITS_DIV*i/640][BITS_DIV*j/400] = 1; } } for ( i = 0; i < BITS_DIV; i ++ ) { for ( j = 0; j < BITS_DIV; j ++ ) { if ( bits_use_pal[i][j] ) SetRect ( &rc, i * 640/BITS_DIV, j * 400/BITS_DIV, ( i + 1) * 640/BITS_DIV, ( j + 1) * 400/BITS_DIV ); InvalidateRect ( w32g_wrd_wnd.hwnd, &rc, FALSE ); } } } #endif } void wrd_graphic_gmode ( int sw ) { w32g_wrd_wnd.gmode = sw; } void wrd_graphic_gmove ( int x1, int y1, int x2, int y2, int xd, int yd, int vs, int vd, int sw ) { int x, y; if ( WrdWndInfo.GraphicStop ) return; if ( !w32g_wrd_wnd.active ) return; if ( vs < 0 || vs >= 2 || vd < 0 || vd >= 2 ) return; if ( x1 < 0 || x1 >= w32g_wrd_wnd.width ) return; if ( y1 < 0 || y1 >= w32g_wrd_wnd.height ) return; if ( xd < 0 || xd >= w32g_wrd_wnd.width ) return; if ( yd < 0 || yd >= w32g_wrd_wnd.height ) return; wrd_wnd_lock(); GdiFlush (); x1 = ( ( x1 + 7 ) / 8 ) * 8; x2 = ( ( x2 + 7 ) / 8 ) * 8; xd = ( ( xd + 7 ) / 8 ) * 8; if ( xd + x2 - x1 >= w32g_wrd_wnd.width ) { int d = w32g_wrd_wnd.width - 1 - xd; x2 = x1 + d; } if ( yd + y2 - y1 >= w32g_wrd_wnd.height ) { int d = w32g_wrd_wnd.height - 1 - yd; y2 = y1 + d; } switch ( sw ) { default: case 0: // COPY for ( y = y1; y <= y2; y ++ ) { int i_src = y * w32g_wrd_wnd.width; int i_dest = (yd + y - y1) * w32g_wrd_wnd.width; if ( w32g_wrd_wnd.gmode >= 0x0F ) { memcpy ( &w32g_wrd_wnd.graphic_dib[vd]->bits[i_dest + xd], &w32g_wrd_wnd.graphic_dib[vs]->bits[i_src + x1], x2 - x1 + 1 ); } else { for ( x = x1; x <= x2; x ++ ) { int i_dest_tmp = i_dest + xd + x - x1; int i_src_tmp = i_src + x; w32g_wrd_wnd.graphic_dib[vd]->bits[i_dest_tmp] = w32g_wrd_wnd.graphic_dib[vs]->bits[i_src_tmp] & w32g_wrd_wnd.gmode; } } } break; case 1: // SWAP for ( y = y1; y <= y2; y ++ ) { int i_src = y * w32g_wrd_wnd.width; int i_dest = (yd + y - y1) * w32g_wrd_wnd.width; if ( w32g_wrd_wnd.gmode >= 0x0F ) { char buff[640+1]; int d = x2 - x1 + 1; memcpy ( buff, &w32g_wrd_wnd.graphic_dib[vd]->bits[i_dest + xd], d ); memcpy ( &w32g_wrd_wnd.graphic_dib[vd]->bits[i_dest + xd], &w32g_wrd_wnd.graphic_dib[vs]->bits[i_src + x1], d ); memcpy ( &w32g_wrd_wnd.graphic_dib[vs]->bits[i_src + x1], buff, d ); } else { for ( x = x1; x <= x2; x ++ ) { int i_dest_tmp = i_dest + xd + x - x1; int i_src_tmp = i_src + x; char t = w32g_wrd_wnd.graphic_dib[vd]->bits[i_dest_tmp]; w32g_wrd_wnd.graphic_dib[vd]->bits[i_dest_tmp] = ( w32g_wrd_wnd.graphic_dib[vd]->bits[i_dest_tmp] & ~w32g_wrd_wnd.gmode ) | ( w32g_wrd_wnd.graphic_dib[vs]->bits[i_src_tmp] & w32g_wrd_wnd.gmode ); w32g_wrd_wnd.graphic_dib[vs]->bits[i_src_tmp] = ( w32g_wrd_wnd.graphic_dib[vs]->bits[i_src_tmp] & ~w32g_wrd_wnd.gmode ) | t & w32g_wrd_wnd.gmode; } } } break; } wrd_wnd_unlock(); if ( w32g_wrd_wnd.index_active == w32g_wrd_wnd.index_display ) { RECT rc; SetRect ( &rc, xd, yd, xd + x2 - x1, yd + y2 - y1 ); wrd_graphic_apply ( &rc, w32g_wrd_wnd.index_display, TRUE ); wrd_graphic_update ( &rc, TRUE ); InvalidateRect ( w32g_wrd_wnd.hwnd, &rc, FALSE ); } } void wrd_graphic_mag ( char *path, int x, int y, int s, int p ) { int x_orig = x, y_orig = y; int size = w32g_wrd_wnd.width * w32g_wrd_wnd.height; magdata *mh; int width, height; if ( WrdWndInfo.GraphicStop ) return; if ( !w32g_wrd_wnd.active ) return; mh = mag_create ( path ); if ( x_orig == WRD_NOARG ) x_orig = 0; if ( y_orig == WRD_NOARG ) y_orig = 0; if ( mh == NULL ) return; width = mh->xend - mh->xorig + 1; height = mh->yend - mh->yorig + 1; if (MAG_WORK_WIDTH < width ) return; if ( MAG_WORK_HEIGHT < height ) return; if ( s <= 0 ) return; wrd_wnd_lock(); GdiFlush (); if ( wrd_graphic_pal_init_flag == 0 ) { /* MIMPI BUG ? */ if ( p == 1 ) p = 0; wrd_graphic_pal_init_flag = 1; } if ( p == 0 || p == 1 ) { if ( s == 1 && x_orig == 0 && y_orig == 0 && width <= w32g_wrd_wnd.width && height <= w32g_wrd_wnd.height ) { mag_load_pixel ( w32g_wrd_wnd.graphic_dib[w32g_wrd_wnd.index_active]->bits, w32g_wrd_wnd.width, w32g_wrd_wnd.height, mh ); } else { #if 1 mag_load_pixel ( w32g_wrd_wnd.bits_mag_work, MAG_WORK_WIDTH, MAG_WORK_HEIGHT, mh ); for ( y = 0; y < height; y ++ ) { int dest_index = (y_orig + y/s) * w32g_wrd_wnd.width; int src_index = y * MAG_WORK_WIDTH; long v[MAG_WORK_WIDTH]; for ( x = 0; x < width; x ++ ) v[x] = 0; for ( x = 0; x < width; x ++ ) { v[x/s] += w32g_wrd_wnd.bits_mag_work[ src_index + x ]; } for ( x = 0; x < width; x ++ ) { if ( v[x/s] >= 0 ) { int i_tmp = dest_index + x_orig + x/s; if ( i_tmp < MAG_WORK_WIDTH * MAG_WORK_HEIGHT ) w32g_wrd_wnd.graphic_dib[w32g_wrd_wnd.index_active]->bits[i_tmp] = ( v[x/s] / s / s ) & 0x0F; v[x/s] = -1; } } } width /= s; height /= s; #else mag_load_pixel ( w32g_wrd_wnd.bits_mag_work, MAG_WORK_WIDTH, MAG_WORK_HEIGHT, mh ); for ( y = 0; y < height; y ++ ) { for ( x = 0; x < width; x ++ ) { w32g_wrd_wnd.graphic_dib[w32g_wrd_wnd.index_active]->bits[(y_orig + y) * w32g_wrd_wnd.width + x_orig + x] = w32g_wrd_wnd.bits_mag_work[ y * MAG_WORK_WIDTH + x]; } } #endif } } wrd_wnd_unlock(); wrd_graphic_pal_g4r4b4 ( 17, mh->pal, 16 ); if ( w32g_wrd_wnd.index_active == 0 ) wrd_graphic_pal_g4r4b4 ( 18, mh->pal, 16 ); if ( w32g_wrd_wnd.index_active == 1 ) wrd_graphic_pal_g4r4b4 ( 19, mh->pal, 16 ); if ( p == 0 || p == 2 ) { wrd_graphic_pal_g4r4b4 ( 0, mh->pal, 16 ); } else { // wrd_graphic_pal_g4r4b4() sȂƗ̈悪XVȂB if ( w32g_wrd_wnd.index_active == w32g_wrd_wnd.index_display ) { RECT rc; SetRect ( &rc, x_orig, y_orig, width, height ); wrd_graphic_apply ( &rc, w32g_wrd_wnd.index_display, TRUE ); wrd_graphic_update ( &rc, TRUE ); InvalidateRect ( w32g_wrd_wnd.hwnd, &rc, FALSE ); } } } void wrd_text_ton ( int sw ) { int sw_old = w32g_wrd_wnd.flag & WRD_FLAG_TEXT; if ( !w32g_wrd_wnd.active ) return; if ( sw && !sw_old ) { w32g_wrd_wnd.flag |= WRD_FLAG_TEXT; // ɐݒ if ( w32g_wrd_wnd.index_active == w32g_wrd_wnd.index_display ) { wrd_text_update ( 0, 0, w32g_wrd_wnd.width, w32g_wrd_wnd.height, TRUE ); } } else if ( !sw && sw_old ) { if ( w32g_wrd_wnd.index_active == w32g_wrd_wnd.index_display ) { wrd_text_update ( 0, 0, w32g_wrd_wnd.width, w32g_wrd_wnd.height, TRUE ); } } if ( sw ) w32g_wrd_wnd.flag |= WRD_FLAG_TEXT; else w32g_wrd_wnd.flag &= ~WRD_FLAG_TEXT; } void wrd_text_scroll ( int x1, int y1, int x2, int y2, int mode, int color, int c ) { int x, y; x1--; x2--; y1--; y2--; if ( !w32g_wrd_wnd.active ) return; if ( x1 > x2 ) return; if ( y1 > y2 ) return; if ( x1 < 0 ) x1 = 0; if ( x2 < 0 ) x2 = 0; if ( x1 >= w32g_wrd_wnd.row ) x1 = w32g_wrd_wnd.row - 1; if ( x2 >= w32g_wrd_wnd.row ) x2 = w32g_wrd_wnd.row - 1; if ( y1 < 0 ) y1 = 0; if ( y2 < 0 ) y2 = 0; if ( y1 >= w32g_wrd_wnd.row ) y1 = w32g_wrd_wnd.col - 1; if ( y2 >= w32g_wrd_wnd.row ) y2 = w32g_wrd_wnd.col - 1; wrd_wnd_lock(); if ( mode == 0 ) { int dx = x2 - x1 + 1; for ( y = y1+1; y <= y2; y ++ ) { memcpy ( &w32g_wrd_wnd.textbuf [ y - 1 ][x1], &w32g_wrd_wnd.textbuf [ y ][x1], dx ); memcpy ( &w32g_wrd_wnd.forecolorbuf [ y - 1 ][x1], &w32g_wrd_wnd.forecolorbuf [ y ][x1], dx ); memcpy ( &w32g_wrd_wnd.backcolorbuf [ y - 1 ][x1], &w32g_wrd_wnd.backcolorbuf [ y ][x1], dx ); memcpy ( &w32g_wrd_wnd.attrbuf [ y - 1 ][x1], &w32g_wrd_wnd.attrbuf [ y ][x1], dx ); } WrdWndCurStateSaveAndRestore ( 1 ); WrdWndSetAttr98 ( color ); for ( x = x1; x <= x2; x ++ ) { w32g_wrd_wnd.textbuf [ y2][x] = c; w32g_wrd_wnd.forecolorbuf [ y2][x] = w32g_wrd_wnd.curforecolor; w32g_wrd_wnd.backcolorbuf [ y2][x] = w32g_wrd_wnd.curbackcolor; w32g_wrd_wnd.attrbuf [ y2][x] = w32g_wrd_wnd.curattr; } WrdWndCurStateSaveAndRestore ( 0 ); } else if ( mode == 1 ) { int dx = x2 - x1 + 1; for ( y = y2 - 1; y >= y1; y -- ) { memcpy ( &w32g_wrd_wnd.textbuf [ y + 1 ][x1], &w32g_wrd_wnd.textbuf [ y ][x1], dx ); memcpy ( &w32g_wrd_wnd.forecolorbuf [ y + 1 ][x1], &w32g_wrd_wnd.forecolorbuf [ y ], dx ); memcpy ( &w32g_wrd_wnd.backcolorbuf [ y + 1 ][x1], &w32g_wrd_wnd.backcolorbuf [ y ][x1], dx ); memcpy ( &w32g_wrd_wnd.attrbuf [ y + 1 ][x1], &w32g_wrd_wnd.attrbuf [ y ][x1], dx ); } WrdWndCurStateSaveAndRestore ( 1 ); WrdWndSetAttr98 ( color ); for ( x = x1; x <= x2; x ++ ) { w32g_wrd_wnd.textbuf [ y1][x] = c; w32g_wrd_wnd.forecolorbuf [ y1][x] = w32g_wrd_wnd.curforecolor; w32g_wrd_wnd.backcolorbuf [ y1][x] = w32g_wrd_wnd.curbackcolor; w32g_wrd_wnd.attrbuf [ y1][x] = w32g_wrd_wnd.curattr; } WrdWndCurStateSaveAndRestore ( 0 ); } else if ( mode == 2 ) { for ( y = y1; y <= y2; y ++ ) { for ( x = x1+1; x <= x2; x ++ ) { w32g_wrd_wnd.textbuf [ y ][ x ] = w32g_wrd_wnd.textbuf [ y ][ x - 1]; w32g_wrd_wnd.forecolorbuf[ y ][ x ] = w32g_wrd_wnd.forecolorbuf [ y ][ x - 1]; w32g_wrd_wnd.backcolorbuf [ y ][ x ] = w32g_wrd_wnd.backcolorbuf [ y ][ x - 1]; w32g_wrd_wnd.attrbuf [ y ][ x ] = w32g_wrd_wnd.attrbuf [ y ][ x - 1]; } } WrdWndCurStateSaveAndRestore ( 1 ); WrdWndSetAttr98 ( color ); for ( y = y1; y <= y2; y ++ ) { w32g_wrd_wnd.textbuf [ y ][ x1] = c; w32g_wrd_wnd.forecolorbuf [ y ][ x1] = w32g_wrd_wnd.curforecolor; w32g_wrd_wnd.backcolorbuf [ y ][ x1] = w32g_wrd_wnd.curbackcolor; w32g_wrd_wnd.attrbuf [ y ][ x1] = w32g_wrd_wnd.curattr; } WrdWndCurStateSaveAndRestore ( 0 ); } else if ( mode == 3 ) { for ( y = y1; y <= y2; y ++ ) { for ( x = x2 - 1; x >= x1; x -- ) { w32g_wrd_wnd.textbuf [ y ][ x ] = w32g_wrd_wnd.textbuf [ y ][ x + 1]; w32g_wrd_wnd.forecolorbuf[ y ][ x ] = w32g_wrd_wnd.forecolorbuf [ y ][ x + 1]; w32g_wrd_wnd.backcolorbuf [ y ][ x ] = w32g_wrd_wnd.backcolorbuf [ y ][ x + 1]; w32g_wrd_wnd.attrbuf [ y ][ x ] = w32g_wrd_wnd.attrbuf [ y ][ x + 1]; } } WrdWndCurStateSaveAndRestore ( 1 ); WrdWndSetAttr98 ( color ); for ( y = y1; y <= y2; y ++ ) { w32g_wrd_wnd.textbuf [ y ][ x2] = c; w32g_wrd_wnd.forecolorbuf [ y ][ x2] = w32g_wrd_wnd.curforecolor; w32g_wrd_wnd.backcolorbuf [ y ][ x2] = w32g_wrd_wnd.curbackcolor; w32g_wrd_wnd.attrbuf [ y ][ x2] = w32g_wrd_wnd.curattr; } WrdWndCurStateSaveAndRestore ( 0 ); } wrd_wnd_unlock(); wrd_text_update ( x1, y1, x2, y2, TRUE ); } void wrd_start_skip ( void ) { wrd_wnd_lock(); w32g_wrd_wnd.draw_skip = 1; wrd_wnd_unlock(); } void wrd_end_skip ( void ) { w32g_wrd_wnd.draw_skip = 0; wrd_text_update ( 0, 0, w32g_wrd_wnd.width, w32g_wrd_wnd.height, TRUE ); } void wrd_graphic_xcopy ( int sx1, int sy1, int sx2, int sy2, int tx, int ty, int ss, int ts, int method, int opt1, int opt2, int opt3, int opt4, int opt5 ) { #if 0 int x, y, d, size = w32g_wrd_wnd.width * w32g_wrd_wnd.height; if ( WrdWndInfo.GraphicStop ) return; if ( !w32g_wrd_wnd.active ) return; if ( ss < 0 || ss >= 2 || ts < 0 || ts >= 2 ) return; if ( sx1 < 0 || sx1 >= w32g_wrd_wnd.width ) return; if ( sy1 < 0 || sy1 >= w32g_wrd_wnd.height ) return; if ( tx < 0 || tx >= w32g_wrd_wnd.width ) return; if ( ty < 0 || ty >= w32g_wrd_wnd.height ) return; wrd_wnd_lock(); GdiFlush (); if ( tx + sx2 - sx1 >= w32g_wrd_wnd.width ) { d = w32g_wrd_wnd.width - 1 - tx; sx2 = sx1 + d; } if ( ty + sy2 - sy1 >= w32g_wrd_wnd.height ) { d = w32g_wrd_wnd.height - 1 - ty; sy2 = sy1 + d; } switch ( method ) { case 0: // COPY d = sx2 - sx1 + 1; for ( y = sy1; y <= sy2; y ++ ) { int i_src = y * w32g_wrd_wnd.width; int i_dest = ( ty + y - sy1) * w32g_wrd_wnd.width; memcpy ( &w32g_wrd_wnd.graphic_dib[ts]->bits[i_dest + tx], &w32g_wrd_wnd.graphic_dib[ss]->bits[i_src + sx1], d ); } break; case 1: // COPY EXCEPT 0 for ( y = sy1; y <= sy2; y ++ ) { int i_src = y * w32g_wrd_wnd.width; int i_dest = ( ty + y - sy1) * w32g_wrd_wnd.width; for ( x = sx1; x <= sx2; x ++ ) { int i_src_tmp = i_src + x; int i_dest_tmp = i_dest + tx + x - sx1; char c = w32g_wrd_wnd.graphic_dib[ss]->bits[i_src_tmp]; if ( c != 0 ) w32g_wrd_wnd.graphic_dib[ts]->bits[i_dest_tmp] = c; } } break; case 2: // XOR for ( y = sy1; y <= sy2; y ++ ) { int i_src = y * w32g_wrd_wnd.width; int i_dest = ( ty + y - sy1) * w32g_wrd_wnd.width; for ( x = sx1; x <= sx2; x ++ ) { int i_src_tmp = i_src + x; int i_dest_tmp = i_dest + tx + x - sx1; w32g_wrd_wnd.graphic_dib[ts]->bits[i_dest_tmp] ^= w32g_wrd_wnd.graphic_dib[ss]->bits[i_src_tmp]; } } break; case 3: // AND for ( y = sy1; y <= sy2; y ++ ) { int i_src = y * w32g_wrd_wnd.width; int i_dest = ( ty + y - sy1) * w32g_wrd_wnd.width; for ( x = sx1; x <= sx2; x ++ ) { int i_src_tmp = i_src + x; int i_dest_tmp = i_dest + tx + x - sx1; w32g_wrd_wnd.graphic_dib[ts]->bits[i_dest_tmp] &= w32g_wrd_wnd.graphic_dib[ss]->bits[i_src_tmp]; } } break; case 4: // OR for ( y = sy1; y <= sy2; y ++ ) { int i_src = y * w32g_wrd_wnd.width; int i_dest = ( ty + y - sy1) * w32g_wrd_wnd.width; for ( x = sx1; x <= sx2; x ++ ) { int i_src_tmp = i_src + x; int i_dest_tmp = i_dest + tx + x - sx1; w32g_wrd_wnd.graphic_dib[ts]->bits[i_dest_tmp] |= w32g_wrd_wnd.graphic_dib[ss]->bits[i_src_tmp]; } } break; case 5: // X REVERSE for ( y = sy1; y <= sy2; y ++ ) { int i_src = y * w32g_wrd_wnd.width; int i_dest = ( ty + y - sy1) * w32g_wrd_wnd.width; for ( x = sx1; x <= sx2; x ++ ) { int i_src_tmp = i_src + x; int i_dest_tmp = i_dest + tx + sx2 - x; w32g_wrd_wnd.graphic_dib[ts]->bits[i_dest_tmp] |= w32g_wrd_wnd.graphic_dib[ss]->bits[i_src_tmp]; } } break; case 6: // Y REVERSE d = sx2 - sx1 + 1; for ( y = sy1; y <= sy2; y ++ ) { int i_src = ( sy1 + sy2 - y ) * w32g_wrd_wnd.width; int i_dest = ( ty + y - sy1) * w32g_wrd_wnd.width; memcpy ( &w32g_wrd_wnd.graphic_dib[ts]->bits[i_dest + tx], &w32g_wrd_wnd.graphic_dib[ss]->bits[i_src + sx1], d ); } break; case 7: // X Y REVERSE for ( y = sy1; y <= sy2; y ++ ) { int i_src = ( sy1 + sy2 - y ) * w32g_wrd_wnd.width; int i_dest = ( ty + y - sy1) * w32g_wrd_wnd.width; for ( x = sx1; x <= sx2; x ++ ) { int i_src_tmp = i_src + x; int i_dest_tmp = i_dest + tx + sx2 - x; w32g_wrd_wnd.graphic_dib[ts]->bits[i_dest_tmp] |= w32g_wrd_wnd.graphic_dib[ss]->bits[i_src_tmp]; } } break; case 8: // COPY2 for ( y = sy1; y <= sy2; y ++ ) { int i_src = y * w32g_wrd_wnd.width; int i_dest = ( ty + y - sy1) * w32g_wrd_wnd.width; for ( x = sx1; x <= sx2; x ++ ) { int i_src_tmp = i_src + x; int i_dest_tmp = i_dest + tx + x - sx1; char c = w32g_wrd_wnd.graphic_dib[ss]->bits[i_src_tmp]; if ( c != 0 ) w32g_wrd_wnd.graphic_dib[ts]->bits[i_dest_tmp] = c; else { i_src_tmp = ( opt2 + y - sy1) * w32g_wrd_wnd.width + opt1 + x - sx1; if ( 0 <= i_src_tmp && i_src_tmp < size ) w32g_wrd_wnd.graphic_dib[ts]->bits[i_dest_tmp] = w32g_wrd_wnd.graphic_dib[ss]->bits[i_src_tmp]; } } } break; case 9: // Ƃ킩ȂB break; case 10: // COPY opt1, opt2 if ( opt1 < 0 || opt2 < 0 ) break; d = sx2 - sx1 + 1; for ( y = sy1; y <= sy2; y ++ ) { int i_src, i_dest; if ( (y - sy1) % ( opt1 + opt2 ) >= opt2 ) continue; i_src = y * w32g_wrd_wnd.width; i_dest = ( ty + y - sy1) * w32g_wrd_wnd.width; memcpy ( &w32g_wrd_wnd.graphic_dib[ts]->bits[i_dest + tx], &w32g_wrd_wnd.graphic_dib[ss]->bits[i_src + sx1], d ); } break; case 11: // Clipping Copy ӂ‚̃Rs[őpB d = sx2 - sx1 + 1; for ( y = sy1; y <= sy2; y ++ ) { int i_src = y * w32g_wrd_wnd.width; int i_dest = ( ty + y - sy1) * w32g_wrd_wnd.width; memcpy ( &w32g_wrd_wnd.graphic_dib[ts]->bits[i_dest + tx], &w32g_wrd_wnd.graphic_dib[ss]->bits[i_src + sx1], d ); } break; case 12: // PLANE COPY if ( opt1 < 0 || opt1 >= 4 || opt2 < 0 || opt2 >= 4 ) break; for ( y = sy1; y <= sy2; y ++ ) { int i_src = y * w32g_wrd_wnd.width; int i_dest = ( ty + y - sy1) * w32g_wrd_wnd.width; for ( x = sx1; x <= sx2; x ++ ) { int i_src_tmp = i_src + x; int i_dest_tmp = i_dest + tx + x - sx1; char c = w32g_wrd_wnd.graphic_dib[ss]->bits[i_src_tmp]; c = ( ( c & ( 1 << opt1) ) >> opt1 ) << opt2; w32g_wrd_wnd.graphic_dib[ts]->bits[i_dest_tmp] = c; } } break; default: break; } wrd_wnd_unlock(); if ( w32g_wrd_wnd.index_active == w32g_wrd_wnd.index_display ) { RECT rc; SetRect ( &rc, tx, ty, tx + sx2 - sx1, ty + sy2 - sy1 ); wrd_graphic_apply ( &rc, w32g_wrd_wnd.index_display, TRUE ); wrd_graphic_update ( &rc, TRUE ); InvalidateRect ( w32g_wrd_wnd.hwnd, &rc, FALSE ); } #endif } void WrdWndReset(void) { int i; wrd_wnd_lock(); w32g_wrd_wnd.curposx = 0; w32g_wrd_wnd.curposy = 0; w32g_wrd_wnd.curforecolor = W32G_WRDWND_WHITE; w32g_wrd_wnd.curbackcolor = W32G_WRDWND_BLACK; w32g_wrd_wnd.curattr = 0; for ( i = 0; i < w32g_wrd_wnd.col; i++ ) { memset ( w32g_wrd_wnd.textbuf[i], 0x20, w32g_wrd_wnd.row ); memset ( w32g_wrd_wnd.forecolorbuf[i], w32g_wrd_wnd.curforecolor, w32g_wrd_wnd.row ); memset ( w32g_wrd_wnd.backcolorbuf[i], w32g_wrd_wnd.curbackcolor, w32g_wrd_wnd.row ); memset ( w32g_wrd_wnd.attrbuf[i], w32g_wrd_wnd.curattr, w32g_wrd_wnd.row); } wrd_graphic_pal_init_flag = 0; wrd_wnd_unlock(); wrd_text_update ( 0, 0, w32g_wrd_wnd.row - 1, w32g_wrd_wnd.col - 1, TRUE ); wrd_graphic_ginit (); } void WrdWndCurStateSaveAndRestore(int saveflag) { static int saved_curposx = 0; static int saved_curposy = 0; static int saved_curforecolor = W32G_WRDWND_WHITE; static int saved_curbackcolor = W32G_WRDWND_BLACK; static int saved_curattr = 0; if ( saveflag ) { saved_curforecolor = w32g_wrd_wnd.curforecolor; saved_curbackcolor = w32g_wrd_wnd.curbackcolor; saved_curattr = w32g_wrd_wnd.curattr; saved_curposx = w32g_wrd_wnd.curposx; saved_curposy = w32g_wrd_wnd.curposy; } else { w32g_wrd_wnd.curforecolor = saved_curforecolor; w32g_wrd_wnd.curbackcolor = saved_curbackcolor; w32g_wrd_wnd.curattr = saved_curattr; WrdWndGoto( saved_curposx, saved_curposy ); } } // from_from s from_to s܂ł to_from s擪ɃRs[B void WrdWndCopyLineS ( int from_from, int from_to, int to_from, int lockflag ) { int y, to_to; if ( !w32g_wrd_wnd.active ) return; if ( to_from >= w32g_wrd_wnd.col ) return; if ( to_from == from_from ) return; if ( from_to < from_from ) return; if ( to_from < 0 ) { from_from -= to_from; from_to -= to_from; to_from = 0; } to_to = to_from + from_to - from_from; if ( to_to >= w32g_wrd_wnd.col ) to_to = w32g_wrd_wnd.col - 1; if ( lockflag ) wrd_wnd_lock(); if ( to_from < from_from ) { for ( y = to_from; y <= to_to; y++ ) { int y_from = from_from + y - to_from; if ( y_from < 0 || y_from >= w32g_wrd_wnd.col ) { memset ( w32g_wrd_wnd.textbuf[y], 0x20, w32g_wrd_wnd.row ); memset ( w32g_wrd_wnd.forecolorbuf[y], W32G_WRDWND_BLACK, w32g_wrd_wnd.row ); memset ( w32g_wrd_wnd.backcolorbuf[y], W32G_WRDWND_BLACK, w32g_wrd_wnd.row ); memset ( w32g_wrd_wnd.attrbuf[y], 0, w32g_wrd_wnd.row); } else { memcpy ( w32g_wrd_wnd.textbuf[y], w32g_wrd_wnd.textbuf[y_from], w32g_wrd_wnd.row ); memcpy ( w32g_wrd_wnd.forecolorbuf[y], w32g_wrd_wnd.forecolorbuf[y_from], w32g_wrd_wnd.row ); memcpy ( w32g_wrd_wnd.backcolorbuf[y], w32g_wrd_wnd.backcolorbuf[y_from], w32g_wrd_wnd.row ); memcpy ( w32g_wrd_wnd.attrbuf[y], w32g_wrd_wnd.attrbuf[y_from], w32g_wrd_wnd.row ); } } } else { for ( y = to_to; y >= to_from; y-- ) { int y_from = from_from + y - to_from; if ( y_from < 0 || y_from >= w32g_wrd_wnd.col ) { memset ( w32g_wrd_wnd.textbuf[y], 0x20, w32g_wrd_wnd.row ); memset ( w32g_wrd_wnd.forecolorbuf[y], W32G_WRDWND_BLACK, w32g_wrd_wnd.row ); memset ( w32g_wrd_wnd.backcolorbuf[y], W32G_WRDWND_BLACK, w32g_wrd_wnd.row ); memset ( w32g_wrd_wnd.attrbuf[y], 0, w32g_wrd_wnd.row); } else { memcpy ( w32g_wrd_wnd.textbuf[y], w32g_wrd_wnd.textbuf[y_from], w32g_wrd_wnd.row ); memcpy ( w32g_wrd_wnd.forecolorbuf[y], w32g_wrd_wnd.forecolorbuf[y_from], w32g_wrd_wnd.row ); memcpy ( w32g_wrd_wnd.backcolorbuf[y], w32g_wrd_wnd.backcolorbuf[y_from], w32g_wrd_wnd.row ); memcpy ( w32g_wrd_wnd.attrbuf[y], w32g_wrd_wnd.attrbuf[y_from], w32g_wrd_wnd.row ); } } } if ( lockflag ) wrd_wnd_unlock(); wrd_text_update ( 0, to_from, w32g_wrd_wnd.row - 1, to_to, lockflag ); } // from s to sɃRs[B void WrdWndCopyLine ( int from, int to, int lockflag ) { if ( !w32g_wrd_wnd.active ) return; WrdWndCopyLineS ( from, from, to, lockflag ); } // froms to s܂ŃNA void WrdWndClearLineFromTo(int from, int to, int lockflag) { int i; if ( !w32g_wrd_wnd.active ) return; if ( from < 0 ) from = 0; if ( from >= w32g_wrd_wnd.col ) from = w32g_wrd_wnd.col - 1; if ( to < 0 ) to = 0; if ( to >= w32g_wrd_wnd.col ) to = w32g_wrd_wnd.col - 1; if ( to < from ) return; if ( lockflag ) wrd_wnd_lock(); for ( i = from; i <= to; i++ ) { memset(w32g_wrd_wnd.textbuf[i], 0x20, w32g_wrd_wnd.row); memset(w32g_wrd_wnd.forecolorbuf[i], W32G_WRDWND_BLACK, w32g_wrd_wnd.row); memset(w32g_wrd_wnd.backcolorbuf[i], W32G_WRDWND_BLACK, w32g_wrd_wnd.row); memset(w32g_wrd_wnd.attrbuf[i], 0, w32g_wrd_wnd.row); } if ( lockflag ) wrd_wnd_unlock(); wrd_text_update ( 0, from, w32g_wrd_wnd.row - 1, to, lockflag ); } // from s to sɈړB void WrdWndMoveLine(int from, int to, int lockflag) { if ( !w32g_wrd_wnd.active ) return; if ( from == to ) return; if ( from < 0 || from >= w32g_wrd_wnd.col ) return; if ( to < 0 || to >= w32g_wrd_wnd.col ) return; WrdWndCopyLine ( from, to, lockflag ); WrdWndClearLineFromTo ( from,from, lockflag ); } // XN[_EB void WrdWndScrollDown(int lockflag) { if ( !w32g_wrd_wnd.active ) return; WrdWndCopyLineS ( 0, w32g_wrd_wnd.col - 1, 1, lockflag ); WrdWndClearLineFromTo ( 0, 0, lockflag ); } // XN[AbvB void WrdWndScrollUp(int lockflag) { if ( !w32g_wrd_wnd.active ) return; WrdWndCopyLineS ( 1, w32g_wrd_wnd.col - 1, 0, lockflag ); WrdWndClearLineFromTo ( w32g_wrd_wnd.col - 1, w32g_wrd_wnd.col - 1, lockflag ); } // ʏ void WrdWndClear(int lockflag) { if ( !w32g_wrd_wnd.active ) return; WrdWndClearLineFromTo ( 0, w32g_wrd_wnd.col - 1, lockflag ); } // o void WrdWndPutString(char *str, int lockflag) { if ( !w32g_wrd_wnd.active ) return; WrdWndPutStringN(str, strlen(str),lockflag); } // o(n) void WrdWndPutStringN(char *str, int n, int lockflag) { int i; if ( !w32g_wrd_wnd.active ) return; if ( lockflag ) wrd_wnd_lock(); for(;;){ if ( w32g_wrd_wnd.curposx + n <= w32g_wrd_wnd.row ) { memcpy( &w32g_wrd_wnd.textbuf[w32g_wrd_wnd.curposy][w32g_wrd_wnd.curposx], str, n ); memset( &w32g_wrd_wnd.forecolorbuf[w32g_wrd_wnd.curposy][w32g_wrd_wnd.curposx], w32g_wrd_wnd.curforecolor, n ); memset( &w32g_wrd_wnd.backcolorbuf[w32g_wrd_wnd.curposy][w32g_wrd_wnd.curposx], w32g_wrd_wnd.curbackcolor, n ); memset( &w32g_wrd_wnd.attrbuf[w32g_wrd_wnd.curposy][w32g_wrd_wnd.curposx], w32g_wrd_wnd.curattr, n ); if ( lockflag ) wrd_wnd_unlock(); wrd_text_update ( w32g_wrd_wnd.curposx, w32g_wrd_wnd.curposy, w32g_wrd_wnd.curposx + n - 1, w32g_wrd_wnd.curposy, lockflag ); if ( lockflag ) wrd_wnd_lock(); w32g_wrd_wnd.curposx += n; if ( w32g_wrd_wnd.curposx >= w32g_wrd_wnd.row ) { w32g_wrd_wnd.curposx = 0; w32g_wrd_wnd.curposy++; if ( w32g_wrd_wnd.curposy >= w32g_wrd_wnd.col ) { if ( lockflag ) wrd_wnd_unlock(); WrdWndScrollUp ( lockflag ); if ( lockflag ) wrd_wnd_lock(); w32g_wrd_wnd.curposy = w32g_wrd_wnd.col - 1; } } break; } else { int len = w32g_wrd_wnd.row - w32g_wrd_wnd.curposx; char mbt = _MBC_SINGLE; if ( PlayerLanguage == LANGUAGE_JAPANESE ) { for ( i=0; i < len; i++ ) { mbt = _mbbtype ( str[i], mbt ); } if ( mbt == _MBC_LEAD ) len -= 1; } memcpy( &w32g_wrd_wnd.textbuf[w32g_wrd_wnd.curposy][w32g_wrd_wnd.curposx], str, len ); memset( &w32g_wrd_wnd.forecolorbuf[w32g_wrd_wnd.curposy][w32g_wrd_wnd.curposx], w32g_wrd_wnd.curforecolor, len ); memset( &w32g_wrd_wnd.backcolorbuf[w32g_wrd_wnd.curposy][w32g_wrd_wnd.curposx], w32g_wrd_wnd.curbackcolor, len ); memset( &w32g_wrd_wnd.attrbuf[w32g_wrd_wnd.curposy][w32g_wrd_wnd.curposx], w32g_wrd_wnd.curattr, len ); if ( mbt == _MBC_LEAD ) { w32g_wrd_wnd.textbuf[w32g_wrd_wnd.curposy][w32g_wrd_wnd.row-1] = 0x20; w32g_wrd_wnd.forecolorbuf[w32g_wrd_wnd.curposy][w32g_wrd_wnd.row-1] = w32g_wrd_wnd.curforecolor; w32g_wrd_wnd.backcolorbuf[w32g_wrd_wnd.curposy][w32g_wrd_wnd.row-1] = w32g_wrd_wnd.curbackcolor; w32g_wrd_wnd.attrbuf[w32g_wrd_wnd.curposy][w32g_wrd_wnd.row-1] = 0; } if ( lockflag ) wrd_wnd_unlock(); wrd_text_update ( w32g_wrd_wnd.curposx, w32g_wrd_wnd.curposy, w32g_wrd_wnd.curposx + len - 1, w32g_wrd_wnd.curposy, lockflag ); if ( lockflag ) wrd_wnd_lock(); n -= len; str += len; w32g_wrd_wnd.curposx = 0; w32g_wrd_wnd.curposy++; if ( w32g_wrd_wnd.curposy >= w32g_wrd_wnd.col ) { if ( lockflag ) wrd_wnd_unlock(); WrdWndScrollUp(lockflag); if ( lockflag ) wrd_wnd_lock(); w32g_wrd_wnd.curposy = w32g_wrd_wnd.col - 1; } } } if ( lockflag ) wrd_wnd_unlock(); } // left == TRUE : s̍ // left != TRUE : s̉E void WrdWndLineClearFrom(int left, int lockflag) { if ( !w32g_wrd_wnd.active ) return; if ( lockflag ) wrd_wnd_lock(); if ( left ) { memset( w32g_wrd_wnd.textbuf[w32g_wrd_wnd.curposy] , 0x20 , w32g_wrd_wnd.curposx + 1 ); memset( w32g_wrd_wnd.forecolorbuf[w32g_wrd_wnd.curposy], W32G_WRDWND_BLACK, w32g_wrd_wnd.curposx + 1 ); memset( w32g_wrd_wnd.backcolorbuf[w32g_wrd_wnd.curposy], W32G_WRDWND_BLACK, w32g_wrd_wnd.curposx + 1 ); memset( w32g_wrd_wnd.attrbuf[w32g_wrd_wnd.curposy], 0, w32g_wrd_wnd.curposx + 1 ); if ( lockflag ) wrd_wnd_unlock(); wrd_text_update ( 0, w32g_wrd_wnd.curposy, w32g_wrd_wnd.curposx - 1, w32g_wrd_wnd.curposy, lockflag ); } else { memset( &w32g_wrd_wnd.textbuf[w32g_wrd_wnd.curposy][w32g_wrd_wnd.curposx], 0x20 , w32g_wrd_wnd.row - w32g_wrd_wnd.curposx ); memset( &w32g_wrd_wnd.forecolorbuf[w32g_wrd_wnd.curposy][w32g_wrd_wnd.curposx], W32G_WRDWND_BLACK, w32g_wrd_wnd.row - w32g_wrd_wnd.curposx ); memset( &w32g_wrd_wnd.backcolorbuf[w32g_wrd_wnd.curposy][w32g_wrd_wnd.curposx], W32G_WRDWND_BLACK, w32g_wrd_wnd.row - w32g_wrd_wnd.curposx ); memset( &w32g_wrd_wnd.attrbuf[w32g_wrd_wnd.curposy][w32g_wrd_wnd.curposx], 0, w32g_wrd_wnd.row - w32g_wrd_wnd.curposx ); if ( lockflag ) wrd_wnd_unlock(); wrd_text_update ( w32g_wrd_wnd.curposx, w32g_wrd_wnd.curposy, w32g_wrd_wnd.row - 1, w32g_wrd_wnd.curposy, lockflag ); } } // PC98 ̃Agr[gŐݒ void WrdWndSetAttr98(int attr) { if ( !w32g_wrd_wnd.active ) return; switch ( attr ) { case 0: // Kl w32g_wrd_wnd.curforecolor = W32G_WRDWND_WHITE; w32g_wrd_wnd.curbackcolor = W32G_WRDWND_BLACK; w32g_wrd_wnd.curattr = 0; break; case 1: // nCCg w32g_wrd_wnd.curattr = 0; break; case 2: // o[eBJC w32g_wrd_wnd.curattr = 0; break; case 4: // A_[C w32g_wrd_wnd.curattr = 0; break; case 5: // uN w32g_wrd_wnd.curattr = 0; break; case 7: // o[X { char tmp = w32g_wrd_wnd.curbackcolor; w32g_wrd_wnd.curbackcolor = w32g_wrd_wnd.curforecolor; w32g_wrd_wnd.curforecolor = tmp; w32g_wrd_wnd.curattr = 0; w32g_wrd_wnd.curattr |= W32G_WRDWND_ATTR_REVERSE; } break; case 8: // V[Nbg w32g_wrd_wnd.curforecolor = W32G_WRDWND_BLACK; w32g_wrd_wnd.curbackcolor = W32G_WRDWND_BLACK; w32g_wrd_wnd.curattr = 0; break; case 16: // w32g_wrd_wnd.curforecolor = W32G_WRDWND_BLACK; w32g_wrd_wnd.curbackcolor = W32G_WRDWND_BLACK; w32g_wrd_wnd.curattr = 0; break; case 17: // w32g_wrd_wnd.curforecolor = W32G_WRDWND_RED; w32g_wrd_wnd.curbackcolor = W32G_WRDWND_BLACK; w32g_wrd_wnd.curattr = 0; break; case 18: // w32g_wrd_wnd.curforecolor = W32G_WRDWND_BLUE; w32g_wrd_wnd.curbackcolor = W32G_WRDWND_BLACK; w32g_wrd_wnd.curattr = 0; break; case 19: // w32g_wrd_wnd.curforecolor = W32G_WRDWND_PURPLE; w32g_wrd_wnd.curbackcolor = W32G_WRDWND_BLACK; w32g_wrd_wnd.curattr = 0; break; case 20: // w32g_wrd_wnd.curforecolor = W32G_WRDWND_GREEN; w32g_wrd_wnd.curbackcolor = W32G_WRDWND_BLACK; w32g_wrd_wnd.curattr = 0; break; case 21: // F w32g_wrd_wnd.curforecolor = W32G_WRDWND_YELLOW; w32g_wrd_wnd.curbackcolor = W32G_WRDWND_BLACK; w32g_wrd_wnd.curattr = 0; break; case 22: // F w32g_wrd_wnd.curforecolor = W32G_WRDWND_LIGHTBLUE; w32g_wrd_wnd.curbackcolor = W32G_WRDWND_BLACK; w32g_wrd_wnd.curattr = 0; break; case 23: // w32g_wrd_wnd.curforecolor = W32G_WRDWND_WHITE; w32g_wrd_wnd.curbackcolor = W32G_WRDWND_BLACK; w32g_wrd_wnd.curattr = 0; break; case 30: // w32g_wrd_wnd.curforecolor = W32G_WRDWND_BLACK; w32g_wrd_wnd.curbackcolor = W32G_WRDWND_BLACK; w32g_wrd_wnd.curattr = 0; break; case 31: // w32g_wrd_wnd.curforecolor = W32G_WRDWND_RED; w32g_wrd_wnd.curbackcolor = W32G_WRDWND_BLACK; w32g_wrd_wnd.curattr = 0; break; case 32: // w32g_wrd_wnd.curforecolor = W32G_WRDWND_GREEN; w32g_wrd_wnd.curbackcolor = W32G_WRDWND_BLACK; w32g_wrd_wnd.curattr = 0; break; case 33: // F w32g_wrd_wnd.curforecolor = W32G_WRDWND_YELLOW; w32g_wrd_wnd.curbackcolor = W32G_WRDWND_BLACK; w32g_wrd_wnd.curattr = 0; break; case 34: // w32g_wrd_wnd.curforecolor = W32G_WRDWND_BLUE; w32g_wrd_wnd.curbackcolor = W32G_WRDWND_BLACK; w32g_wrd_wnd.curattr = 0; break; case 35: // w32g_wrd_wnd.curforecolor = W32G_WRDWND_PURPLE; w32g_wrd_wnd.curbackcolor = W32G_WRDWND_BLACK; w32g_wrd_wnd.curattr = 0; break; case 36: // F w32g_wrd_wnd.curforecolor = W32G_WRDWND_LIGHTBLUE; w32g_wrd_wnd.curbackcolor = W32G_WRDWND_BLACK; w32g_wrd_wnd.curattr = 0; break; case 37: // w32g_wrd_wnd.curforecolor = W32G_WRDWND_WHITE; w32g_wrd_wnd.curbackcolor = W32G_WRDWND_BLACK; w32g_wrd_wnd.curattr = 0; break; case 40: // ] w32g_wrd_wnd.curforecolor = W32G_WRDWND_BLACK; w32g_wrd_wnd.curbackcolor = W32G_WRDWND_BLACK; w32g_wrd_wnd.curattr = 0; w32g_wrd_wnd.curattr |= W32G_WRDWND_ATTR_REVERSE; break; case 41: // Ԕ] w32g_wrd_wnd.curforecolor = W32G_WRDWND_BLACK; w32g_wrd_wnd.curbackcolor = W32G_WRDWND_RED; w32g_wrd_wnd.curattr = 0; w32g_wrd_wnd.curattr |= W32G_WRDWND_ATTR_REVERSE; break; case 42: // Δ] w32g_wrd_wnd.curforecolor = W32G_WRDWND_BLACK; w32g_wrd_wnd.curbackcolor = W32G_WRDWND_GREEN; w32g_wrd_wnd.curattr = 0; w32g_wrd_wnd.curattr |= W32G_WRDWND_ATTR_REVERSE; break; case 43: // F] w32g_wrd_wnd.curforecolor = W32G_WRDWND_BLACK; w32g_wrd_wnd.curbackcolor = W32G_WRDWND_YELLOW; w32g_wrd_wnd.curattr = 0; w32g_wrd_wnd.curattr |= W32G_WRDWND_ATTR_REVERSE; break; case 44: // ”] w32g_wrd_wnd.curforecolor = W32G_WRDWND_BLACK; w32g_wrd_wnd.curbackcolor = W32G_WRDWND_BLUE; w32g_wrd_wnd.curattr = 0; w32g_wrd_wnd.curattr |= W32G_WRDWND_ATTR_REVERSE; break; case 45: // ] w32g_wrd_wnd.curforecolor = W32G_WRDWND_BLACK; w32g_wrd_wnd.curbackcolor = W32G_WRDWND_PURPLE; w32g_wrd_wnd.curattr = 0; w32g_wrd_wnd.curattr |= W32G_WRDWND_ATTR_REVERSE; break; case 46: // F] w32g_wrd_wnd.curforecolor = W32G_WRDWND_BLACK; w32g_wrd_wnd.curbackcolor = W32G_WRDWND_LIGHTBLUE; w32g_wrd_wnd.curattr = 0; w32g_wrd_wnd.curattr |= W32G_WRDWND_ATTR_REVERSE; break; case 47: // ] w32g_wrd_wnd.curforecolor = W32G_WRDWND_BLACK; w32g_wrd_wnd.curbackcolor = W32G_WRDWND_WHITE; w32g_wrd_wnd.curattr = 0; w32g_wrd_wnd.curattr |= W32G_WRDWND_ATTR_REVERSE; break; default: w32g_wrd_wnd.curforecolor = W32G_WRDWND_WHITE; w32g_wrd_wnd.curbackcolor = W32G_WRDWND_BLACK; w32g_wrd_wnd.curattr = 0; break; } } // Agr[g̃Zbg void WrdWndSetAttrReset(void) { if ( !w32g_wrd_wnd.active ) return; w32g_wrd_wnd.curforecolor = W32G_WRDWND_WHITE; w32g_wrd_wnd.curbackcolor = W32G_WRDWND_BLACK; w32g_wrd_wnd.curattr = 0; } // J[\|WV̈ړ void WrdWndGoto(int x, int y) { if ( !w32g_wrd_wnd.active ) return; if ( x < 0 ) x = 0; if ( x >= w32g_wrd_wnd.row ) x = w32g_wrd_wnd.row - 1; if ( y < 0 ) y = 0; if ( y >= w32g_wrd_wnd.col ) y = w32g_wrd_wnd.col - 1; w32g_wrd_wnd.curposx = x; w32g_wrd_wnd.curposy = y; } void WrdWndPaintAll(int lockflag) { if ( !w32g_wrd_wnd.active ) return; wrd_text_update ( 0, 0, w32g_wrd_wnd.row - 1, w32g_wrd_wnd.col - 1, TRUE ); } // SetInvalidateRect() WM_PAINT Ăԉ”\B void WrdWndPaintDo(int flag) { RECT rc; if ( flag ) InvalidateRect( w32g_wrd_wnd.hwnd,NULL, FALSE ); if ( GetUpdateRect(w32g_wrd_wnd.hwnd, &rc, FALSE) ) { PAINTSTRUCT ps; if ( wrd_wnd_lock_ex ( 0 ) == TRUE ) { if ( GDI_LOCK_EX(0) == 0 ) { w32g_wrd_wnd.hdc = BeginPaint(w32g_wrd_wnd.hwnd, &ps); BitBlt(w32g_wrd_wnd.hdc,rc.left,rc.top,rc.right,rc.bottom,w32g_wrd_wnd.hmdc,rc.left,rc.top,SRCCOPY); EndPaint(w32g_wrd_wnd.hwnd, &ps); GDI_UNLOCK(); // gdi_lock } else { InvalidateRect ( w32g_wrd_wnd.hwnd, &rc, FALSE ); } } else { InvalidateRect ( w32g_wrd_wnd.hwnd, &rc, FALSE ); } wrd_wnd_unlock(); } } #define IDM_GRAPHIC_STOP 3531 #define IDM_GRAPHIC_START 3532 BOOL CALLBACK WrdCanvasWndProc(HWND hwnd, UINT uMess, WPARAM wParam, LPARAM lParam) { static HMENU hPopupMenu = NULL; switch (uMess) { case WM_CREATE: break; case WM_PAINT: WrdWndPaintDo(FALSE); return 0; case WM_DROPFILES: SendMessage(hMainWnd,WM_DROPFILES,wParam,lParam); return 0; case WM_DESTROY: if ( hPopupMenu != NULL ) DestroyMenu ( hPopupMenu ); hPopupMenu = NULL; break; case WM_COMMAND: switch (LOWORD(wParam)) { case IDM_GRAPHIC_STOP: WrdWndInfo.GraphicStop = 1; break; case IDM_GRAPHIC_START: WrdWndInfo.GraphicStop = 0; break; default: break; } break; case WM_RBUTTONDOWN: { if ( LOWORD(lParam ) != HTCAPTION ){ POINT point; int res; if ( hPopupMenu != NULL ) DestroyMenu ( hPopupMenu ); hPopupMenu = CreatePopupMenu(); if ( WrdWndInfo.GraphicStop ) { AppendMenu(hPopupMenu,MF_STRING,IDM_GRAPHIC_START,"Graphic Start"); } else { AppendMenu(hPopupMenu,MF_STRING,IDM_GRAPHIC_STOP,"Graphic Stop"); } GetCursorPos(&point); SetForegroundWindow ( hwnd ); res = TrackPopupMenu ( hPopupMenu, TPM_TOPALIGN|TPM_LEFTALIGN, point.x, point.y, 0, hwnd, NULL ); PostMessage ( hwnd, WM_NULL, 0, 0 ); DestroyMenu ( hPopupMenu ); hPopupMenu = NULL; } } break; default: return DefWindowProc(hwnd,uMess,wParam,lParam) ; } return 0L; } extern void MainWndUpdateWrdButton(void); BOOL CALLBACK WrdWndProc(HWND hwnd, UINT uMess, WPARAM wParam, LPARAM lParam) { switch (uMess){ case WM_INITDIALOG: SetWindowPosSize(GetDesktopWindow(),hwnd,WrdWndInfo.PosX, WrdWndInfo.PosY ); return FALSE; case WM_DESTROY: TerminateWrdWnd (); INISaveWrdWnd(); break; case WM_COMMAND: switch (LOWORD(wParam)) { case IDCLOSE: ShowWindow(hwnd, SW_HIDE); MainWndUpdateWrdButton(); break; default: return FALSE; } case WM_MOVE: // WrdWndInfo.PosX = (int) LOWORD(lParam); // WrdWndInfo.PosY = (int) HIWORD(lParam); { RECT rc; GetWindowRect(hwnd,&rc); WrdWndInfo.PosX = rc.left; WrdWndInfo.PosY = rc.top; } break; case WM_CLOSE: ShowWindow(hWrdWnd, SW_HIDE); MainWndUpdateWrdButton(); break; case WM_DROPFILES: SendMessage(hMainWnd,WM_DROPFILES,wParam,lParam); return 0; default: return FALSE; } return FALSE; } static int WrdWndInfoReset(HWND hwnd) { memset(&WrdWndInfo,0,sizeof(WRDWNDINFO)); WrdWndInfo.PosX = - 1; WrdWndInfo.PosY = - 1; WrdWndInfo.GraphicStop = 1; return 0; } static int WrdWndInfoApply(void) { return 0; } static RGBQUAD RGBtoRGBQUAD ( COLORREF color ) { RGBQUAD rq; rq.rgbRed = (unsigned char) ( ( color & 0x000000FFL ) >> 0 ); rq.rgbGreen = (unsigned char) ( ( color & 0x0000FF00L ) >> 8 ); rq.rgbBlue = (unsigned char) ( ( color & 0x00FF0000L ) >> 16 ); rq.rgbReserved = 0; return rq; } static COLORREF RGBQUADtoRGB ( RGBQUAD rq ) { return RGB ( rq.rgbRed, rq.rgbGreen, rq.rgbBlue ); } extern int PosSizeSave; #define SEC_WRDWND "WrdWnd" int INISaveWrdWnd(void) { char *section = SEC_WRDWND; char *inifile = TIMIDITY_WINDOW_INI_FILE; char buffer[256]; if ( PosSizeSave ) { if ( WrdWndInfo.PosX >= 0 || WrdWndInfo.PosY >= 0 ) { if ( WrdWndInfo.PosX < 0 ) WrdWndInfo.PosX = 0; if ( WrdWndInfo.PosY < 0 ) WrdWndInfo.PosY = 0; } sprintf(buffer,"%d",WrdWndInfo.PosX); if ( WrdWndInfo.PosX >= 0 ) WritePrivateProfileString(section,"PosX",buffer,inifile); sprintf(buffer,"%d",WrdWndInfo.PosY); if ( WrdWndInfo.PosY >= 0 ) WritePrivateProfileString(section,"PosY",buffer,inifile); } sprintf(buffer,"%d",WrdWndInfo.GraphicStop); WritePrivateProfileString(section,"GraphicStop",buffer,inifile); WritePrivateProfileString(NULL,NULL,NULL,inifile); // Write Flush return 0; } int INILoadWrdWnd(void) { char *section = SEC_WRDWND; char *inifile = TIMIDITY_WINDOW_INI_FILE; int num; num = GetPrivateProfileInt(section,"PosX",-1,inifile); WrdWndInfo.PosX = num; num = GetPrivateProfileInt(section,"PosY",-1,inifile); WrdWndInfo.PosY = num; num = GetPrivateProfileInt(section,"GraphicStop",1,inifile); WrdWndInfo.GraphicStop = num; return 0; } void w32_wrd_ctl_event(CtlEvent *e) { } TiMidity++-2.13.2/interface/w32g_wrd.h0100644004711200001440000000600207607635076016462 0ustar tamukiusers#ifndef __W32G_WRD_H__ #define __W32G_WRD_H__ #define W32G_WRDWND_ROW 80 #define W32G_WRDWND_COL 25 #define W32G_WRDWND_ATTR_REVERSE 0x01 #define W32G_WRDWND_BLACK 0 #define W32G_WRDWND_RED 1 #define W32G_WRDWND_BLUE 2 #define W32G_WRDWND_PURPLE 3 #define W32G_WRDWND_GREEN 4 #define W32G_WRDWND_LIGHTBLUE 5 #define W32G_WRDWND_YELLOW 6 #define W32G_WRDWND_WHITE 7 #define W32G_WRDWND_GRAPHIC_PLANE_MAX 2 #define W32G_WRDWND_GRAPHIC_PALLETE_MAX 16 #define W32G_WRDWND_GRAPHIC_BITS 8 #define W32G_WRDWND_GRAPHIC_PALLETE_BUF_MAX 20 #define WRD_FLAG_TEXT 1 #define WRD_FLAG_GRAPHIC 2 #define WRD_FLAG_DEFAULT ( WRD_FLAG_TEXT | WRD_FLAG_GRAPHIC ) typedef struct w32g_wrd_wnd_t_ { HWND hwnd; HWND hParentWnd; HDC hdc; HDC hmdc; HGDIOBJ hgdiobj_hmdcprev; HBITMAP hbitmap; int flag; // tO int draw_skip; // [N HBITMAP hbmp_work; // eLXg}XN HBITMAP hbmp_tmask; // OtBbN w32g_dib_t *graphic_dib[W32G_WRDWND_GRAPHIC_PLANE_MAX]; int index_active; // ANeBu int index_display; // fBXvC int gmode; // 摜f[^̌` BITMAPINFO *bmi_graphic[W32G_WRDWND_GRAPHIC_PLANE_MAX]; // pbgx[X̉摜f[^ char *bits_mag_work; // OtBbNpbgobt@ RGBQUAD default_gpal[W32G_WRDWND_GRAPHIC_PALLETE_MAX]; RGBQUAD gpal_buff[W32G_WRDWND_GRAPHIC_PALLETE_BUF_MAX][W32G_WRDWND_GRAPHIC_PALLETE_MAX]; // ύX int modified_graphic[W32G_WRDWND_GRAPHIC_PLANE_MAX]; // tF[h int fade_from; int fade_to; // HPEN hNullPen; HBRUSH hNullBrush; HFONT hFont; RECT rc; int font_height; int font_width; int height; int width; int row; int col; int curposx; int curposy; char curforecolor; char curbackcolor; char curattr; char textbuf[W32G_WRDWND_COL][W32G_WRDWND_ROW]; char forecolorbuf[W32G_WRDWND_COL][W32G_WRDWND_ROW]; char backcolorbuf[W32G_WRDWND_COL][W32G_WRDWND_ROW]; char attrbuf[W32G_WRDWND_COL][W32G_WRDWND_ROW]; int valid; int active; int updateall; COLORREF pals[32]; } w32g_wrd_wnd_t; extern void WrdWndReset(void); extern void WrdWndCopyLine(int from, int to, int lockflag); extern void WrdWndClearLineFromTo(int from, int to, int lockflag); extern void WrdWndMoveLine(int from, int to, int lockflag); extern void WrdWndScrollDown(int lockflag); extern void WrdWndScrollUp(int lockflag); extern void WrdWndClear(int lockflag); extern void WrdWndPutString(char *str, int lockflag); extern void WrdWndPutStringN(char *str, int n, int lockflag); extern void WrdWndLineClearFrom(int left, int lockflag); extern void WrdWndSetAttr98(int attr); extern void WrdWndSetAttrReset(void); extern void WrdWndGoto(int x, int y); extern void WrdWndPaintAll(int lockflag); extern void WrdWndPaintDo(int flag); extern void WrdWndCurStateSaveAndRestore(int saveflag); extern w32g_wrd_wnd_t w32g_wrd_wnd; // section of ini file // [WrdWnd] // PosX = // PosY = typedef struct WRDWNDINFO_ { HWND hwnd; int PosX; int PosY; int volatile GraphicStop; } WRDWNDINFO; extern WRDWNDINFO WrdWndInfo; extern int INISaveWrdWnd(void); extern int INILoadWrdWnd(void); #endif /* __W32G_WRD_H__ */ TiMidity++-2.13.2/interface/wrdt_w32g.c0100644004711200001440000004761010125651536016637 0ustar tamukiusers/* TiMidity++ -- MIDI to WAVE converter and player Copyright (C) 1999-2002 Masanao Izumo Copyright (C) 1995 Tuukka Toivonen 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* * WRD Tracer for vt100 control terminal * Written by Takanori Watanabe */ /* * WRD Tracer for Win32GUI * modified for Windows console by Daisuke Aoki */ #ifdef HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ #include #include #ifndef NO_STRING_H #include #else #include #endif #include "timidity.h" #include "common.h" #include "instrum.h" #include "playmidi.h" #include "readmidi.h" #include "controls.h" #include "wrd.h" #include #include "w32g_dib.h" #include "w32g_wrd.h" static int wrdt_open(char *dummy); static void wrdt_apply(int cmd, int wrd_argc, int wrd_args[]); static void wrdt_update_events(void); static void wrdt_end(void); static void wrdt_close(void); #define NO_GRAPHIC_SUPPORT #define wrdt w32g_wrdt_mode #define COLOR_REMAP(k) ((k)>16)&&((k)<30)?(k)+14:k WRDTracer wrdt = { "Windows Console WRD tracer", 'w', 0, wrdt_open, wrdt_apply, NULL, wrdt_update_events, NULL, wrdt_end, wrdt_close }; static int wrd_argc; static int wrd_args[WRD_MAXPARAM]; static int inkey_flag; static void putstring(char *str) { WrdWndPutString(str,TRUE); } static void putstringn(char *str, int n) { WrdWndPutStringN(str,n,TRUE); } /* Escape sequence */ static void esc_index(void) { w32g_wrd_wnd.curposy++; if ( w32g_wrd_wnd.curposy >= w32g_wrd_wnd.col ) { WrdWndScrollUp(TRUE); w32g_wrd_wnd.curposy = w32g_wrd_wnd.col - 1; } } void esc_nextline(void) { w32g_wrd_wnd.curposx = 0; w32g_wrd_wnd.curposy++; if ( w32g_wrd_wnd.curposy >= w32g_wrd_wnd.col ) { WrdWndScrollUp(TRUE); w32g_wrd_wnd.curposy = w32g_wrd_wnd.col - 1; } } void esc_reverseindex(void) { w32g_wrd_wnd.curposy--; if ( w32g_wrd_wnd.curposy < 0 ) { WrdWndScrollDown(TRUE); } } void esc_clearscreen(void) { WrdWndClear(TRUE); } void esc_directcursoraddressing(int x, int y) { WrdWndGoto( x-1, y-1 ); } void esc_cursorup(int n) { if(n < 1) n = 1; WrdWndGoto( w32g_wrd_wnd.curposx, w32g_wrd_wnd.curposy - n ); } void esc_cursordown(int n) { if(n < 1) n = 1; WrdWndGoto( w32g_wrd_wnd.curposx, w32g_wrd_wnd.curposy + n ); } void esc_cursorforward(int n) { if(n < 1) n = 1; WrdWndGoto( w32g_wrd_wnd.curposx - n , w32g_wrd_wnd.curposy ); } void esc_cursorbackward(int n) { if(n < 1) n = 1; WrdWndGoto( w32g_wrd_wnd.curposx + n , w32g_wrd_wnd.curposy ); } void esc_clearfromcursortoendofscreen(void) { WrdWndLineClearFrom(FALSE, TRUE); WrdWndClearLineFromTo(w32g_wrd_wnd.curposy + 1, w32g_wrd_wnd.col - 1, TRUE); } void esc_clearfrombeginningofscreentocursor(void) { WrdWndClearLineFromTo(0,w32g_wrd_wnd.curposy - 1, TRUE); WrdWndLineClearFrom(TRUE, TRUE); } void esc_clearfromcursortoendofline(void) { WrdWndLineClearFrom(FALSE, TRUE); } void esc_clearfrombeginningoflinetocursor(void) { WrdWndLineClearFrom(TRUE, TRUE); } void esc_clearentirelinecontainingcursor(void) { WrdWndClearLineFromTo( w32g_wrd_wnd.curposy, w32g_wrd_wnd.curposy, TRUE ); } void esc_deleteline(int n) { int i; if(n < 1) n = 1; if( w32g_wrd_wnd.curposy + n >= w32g_wrd_wnd.col ) n = w32g_wrd_wnd.col - 1 - w32g_wrd_wnd.curposy; for( i = w32g_wrd_wnd.curposy; i < w32g_wrd_wnd.curposy + n; i++ ) { WrdWndMoveLine(i+n,i,TRUE); } WrdWndClearLineFromTo(w32g_wrd_wnd.col - n, w32g_wrd_wnd.col - 1, TRUE); w32g_wrd_wnd.curposx = 0; } void esc_insertline(int n) { int i; if(n < 1) n = 1; if( w32g_wrd_wnd.curposy + n >= w32g_wrd_wnd.col ) n = w32g_wrd_wnd.col - 1 - w32g_wrd_wnd.curposy; for( i = w32g_wrd_wnd.col - n - 1; i >= w32g_wrd_wnd.curposy; i-- ) { WrdWndMoveLine(i,i+n,TRUE); } w32g_wrd_wnd.curposx = 0; } static volatile int saved_x; static volatile int saved_y; static volatile int saved_attr; void esc_savecursorposition(void) { WrdWndCurStateSaveAndRestore(1); return; } void esc_setcursorposition(void) { WrdWndCurStateSaveAndRestore(0); return; } void esc_enablecursordisplay(void) { return; } void esc_disablecursordisplay(void) { return; } void esc_characterattribute(int n) { WrdWndSetAttr98(n); } /* return figures */ static int getdigit(char *str,int *num) { int i; char local[20]; for(i=0;i<=10;i++) if(str[i] < '0' || str[i] > '9'){ if(i<1) return 0; else break; } strncpy(local,str,i); local[i] = '\0'; *num = atoi(local); return i; } extern int gdi_lock(void); extern int gdi_unlock(void); static void putstring_with_esc(char *str) { char *p; while(*str) { p = str; for(;;) { if((unsigned char)*p >= 0x20){ p++; continue; } if(p-str > 0){ WrdWndPutStringN(str,p-str,TRUE); str = p; break; } if(*p == '\0') break; if(*p == '\n') { esc_nextline(); str = p + 1; break; } if(*p == '\r' && *(p+1) == '\n') { esc_nextline(); str = p + 2; break; } if(*p == '\t') { WrdWndPutStringN ( " ", 8, TRUE ); str = p + 1; break; } if(*p != 0x1b){ str = p + 1; break; } if(*p == 0x1b){ int res, n[1024], n_max = 0; char *oldp = p; p++; if(*p == '['){ p++; for(;;){ res = getdigit(p,&(n[n_max+1])); if(res>0){ n_max++; p += res; } if(*p != ';') break; else p++; } } else if(*p == 'D'){ esc_index(); p++; str = p; break; } else if(*p == 'E'){ esc_nextline(); p++; str = p; break; } else if(*p == 'M'){ esc_reverseindex(); p++; str = p; break; } else if(*p == '*'){ esc_clearscreen(); p++; str = p; break; } else { p = oldp; if(p-str > 0){ WrdWndPutStringN(str,p-str,TRUE); str = p; break; } } if(n_max == 2 && (*p == 'H' || *p == 'f')){ esc_directcursoraddressing(n[2],n[1]); p++; str = p; break; } if((n_max == 1 && *p == 'A') || (n_max == 0 && *p == 'A')){ if(n_max == 0) n[1] = 1; esc_cursorup(n[1]); p++; str = p; break; } if((n_max == 1 && *p == 'B') || (n_max == 0 && *p == 'B')){ if(n_max == 0) n[1] = 1; esc_cursordown(n[1]); p++; str = p; break; } if((n_max == 1 && *p == 'C') || (n_max == 0 && *p == 'C')){ if(n_max == 0) n[1] = 1; esc_cursorforward(n[1]); p++; str = p; break; } if((n_max == 1 && *p == 'D') || (n_max == 0 && *p == 'D')){ if(n_max == 0) n[1] = 1; esc_cursorbackward(n[1]); p++; str = p; break; } if((n_max == 1 && *p == 'J') || (n_max == 0 && *p == 'J')){ if(n_max == 0 || n[1] == 0) esc_clearfromcursortoendofscreen(); else if(n[1] == 1) esc_clearfrombeginningofscreentocursor(); else if(n[1] == 2) esc_clearscreen(); p++; str = p; break; } if((n_max == 1 && *p == 'K') || (n_max == 0 && *p == 'K')){ if(n_max == 0 || n[1] == 0) esc_clearfromcursortoendofline(); else if(n[1] == 1) esc_clearfrombeginningoflinetocursor(); else if(n[1] == 2) esc_clearentirelinecontainingcursor(); p++; str = p; break; } if((n_max == 1 && *p == 'M') || (n_max == 0 && *p == 'M')){ if(n_max == 0) n[1] = 1; esc_deleteline(n[1]); p++; str = p; break; } if((n_max == 1 && *p == 'L') || (n_max == 0 && *p == 'L')){ if(n_max == 0) n[1] = 1; esc_insertline(n[1]); p++; str = p; break; } if(n_max == 0 && *p == 's'){ esc_savecursorposition(); p++; str = p; break; } if(n_max == 0 && *p == 'u'){ esc_setcursorposition(); p++; str = p; break; } if(!strncmp(p,">5l",3)){ esc_enablecursordisplay(); p += 3; str = p; break; } if(!strncmp(p,">5h",3)){ esc_disablecursordisplay(); p += 3; str = p; break; } if(!strncmp(p,">1h",3)){ /* Enabel bottom line */ p += 3; str = p; break; } if(!strncmp(p,">1l",3)){ /* Disabel bottom line */ p += 3; str = p; break; } if(!strncmp(p,">3h",3)){ /* Select 31 line mode */ p += 3; str = p; break; } if(!strncmp(p,">3l",3)){ /* Select 25 line mode */ p += 3; str = p; break; } if(*p == 'm'){ int i; for(i=1;i<=n_max;i++) esc_characterattribute(n[i]); p++; str = p; break; } p = oldp; WrdWndPutStringN(p,1,TRUE); p++; str = p; break; } } } } static int wrdt_open(char *dummy) { wrdt.opened = 1; inkey_flag = 0; WrdWndReset(); return 0; } static void wrdt_update_events(void) { } static void wrdt_end(void) { esc_enablecursordisplay(); inkey_flag = 0; } static void wrdt_close(void) { wrdt.opened = 0; inkey_flag = 0; } static char *wrd_event2string(int id) { char *name; name = event2string(id); if(name != NULL) return name + 1; return ""; } #define SEIKIX(x) { \ if ( x < 1 ) x = 1; \ if ( x > w32g_wrd_wnd.row ) x = w32g_wrd_wnd.row; \ } #define SEIKIY(y) { \ if ( y < 1 ) y = 1; \ if ( y > w32g_wrd_wnd.col ) y = w32g_wrd_wnd.col; \ } static void borlandc_esc(char *str) { char local[201]; local[0] = '\033'; local[1] = '['; strncpy(local+2,str,sizeof(local)-3); local[200] = '\0'; putstring_with_esc(local); } extern void wrd_graphic_ginit ( void ); extern void wrd_graphic_gcls ( int sw ); extern void wrd_graphic_gscreen ( int active, int display ); extern void wrd_graphic_gon ( int sw ); extern void wrd_graphic_gline ( int x1, int y1, int x2, int y2, int p1, int sw, int p2 ); extern void wrd_graphic_gcircle ( int x, int y, int r, int p1, int sw, int p2 ); extern void wrd_graphic_pload ( char *path ); extern void wrd_graphic_pal_g4r4b4 ( int p, int *g4r4b4, int max ); extern void wrd_graphic_palrev ( int p ); extern void wrd_graphic_apply_pal ( int p ); extern void wrd_graphic_fade ( int p1, int p2, int speed ); extern void wrd_graphic_fadestep ( int v ); extern void wrd_graphic_gmode ( int sw ); extern void wrd_graphic_gmove ( int x1, int y1, int x2, int y2, int xd, int yd, int vs, int vd, int sw ); extern void wrd_graphic_mag ( char *path, int x, int y, int s, int p ); extern void wrd_text_ton ( int sw ); extern void wrd_text_scroll ( int x1, int y1, int x2, int y2, int mode, int color, int c ); extern void wrd_start_skip ( void ); extern void wrd_end_skip ( void ); extern void wrd_graphic_xcopy ( int sx1, int sy1, int sx2, int sy2, int tx, int ty, int ss, int ts, int method, int opt1, int opt2, int opt3, int opt4, int opt5 ); // #define WRD_VERBOSE static void wrdt_apply(int cmd, int wrd_argc, int wrd_args[]) { char *p; char *text; int i, len; static txtclr_preserve=0; if ( !w32g_wrd_wnd.active ) return; switch(cmd) { case WRD_LYRIC: p = wrd_event2string(wrd_args[0]); len = strlen(p); text = (char *)new_segment(&tmpbuffer, SAFE_CONVERT_LENGTH(len)); /*This must be not good thing,but as far as I know no wrd file written in EUC-JP code found*/ strcpy(text,p); #ifdef WRD_VERBOSE // ctl->cmsg(CMSG_INFO, VERB_VERBOSE, // "[WRD_LYRIC]\n%s", text ); #endif putstring_with_esc(text); reuse_mblock(&tmpbuffer); break; case WRD_NL: /* Newline (Ignored) */ esc_nextline(); // putchar('\n'); break; case WRD_COLOR: /*Compatibility Hack,This remaps color(17-29 color seems to be ignored in kterm)*/ esc_characterattribute(wrd_args[0]); break; case WRD_END: /* Never call */ break; case WRD_ESC: borlandc_esc(wrd_event2string(wrd_args[0])); break; case WRD_EXEC: /*I don't spaun another program*/ ctl->cmsg(CMSG_INFO, VERB_VERBOSE, "@EXEC(%s)", wrd_event2string(wrd_args[0])); break; case WRD_FADE: wrd_graphic_fade ( wrd_args[0], wrd_args[1], wrd_args[2] ); #ifdef WRD_VERBOSE ctl->cmsg(CMSG_INFO, VERB_VERBOSE, "@FADE(%d,%d,%d)", wrd_args[0], wrd_args[1], wrd_args[2]); #endif break; case WRD_FADESTEP: wrd_graphic_fadestep ( wrd_args[0] ); #ifdef WRD_VERBOSE ctl->cmsg(CMSG_INFO, VERB_VERBOSE, "@FADESTEP(%d/%d)", wrd_args[0], WRD_MAXFADESTEP); #endif break; case WRD_GCIRCLE: wrd_graphic_gcircle ( wrd_args[0], wrd_args[1], wrd_args[2], wrd_args[3], wrd_args[4], wrd_args[5] ); ctl->cmsg(CMSG_INFO, VERB_VERBOSE, "@GCIRCLE(%d,%d,%d,%d,%d,%d)", wrd_args[0], wrd_args[1], wrd_args[2], wrd_args[3], wrd_args[4], wrd_args[5]); break; case WRD_GCLS: wrd_graphic_gcls ( wrd_args[0] ); #ifdef WRD_VERBOSE ctl->cmsg(CMSG_INFO, VERB_VERBOSE, "@GCLS(%d)", wrd_args[0]); #endif break; case WRD_GINIT: wrd_graphic_ginit (); #ifdef WRD_VERBOSE ctl->cmsg(CMSG_INFO, VERB_VERBOSE, "@GINIT()"); #endif break; case WRD_GLINE: wrd_graphic_gline ( wrd_args[0], wrd_args[1], wrd_args[2], wrd_args[3], wrd_args[4], wrd_args[5], wrd_args[6] ); #ifdef WRD_VERBOSE ctl->cmsg(CMSG_INFO, VERB_VERBOSE, "@GLINE(%d,%d,%d,%d,%d,%d,%d)", wrd_args[0], wrd_args[1], wrd_args[2], wrd_args[3], wrd_args[4], wrd_args[5], wrd_args[6]); #endif break; case WRD_GMODE: wrd_graphic_gmode ( wrd_args[0] ); #ifdef WRD_VERBOSE ctl->cmsg(CMSG_INFO, VERB_VERBOSE, "@GMODE(%d)", wrd_args[0]); #endif break; case WRD_GMOVE: wrd_graphic_gmove ( wrd_args[0], wrd_args[1], wrd_args[2], wrd_args[3], wrd_args[4], wrd_args[5], wrd_args[6], wrd_args[7], wrd_args[8] ); #ifdef WRD_VERBOSE ctl->cmsg(CMSG_INFO, VERB_VERBOSE, "@GMOVE(%d,%d,%d,%d,%d,%d,%d)", wrd_args[0], wrd_args[1], wrd_args[2], wrd_args[3], wrd_args[4], wrd_args[5], wrd_args[6], wrd_args[7], wrd_args[8]); #endif break; case WRD_GON: wrd_graphic_gon ( wrd_args[0] ); #ifdef WRD_VERBOSE ctl->cmsg(CMSG_INFO, VERB_VERBOSE, "@GON(%d)", wrd_args[0]); #endif break; case WRD_GSCREEN: wrd_graphic_gscreen ( wrd_args[0], wrd_args[1] ); #ifdef WRD_VERBOSE ctl->cmsg(CMSG_INFO, VERB_VERBOSE, "@GSCREEN(%d,%d)", wrd_args[0], wrd_args[1]); #endif break; case WRD_INKEY: inkey_flag = 1; ctl->cmsg(CMSG_INFO, VERB_VERBOSE, "@INKEY - begin"); break; case WRD_OUTKEY: inkey_flag = 0; ctl->cmsg(CMSG_INFO, VERB_VERBOSE, "@INKEY - end"); break; case WRD_LOCATE: { int x = wrd_args[0], y = wrd_args[1]; WrdWndGoto(x-1, y-1); } break; case WRD_LOOP: /* Never call */ break; case WRD_MAG: wrd_graphic_mag ( wrd_event2string(wrd_args[0]), wrd_args[1], wrd_args[2], wrd_args[3], wrd_args[4]); #ifdef WRD_VERBOSE p = (char *)new_segment(&tmpbuffer, MIN_MBLOCK_SIZE); snprintf(p, MIN_MBLOCK_SIZE-1, "@MAG(%s", wrd_event2string(wrd_args[0])); p[MIN_MBLOCK_SIZE-1] = '\0'; /* fail safe */ for(i = 1; i < 5; i++) { if(wrd_args[i] == WRD_NOARG) strncat(p, ",*", MIN_MBLOCK_SIZE - strlen(p) - 1); else { char q[CHAR_BIT*sizeof(int)]; snprintf(q, sizeof(q)-1, ",%d", wrd_args[i]); strncat(p, q, MIN_MBLOCK_SIZE - strlen(p) - 1); } } strncat(p, ")", MIN_MBLOCK_SIZE - strlen(p) - 1); ctl->cmsg(CMSG_INFO, VERB_VERBOSE, "%s", p); reuse_mblock(&tmpbuffer); #endif break; case WRD_MIDI: /* Never call */ break; case WRD_OFFSET: /* Never call */ break; case WRD_PAL: wrd_graphic_pal_g4r4b4 (wrd_args[0], wrd_args + 1, 16 ); #ifdef WRD_VERBOSE p = (char *)new_segment(&tmpbuffer, MIN_MBLOCK_SIZE); snprintf(p, MIN_MBLOCK_SIZE, "@PAL(%03x", wrd_args[0]); for(i = 1; i < 17; i++) { char q[5]; snprintf(q, sizeof(q)-1, ",%03x", wrd_args[i]); strncat(p, q, MIN_MBLOCK_SIZE - strlen(p) - 1); } strncat(p, ")", MIN_MBLOCK_SIZE - strlen(p) - 1); ctl->cmsg(CMSG_INFO, VERB_VERBOSE, "%s", p); reuse_mblock(&tmpbuffer); #endif break; case WRD_PALCHG: wrd_graphic_apply_pal ( wrd_args[0] ); #ifdef WRD_VERBOSE ctl->cmsg(CMSG_INFO, VERB_VERBOSE, "@PALCHG(%s)", wrd_event2string(wrd_args[0])); #endif break; case WRD_PALREV: wrd_graphic_palrev ( wrd_args[0] ); #ifdef WRD_VERBOSE ctl->cmsg(CMSG_INFO, VERB_VERBOSE, "@PALREV(%d)", wrd_args[0]); #endif break; case WRD_PATH: ctl->cmsg(CMSG_INFO, VERB_VERBOSE, "@PATH(%s)", wrd_event2string(wrd_args[0])); break; case WRD_PLOAD: wrd_graphic_pload ( wrd_event2string(wrd_args[0]) ); #ifdef WRD_VERBOSE ctl->cmsg(CMSG_INFO, VERB_VERBOSE, "@PLOAD(%s)", wrd_event2string(wrd_args[0])); #endif break; case WRD_REM: p = wrd_event2string(wrd_args[0]); len = strlen(p); text = (char *)new_segment(&tmpbuffer, SAFE_CONVERT_LENGTH(len)); code_convert(p, text, SAFE_CONVERT_LENGTH(len), NULL, NULL); ctl->cmsg(CMSG_INFO, VERB_VERBOSE, "@REM %s", text); reuse_mblock(&tmpbuffer); break; case WRD_REMARK: ctl->cmsg(CMSG_INFO, VERB_VERBOSE, "@REMARK(%s)", wrd_event2string(wrd_args[0])); break; case WRD_REST: /* Never call */ break; case WRD_SCREEN: /* Not supported */ break; case WRD_SCROLL: wrd_text_scroll (wrd_args[0], wrd_args[1], wrd_args[2], wrd_args[3], wrd_args[4], wrd_args[5], wrd_args[6]); #ifdef WRD_VERBOSE ctl->cmsg(CMSG_INFO, VERB_VERBOSE, "@SCROLL(%d,%d,%d,%d,%d,%d,%d)", wrd_args[0], wrd_args[1], wrd_args[2], wrd_args[3], wrd_args[4], wrd_args[5], wrd_args[6]); #endif break; case WRD_STARTUP: WrdWndReset (); inkey_flag = 0; #ifdef WRD_VERBOSE ctl->cmsg(CMSG_INFO, VERB_VERBOSE, "@STARTUP(%d)", wrd_args[0]); #endif esc_clearscreen(); break; case WRD_STOP: /* Never call */ break; case WRD_TCLS: { char fillbuf[1024]; { int left = wrd_args[0], right = wrd_args[2]; int top = wrd_args[1], bottom = wrd_args[3]; SEIKIX(left); SEIKIX(right); SEIKIY(top); SEIKIY(bottom); if(left>right) right = left; if(top>bottom) bottom = top; memset(fillbuf,wrd_args[5],right-left);/*X2-X1*/ fillbuf[right-left]=0; // borlandc_con_save_attr(); esc_characterattribute(wrd_args[4]); for(i=top;i<=bottom;i++)/*Y1 to Y2*/ { WrdWndGoto(left-1,i-1); putstring(fillbuf); } // borlandc_con_restore_attr(); } } break; case WRD_TON: wrd_text_ton ( wrd_args[0] ); ctl->cmsg(CMSG_INFO, VERB_VERBOSE, "@TON(%d)", wrd_args[0]); break; case WRD_WAIT: /* Never call */ break; case WRD_WMODE: /* Never call */ break; /* Ensyutsukun */ case WRD_eFONTM: print_ecmd("FONTM", wrd_args, 1); break; case WRD_eFONTP: print_ecmd("FONTP", wrd_args, 4); break; case WRD_eFONTR: print_ecmd("FONTR", wrd_args, 17); break; case WRD_eGSC: print_ecmd("GSC", wrd_args, 1); break; case WRD_eLINE: print_ecmd("LINE", wrd_args, 1); break; case WRD_ePAL: print_ecmd("PAL", wrd_args, 2); break; case WRD_eREGSAVE: print_ecmd("REGSAVE", wrd_args, 17); break; case WRD_eSCROLL: print_ecmd("SCROLL",wrd_args, 2); break; case WRD_eTEXTDOT: print_ecmd("TEXTDOT", wrd_args, 1); break; case WRD_eTMODE: print_ecmd("TMODE", wrd_args, 1); break; case WRD_eTSCRL: print_ecmd("TSCRL", wrd_args, 0); break; case WRD_eVCOPY: print_ecmd("VCOPY", wrd_args, 9); break; case WRD_eVSGET: print_ecmd("VSGE", wrd_args, 4); break; case WRD_eVSRES: print_ecmd("VSRES", wrd_args, 0); break; case WRD_eXCOPY: wrd_graphic_xcopy ( wrd_args[0], wrd_args[1], wrd_args[2], wrd_args[3], wrd_args[4], wrd_args[5], wrd_args[6], wrd_args[7], wrd_args[8], wrd_args[9], wrd_args[10], wrd_args[11], wrd_args[12], wrd_args[13] ); print_ecmd("XCOPY", wrd_args, 14); break; case WRD_START_SKIP: wrd_start_skip (); #ifdef WRD_VERBOSE ctl->cmsg(CMSG_INFO, VERB_VERBOSE, "WRD_START_SKIP"); #endif break; case WRD_END_SKIP: wrd_end_skip (); #ifdef WRD_VERBOSE ctl->cmsg(CMSG_INFO, VERB_VERBOSE, "WRD_END_SKIP"); #endif break; /* Extensionals */ } } TiMidity++-2.13.2/interface/w32g_subwin3.c0100644004711200001440000021530710020532712017235 0ustar tamukiusers/* TiMidity++ -- MIDI to WAVE converter and player Copyright (C) 1999-2002 Masanao Izumo Copyright (C) 1995 Tuukka Toivonen 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA w32g_subwin3.c: Written by Daisuke Aoki */ #ifdef HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ #include #include #include #include #ifndef NO_STRING_H #include #else #include #endif #include "timidity.h" #include "common.h" #include "instrum.h" #include "playmidi.h" #include "readmidi.h" #include "output.h" #include "controls.h" #include "tables.h" #include "miditrace.h" #include "reverb.h" #ifdef SUPPORT_SOUNDSPEC #include "soundspec.h" #endif /* SUPPORT_SOUNDSPEC */ #include "recache.h" #include "arc.h" #include "strtab.h" #include "mid.defs" #include "w32g.h" #include #include #include #include "w32g_res.h" #include "w32g_utl.h" #include "w32g_pref.h" #include "w32g_subwin.h" #include "w32g_ut2.h" #include "w32g_tracer.h" extern int gdi_lock_ex ( DWORD timeout ); #if 0 static int gdi_lock_result; #define GDI_LOCK_EX(timeout) ( \ ctl->cmsg(CMSG_INFO, VERB_VERBOSE, "GDI_LOCK_EX(%s: %d)", __FILE__, __LINE__ ), \ gdi_lock_result = gdi_lock_ex(timeout), \ ctl->cmsg(CMSG_INFO, VERB_VERBOSE, "GDI_LOCK_EX_RESULT(%d)", gdi_lock_result ), \ gdi_lock_result \ ) #define GDI_LOCK() { \ ctl->cmsg(CMSG_INFO, VERB_VERBOSE, "GDI_LOCK(%s: %d)", __FILE__, __LINE__ ); \ gdi_lock(); \ } #define GDI_UNLOCK() { \ ctl->cmsg(CMSG_INFO, VERB_VERBOSE, "GDI_UNLOCK(%s: %d)", __FILE__, __LINE__ ); \ gdi_unlock(); \ } #else #define GDI_LOCK() { gdi_lock(); } #define GDI_LOCK_EX(timeout) gdi_lock_ex(timeout) #define GDI_UNLOCK() { gdi_unlock(); } #endif #if defined(__CYGWIN32__) || defined(__MINGW32__) #ifndef TPM_TOPALIGN #define TPM_TOPALIGN 0x0000L #endif #endif extern void VprintfEditCtlWnd(HWND hwnd, char *fmt, va_list argList); extern void PrintfEditCtlWnd(HWND hwnd, char *fmt, ...); extern void PutsEditCtlWnd(HWND hwnd, char *str); extern void ClearEditCtlWnd(HWND hwnd); #define C_BACK RGB(0x00,0x00,0x00) // #define C_BAR_FORE RGB(0xFF,0xFF,0x00) #define C_BAR_FORE RGB(0xD0,0xD0,0x00) #define C_BAR_FORE2 RGB(0xD0,0xB0,0x00) #define C_BAR_BACK RGB(0xA0,0xA0,0xA0) #define C_BAR_LEFT RGB(0xD0,0xD0,0x00) #define C_BAR_RIGHT RGB(0x80,0xD0,0x40) #define C_TEXT_FORE RGB(0x00,0x00,0x00) #define C_TEXT_BACK RGB(0xC0,0xC0,0xC0) #define C_TEXT_BACK_DARK RGB(0x80,0x80,0x80) #define C_TEXT_BACK_VERY_DARK RGB(0x40,0x40,0x40) #define CVV_TYPE_NONE 0 #define CVV_TYPE_LEFT 1 // E #define CVV_TYPE_RIGHT 2 // E獶 #define CVV_TYPE_TOP 3 // ォ牺 #define CVV_TYPE_BOTTOM 4 // #define VEL_MAX 128*4 #define TWI_MODE_1_32CH 1 #define TWI_MODE_1_16CH 2 #define TWI_MODE_17_32CH 3 #define CTL_STATUS_UPDATE -98 extern ControlMode *ctl; #define CSV_LEFT 0 #define CSV_RIGHT 1 #define CSV_CENTER 2 static struct tracer_bmp_ { HBITMAP hbmp; HDC hmdc; RECT rc_volume; RECT rc_expression; RECT rc_pan; RECT rc_sustain; RECT rc_pitch_bend; RECT rc_mod_wheel; RECT rc_chorus_effect; RECT rc_reverb_effect; RECT rc_velocity[2]; RECT rc_notes; RECT rc_notes_sustain; RECT rc_notes_on; RECT rc_notes_mask[12]; RECT rc_note[12]; RECT rc_note_sustain[12]; RECT rc_note_on[12]; RECT rc_gm_on; RECT rc_gm_off; RECT rc_gs_on; RECT rc_gs_off; RECT rc_xg_on; RECT rc_xg_off; RECT rc_temper_keysig[32]; RECT rc_temper_type[8]; } tracer_bmp; static int get_head_rc ( RECT *rc, RECT *rc_base ); static int get_ch_rc ( int ch, RECT *rc, RECT *rc_base ); static int notes_view_draw ( RECT *lprc, int note, int vel, int back_draw, int lockflag ); #if 0 static int cheap_volume_view_draw ( RECT *lprc, int vol, int max, COLORREF fore, COLORREF back, int type, int lockflag ); #endif static int cheap_string_view_draw ( RECT *lprc, char *str, COLORREF fore, COLORREF back, int mode, int lockflag ); static int cheap_half_string_view_draw ( RECT *lprc, char *str, COLORREF fore, COLORREF back, int mode, int lockflag ); static int change_tracer_wnd_mode ( int mode ); static int init_tracer_bmp ( HDC hdc ); static int tracer_ch_number_draw(int ch, int mute, int lockflag); static int tracer_ch_program_draw ( int ch, int bank, int program, char *instrument, int mapID, int lockflag ); static int tracer_velocity_draw ( RECT *lprc, int vol, int max, int lockflag ); static int tracer_velocity_draw_ex ( RECT *lprc, int vol, int vol_old, int max, int lockflag ); static int tracer_volume_draw ( RECT *lprc, int vol, int max, int lockflag ); static int tracer_expression_draw ( RECT *lprc, int vol, int max, int lockflag ); static int tracer_pan_draw ( RECT *lprc, int vol, int max, int lockflag ); static int tracer_sustain_draw ( RECT *lprc, int vol, int lockflag ); static int tracer_pitch_bend_draw ( RECT *lprc, int vol, int max, int lockflag ); static int tracer_mod_wheel_draw ( RECT *lprc, int vol, int max, int lockflag ); static int tracer_chorus_effect_draw ( RECT *lprc, int vol, int max, int lockflag ); static int tracer_reverb_effect_draw ( RECT *lprc, int vol, int max, int lockflag ); static int tracer_temper_keysig_draw(RECT *lprc, int8 tk, int ko, int lockflag); static int tracer_temper_type_draw(RECT *lprc, int ch, int8 tt, int lockflag); static int tracer_gm_draw ( RECT *lprc, int flag, int lockflag ); static int tracer_gs_draw ( RECT *lprc, int flag, int lockflag ); static int tracer_xg_draw ( RECT *lprc, int flag, int lockflag ); static int notes_view_generate ( int lockflag ); // **************************************************************************** // lock #if 0 static int tracer_lock_result; #define TRACER_LOCK_EX(timeout) ( \ ctl->cmsg(CMSG_INFO, VERB_VERBOSE, "TRACER_LOCK_EX(%s: %d)", __FILE__, __LINE__ ), \ tracer_lock_result = tracer_lock_ex(timeout), \ ctl->cmsg(CMSG_INFO, VERB_VERBOSE, "TRACER_LOCK_EX_RESULT(%d)", tracer_lock_result ), \ tracer_wnd_lock_result \ ) #define TRACER_LOCK() { \ ctl->cmsg(CMSG_INFO, VERB_VERBOSE, "TRACER_LOCK(%s: %d)", __FILE__, __LINE__ ); \ tracer_wnd_lock(); \ } #define TRACER_UNLOCK() { \ ctl->cmsg(CMSG_INFO, VERB_VERBOSE, "TRACER_UNLOCK(%s: %d)", __FILE__, __LINE__ ); \ tracer_wnd_unlock(); \ } #else #define TRACER_LOCK() { tracer_wnd_lock(); } #define TRACER_LOCK_EX(timeout) tracer_wnd_lock_ex(timeout) #define TRACER_UNLOCK() { tracer_wnd_unlock(); } #endif static HANDLE volatile hMutexWrd = NULL; static BOOL tracer_wnd_lock_ex ( DWORD timeout ) { if ( hMutexWrd == NULL ) { hMutexWrd = CreateMutex ( NULL, FALSE, NULL ); if ( hMutexWrd == NULL ) return FALSE; } if ( WaitForSingleObject ( hMutexWrd, timeout )== WAIT_FAILED ) { return FALSE; } return TRUE; } static BOOL tracer_wnd_lock (void) { return tracer_wnd_lock_ex ( INFINITE ); } static void tracer_wnd_unlock (void) { ReleaseMutex ( hMutexWrd ); } // **************************************************************************** // Tracer Window TRACERWNDINFO TracerWndInfo; static int TracerWndInfoReset(HWND hwnd); static int TracerWndInfoApply(void); w32g_tracer_wnd_t w32g_tracer_wnd; BOOL SetTracerWndActive(void) { if ( IsWindowVisible(hTracerWnd) ) { w32g_tracer_wnd.active = TRUE; } else { w32g_tracer_wnd.active = FALSE; } return w32g_tracer_wnd.active; } BOOL CALLBACK TracerWndProc(HWND hwnd, UINT uMess, WPARAM wParam, LPARAM lParam); BOOL CALLBACK TracerCanvasWndProc(HWND hwnd, UINT uMess, WPARAM wParam, LPARAM lParam); void InitTracerWnd(HWND hParentWnd) { WNDCLASS wndclass ; int height, space; RECT rc, rc2; HICON hIcon; static int init = 1; if ( init ) { w32g_tracer_wnd.hNullBrush = GetStockObject ( NULL_BRUSH ); w32g_tracer_wnd.hNullPen = GetStockObject ( NULL_PEN ); init = 0; } if (hTracerWnd != NULL) { TRACER_LOCK(); DestroyWindow(hTracerWnd); hTracerWnd = NULL; DeleteObject ( (HGDIOBJ)w32g_tracer_wnd.hFontCommon ); DeleteObject ( (HGDIOBJ)w32g_tracer_wnd.hFontHalf ); DeleteDC ( w32g_tracer_wnd.hmdc ); TRACER_UNLOCK(); } w32g_tracer_wnd.active = FALSE; INILoadTracerWnd(); hTracerWnd = CreateDialog (hInst,MAKEINTRESOURCE(IDD_DIALOG_TRACER),hParentWnd,TracerWndProc); TracerWndInfoReset(hTracerWnd); ShowWindow(hTracerWnd,SW_HIDE); hIcon = LoadImage(hInst, MAKEINTRESOURCE(IDI_ICON_TIMIDITY), IMAGE_ICON, 16, 16, 0); if (hIcon!=NULL) SendMessage(hTracerWnd,WM_SETICON,FALSE,(LPARAM)hIcon); INILoadTracerWnd(); w32g_tracer_wnd.font_common_height = 14; w32g_tracer_wnd.font_common_width = 0; SetRect ( &w32g_tracer_wnd.rc_head, 1, 2, 0, 0 ); SetRect ( &w32g_tracer_wnd.rc_all_channels, 1, 20 + 2, 0, 0 ); w32g_tracer_wnd.width = 2 + 880 + 2; w32g_tracer_wnd.height = 1 + 19 + 1 + (19 + 1) * 32 + 1; w32g_tracer_wnd.ch_height = 19; w32g_tracer_wnd.ch_space = 1; height = w32g_tracer_wnd.ch_height; space = w32g_tracer_wnd.ch_space; #if 0 SetRect ( &w32g_tracer_wnd.rc_current_time, 2, 1, 80, height ); SetRect ( &w32g_tracer_wnd.rc_tempo, 82, 1, 160, height ); SetRect ( &w32g_tracer_wnd.rc_master_volume, 162, 1, 200, height / 2 - 1 ); SetRect ( &w32g_tracer_wnd.rc_maxvoices, 162, height / 2 + 1, 200, height ); #endif wndclass.style = CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS | CS_CLASSDC; wndclass.lpfnWndProc = TracerCanvasWndProc ; wndclass.cbClsExtra = 0 ; wndclass.cbWndExtra = 0 ; wndclass.hInstance = hInst ; wndclass.hIcon = NULL; wndclass.hCursor = LoadCursor(0,IDC_ARROW) ; wndclass.hbrBackground = w32g_tracer_wnd.hNullBrush; wndclass.lpszMenuName = NULL; wndclass.lpszClassName = "tracer canvas wnd"; RegisterClass(&wndclass); w32g_tracer_wnd.hwnd = CreateWindowEx(0,"tracer canvas wnd",0,WS_CHILD, CW_USEDEFAULT,0,w32g_tracer_wnd.width,w32g_tracer_wnd.height, hTracerWnd,0,hInst,0); w32g_tracer_wnd.hdc = GetDC(w32g_tracer_wnd.hwnd); TRACER_LOCK(); SelectObject ( w32g_tracer_wnd.hdc, w32g_tracer_wnd.hNullBrush ); SelectObject ( w32g_tracer_wnd.hdc, w32g_tracer_wnd.hNullPen ); w32g_tracer_wnd.hbitmap = CreateCompatibleBitmap(w32g_tracer_wnd.hdc,w32g_tracer_wnd.width,w32g_tracer_wnd.height); w32g_tracer_wnd.hmdc = CreateCompatibleDC(w32g_tracer_wnd.hdc); w32g_tracer_wnd.hgdiobj_hmdcprev = SelectObject(w32g_tracer_wnd.hmdc,w32g_tracer_wnd.hbitmap); SelectObject ( w32g_tracer_wnd.hmdc, w32g_tracer_wnd.hNullBrush ); SelectObject ( w32g_tracer_wnd.hmdc, w32g_tracer_wnd.hNullPen ); TRACER_UNLOCK(); init_tracer_bmp ( w32g_tracer_wnd.hdc ); ReleaseDC(w32g_tracer_wnd.hwnd,w32g_tracer_wnd.hdc); { char fontname[128]; if ( PlayerLanguage == LANGUAGE_JAPANESE ) strcpy(fontname,"lr o"); else { strcpy(fontname,"Arial"); w32g_tracer_wnd.font_common_height = 16; } w32g_tracer_wnd.hFontCommon = CreateFont(w32g_tracer_wnd.font_common_height,w32g_tracer_wnd.font_common_width,0,0,FW_DONTCARE,FALSE,FALSE,FALSE, DEFAULT_CHARSET,OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,ANTIALIASED_QUALITY, DEFAULT_PITCH | FF_MODERN ,fontname); w32g_tracer_wnd.hFontHalf = CreateFont(-10,0,0,0,FW_DONTCARE,FALSE,FALSE,FALSE, DEFAULT_CHARSET,OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,ANTIALIASED_QUALITY, DEFAULT_PITCH | FF_MODERN ,"Courier"); } TracerWndReset(); SetRect(&w32g_tracer_wnd.rc_channel_top, 1, 0, 20, height); SetRect(&w32g_tracer_wnd.rc_instrument, 21, 0, 179, height); SetRect(&w32g_tracer_wnd.rc_inst_map, 180, 0, 233, height); SetRect(&w32g_tracer_wnd.rc_bank, 234, 0, 264, height); SetRect(&w32g_tracer_wnd.rc_program, 265, 0, 295, height); SetRect(&w32g_tracer_wnd.rc_velocity, 296, 0, 326, height); SetRect(&w32g_tracer_wnd.rc_volume, 327, 0, 347, height / 2); SetRect(&w32g_tracer_wnd.rc_expression, 327, height / 2 + 1, 347, height); SetRect(&w32g_tracer_wnd.rc_panning, 348, 0, 368, height / 2); SetRect(&w32g_tracer_wnd.rc_sustain, 348, height / 2 + 1, 368, height); SetRect(&w32g_tracer_wnd.rc_pitch_bend, 369, 0, 389, height / 2); SetRect(&w32g_tracer_wnd.rc_mod_wheel, 369, height / 2 + 1, 389, height); SetRect(&w32g_tracer_wnd.rc_chorus_effect, 390, 0, 410, height / 2); SetRect(&w32g_tracer_wnd.rc_reverb_effect, 390, height / 2 + 1, 410, height); SetRect(&w32g_tracer_wnd.rc_temper_keysig, 411, 0, 444, height); SetRect(&w32g_tracer_wnd.rc_gm, 445, 0, 469, height); SetRect(&w32g_tracer_wnd.rc_gs, 470, 0, 494, height); SetRect(&w32g_tracer_wnd.rc_xg, 495, 0, 519, height); SetRect(&w32g_tracer_wnd.rc_head_rest, 520, 0, 890, height); SetRect(&w32g_tracer_wnd.rc_temper_type, 411, 0, 430, height); SetRect(&w32g_tracer_wnd.rc_notes, 431, 0, 890, height); GetWindowRect ( hTracerWnd, &rc ); GetClientRect ( hTracerWnd, &rc2 ); rc.left = rc.left; rc.top = rc.top; rc.right = (rc.right - rc.left) - (rc2.right - rc2.left) + w32g_tracer_wnd.width; rc.bottom = (rc.bottom - rc.top) - (rc2.bottom - rc2.top) + w32g_tracer_wnd.height; MoveWindow ( hTracerWnd, rc.left, rc.top, rc.right, rc.bottom, TRUE); MoveWindow(w32g_tracer_wnd.hwnd,0,0,w32g_tracer_wnd.width,w32g_tracer_wnd.height,TRUE); ShowWindow(w32g_tracer_wnd.hwnd,SW_SHOW); UpdateWindow(w32g_tracer_wnd.hwnd); UpdateWindow(hTracerWnd); INILoadTracerWnd(); TracerWndInfoApply(); } static int notes_view_generate ( int lockflag ) { int i; if ( lockflag ) TRACER_LOCK (); for(i=0;i<12;i++) { BitBlt ( tracer_bmp.hmdc, tracer_bmp.rc_note[i].left, tracer_bmp.rc_note[i].top, tracer_bmp.rc_note[i].right - tracer_bmp.rc_note[i].left, tracer_bmp.rc_note[i].bottom - tracer_bmp.rc_note[i].top, tracer_bmp.hmdc, tracer_bmp.rc_notes_mask[i].left, tracer_bmp.rc_notes_mask[i].top, SRCINVERT ); BitBlt ( tracer_bmp.hmdc, tracer_bmp.rc_note[i].left, tracer_bmp.rc_note[i].top, tracer_bmp.rc_note[i].right - tracer_bmp.rc_note[i].left, tracer_bmp.rc_note[i].bottom - tracer_bmp.rc_note[i].top, tracer_bmp.hmdc, tracer_bmp.rc_notes.left, tracer_bmp.rc_notes.top, SRCPAINT ); BitBlt ( tracer_bmp.hmdc, tracer_bmp.rc_note_on[i].left, tracer_bmp.rc_note_on[i].top, tracer_bmp.rc_note_on[i].right - tracer_bmp.rc_note_on[i].left, tracer_bmp.rc_note_on[i].bottom - tracer_bmp.rc_note_on[i].top, tracer_bmp.hmdc, tracer_bmp.rc_notes_mask[i].left, tracer_bmp.rc_notes_mask[i].top, SRCINVERT ); BitBlt ( tracer_bmp.hmdc, tracer_bmp.rc_note_on[i].left, tracer_bmp.rc_note_on[i].top, tracer_bmp.rc_note_on[i].right - tracer_bmp.rc_note_on[i].left, tracer_bmp.rc_note_on[i].bottom - tracer_bmp.rc_note_on[i].top, tracer_bmp.hmdc, tracer_bmp.rc_notes_on.left, tracer_bmp.rc_notes_on.top, SRCPAINT ); BitBlt ( tracer_bmp.hmdc, tracer_bmp.rc_note_sustain[i].left, tracer_bmp.rc_note_sustain[i].top, tracer_bmp.rc_note_sustain[i].right - tracer_bmp.rc_note_sustain[i].left, tracer_bmp.rc_note_sustain[i].bottom - tracer_bmp.rc_note_sustain[i].top, tracer_bmp.hmdc, tracer_bmp.rc_notes_mask[i].left, tracer_bmp.rc_notes_mask[i].top, SRCINVERT ); BitBlt ( tracer_bmp.hmdc, tracer_bmp.rc_note_sustain[i].left, tracer_bmp.rc_note_sustain[i].top, tracer_bmp.rc_note_sustain[i].right - tracer_bmp.rc_note_sustain[i].left, tracer_bmp.rc_note_sustain[i].bottom - tracer_bmp.rc_note_sustain[i].top, tracer_bmp.hmdc, tracer_bmp.rc_notes_sustain.left, tracer_bmp.rc_notes_sustain.top, SRCPAINT ); } if ( lockflag ) TRACER_UNLOCK (); return 0; } #define TRACER_BMP_SIZE_X 316 #define TRACER_BMP_SIZE_Y 269 #define TRACER_CANVAS_SIZE_X 316 #define TRACER_CANVAS_SIZE_Y 451 static int init_tracer_bmp ( HDC hdc ) { int i, j; static int init = 1; HBITMAP hbmp; HDC hmdc; if ( init ) { tracer_bmp.hbmp = NULL; tracer_bmp.hmdc = NULL; init = 0; } TRACER_LOCK (); if ( tracer_bmp.hmdc != NULL ) DeleteDC ( tracer_bmp.hmdc ); if ( tracer_bmp.hbmp != NULL ) DeleteObject ( (HGDIOBJ) tracer_bmp.hbmp ); tracer_bmp.hbmp = CreateCompatibleBitmap ( hdc, TRACER_CANVAS_SIZE_X, TRACER_CANVAS_SIZE_Y ); tracer_bmp.hmdc = CreateCompatibleDC ( hdc ); SelectObject ( tracer_bmp.hmdc, w32g_tracer_wnd.hNullBrush ); /* KvȂȂ */ SelectObject ( tracer_bmp.hmdc, w32g_tracer_wnd.hNullPen ); /* KvȂȂ */ SelectObject ( tracer_bmp.hmdc, tracer_bmp.hbmp ); hbmp = LoadBitmap ( hInst, MAKEINTRESOURCE(IDB_BITMAP_TRACER) ); hmdc = CreateCompatibleDC ( hdc ); SelectObject ( hmdc, hbmp ); BitBlt ( tracer_bmp.hmdc, 0, 0, TRACER_CANVAS_SIZE_X, TRACER_CANVAS_SIZE_Y, hmdc, 0, 0, WHITENESS ); BitBlt ( tracer_bmp.hmdc, 0, 0, TRACER_BMP_SIZE_X, TRACER_BMP_SIZE_Y, hmdc, 0, 0, SRCCOPY ); DeleteDC(hmdc); DeleteObject(hbmp); TRACER_UNLOCK (); SetRect ( &tracer_bmp.rc_volume, 8, 16, 28, 195 ); SetRect ( &tracer_bmp.rc_expression, 32, 16, 52, 195 ); SetRect ( &tracer_bmp.rc_pan, 56, 16, 76, 195 ); SetRect ( &tracer_bmp.rc_sustain, 80, 16, 100, 195 ); SetRect ( &tracer_bmp.rc_pitch_bend, 104, 16, 124, 195 ); SetRect ( &tracer_bmp.rc_mod_wheel, 128, 16, 148, 195 ); SetRect ( &tracer_bmp.rc_chorus_effect, 152, 16, 172, 195 ); SetRect ( &tracer_bmp.rc_reverb_effect, 176, 16, 196, 195 ); SetRect ( &tracer_bmp.rc_velocity[0], 200, 16, 230, 215 ); SetRect ( &tracer_bmp.rc_velocity[1], 231, 16, 261, 215 ); SetRect ( &tracer_bmp.rc_notes, 16, 59, 58, 78 ); SetRect ( &tracer_bmp.rc_notes_sustain, 202, 59, 244, 78 ); SetRect ( &tracer_bmp.rc_notes_on, 156, 59, 198, 78 ); for(i=0;i<6;i++) { SetRect ( &tracer_bmp.rc_notes_mask[i], 16 + i * 46, 107, 58 + i * 46, 126); SetRect ( &tracer_bmp.rc_note[i], 16 + i * 46, 271, 58 + i * 46, 290); SetRect ( &tracer_bmp.rc_note_on[i], 16 + i * 46, 319, 58 + i * 46, 338); SetRect ( &tracer_bmp.rc_note_sustain[i], 16 + i * 46, 367, 58 + i * 46, 386); } for(i=0;i<6;i++) { SetRect ( &tracer_bmp.rc_notes_mask[i + 6], 16 + i * 46, 131, 58 + i * 46, 150); SetRect ( &tracer_bmp.rc_note[i + 6], 16 + i * 46, 295, 58 + i * 46, 314); SetRect ( &tracer_bmp.rc_note_on[i + 6], 16 + i * 46, 343, 58 + i * 46, 362); SetRect ( &tracer_bmp.rc_note_sustain[i + 6], 16 + i * 46, 391, 58 + i * 46, 410); } notes_view_generate(TRUE); SetRect ( &tracer_bmp.rc_gm_on, 64, 59, 88, 78 ); SetRect ( &tracer_bmp.rc_gm_off, 64, 83, 88, 102 ); SetRect ( &tracer_bmp.rc_gs_on, 96, 59, 120, 78 ); SetRect ( &tracer_bmp.rc_gs_off, 96, 83, 120, 102 ); SetRect ( &tracer_bmp.rc_xg_on, 128, 59, 152, 78 ); SetRect ( &tracer_bmp.rc_xg_off, 128, 83, 152, 102 ); for (i = 0; i < 4; i++) for (j = 0; j < 8; j++) SetRect(&tracer_bmp.rc_temper_keysig[i * 8 + j], 16 + j * 37, 155 + i * 23, 49 + j * 37, 174 + i * 23); for (i = 0; i < 8; i++) SetRect(&tracer_bmp.rc_temper_type[i], 16 + i * 23, 247, 35 + i * 23, 266); return 0; } void TracerWndReset(void) { int i, j; strcpy ( w32g_tracer_wnd.titlename, "" ); strcpy ( w32g_tracer_wnd.filename, "" ); #if 0 sprintf ( w32g_tracer_wnd.current_time, "00:00:00" ); w32g_tracer_wnd.current_time_sec = 0; w32g_tracer_wnd.tempo = 0; w32g_tracer_wnd.master_volume = 0; w32g_tracer_wnd.maxvoices = 0; #endif for ( i = 0; i < TRACER_CHANNELS; i ++ ) { strcpy ( w32g_tracer_wnd.instrument[i]," ----" ); w32g_tracer_wnd.mapID[i] = INST_NO_MAP; w32g_tracer_wnd.bank[i] = 0; w32g_tracer_wnd.program[i] = 0; w32g_tracer_wnd.velocity[i] = 0; w32g_tracer_wnd.volume[i] = 0; w32g_tracer_wnd.expression[i] = 0; w32g_tracer_wnd.panning[i] = 64; w32g_tracer_wnd.sustain[i] = 0; w32g_tracer_wnd.pitch_bend[i] = 0x2000; w32g_tracer_wnd.mod_wheel[i] = 0; w32g_tracer_wnd.chorus_effect[i] = 0; w32g_tracer_wnd.reverb_effect[i] = 0; w32g_tracer_wnd.tt[i] = 0; for ( j = 0; j < 256; j ++ ) { w32g_tracer_wnd.notes[i][j] = -1; } } w32g_tracer_wnd.play_system_mode = play_system_mode; w32g_tracer_wnd.quietchannels = quietchannels; w32g_tracer_wnd.channel_mute = channel_mute; InvalidateRect(w32g_tracer_wnd.hwnd,NULL, FALSE); } void TracerWndReset2(void) { int i, j; for ( i = 0; i < TRACER_CHANNELS; i ++ ) { w32g_tracer_wnd.velocity[i] = 0; for ( j = 0; j < 128; j ++ ) { w32g_tracer_wnd.notes[i][j] = -1; } } TRACER_LOCK(); for ( i = 0; i < TRACER_CHANNELS; i ++ ) { for ( j = 0; j < 128; j ++ ) { RECT rc; if ( get_ch_rc ( i, &rc, &w32g_tracer_wnd.rc_notes ) == 0 ) notes_view_draw ( &rc, j, w32g_tracer_wnd.notes[i][j], TRUE, FALSE ); } } TRACER_UNLOCK(); } // ʏ void TracerWndClear(int lockflag) { HPEN hPen; HBRUSH hBrush; HGDIOBJ hgdiobj_hpen, hgdiobj_hbrush; RECT rc; if ( lockflag ) TRACER_LOCK(); hPen = CreatePen(PS_SOLID,1,C_BACK); hBrush = CreateSolidBrush(C_BACK); hgdiobj_hpen = SelectObject(w32g_tracer_wnd.hmdc, hPen); hgdiobj_hbrush = SelectObject(w32g_tracer_wnd.hmdc, hBrush); GetClientRect(w32g_tracer_wnd.hwnd,&rc); Rectangle(w32g_tracer_wnd.hmdc,rc.left,rc.top,rc.right,rc.bottom); InvalidateRect( w32g_tracer_wnd.hwnd, NULL, FALSE ); SelectObject(w32g_tracer_wnd.hmdc, hgdiobj_hpen); DeleteObject(hPen); SelectObject(w32g_tracer_wnd.hmdc, hgdiobj_hbrush); DeleteObject(hBrush); if ( lockflag ) TRACER_UNLOCK(); } #define TRACER_VOICE_OFF -1 #define TRACER_VOICE_SUSTAINED -2 void w32_tracer_ctl_event(CtlEvent *e) { RECT rc; int v1, v2; switch ( e->type ) { case CTLE_NOW_LOADING: { char * title; TracerWndReset (); TracerWndPaintAll (TRUE); strncpy ( w32g_tracer_wnd.filename, (char *)e->v1, 1000 ); w32g_tracer_wnd.filename[1000] = '\0'; title = get_midi_title(w32g_tracer_wnd.filename); if ( title == NULL ) title = w32g_tracer_wnd.filename; strcpy ( w32g_tracer_wnd.titlename, " " ); strncat ( w32g_tracer_wnd.titlename, title, 1000 ); w32g_tracer_wnd.titlename[1000] = '\0'; get_head_rc ( &rc, &w32g_tracer_wnd.rc_head_rest ); cheap_string_view_draw ( &rc, w32g_tracer_wnd.titlename, C_TEXT_FORE, C_TEXT_BACK, CSV_LEFT, TRUE ); } break; case CTLE_LOADING_DONE: break; case CTLE_PLAY_START: #if 0 { int i; for ( i = 0; i < TRACER_CHANNELS; i++ ) { // tracer_ch_program_draw ( i, -1, -1, (char *)-1, -1 ); w32g_tracer_wnd.volume[i] = channel[i].volume; w32g_tracer_wnd.expression[i] = channel[i].expression; w32g_tracer_wnd.panning[i] = channel[i].panning; w32g_tracer_wnd.sustain[i] = channel[i].sustain; w32g_tracer_wnd.pitch_bend[i] = channel[i].pitchbend; w32g_tracer_wnd.mod_wheel[i] = channel[i].mod.val; w32g_tracer_wnd.chorus_effect[i] = channel[i].chorus_level; w32g_tracer_wnd.reverb_effect[i] = channel[i].reverb_level; } #endif break; case CTLE_PLAY_END: break; case CTLE_TEMPO: #if 0 { char buff[64]; w32g_tracer_wnd.tempo = (int)e->v1; sprintf ( buff, "%08ld", w32g_tracer_wnd.current_time); cheap_string_view_draw ( &w32g_tracer_wnd.rc_tempo, buff, C_TEXT_FORE, C_TEXT_BACK, CSV_CENTER, TRUE ); } #endif break; case CTLE_METRONOME: break; case CTLE_CURRENT_TIME: #if 0 { int sec, min, hour; if(midi_trace.flush_flag) return; if(ctl->trace_playing) sec = (int)e->v1; else { sec = current_trace_samples(); if(sec < 0) sec = (int)e->v1; else sec = sec / play_mode->rate; } min = sec / 60; sec %= 60; hour = min / 60; min %= 60; sprintf ( w32g_tracer_wnd.current_time, "%02d:%02d:%02d", hour, min, sec ); w32g_tracer_wnd.current_time_sec = sec; cheap_string_view_draw ( &w32g_tracer_wnd.rc_current_time, w32g_tracer_wnd.current_time, C_TEXT_FORE, C_TEXT_BACK, CSV_CENTER, TRUE ); cheap_volume_view_draw ( &w32g_tracer_wnd.rc_maxvoices, (int)e->v2, voices, C_BAR_FORE, C_BAR_BACK, CVV_TYPE_LEFT, TRUE ); } #endif break; case CTLE_NOTE: { int vel = 0, vel_old = w32g_tracer_wnd.velocity[(int)e->v2]; switch ( (int)e->v1 ) { case VOICE_ON: w32g_tracer_wnd.velocity[(int)e->v2] += (int)e->v4; break; case VOICE_SUSTAINED: vel = TRACER_VOICE_SUSTAINED; break; case VOICE_DIE: case VOICE_FREE: case VOICE_OFF: w32g_tracer_wnd.velocity[(int)e->v2] -= (int)e->v4; vel = TRACER_VOICE_OFF; break; } if ( w32g_tracer_wnd.velocity[(int)e->v2] < 0 ) w32g_tracer_wnd.velocity[(int)e->v2] = 0; if ( get_ch_rc ( (int)e->v2, &rc, &w32g_tracer_wnd.rc_notes ) == 0 ) notes_view_draw ( &rc, (int)e->v3, vel, FALSE, TRUE ); w32g_tracer_wnd.notes[(int)e->v2][(int)e->v3] = vel; if ( get_ch_rc ( (int)e->v2, &rc, &w32g_tracer_wnd.rc_velocity ) == 0 ) tracer_velocity_draw_ex ( &rc, w32g_tracer_wnd.velocity[(int)e->v2], vel_old, VEL_MAX, TRUE ); } break; case CTLE_MASTER_VOLUME: // ctl_master_volume((int)e->v1); #if 0 w32g_tracer_wnd.master_volume = (int)e->v1; cheap_volume_view_draw ( &w32g_tracer_wnd.rc_master_volume, w32g_tracer_wnd.master_volume, 256, C_BAR_FORE, C_BAR_BACK, CVV_TYPE_LEFT, TRUE ); #endif break; case CTLE_MUTE: tracer_ch_number_draw((int) e->v1, (int) e->v2, TRUE); break; case CTLE_PROGRAM: v1 = (int)e->v1; v2 = (int)e->v2; tracer_ch_program_draw ( v1, -1, v2, (char *)e->v3, -1, TRUE ); break; case CTLE_DRUMPART: break; case CTLE_VOLUME: v1 = (int)e->v1; v2 = (int)e->v2; if ( w32g_tracer_wnd.volume[v1] != v2 ) if ( get_ch_rc ( v1, &rc, &w32g_tracer_wnd.rc_volume ) == 0 ) tracer_volume_draw ( &rc, v2, 128, TRUE ); w32g_tracer_wnd.volume[v1] = v2; break; case CTLE_EXPRESSION: v1 = (int)e->v1; v2 = (int)e->v2; if ( w32g_tracer_wnd.expression[v1] != v2 ) if ( get_ch_rc ( v1, &rc, &w32g_tracer_wnd.rc_expression ) == 0 ) tracer_expression_draw ( &rc, v2, 128, TRUE ); w32g_tracer_wnd.expression[v1] = v2; break; case CTLE_PANNING: v1 = (int)e->v1; v2 = (int)e->v2; if ( w32g_tracer_wnd.panning[v1] != v2 ) if ( get_ch_rc ( v1, &rc, &w32g_tracer_wnd.rc_panning ) == 0 ) tracer_pan_draw ( &rc, v2, 128, TRUE ); w32g_tracer_wnd.panning[v1] = v2; break; case CTLE_SUSTAIN: v1 = (int)e->v1; v2 = (int)e->v2; if ( w32g_tracer_wnd.sustain[v1] != v2 ) if ( get_ch_rc ( v1, &rc, &w32g_tracer_wnd.rc_sustain ) == 0 ) tracer_sustain_draw ( &rc, v2, TRUE ); w32g_tracer_wnd.sustain[v1] = v2; break; case CTLE_PITCH_BEND: v1 = (int)e->v1; v2 = (int)e->v2; if ( w32g_tracer_wnd.pitch_bend[v1] != v2 ) if ( get_ch_rc ( v1, &rc, &w32g_tracer_wnd.rc_pitch_bend ) == 0 ) tracer_pitch_bend_draw ( &rc, v2, 0x4000, TRUE ); w32g_tracer_wnd.pitch_bend[v1] = v2; break; case CTLE_MOD_WHEEL: v1 = (int)e->v1; v2 = (int)e->v2; if ( w32g_tracer_wnd.mod_wheel[v1] != v2 ) if ( get_ch_rc ( v1, &rc, &w32g_tracer_wnd.rc_mod_wheel ) == 0 ) tracer_mod_wheel_draw ( &rc, v2, 32, TRUE ); w32g_tracer_wnd.mod_wheel[v1] = v2; break; case CTLE_CHORUS_EFFECT: v1 = (int)e->v1; v2 = (int)e->v2; if ( w32g_tracer_wnd.chorus_effect[v1] != v2 ) if ( get_ch_rc ( v1, &rc, &w32g_tracer_wnd.rc_chorus_effect ) == 0 ) tracer_chorus_effect_draw ( &rc, v2, 128, TRUE ); w32g_tracer_wnd.chorus_effect[v1] = v2; break; case CTLE_REVERB_EFFECT: v1 = (int)e->v1; v2 = (int)e->v2; if ( w32g_tracer_wnd.reverb_effect[v1] != v2 ) if ( get_ch_rc ( v1, &rc, &w32g_tracer_wnd.rc_reverb_effect ) == 0 ) tracer_reverb_effect_draw ( &rc, v2, 128, TRUE ); w32g_tracer_wnd.reverb_effect[v1] = v2; break; case CTLE_KEY_OFFSET: get_head_rc(&rc, &w32g_tracer_wnd.rc_temper_keysig); tracer_temper_keysig_draw(&rc, CTL_STATUS_UPDATE, (int) e->v1, TRUE); break; case CTLE_TEMPER_KEYSIG: get_head_rc(&rc, &w32g_tracer_wnd.rc_temper_keysig); tracer_temper_keysig_draw(&rc, (int8) e->v1, CTL_STATUS_UPDATE, TRUE); break; case CTLE_TEMPER_TYPE: if (! get_ch_rc((int) e->v1, &rc, &w32g_tracer_wnd.rc_temper_type)) tracer_temper_type_draw(&rc, (int) e->v1, (int8) e->v2, TRUE); break; case CTLE_LYRIC: break; case CTLE_REFRESH: break; case CTLE_RESET: TracerWndReset2(); #if 0 if ( w32g_tracer_wnd.play_system_mode != play_system_mode ) { #endif get_head_rc ( &rc, &w32g_tracer_wnd.rc_gm ); tracer_gm_draw ( &rc, play_system_mode == GM_SYSTEM_MODE ? 1 : 0, TRUE ); get_head_rc ( &rc, &w32g_tracer_wnd.rc_gs ); tracer_gs_draw ( &rc, play_system_mode == GS_SYSTEM_MODE ? 1 : 0, TRUE ); get_head_rc ( &rc, &w32g_tracer_wnd.rc_xg ); tracer_xg_draw ( &rc, play_system_mode == XG_SYSTEM_MODE ? 1 : 0, TRUE ); #if 0 } #endif w32g_tracer_wnd.play_system_mode = play_system_mode; break; case CTLE_SPEANA: break; case CTLE_PAUSE: break; case CTLE_MAXVOICES: #if 0 w32g_tracer_wnd.maxvoices = (int)e->v1; #endif break; case CTLE_GSLCD: break; } } static int get_head_rc ( RECT *rc, RECT *rc_base ) { rc->top = w32g_tracer_wnd.rc_head.top + rc_base->top; rc->bottom = w32g_tracer_wnd.rc_head.top + rc_base->bottom; rc->left = w32g_tracer_wnd.rc_head.left + rc_base->left; rc->right = w32g_tracer_wnd.rc_head.left + rc_base->right; return 0; } static int get_ch_rc ( int ch, RECT *rc, RECT *rc_base ) { switch (TracerWndInfo.mode) { default: case TWI_MODE_1_32CH: break; case TWI_MODE_1_16CH: if ( ch >= 16 ) return -1; break; case TWI_MODE_17_32CH: if ( ch < 16 ) return -1; ch = ch - 16; break; } rc->top = w32g_tracer_wnd.rc_all_channels.top + rc_base->top + ( w32g_tracer_wnd.ch_height + w32g_tracer_wnd.ch_space ) * ( ch - 0 ); rc->bottom = w32g_tracer_wnd.rc_all_channels.top + rc_base->bottom + ( w32g_tracer_wnd.ch_height + w32g_tracer_wnd.ch_space ) * ( ch - 0 ); rc->left = w32g_tracer_wnd.rc_all_channels.left + rc_base->left; rc->right = w32g_tracer_wnd.rc_all_channels.left + rc_base->right; return 0; } static int notes_view_draw ( RECT *lprc, int note, int vel, int back_draw, int lockflag ) { HDC hdc = w32g_tracer_wnd.hmdc; RECT rc1; int note1, left, top; if (!w32g_tracer_wnd.active) return 0; note1 = note / 12; left = rc1.left = lprc->left + 6 * 7 * note1 + 0; top = rc1.top = lprc->top + 0; rc1.right = lprc->left + 6 * 7 * (note1 + 1) - 0; rc1.bottom = lprc->top + 19 + 1; if ( back_draw ) { if ( lockflag ) TRACER_LOCK (); BitBlt ( hdc, rc1.left, rc1.top, rc1.right - rc1.left, rc1.bottom - rc1.top, tracer_bmp.hmdc, tracer_bmp.rc_notes.left, tracer_bmp.rc_notes.top, SRCCOPY ); if ( lockflag ) TRACER_UNLOCK (); InvalidateRect ( w32g_tracer_wnd.hwnd, &rc1, FALSE ); } note = note % 12; switch(note) { // white keys case 0: left = 0; rc1.right = rc1.left + 7; break; case 2: rc1.left += left = 6; rc1.right = rc1.left + 7; break; case 4: rc1.left += left = 12; rc1.right = rc1.left + 7; break; case 5: rc1.left += left = 18; rc1.right = rc1.left + 7; break; case 7: rc1.left += left = 24; rc1.right = rc1.left + 7; break; case 9: rc1.left += left = 30; rc1.right = rc1.left + 7; break; case 11: rc1.left += left = 36; rc1.right = rc1.left + 6; break; // black keys case 1: rc1.left += left = 4; rc1.right = rc1.left + 5; break; case 3: rc1.left += left = 10; rc1.right = rc1.left + 5; break; case 6: rc1.left += left = 22; rc1.right = rc1.left + 5; break; case 8: rc1.left += left = 28; rc1.right = rc1.left + 5; break; case 10: rc1.left += left = 34; rc1.right = rc1.left + 5; break; default: break; } if ( lockflag ) TRACER_LOCK (); if ( vel >= 0 ) { BitBlt ( hdc, rc1.left, rc1.top, rc1.right - rc1.left, rc1.bottom - rc1.top, tracer_bmp.hmdc, tracer_bmp.rc_notes_mask[note].left + left, tracer_bmp.rc_notes_mask[note].top, SRCPAINT ); BitBlt ( hdc, rc1.left, rc1.top, rc1.right - rc1.left, rc1.bottom - rc1.top, tracer_bmp.hmdc, tracer_bmp.rc_note_on[note].left + left, tracer_bmp.rc_note_on[note].top, SRCAND ); } else if ( vel == TRACER_VOICE_SUSTAINED ) { BitBlt ( hdc, rc1.left, rc1.top, rc1.right - rc1.left, rc1.bottom - rc1.top, tracer_bmp.hmdc, tracer_bmp.rc_notes_mask[note].left + left, tracer_bmp.rc_notes_mask[note].top, SRCPAINT ); BitBlt ( hdc, rc1.left, rc1.top, rc1.right - rc1.left, rc1.bottom - rc1.top, tracer_bmp.hmdc, tracer_bmp.rc_note_sustain[note].left + left, tracer_bmp.rc_note_sustain[note].top, SRCAND ); } else { BitBlt ( hdc, rc1.left, rc1.top, rc1.right - rc1.left, rc1.bottom - rc1.top, tracer_bmp.hmdc, tracer_bmp.rc_notes_mask[note].left + left, tracer_bmp.rc_notes_mask[note].top, SRCPAINT ); BitBlt ( hdc, rc1.left, rc1.top, rc1.right - rc1.left, rc1.bottom - rc1.top, tracer_bmp.hmdc, tracer_bmp.rc_note[note].left + left, tracer_bmp.rc_note[note].top, SRCAND ); } if ( lockflag ) TRACER_UNLOCK (); InvalidateRect ( w32g_tracer_wnd.hwnd, &rc1, FALSE ); return 0; } static int tracer_ch_number_draw(int ch, int mute, int lockflag) { RECT rc; char buff[3]; if (mute != CTL_STATUS_UPDATE) { if (((IS_SET_CHANNELMASK( w32g_tracer_wnd.channel_mute, ch)) ? 1 : 0) == mute) return 0; if (mute) SET_CHANNELMASK(w32g_tracer_wnd.channel_mute, ch); else UNSET_CHANNELMASK(w32g_tracer_wnd.channel_mute, ch); } else mute = (IS_SET_CHANNELMASK( w32g_tracer_wnd.channel_mute, ch)) ? 1 : 0; if (IS_SET_CHANNELMASK(w32g_tracer_wnd.quietchannels, ch)) return 0; if (get_ch_rc(ch, &rc, &w32g_tracer_wnd.rc_channel_top) == 0) { sprintf(buff, "%02d", ch + 1); cheap_string_view_draw(&rc, buff, C_TEXT_FORE, (mute) ? C_TEXT_BACK_DARK : C_TEXT_BACK, CSV_CENTER, lockflag); } return 0; } static int tracer_ch_program_draw ( int ch, int bank, int program, char *instrument, int mapID, int lockflag ) { RECT rc; char buff[64]; char *p_buff; if ( bank >= 0 ) { w32g_tracer_wnd.bank[ch] = bank; } else { if ( ISDRUMCHANNEL(ch) ) bank = w32g_tracer_wnd.bank[ch] = 128; else bank = w32g_tracer_wnd.bank[ch] = channel[ch].bank; } if ( bank == 128 ) { if ( get_ch_rc ( ch, &rc, &w32g_tracer_wnd.rc_bank ) == 0 ) { sprintf ( buff, "drum"); cheap_string_view_draw ( &rc, buff, C_TEXT_FORE, C_TEXT_BACK, CSV_CENTER, lockflag ); } } else { if ( get_ch_rc ( ch, &rc, &w32g_tracer_wnd.rc_bank ) == 0 ) { sprintf ( buff, "%03d", bank ); cheap_string_view_draw ( &rc, buff, C_TEXT_FORE, C_TEXT_BACK, CSV_CENTER, lockflag ); } } if ( program >= 0 ) { w32g_tracer_wnd.program[ch] = program; } else { program = w32g_tracer_wnd.program[ch] = channel[ch].program; } if ( get_ch_rc ( ch, &rc, &w32g_tracer_wnd.rc_program ) == 0 ) { sprintf ( buff, "%03d", program ); cheap_string_view_draw ( &rc, buff, C_TEXT_FORE, C_TEXT_BACK, CSV_CENTER, lockflag ); } if ( instrument == NULL ) {instrument = " ----";} strncpy ( w32g_tracer_wnd.instrument[ch], (char *)instrument, 250 ); w32g_tracer_wnd.instrument[ch][250] = '\0'; if ( w32g_tracer_wnd.instrument[ch][0] != ' ' ) { char buff[255]; strncpy ( buff, w32g_tracer_wnd.instrument[ch], 250 ); buff[250] = '\0'; w32g_tracer_wnd.instrument[ch][0] = ' '; w32g_tracer_wnd.instrument[ch][1] = '\0'; strcat ( w32g_tracer_wnd.instrument[ch], buff ); } if ( get_ch_rc ( ch, &rc, &w32g_tracer_wnd.rc_instrument ) == 0 ) cheap_string_view_draw ( &rc, w32g_tracer_wnd.instrument[ch], C_TEXT_FORE, C_TEXT_BACK, CSV_LEFT, lockflag ); if ( mapID >= 0 ) { w32g_tracer_wnd.mapID[ch] = mapID; } else { mapID = w32g_tracer_wnd.mapID[ch] = channel[ch].mapID; } switch ( mapID ) { default: case INST_NO_MAP: case NUM_INST_MAP: p_buff = "----"; break; case SC_55_TONE_MAP: p_buff = "55 T"; break; case SC_55_DRUM_MAP: p_buff = "55 D"; break; case SC_88_TONE_MAP: p_buff = "88 T"; break; case SC_88_DRUM_MAP: p_buff = "88 D"; break; case SC_88PRO_TONE_MAP: p_buff = "88Pro T"; break; case SC_88PRO_DRUM_MAP: p_buff = "88Pro D"; break; case SC_8850_TONE_MAP: p_buff = "8850 T"; break; case SC_8850_DRUM_MAP: p_buff = "8850 D"; break; case XG_NORMAL_MAP: p_buff = "XG"; break; case XG_SFX64_MAP: p_buff = "XG SFX64"; break; case XG_SFX126_MAP: p_buff = "XG SFX126"; break; case XG_DRUM_MAP: p_buff = "XG D"; break; case GM2_TONE_MAP: p_buff = "GM2 T"; break; case GM2_DRUM_MAP: p_buff = "GM2 D"; } if ( get_ch_rc ( ch, &rc, &w32g_tracer_wnd.rc_inst_map ) == 0 ) cheap_string_view_draw ( &rc, p_buff, C_TEXT_FORE, C_TEXT_BACK, CSV_CENTER, lockflag ); return 0; } static int effect_view_border_draw ( RECT *lprc, int lockflag) { HDC hdc; COLORREF base = RGB(128, 128, 128); HPEN hPen1 = NULL; HPEN hPen3 = NULL; HPEN hOldPen = NULL; if ( !w32g_tracer_wnd.active ) return 0; hdc = w32g_tracer_wnd.hmdc; hPen1 = CreatePen(PS_SOLID, 1, base); hPen3 = CreatePen(PS_SOLID, 1, base); if ( lockflag ) TRACER_LOCK (); hOldPen= (HPEN)SelectObject(hdc,GetStockObject(NULL_PEN)); // E SelectObject(hdc, hPen3); MoveToEx(hdc, lprc->right, lprc->top - 1, NULL); LineTo(hdc, lprc->right, lprc->bottom + 1); // SelectObject(hdc, hPen1); MoveToEx(hdc, lprc->left - 1, lprc->bottom, NULL); LineTo(hdc, lprc->right + 1, lprc->bottom); SelectObject(hdc, hOldPen); if ( lockflag ) TRACER_UNLOCK (); DeleteObject (hPen1); DeleteObject (hPen3); return 0; } static int tracer_velocity_draw ( RECT *lprc, int vol, int max, int lockflag ) { return tracer_velocity_draw_ex ( lprc, vol, -1, max, lockflag ); } static int tracer_velocity_draw_ex ( RECT *lprc, int vol, int vol_old, int max, int lockflag ) { HDC hdc; const int view_max = 30, div = 17; RECT rc; if ( !w32g_tracer_wnd.active ) return 0; hdc = w32g_tracer_wnd.hmdc; vol /= div; if ( vol_old < 0 ) vol_old = max; vol_old /= div; if(vol >= view_max) {vol = view_max;} if(vol_old >= view_max) {vol_old = view_max;} if ( lockflag ) TRACER_LOCK (); // KvȂxVeBo[̔wi` // BitBlt ( hdc, lprc->left + vol, lprc->top, lprc->right - lprc->left - vol, lprc->bottom - lprc->top, BitBlt ( hdc, lprc->left + vol, lprc->top, vol_old - vol, lprc->bottom - lprc->top, tracer_bmp.hmdc, tracer_bmp.rc_velocity[0].left + vol, tracer_bmp.rc_velocity[0].top, SRCCOPY ); // KvȂxVeBo[` BitBlt ( hdc, lprc->left, lprc->top, vol, lprc->bottom - lprc->top, tracer_bmp.hmdc, tracer_bmp.rc_velocity[0].left, tracer_bmp.rc_velocity[0].top + 19 + 1, SRCCOPY ); SetRect ( &rc, lprc->left, lprc->top, lprc->left + (( vol_old > vol ) ? vol_old : vol), lprc->bottom); effect_view_border_draw (lprc, lockflag); InvalidateRect ( w32g_tracer_wnd.hwnd, &rc, FALSE ); if ( lockflag ) TRACER_UNLOCK (); return 0; } static int tracer_volume_draw ( RECT *lprc, int vol, int max, int lockflag ) { HDC hdc; const int view_max = 20, div = 7; if ( !w32g_tracer_wnd.active ) return 0; hdc = w32g_tracer_wnd.hmdc; vol /= div; if(vol >= view_max) {vol = view_max;} if ( lockflag ) TRACER_LOCK (); // KvȂwi` BitBlt ( hdc, lprc->left + vol, lprc->top, lprc->right - lprc->left - vol, lprc->bottom - lprc->top, tracer_bmp.hmdc, tracer_bmp.rc_volume.left, tracer_bmp.rc_volume.top, SRCCOPY ); // KvȂ` BitBlt ( hdc, lprc->left, lprc->top, vol, lprc->bottom - lprc->top, tracer_bmp.hmdc, tracer_bmp.rc_volume.left, tracer_bmp.rc_volume.top + 9 + 1, SRCCOPY ); if ( lockflag ) TRACER_UNLOCK (); effect_view_border_draw (lprc, lockflag); InvalidateRect ( w32g_tracer_wnd.hwnd, lprc, FALSE ); return 0; } static int tracer_expression_draw ( RECT *lprc, int vol, int max, int lockflag ) { HDC hdc; const int view_max = 20, div = 7; if ( !w32g_tracer_wnd.active ) return 0; hdc = w32g_tracer_wnd.hmdc; vol /= div; if(vol >= view_max) {vol = view_max;} if ( lockflag ) TRACER_LOCK (); // KvȂwi` BitBlt ( hdc, lprc->left + vol, lprc->top, lprc->right - lprc->left - vol, lprc->bottom - lprc->top, tracer_bmp.hmdc, tracer_bmp.rc_expression.left, tracer_bmp.rc_expression.top, SRCCOPY ); // KvȂ` BitBlt ( hdc, lprc->left, lprc->top, vol, lprc->bottom - lprc->top, tracer_bmp.hmdc, tracer_bmp.rc_expression.left, tracer_bmp.rc_expression.top + 9 + 1, SRCCOPY ); if ( lockflag ) TRACER_UNLOCK (); effect_view_border_draw (lprc, lockflag); InvalidateRect ( w32g_tracer_wnd.hwnd, lprc, FALSE ); return 0; } static int tracer_pan_draw ( RECT *lprc, int vol, int max, int lockflag ) { HDC hdc; const int view_max = 10, div = 7; if ( !w32g_tracer_wnd.active ) return 0; hdc = w32g_tracer_wnd.hmdc; vol = (vol - 64) / div; if(vol > view_max) {vol = view_max;} else if(vol < -view_max) {vol = -view_max;} if ( lockflag ) TRACER_LOCK (); // wi` BitBlt ( hdc, lprc->left, lprc->top, lprc->right - lprc->left, lprc->bottom - lprc->top, tracer_bmp.hmdc, tracer_bmp.rc_pan.left, tracer_bmp.rc_pan.top, SRCCOPY ); // ȉ2‚̓]ł͖ʂȕ]Ă̂ŁA܂ΏȂB // }XN` BitBlt ( hdc, lprc->left + vol, lprc->top, lprc->right - lprc->left, lprc->bottom - lprc->top, tracer_bmp.hmdc, tracer_bmp.rc_pan.left, tracer_bmp.rc_pan.top + (9 + 1) * 2, SRCPAINT ); // ‚܂݂` BitBlt ( hdc, lprc->left + vol, lprc->top, lprc->right - lprc->left, lprc->bottom - lprc->top, tracer_bmp.hmdc, tracer_bmp.rc_pan.left, tracer_bmp.rc_pan.top + 9 + 1, SRCAND ); if ( lockflag ) TRACER_UNLOCK (); effect_view_border_draw (lprc, lockflag); InvalidateRect ( w32g_tracer_wnd.hwnd, lprc, FALSE ); return 0; } static int tracer_sustain_draw ( RECT *lprc, int vol, int lockflag ) { HDC hdc; const int view_max = 20, div = 6; if ( !w32g_tracer_wnd.active ) return 0; hdc = w32g_tracer_wnd.hmdc; vol /= div; if(vol >= view_max) {vol = view_max;} if ( lockflag ) TRACER_LOCK (); // KvȂwi` BitBlt ( hdc, lprc->left + vol, lprc->top, lprc->right - lprc->left - vol, lprc->bottom - lprc->top, tracer_bmp.hmdc, tracer_bmp.rc_sustain.left, tracer_bmp.rc_sustain.top, SRCCOPY ); // KvȂ` BitBlt ( hdc, lprc->left, lprc->top, vol, lprc->bottom - lprc->top, tracer_bmp.hmdc, tracer_bmp.rc_sustain.left, tracer_bmp.rc_sustain.top + 9 + 1, SRCCOPY ); if ( lockflag ) TRACER_UNLOCK (); effect_view_border_draw (lprc, lockflag); InvalidateRect ( w32g_tracer_wnd.hwnd, lprc, FALSE ); return 0; /* HDC hdc; if ( !w32g_tracer_wnd.active ) return 0; hdc = w32g_tracer_wnd.hmdc; if ( vol <= 0 ) vol = 0; if ( vol >= 1 ) vol = 1; if ( lockflag ) TRACER_LOCK (); BitBlt ( hdc, lprc->left, lprc->top, lprc->right - lprc->left, lprc->bottom - lprc->top, tracer_bmp.hmdc, tracer_bmp.rc_sustain.left, tracer_bmp.rc_sustain.top + vol * ( 9 + 1 ), SRCCOPY ); if ( lockflag ) TRACER_UNLOCK (); effect_view_border_draw (lprc, lockflag); InvalidateRect ( w32g_tracer_wnd.hwnd, lprc, FALSE ); return 0;*/ } static int tracer_pitch_bend_draw ( RECT *lprc, int vol, int max, int lockflag ) { HDC hdc; const int view_max = 10; if ( !w32g_tracer_wnd.active ) return 0; hdc = w32g_tracer_wnd.hmdc; vol = (vol - max / 2) * view_max * 2 / max; if(vol > view_max) {vol = view_max;} else if(vol < -view_max) {vol = -view_max;} if ( lockflag ) TRACER_LOCK (); // wi` BitBlt ( hdc, lprc->left, lprc->top, lprc->right - lprc->left, lprc->bottom - lprc->top, tracer_bmp.hmdc, tracer_bmp.rc_pitch_bend.left, tracer_bmp.rc_pitch_bend.top, SRCCOPY ); if(vol > 0) { // KvȂ` BitBlt ( hdc, lprc->left + view_max, lprc->top, vol, lprc->bottom - lprc->top, tracer_bmp.hmdc, tracer_bmp.rc_pitch_bend.left + view_max, tracer_bmp.rc_pitch_bend.top + 9 + 1, SRCCOPY ); } else if(vol < 0) { BitBlt ( hdc, lprc->left + view_max + vol, lprc->top, -vol, lprc->bottom - lprc->top, tracer_bmp.hmdc, tracer_bmp.rc_pitch_bend.left + view_max + vol, tracer_bmp.rc_pitch_bend.top + 9 + 1, SRCCOPY ); } if ( lockflag ) TRACER_UNLOCK (); effect_view_border_draw (lprc, lockflag); InvalidateRect ( w32g_tracer_wnd.hwnd, lprc, FALSE ); return 0; } static int tracer_mod_wheel_draw ( RECT *lprc, int vol, int max, int lockflag ) { HDC hdc; const int view_max = 20, div = 7; if ( !w32g_tracer_wnd.active ) return 0; hdc = w32g_tracer_wnd.hmdc; vol /= div; if(vol >= view_max) {vol = view_max;} if ( lockflag ) TRACER_LOCK (); // KvȂwi` BitBlt ( hdc, lprc->left + vol, lprc->top, lprc->right - lprc->left - vol, lprc->bottom - lprc->top, tracer_bmp.hmdc, tracer_bmp.rc_mod_wheel.left, tracer_bmp.rc_mod_wheel.top, SRCCOPY ); // KvȂ` BitBlt ( hdc, lprc->left, lprc->top, vol, lprc->bottom - lprc->top, tracer_bmp.hmdc, tracer_bmp.rc_mod_wheel.left, tracer_bmp.rc_mod_wheel.top + 9 + 1, SRCCOPY ); if ( lockflag ) TRACER_UNLOCK (); effect_view_border_draw (lprc, lockflag); InvalidateRect ( w32g_tracer_wnd.hwnd, lprc, FALSE ); return 0; } static int tracer_chorus_effect_draw ( RECT *lprc, int vol, int max, int lockflag ) { HDC hdc; const int view_max = 20, div = 7; if ( !w32g_tracer_wnd.active ) return 0; hdc = w32g_tracer_wnd.hmdc; vol /= div; if(vol >= view_max) {vol = view_max;} if ( lockflag ) TRACER_LOCK (); // KvȂwi` BitBlt ( hdc, lprc->left + vol, lprc->top, lprc->right - lprc->left - vol, lprc->bottom - lprc->top, tracer_bmp.hmdc, tracer_bmp.rc_chorus_effect.left, tracer_bmp.rc_chorus_effect.top, SRCCOPY ); // KvȂ` BitBlt ( hdc, lprc->left, lprc->top, vol, lprc->bottom - lprc->top, tracer_bmp.hmdc, tracer_bmp.rc_chorus_effect.left, tracer_bmp.rc_chorus_effect.top + 9 + 1, SRCCOPY ); if ( lockflag ) TRACER_UNLOCK (); effect_view_border_draw (lprc, lockflag); InvalidateRect ( w32g_tracer_wnd.hwnd, lprc, FALSE ); return 0; } static int tracer_reverb_effect_draw ( RECT *lprc, int vol, int max, int lockflag ) { HDC hdc; const int view_max = 20, div = 7; if ( !w32g_tracer_wnd.active ) return 0; hdc = w32g_tracer_wnd.hmdc; vol /= div; if(vol >= view_max) {vol = view_max;} if ( lockflag ) TRACER_LOCK (); // KvȂwi` BitBlt ( hdc, lprc->left + vol, lprc->top, lprc->right - lprc->left - vol, lprc->bottom - lprc->top, tracer_bmp.hmdc, tracer_bmp.rc_reverb_effect.left, tracer_bmp.rc_reverb_effect.top, SRCCOPY ); // KvȂ` BitBlt ( hdc, lprc->left, lprc->top, vol, lprc->bottom - lprc->top, tracer_bmp.hmdc, tracer_bmp.rc_reverb_effect.left, tracer_bmp.rc_reverb_effect.top + 9 + 1, SRCCOPY ); if ( lockflag ) TRACER_UNLOCK (); effect_view_border_draw (lprc, lockflag); InvalidateRect ( w32g_tracer_wnd.hwnd, lprc, FALSE ); return 0; } static int tracer_temper_keysig_draw(RECT *lprc, int8 tk, int ko, int lockflag) { static int8 lastkeysig = CTL_STATUS_UPDATE; static int lastoffset = CTL_STATUS_UPDATE; int adj, i, j; HDC hdc; if (tk == CTL_STATUS_UPDATE) tk = lastkeysig; else lastkeysig = tk; if (ko == CTL_STATUS_UPDATE) ko = lastoffset; else lastoffset = ko; adj = tk + 8 & 0x20, tk = (tk + 8) % 32 - 8; i = tk + ((tk < 8) ? 7 : -9); if (ko > 0) for (j = 0; j < ko; j++) i += (i > 7) ? -5 : 7; else for (j = 0; j < abs(ko); j++) i += (i < 7) ? 5 : -7; i += (tk < 8) ? 1 : 17; if (! w32g_tracer_wnd.active) return 0; hdc = w32g_tracer_wnd.hmdc; if (lockflag) TRACER_LOCK(); BitBlt(hdc, lprc->left, lprc->top, lprc->right - lprc->left, lprc->bottom - lprc->top, tracer_bmp.hmdc, tracer_bmp.rc_temper_keysig[i].left, tracer_bmp.rc_temper_keysig[i].top, (adj) ? NOTSRCCOPY : SRCCOPY); if (lockflag) TRACER_UNLOCK(); InvalidateRect(w32g_tracer_wnd.hwnd, lprc, FALSE); return 0; } static int tracer_temper_type_draw(RECT *lprc, int ch, int8 tt, int lockflag) { HDC hdc; if (tt != CTL_STATUS_UPDATE) { if (w32g_tracer_wnd.tt[ch] == tt) return 0; w32g_tracer_wnd.tt[ch] = tt; } else tt = w32g_tracer_wnd.tt[ch]; if (! w32g_tracer_wnd.active) return 0; hdc = w32g_tracer_wnd.hmdc; if (lockflag) TRACER_LOCK(); BitBlt(hdc, lprc->left, lprc->top, lprc->right - lprc->left, lprc->bottom - lprc->top, tracer_bmp.hmdc, tracer_bmp.rc_temper_type[(tt < 0x40) ? tt : tt - 0x3c].left, tracer_bmp.rc_temper_type[(tt < 0x40) ? tt : tt - 0x3c].top, SRCCOPY); if (lockflag) TRACER_UNLOCK(); effect_view_border_draw (lprc, lockflag); InvalidateRect(w32g_tracer_wnd.hwnd, lprc, FALSE); return 0; } static int tracer_gm_draw ( RECT *lprc, int flag, int lockflag ) { HDC hdc; if ( !w32g_tracer_wnd.active ) return 0; hdc = w32g_tracer_wnd.hmdc; if ( lockflag ) TRACER_LOCK (); switch ( flag ) { default: case 0: BitBlt ( hdc, lprc->left, lprc->top, lprc->right - lprc->left, lprc->bottom - lprc->top, tracer_bmp.hmdc, tracer_bmp.rc_gm_off.left, tracer_bmp.rc_gm_off.top, SRCCOPY ); break; case 1: BitBlt ( hdc, lprc->left, lprc->top, lprc->right - lprc->left, lprc->bottom - lprc->top, tracer_bmp.hmdc, tracer_bmp.rc_gm_on.left, tracer_bmp.rc_gm_on.top, SRCCOPY ); break; } if ( lockflag ) TRACER_UNLOCK (); InvalidateRect ( w32g_tracer_wnd.hwnd, lprc, FALSE ); return 0; } static int tracer_gs_draw ( RECT *lprc, int flag, int lockflag ) { HDC hdc; if ( !w32g_tracer_wnd.active ) return 0; hdc = w32g_tracer_wnd.hmdc; if ( lockflag ) TRACER_LOCK (); switch ( flag ) { default: case 0: BitBlt ( hdc, lprc->left, lprc->top, lprc->right - lprc->left, lprc->bottom - lprc->top, tracer_bmp.hmdc, tracer_bmp.rc_gs_off.left, tracer_bmp.rc_gs_off.top, SRCCOPY ); break; case 1: BitBlt ( hdc, lprc->left, lprc->top, lprc->right - lprc->left, lprc->bottom - lprc->top, tracer_bmp.hmdc, tracer_bmp.rc_gs_on.left, tracer_bmp.rc_gs_on.top, SRCCOPY ); break; } if ( lockflag ) TRACER_UNLOCK (); InvalidateRect ( w32g_tracer_wnd.hwnd, lprc, FALSE ); return 0; } static int tracer_xg_draw ( RECT *lprc, int flag, int lockflag ) { HDC hdc; if ( !w32g_tracer_wnd.active ) return 0; hdc = w32g_tracer_wnd.hmdc; if ( lockflag ) TRACER_LOCK (); switch ( flag ) { default: case 0: BitBlt ( hdc, lprc->left, lprc->top, lprc->right - lprc->left, lprc->bottom - lprc->top, tracer_bmp.hmdc, tracer_bmp.rc_xg_off.left, tracer_bmp.rc_xg_off.top, SRCCOPY ); break; case 1: BitBlt ( hdc, lprc->left, lprc->top, lprc->right - lprc->left, lprc->bottom - lprc->top, tracer_bmp.hmdc, tracer_bmp.rc_xg_on.left, tracer_bmp.rc_xg_on.top, SRCCOPY ); break; } if ( lockflag ) TRACER_UNLOCK (); InvalidateRect ( w32g_tracer_wnd.hwnd, lprc, FALSE ); return 0; } #if 0 static int cheap_volume_view_draw ( RECT *lprc, int vol, int max, COLORREF fore, COLORREF back, int type, int lockflag ) { RECT rc1; HDC hdc; HBRUSH hFore, hBack; if ( !w32g_tracer_wnd.active ) return 0; rc1; hdc = w32g_tracer_wnd.hmdc; hFore = CreateSolidBrush ( fore ); hBack = CreateSolidBrush ( back ); if ( vol > max ) vol = max; if ( vol < 0 ) vol = 0; switch (type) { default: case CVV_TYPE_LEFT: rc1.left = lprc->left; rc1.right = lprc->left + (lprc->right - lprc->left) * vol / max; rc1.top = lprc->top; rc1.bottom = lprc->bottom; break; case CVV_TYPE_RIGHT: rc1.left = lprc->left + (lprc->right - lprc->left) * (max - vol) / max; rc1.right = lprc->right; rc1.top = lprc->top; rc1.bottom = lprc->bottom; break; case CVV_TYPE_TOP: rc1.left = lprc->left; rc1.right = lprc->right; rc1.top = lprc->top; rc1.bottom = lprc->top + (lprc->bottom - lprc->top) * vol / max; break; case CVV_TYPE_BOTTOM: rc1.left = lprc->left; rc1.right = lprc->right; rc1.top = lprc->top + (lprc->bottom - lprc->top) * (max - vol) / max; rc1.bottom = lprc->bottom; break; } if ( lockflag ) TRACER_LOCK (); FillRect(hdc, &rc1, hFore); if ( lockflag ) TRACER_UNLOCK (); InvalidateRect ( w32g_tracer_wnd.hwnd, &rc1, FALSE ); switch (type) { default: case CVV_TYPE_LEFT: rc1.left = rc1.right; rc1.right = lprc->right; break; case CVV_TYPE_RIGHT: rc1.left = lprc->left; rc1.right = rc1.left; break; case CVV_TYPE_TOP: rc1.top = rc1.bottom; rc1.bottom = lprc->bottom; break; case CVV_TYPE_BOTTOM: rc1.top = lprc->top; rc1.bottom = rc1.top; break; } if ( lockflag ) TRACER_LOCK (); FillRect(hdc, &rc1, hBack); if ( lockflag ) TRACER_UNLOCK (); InvalidateRect ( w32g_tracer_wnd.hwnd, &rc1, FALSE ); DeleteObject ( (HGDIOBJ) hFore ); DeleteObject ( (HGDIOBJ) hBack ); return 0; } #endif static int string_view_border_draw ( RECT *lprc, COLORREF back, int lockflag) { HDC hdc; HPEN hPen1 = NULL; HPEN hPen2 = NULL; HPEN hPen3 = NULL; HPEN hPen4 = NULL; HPEN hOldPen = NULL; if ( !w32g_tracer_wnd.active ) return 0; hdc = w32g_tracer_wnd.hmdc; hPen1 = CreatePen(PS_SOLID, 1, RGB(GetRValue(back) + 32, GetGValue(back) + 32, GetBValue(back) + 32)); hPen2 = CreatePen(PS_SOLID, 1, RGB(GetRValue(back) - 16, GetGValue(back) - 16, GetBValue(back) - 16)); hPen3 = CreatePen(PS_SOLID, 1, RGB(GetRValue(back) + 16, GetGValue(back) + 16, GetBValue(back) + 16)); hPen4 = CreatePen(PS_SOLID, 1, RGB(GetRValue(back) - 32, GetGValue(back) - 32, GetBValue(back) - 32)); if ( lockflag ) TRACER_LOCK (); hOldPen= (HPEN)SelectObject(hdc,GetStockObject(NULL_PEN)); // SelectObject(hdc, hPen1); MoveToEx(hdc, lprc->left, lprc->top, NULL); LineTo(hdc, lprc->right, lprc->top); // SelectObject(hdc, hPen3); MoveToEx(hdc, lprc->left, lprc->top, NULL); LineTo(hdc, lprc->left, lprc->bottom); // SelectObject(hdc, hPen2); MoveToEx(hdc, lprc->left, lprc->bottom - 1, NULL); LineTo(hdc, lprc->right, lprc->bottom - 1); // E SelectObject(hdc, hPen4); MoveToEx(hdc, lprc->right - 1, lprc->top, NULL); LineTo(hdc, lprc->right - 1, lprc->bottom); SelectObject(hdc, hOldPen); if ( lockflag ) TRACER_UNLOCK (); DeleteObject (hPen1); DeleteObject (hPen2); DeleteObject (hPen3); DeleteObject (hPen4); return 0; } static int cheap_string_view_draw_font ( RECT *lprc, char *str, COLORREF fore, COLORREF back, int mode, HFONT hFont, int lockflag ) { HDC hdc; COLORREF old_fore, old_back; HGDIOBJ hgdiobj; UINT old_mode; int left, top, bottom; if ( !w32g_tracer_wnd.active ) return 0; hdc = w32g_tracer_wnd.hmdc; if ( lockflag ) TRACER_LOCK (); if ( mode == CSV_CENTER ) { old_mode = SetTextAlign(hdc, TA_CENTER | TA_BOTTOM ); left = ( lprc->left + lprc->right ) / 2; top = lprc->top; bottom = lprc->bottom; } else if ( mode == CSV_LEFT ) { old_mode = SetTextAlign(hdc, TA_LEFT | TA_BOTTOM ); left = lprc->left; top = lprc->top; bottom = lprc->bottom; } else if ( mode == CSV_RIGHT ) { old_mode = SetTextAlign(hdc, TA_RIGHT | TA_BOTTOM ); left = lprc->right; top = lprc->top; bottom = lprc->bottom; } old_fore = SetTextColor ( hdc, fore ); old_back = SetBkColor ( hdc, back ); hgdiobj = SelectObject( hdc, hFont ); // ExtTextOut ( hdc, left, top, ETO_CLIPPED | ETO_OPAQUE, lprc, str, strlen(str), NULL); ExtTextOut ( hdc, left, bottom - 2, ETO_CLIPPED | ETO_OPAQUE, lprc, str, strlen(str), NULL); SetTextColor ( hdc, old_fore ); SetBkColor ( hdc, old_back ); SelectObject( hdc, hgdiobj ); SetTextAlign(hdc, old_mode ); string_view_border_draw(lprc, back, FALSE); if ( lockflag ) TRACER_UNLOCK (); InvalidateRect ( w32g_tracer_wnd.hwnd, lprc, FALSE ); return 0; } static int cheap_string_view_draw ( RECT *lprc, char *str, COLORREF fore, COLORREF back, int mode, int lockflag ) { return cheap_string_view_draw_font ( lprc, str, fore, back, mode, w32g_tracer_wnd.hFontCommon, lockflag ); } static int cheap_half_string_view_draw ( RECT *lprc, char *str, COLORREF fore, COLORREF back, int mode, int lockflag ) { HDC hdc; COLORREF old_fore, old_back; HGDIOBJ hgdiobj; UINT old_mode; HFONT hFont = w32g_tracer_wnd.hFontHalf; int left, top; if ( !w32g_tracer_wnd.active ) return 0; hdc = w32g_tracer_wnd.hmdc; if ( lockflag ) TRACER_LOCK (); if ( mode == CSV_CENTER ) { old_mode = SetTextAlign(hdc, TA_CENTER ); left = ( lprc->left + lprc->right ) / 2; top = lprc->top; } else if ( mode == CSV_LEFT ) { old_mode = SetTextAlign(hdc, TA_LEFT ); left = lprc->left; top = lprc->top; } else if ( mode == CSV_RIGHT ) { old_mode = SetTextAlign(hdc, TA_RIGHT ); left = lprc->right; top = lprc->top; } old_fore = SetTextColor ( hdc, fore ); old_back = SetBkColor ( hdc, back ); hgdiobj = SelectObject( hdc, hFont ); ExtTextOut ( hdc, left, top-3, ETO_CLIPPED | ETO_OPAQUE, lprc, str, strlen(str), NULL); SetTextColor ( hdc, old_fore ); SetBkColor ( hdc, old_back ); SelectObject( hdc, hgdiobj ); SetTextAlign(hdc, old_mode ); string_view_border_draw(lprc, back, FALSE); if ( lockflag ) TRACER_UNLOCK (); InvalidateRect ( w32g_tracer_wnd.hwnd, lprc, FALSE ); return 0; } void TracerWndPaintAll(int lockflag) { int i, j; char buff[1024]; RECT rc; if ( !w32g_tracer_wnd.active ) return; if ( lockflag ) TRACER_LOCK(); // ^Cg strcpy ( buff, "ch" ); get_head_rc ( &rc, &w32g_tracer_wnd.rc_channel_top ); cheap_string_view_draw ( &rc, buff, C_TEXT_FORE, C_TEXT_BACK, CSV_CENTER, FALSE ); strcpy ( buff, " instrument " ); get_head_rc ( &rc, &w32g_tracer_wnd.rc_instrument ); cheap_string_view_draw ( &rc, buff, C_TEXT_FORE, C_TEXT_BACK, CSV_CENTER, FALSE ); strcpy ( buff, " map " ); get_head_rc ( &rc, &w32g_tracer_wnd.rc_inst_map ); cheap_string_view_draw ( &rc, buff, C_TEXT_FORE, C_TEXT_BACK, CSV_CENTER, FALSE ); strcpy ( buff, "bank" ); get_head_rc ( &rc, &w32g_tracer_wnd.rc_bank ); cheap_string_view_draw ( &rc, buff, C_TEXT_FORE, C_TEXT_BACK, CSV_CENTER, FALSE ); strcpy ( buff, "prog" ); get_head_rc ( &rc, &w32g_tracer_wnd.rc_program ); cheap_string_view_draw ( &rc, buff, C_TEXT_FORE, C_TEXT_BACK, CSV_CENTER, FALSE ); strcpy ( buff, "vel" ); get_head_rc ( &rc, &w32g_tracer_wnd.rc_velocity ); cheap_string_view_draw ( &rc, buff, C_TEXT_FORE, C_TEXT_BACK, CSV_CENTER, FALSE ); strcpy ( buff, "vo" ); get_head_rc ( &rc, &w32g_tracer_wnd.rc_volume ); cheap_half_string_view_draw ( &rc, buff, C_TEXT_FORE, C_TEXT_BACK, CSV_CENTER, FALSE ); strcpy ( buff, "ex" ); get_head_rc ( &rc, &w32g_tracer_wnd.rc_expression ); cheap_half_string_view_draw ( &rc, buff, C_TEXT_FORE, C_TEXT_BACK, CSV_CENTER, FALSE ); strcpy ( buff, "pa" ); get_head_rc ( &rc, &w32g_tracer_wnd.rc_panning ); cheap_half_string_view_draw ( &rc, buff, C_TEXT_FORE, C_TEXT_BACK, CSV_CENTER, FALSE ); strcpy ( buff, "su" ); get_head_rc ( &rc, &w32g_tracer_wnd.rc_sustain ); cheap_half_string_view_draw ( &rc, buff, C_TEXT_FORE, C_TEXT_BACK, CSV_CENTER, FALSE ); strcpy ( buff, "pb" ); get_head_rc ( &rc, &w32g_tracer_wnd.rc_pitch_bend ); cheap_half_string_view_draw ( &rc, buff, C_TEXT_FORE, C_TEXT_BACK, CSV_CENTER, FALSE ); strcpy ( buff, "mw" ); get_head_rc ( &rc, &w32g_tracer_wnd.rc_mod_wheel ); cheap_half_string_view_draw ( &rc, buff, C_TEXT_FORE, C_TEXT_BACK, CSV_CENTER, FALSE ); strcpy ( buff, "ch" ); get_head_rc ( &rc, &w32g_tracer_wnd.rc_chorus_effect ); cheap_half_string_view_draw ( &rc, buff, C_TEXT_FORE, C_TEXT_BACK, CSV_CENTER, FALSE ); strcpy ( buff, "re" ); get_head_rc ( &rc, &w32g_tracer_wnd.rc_reverb_effect ); cheap_half_string_view_draw ( &rc, buff, C_TEXT_FORE, C_TEXT_BACK, CSV_CENTER, FALSE ); get_head_rc(&rc, &w32g_tracer_wnd.rc_temper_keysig); tracer_temper_keysig_draw(&rc, CTL_STATUS_UPDATE, CTL_STATUS_UPDATE, FALSE); get_head_rc ( &rc, &w32g_tracer_wnd.rc_gm ); tracer_gm_draw ( &rc, w32g_tracer_wnd.play_system_mode == GM_SYSTEM_MODE ? 1 : 0, FALSE ); get_head_rc ( &rc, &w32g_tracer_wnd.rc_gs ); tracer_gs_draw ( &rc, w32g_tracer_wnd.play_system_mode == GS_SYSTEM_MODE ? 1 : 0, FALSE ); get_head_rc ( &rc, &w32g_tracer_wnd.rc_xg ); tracer_xg_draw ( &rc, w32g_tracer_wnd.play_system_mode == XG_SYSTEM_MODE ? 1 : 0, FALSE ); strcpy ( buff, w32g_tracer_wnd.titlename ); get_head_rc ( &rc, &w32g_tracer_wnd.rc_head_rest ); cheap_string_view_draw ( &rc, buff, C_TEXT_FORE, C_TEXT_BACK, CSV_LEFT, FALSE ); // e`l for ( i = 0; i < TRACER_CHANNELS ; i ++ ) { if ( get_ch_rc ( i, &rc, &w32g_tracer_wnd.rc_channel_top ) == 0 ) { sprintf ( buff, "%02d", i + 1); if ( IS_SET_CHANNELMASK ( w32g_tracer_wnd.quietchannels, i ) ) cheap_string_view_draw ( &rc, buff, C_TEXT_FORE, C_TEXT_BACK_VERY_DARK, CSV_CENTER, FALSE ); else { if ( IS_SET_CHANNELMASK ( w32g_tracer_wnd.channel_mute, i ) ) cheap_string_view_draw ( &rc, buff, C_TEXT_FORE, C_TEXT_BACK_DARK, CSV_CENTER, FALSE ); else cheap_string_view_draw ( &rc, buff, C_TEXT_FORE, C_TEXT_BACK, CSV_CENTER, FALSE ); } } tracer_ch_program_draw ( i, w32g_tracer_wnd.bank[i], w32g_tracer_wnd.program[i], w32g_tracer_wnd.instrument[i], w32g_tracer_wnd.mapID[i], FALSE ); if ( get_ch_rc ( i, &rc, &w32g_tracer_wnd.rc_velocity ) == 0 ) tracer_velocity_draw ( &rc, w32g_tracer_wnd.velocity[i], VEL_MAX, FALSE ); if ( get_ch_rc ( i, &rc, &w32g_tracer_wnd.rc_volume ) == 0 ) tracer_volume_draw ( &rc, w32g_tracer_wnd.volume[i], 128, FALSE ); if ( get_ch_rc ( i, &rc, &w32g_tracer_wnd.rc_expression ) == 0 ) tracer_expression_draw ( &rc, w32g_tracer_wnd.expression[i], 128, FALSE ); if ( get_ch_rc ( i, &rc, &w32g_tracer_wnd.rc_panning ) == 0 ) tracer_pan_draw ( &rc, w32g_tracer_wnd.panning[i], 128, FALSE ); if ( get_ch_rc ( i, &rc, &w32g_tracer_wnd.rc_sustain ) == 0 ) tracer_sustain_draw ( &rc, w32g_tracer_wnd.sustain[i], FALSE ); if ( get_ch_rc ( i, &rc, &w32g_tracer_wnd.rc_pitch_bend ) == 0 ) tracer_pitch_bend_draw ( &rc, w32g_tracer_wnd.pitch_bend[i], 0x4000, FALSE ); if ( get_ch_rc ( i, &rc, &w32g_tracer_wnd.rc_mod_wheel ) == 0 ) tracer_mod_wheel_draw ( &rc, w32g_tracer_wnd.mod_wheel[i], 32, FALSE ); if ( get_ch_rc ( i, &rc, &w32g_tracer_wnd.rc_chorus_effect ) == 0 ) tracer_chorus_effect_draw ( &rc, w32g_tracer_wnd.chorus_effect[i], 128, FALSE ); if ( get_ch_rc ( i, &rc, &w32g_tracer_wnd.rc_reverb_effect ) == 0 ) tracer_reverb_effect_draw ( &rc, w32g_tracer_wnd.reverb_effect[i], 128, FALSE ); if (! get_ch_rc(i, &rc, &w32g_tracer_wnd.rc_temper_type)) tracer_temper_type_draw(&rc, i, CTL_STATUS_UPDATE, FALSE); for ( j = 0; j < 128; j ++ ) { if ( get_ch_rc ( i, &rc, &w32g_tracer_wnd.rc_notes ) == 0 ) notes_view_draw ( &rc, j, w32g_tracer_wnd.notes[i][j], TRUE, FALSE ); } } // ... if ( lockflag ) TRACER_UNLOCK(); InvalidateRect( w32g_tracer_wnd.hwnd,NULL, FALSE ); } // GUI Xbĥ݌Ăׂ void TracerWndPaintDo(int flag) { RECT rc; if ( !w32g_tracer_wnd.active ) return; if ( flag ) InvalidateRect( w32g_tracer_wnd.hwnd,NULL, FALSE ); if ( GetUpdateRect(w32g_tracer_wnd.hwnd, &rc, FALSE) ) { PAINTSTRUCT ps; if ( GDI_LOCK_EX(0) == 0 ) { TRACER_LOCK(); w32g_tracer_wnd.hdc = BeginPaint(w32g_tracer_wnd.hwnd, &ps); BitBlt(w32g_tracer_wnd.hdc,rc.left,rc.top,rc.right,rc.bottom,w32g_tracer_wnd.hmdc,rc.left,rc.top,SRCCOPY); EndPaint(w32g_tracer_wnd.hwnd, &ps); GDI_UNLOCK(); TRACER_UNLOCK(); } else { InvalidateRect ( w32g_tracer_wnd.hwnd, &rc, FALSE ); } } } BOOL CALLBACK TracerCanvasWndProc(HWND hwnd, UINT uMess, WPARAM wParam, LPARAM lParam) { switch (uMess) { case WM_CREATE: break; case WM_PAINT: TracerWndPaintDo(FALSE); return 0; case WM_DROPFILES: SendMessage(hMainWnd,WM_DROPFILES,wParam,lParam); return 0; case WM_RBUTTONDBLCLK: case WM_LBUTTONDBLCLK: { int i, mode; int xPos = LOWORD(lParam); int yPos = HIWORD(lParam); RECT rc; int flag = FALSE; get_head_rc ( &rc, &w32g_tracer_wnd.rc_channel_top ); if ( rc.left <= xPos && xPos <= rc.right && rc.top <= yPos && yPos <= rc.bottom ) { char buff[64]; for ( i = 0; i < TRACER_CHANNELS; i ++ ) { if ( get_ch_rc ( i, &rc, &w32g_tracer_wnd.rc_channel_top ) == 0 ) { sprintf ( buff, "%02d", i + 1 ); if ( uMess == WM_RBUTTONDBLCLK ) UNSET_CHANNELMASK ( channel_mute, i ); else TOGGLE_CHANNELMASK ( channel_mute, i ); if ( IS_SET_CHANNELMASK ( quietchannels, i ) ) cheap_string_view_draw ( &rc, buff, C_TEXT_FORE, C_TEXT_BACK_VERY_DARK, CSV_CENTER, TRUE ); else { flag = TRUE; if ( IS_SET_CHANNELMASK ( channel_mute, i ) ) cheap_string_view_draw ( &rc, buff, C_TEXT_FORE, C_TEXT_BACK_DARK, CSV_CENTER, TRUE ); else cheap_string_view_draw ( &rc, buff, C_TEXT_FORE, C_TEXT_BACK, CSV_CENTER, TRUE ); } } } if ( flag ) w32g_send_rc ( RC_SYNC_RESTART, 0 ); w32g_tracer_wnd.channel_mute = channel_mute; w32g_tracer_wnd.quietchannels = quietchannels; flag = TRUE; } if ( uMess == WM_RBUTTONDBLCLK ) break; if ( flag ) break; for ( i = 0; i < TRACER_CHANNELS; i ++ ) { if ( get_ch_rc ( i, &rc, &w32g_tracer_wnd.rc_channel_top ) == 0 ) { if ( rc.left <= xPos && xPos <= rc.right && rc.top <= yPos && yPos <= rc.bottom ) { char buff[64]; sprintf ( buff, "%02d", i + 1 ); TOGGLE_CHANNELMASK ( channel_mute, i ); if ( IS_SET_CHANNELMASK ( quietchannels, i ) ) cheap_string_view_draw ( &rc, buff, C_TEXT_FORE, C_TEXT_BACK_VERY_DARK, CSV_CENTER, TRUE ); else { flag = TRUE; if ( IS_SET_CHANNELMASK ( channel_mute, i ) ) cheap_string_view_draw ( &rc, buff, C_TEXT_FORE, C_TEXT_BACK_DARK, CSV_CENTER, TRUE ); else cheap_string_view_draw ( &rc, buff, C_TEXT_FORE, C_TEXT_BACK, CSV_CENTER, TRUE ); } w32g_tracer_wnd.channel_mute = channel_mute; w32g_tracer_wnd.quietchannels = quietchannels; if ( flag ) w32g_send_rc ( RC_SYNC_RESTART, 0 ); flag = TRUE; break; } } } if ( flag ) break; switch ( TracerWndInfo.mode ) { case TWI_MODE_1_32CH: mode = TWI_MODE_1_16CH; break; case TWI_MODE_1_16CH: mode = TWI_MODE_17_32CH; break; default: case TWI_MODE_17_32CH: mode = TWI_MODE_1_32CH; break; } change_tracer_wnd_mode ( mode ); } break; case WM_CHAR: // case WM_KEYDOWN: // ctl->cmsg(CMSG_ERROR, VERB_NORMAL, // "%x", wParam ); switch ( wParam ) { case 0x50: // P case 0x70: // p SendMessage(hMainWnd,WM_COMMAND,MAKEWPARAM(IDM_PREV,0),0); return 0; case 0x4e: // N case 0x6e: // n SendMessage(hMainWnd,WM_COMMAND,MAKEWPARAM(IDM_NEXT,0),0); return 0; case 0x45: // E case 0x65: // e w32g_send_rc ( RC_RESTART, 0); SendMessage(hMainWnd,WM_COMMAND,MAKEWPARAM(IDM_STOP,0),0); return 0; case 0x48: // H case 0x68: // h if ( PlayerLanguage == LANGUAGE_JAPANESE ){ MessageBox(hTracerWnd, "L[R}h\n" "g[TEChER}h\n" " ESC: wv‚ H: wvo\n" " +: L[Abv -: L[_E\n" " >: Xs[hAbv <: Xs[h_E\n" "vC[R}h\n" " SPACE/ENTER: tJn E: ~ S: ꎞ~\n" " P: Ő N: ̋\n" "TiMidity R}h\n" " Q: I\n" ,"wv", MB_OK); } else { MessageBox(hTracerWnd, "Usage of key.\n" "Tracer window command.\n" " ESC: Close Help H: Help\n" " +: Key up -: Key down\n" " >: Speed up <: Speed down\n" "Player command.\n" " SPACE/ENTER: PLAY E: Stop S: Pause\n" " P: Prev N: Next\n" "TiMidity command.\n" " Q: Quit\n" ,"Help", MB_OK); } return 0; case 0x52: // R case 0x72: // r return 0; case 0x53: // S case 0x73: // s SendMessage(hMainWnd,WM_COMMAND,MAKEWPARAM(IDM_PAUSE,0),0); return 0; case VK_ESCAPE: SendMessage(hTracerWnd,WM_COMMAND,MAKEWPARAM(0,IDCLOSE),0); return 0; case 0x51: // Q case 0x71: // q if(MessageBox(hTracerWnd,"Quit TiMidity?","TiMidity",MB_ICONQUESTION|MB_YESNO)==IDYES) SendMessage(hMainWnd,WM_CLOSE,0,0); return 0; case VK_SPACE: case VK_RETURN: SendMessage(hMainWnd,WM_COMMAND,MAKEWPARAM(IDM_PLAY,0),0); return 0; case 0x3E: // < w32g_send_rc ( RC_SPEEDUP, 1); return 0; case 0x3C: // < w32g_send_rc ( RC_SPEEDDOWN, 1); return 0; case 0x2B: // + w32g_send_rc ( RC_KEYUP, 1); return 0; case 0x2D: // - // w32g_send_rc ( RC_KEYDOWN, 1); w32g_send_rc ( RC_KEYDOWN, -1); return 0; #if 0 case 0x4F: // O w32g_send_rc ( RC_VOICEINCR, 1); return 0; case 0x6F: // o w32g_send_rc ( RC_VOICEDECR, 1); return 0; #endif } default: return DefWindowProc(hwnd,uMess,wParam,lParam) ; } return 0L; } extern void MainWndUpdateTracerButton(void); BOOL CALLBACK TracerWndProc(HWND hwnd, UINT uMess, WPARAM wParam, LPARAM lParam) { switch (uMess){ case WM_INITDIALOG: SetWindowPosSize(GetDesktopWindow(),hwnd,TracerWndInfo.PosX, TracerWndInfo.PosY ); return FALSE; case WM_DESTROY: { RECT rc; GetWindowRect(hwnd,&rc); TracerWndInfo.PosX = rc.left; TracerWndInfo.PosY = rc.top; } INISaveTracerWnd(); break; case WM_COMMAND: switch (LOWORD(wParam)) { case IDCLOSE: ShowWindow(hwnd, SW_HIDE); MainWndUpdateTracerButton(); break; default: return FALSE; } case WM_MOVE: // TracerWndInfo.PosX = (int) LOWORD(lParam); // TracerWndInfo.PosY = (int) HIWORD(lParam); { RECT rc; GetWindowRect(hwnd,&rc); TracerWndInfo.PosX = rc.left; TracerWndInfo.PosY = rc.top; } break; case WM_SHOWWINDOW: if ( wParam ) { w32g_tracer_wnd.active = TRUE; TracerWndClear( TRUE ); TracerWndPaintAll ( TRUE ); } else { w32g_tracer_wnd.active = FALSE; } break; case WM_CLOSE: ShowWindow(hTracerWnd, SW_HIDE); MainWndUpdateTracerButton(); break; case WM_DROPFILES: SendMessage(hMainWnd,WM_DROPFILES,wParam,lParam); return 0; case WM_LBUTTONDBLCLK: { int mode; switch ( TracerWndInfo.mode ) { case TWI_MODE_1_32CH: mode = TWI_MODE_1_16CH; break; case TWI_MODE_1_16CH: mode = TWI_MODE_17_32CH; break; default: case TWI_MODE_17_32CH: mode = TWI_MODE_1_32CH; break; } change_tracer_wnd_mode ( mode ); } break; default: return FALSE; } return FALSE; } extern int PosSizeSave; #define SEC_TRACERWND "TracerWnd" int INISaveTracerWnd(void) { char *section = SEC_TRACERWND; char *inifile = TIMIDITY_WINDOW_INI_FILE; char buffer[256]; if ( PosSizeSave ) { if ( TracerWndInfo.PosX >= 0 || TracerWndInfo.PosY >= 0 ) { if ( TracerWndInfo.PosX < 0 ) TracerWndInfo.PosX = 0; if ( TracerWndInfo.PosY < 0 ) TracerWndInfo.PosY = 0; } sprintf(buffer,"%d",TracerWndInfo.PosX); if ( TracerWndInfo.PosX >= 0 ) WritePrivateProfileString(section,"PosX",buffer,inifile); sprintf(buffer,"%d",TracerWndInfo.PosY); if ( TracerWndInfo.PosY >= 0 ) WritePrivateProfileString(section,"PosY",buffer,inifile); } sprintf(buffer,"%d",TracerWndInfo.mode); WritePrivateProfileString(section,"mode",buffer,inifile); WritePrivateProfileString(NULL,NULL,NULL,inifile); // Write Flush return 0; } int INILoadTracerWnd(void) { char *section = SEC_TRACERWND; char *inifile = TIMIDITY_WINDOW_INI_FILE; int num; num = GetPrivateProfileInt(section,"PosX",-1,inifile); TracerWndInfo.PosX = num; num = GetPrivateProfileInt(section,"PosY",-1,inifile); TracerWndInfo.PosY = num; num = GetPrivateProfileInt(section,"mode",TWI_MODE_1_32CH,inifile); TracerWndInfo.mode = num; return 0; } static int TracerWndInfoReset(HWND hwnd) { memset(&TracerWndInfo,0,sizeof(TRACERWNDINFO)); TracerWndInfo.PosX = - 1; TracerWndInfo.PosY = - 1; TracerWndInfo.mode = TWI_MODE_1_32CH; return 0; } static int TracerWndInfoApply(void) { change_tracer_wnd_mode ( TracerWndInfo.mode ); return 0; } static int change_tracer_wnd_mode ( int mode ) { RECT rc, rc2; switch (mode) { default: case TWI_MODE_1_32CH: w32g_tracer_wnd.height = 1 + 19 + 1 + (19 + 1) * 32 + 1; break; case TWI_MODE_1_16CH: case TWI_MODE_17_32CH: w32g_tracer_wnd.height = 1 + 19 + 1 + (19 + 1) * 16 + 1; break; } GetWindowRect ( hTracerWnd, &rc ); GetClientRect ( hTracerWnd, &rc2 ); rc.left = rc.left; rc.top = rc.top; rc.right = (rc.right - rc.left) - (rc2.right - rc2.left) + w32g_tracer_wnd.width; rc.bottom = (rc.bottom - rc.top) - (rc2.bottom - rc2.top) + w32g_tracer_wnd.height; MoveWindow ( hTracerWnd, rc.left, rc.top, rc.right, rc.bottom, TRUE); MoveWindow (w32g_tracer_wnd.hwnd,0,0,w32g_tracer_wnd.width,w32g_tracer_wnd.height,TRUE); TracerWndInfo.mode = mode; TracerWndClear(TRUE); TracerWndPaintAll ( TRUE ); return 0; } void TracerWndApplyQuietChannel( ChannelBitMask quietchannels_ ) { w32g_tracer_wnd.quietchannels = quietchannels_; TracerWndPaintAll(TRUE); } TiMidity++-2.13.2/interface/w32g_tracer.h0100644004711200001440000000450607643656760017160 0ustar tamukiusers#ifndef __W32G_TRACER_H__ #define __W32G_TRACER_H__ #define TRACER_CHANNELS 32 typedef struct w32g_tracer_wnd_t_ { HWND hwnd; HWND hParentWnd; HDC hdc; HDC hmdc; HGDIOBJ hgdiobj_hmdcprev; HBITMAP hbitmap; HFONT hFontCommon; HFONT hFontHalf; RECT rc; int font_common_height; int font_common_width; int height; int width; int valid; int active; int updateall; RECT rc_current_time; RECT rc_tempo; RECT rc_master_volume; // }X^[{[ RECT rc_maxvoices; RECT rc_head; RECT rc_all_channels; // ׂẴ`l int ch_height; // `l̕\̍ int ch_space; // `l̊Ԃ̃Xy[X RECT rc_channel_top; // `l RECT rc_instrument; // vO RECT rc_inst_map; RECT rc_bank; RECT rc_program; // vOԍ RECT rc_velocity; RECT rc_volume; RECT rc_expression; RECT rc_panning; RECT rc_sustain; RECT rc_pitch_bend; RECT rc_mod_wheel; RECT rc_chorus_effect; RECT rc_reverb_effect; RECT rc_temper_keysig; RECT rc_temper_type; RECT rc_notes; RECT rc_gm; RECT rc_gs; RECT rc_xg; RECT rc_head_rest; char current_time[30]; long current_time_sec; long tempo; int master_volume; int maxvoices; char instrument[TRACER_CHANNELS][256]; short bank[TRACER_CHANNELS]; short program[TRACER_CHANNELS]; int velocity[TRACER_CHANNELS]; short volume[TRACER_CHANNELS]; short expression[TRACER_CHANNELS]; short panning[TRACER_CHANNELS]; short sustain[TRACER_CHANNELS]; short pitch_bend[TRACER_CHANNELS]; short mod_wheel[TRACER_CHANNELS]; short chorus_effect[TRACER_CHANNELS]; short reverb_effect[TRACER_CHANNELS]; int8 tt[TRACER_CHANNELS]; char notes[TRACER_CHANNELS][256]; char filename[1024]; char titlename[1024]; int play_system_mode; ChannelBitMask quietchannels; ChannelBitMask channel_mute; int mapID[TRACER_CHANNELS]; HBRUSH hNullBrush; HPEN hNullPen; } w32g_tracer_wnd_t; extern void TracerWndReset(void); extern void TracerWndClear(int lockflag); extern void TracerWndPaintAll(int lockflag); extern void TracerWndPaintDo(int flag); extern w32g_tracer_wnd_t w32g_tracer_wnd; // section of ini file // [TracerWnd] // PosX = // PosY = typedef struct TRACERWNDINFO_ { HWND hwnd; int PosX; int PosY; int mode; } TRACERWNDINFO; extern TRACERWNDINFO TracerWndInfo; extern int INISaveTracerWnd(void); extern int INILoadTracerWnd(void); #endif /* __W32G_TRACER_H__ */ TiMidity++-2.13.2/interface/w32g_tracer.bmp0100644004711200001440000006304610020266340017461 0ustar tamukiusersBM&f6(< a(22@@@@____߿_ʦaaa;;;ssss88ss8sgfff&&&EsgsgP.Psswwwww      w       w  w      w        w     w           w           w        w   w wwwwww########!!!!!!!!!!!     !!!     !!!                             !!!!!!!!!!!!!!!!!!!!!!!!!!!################!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!   !   !!! !  !       !!!!    !  !!!!!!!!!!!!!!!!!!!!!!!!!!!!################!!!!!!!!!!!!!!  !!!!!!  !!!!!!                                                                                                                                           !!!!!!  !!!!!!!!!!!!!!!!!!!!!!!!################!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!            !            !         !     !     !       !     !           !              !           !              !      !!!!!!!!!!!!!!!!!!!!!!!!!########,,,,,,* **$* **$* **$* **$* **$* **$* **$* **$  "$   "&   "&   "&   "&   "&   "&   "&   "&   "&   "&,,,,,,,,,,,,#** #** #** #** #** #** #** #** #!  %! %! %! %! %! %! %! %! %! %! ,,,,,,,*    ,,,,G**G              G              G               G              G              G              G              G       G            G               G            G            G            G            G            G     GGG,,,G U              $ $ U              $ $ U                U                U                U                U                U                U                U7z                U7  z                U7  z                U7  z                U7  z                U7  z                U7  z                U7  z                U7  z                U7zU U    !"#U      U      U      U      U      U      U      UUU    U    U    U    U    U    U    U    UU U//01 ] _   ____[) _[) _Z(_TiMidity++-2.13.2/interface/w32g_mag.c0100644004711200001440000001545407550562340016426 0ustar tamukiusers/* TiMidity++ -- MIDI to WAVE converter and player Copyright (C) 1999-2002 Masanao Izumo Copyright (C) 1995 Tuukka Toivonen 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Macintosh interface for TiMidity by T.Nogami mac_mag.c Macintosh mag loader */ /* *X mag loader By Takanori Watanabe. Based on Mac mag loader. */ /* * W32G Interface mag loader By Daisuke Aoki on X mag loader. */ #ifdef HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ #include #include #include #include "timidity.h" #include "common.h" #include "w32g_mag.h" #include "controls.h" #include "wrd.h" #define BUFSIZE 512 static const char *MAGSIG="MAKI02 "; #define READSHORT(p) ((int)*(uint8*)((p)+1)*256+(int)*(uint8 *)(p)) #define READLONG(p) (\ (int)*(uint8*)((p)+3)*256*256*256+\ (int)*(uint8*)((p)+2)*256*256+\ (int)*(uint8*)((p)+1)*256+\ (int)*(uint8 *)(p)\ ) #define MAGHDRLEN 31 static void mag_delete(magdata *mg); static magdata *top=NULL; struct magfilehdr{ char machine; char mflag; char scrmode; char xorig[2]; char yorig[2]; char xend[2]; char yend[2]; char flagaoff[4]; char flagboff[4]; char flagbsize[4]; char pxloff[4]; char pxlsize[4]; }; static int read_flag_1line(magdata * mh,uint8 *flag ) { int x, flagA,flagB,j; j=0; for( x=0; x<=mh->xend-(mh->xorig/8*8); ){ flagA= mh->flagadata[mh->flagapos/8] & (0x80 >> (mh->flagapos & 0x07) ); mh->flagapos++; if( flagA ){ flagB= mh->flagbdata[mh->flagbpos++]; }else{ flagB= 0; } flag[x] ^= flagB>>4; x+=4;j++; flag[x] ^= flagB & 0x0F; x+=4;j++; } return j; } int pho_load_pixel ( char *image, int width, int height, char *filename) { int i,j,k,l; // static const int shift[4]={0,2,1,3};/*B,R,G,E*/ static const int shift[4]={0,1,2,3}; struct timidity_file *fp; char buffer[640/8]; if((fp=wrd_open_file(filename))==NULL) return 0; for(l=0;l<4;l++){ for(i=0;i<400;i++){ if(tf_read(buffer,sizeof(buffer),1,fp)==0){ goto close; } for(j=0;j= width * height ) { close_file(fp); return 0; } if ( ( buffer[j]<flagapos=mh->flagbpos=pxlpos=0; w = width; for( y=0; y<=mh->yend-mh->yorig; y++ ){ repl=read_flag_1line( mh,flag ); x=0; for( j=0; jpxldata[pxlpos]*256+mh->pxldata[pxlpos+1]; pxlpos+=2; for( i=3; i>=0; i-- ){ if(x+i < w) image [ x + i + y * width ] = pixels & 0x000F; pixels >>= 4; } } else { dx=DX[flag[x]]; dy=DY[flag[x]]; for(i=0;i<4;i++) { if(x+i < w) image [ x + i + y * width ] = image [ x+dx+i + (y+dy) * width ]; } } x+=4; } } } void mag_deletetab(void) { if(top!=NULL){ mag_delete(top); } top=NULL; } static void mag_delete(magdata *mg){ if(mg->next!=NULL) mag_delete(mg->next); free(mg->filename); free(mg->flagadata); free(mg->flagbdata); free(mg->pxldata); free(mg); } magdata *mag_search (char *filename ) { magdata *m; for(m=top;m!=NULL;m=m->next) if(strcmp(filename,m->filename)==0) return m; return NULL; } magdata *mag_create ( char *file ) { struct timidity_file *fp=NULL; int i; uint8 buffer[BUFSIZE]; int *pal; magdata mg,*res; struct magfilehdr mfh; int len,c,header_pos; char *flaga=NULL,*flagb=NULL,*pixels=NULL; if((res=mag_search(file))){ return res; } mg.filename=safe_malloc(strlen(file)+2); strcpy(mg.filename,file); fp=wrd_open_file(file); if(fp==NULL){ goto error; } header_pos=0; while((c=tf_getc(fp))!=0){ len=strlen(MAGSIG); if(header_poscmsg(CMSG_INFO,VERB_VERBOSE,"BAD SIGNATURE\n"); goto error; } } header_pos++; } /*READ FHDR*/ { if(tf_read(&mfh,sizeof(mfh),1,fp)==0){ fprintf(stderr,"FOO!\n"); goto error; } mg.machine=mfh.machine; mg.mflag=mfh.mflag; mg.scrmode=mfh.scrmode; mg.xorig=READSHORT(mfh.xorig); mg.yorig=READSHORT(mfh.yorig); mg.xend=READSHORT(mfh.xend); mg.yend=READSHORT(mfh.yend); mg.flagaoff=READLONG(mfh.flagaoff); mg.flagboff=READLONG(mfh.flagboff); mg.flagbsize=READLONG(mfh.flagbsize); mg.pxloff=READLONG(mfh.pxloff); mg.pxlsize=READLONG(mfh.pxlsize); } /*READ PALLET*/ // pal=mg.pal+1; pal=mg.pal; for(i=0;inext=top; top=res; return res; error: if(fp!=NULL) { close_file(fp); ctl->cmsg(CMSG_INFO,VERB_VERBOSE,"Mag error: %s\n", file); } free(mg.filename); if(flaga != NULL) free(flaga); if(flagb != NULL) free(flagb); if(pixels != NULL) free(pixels); return NULL; } TiMidity++-2.13.2/interface/w32g_mag.h0100644004711200001440000000315207476016206016425 0ustar tamukiusers/* TiMidity++ -- MIDI to WAVE converter and player Copyright (C) 1999-2002 Masanao Izumo Copyright (C) 1995 Tuukka Toivonen 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef __W32G_MAG_H__ #define __W32G_MAG_H__ typedef struct _magdata{ char *filename; char machine; char mflag; char scrmode; int xorig; int yorig; int xend; int yend; long flagaoff; long flagboff; long flagbsize; long pxloff; long pxlsize; long flagapos; long flagbpos; uint8 *flagadata; uint8 *flagbdata; uint8 *pxldata; struct _magdata *next; #define PALSIZE 16 int pal[PALSIZE+1]; } magdata; extern magdata *mag_create ( char *file ); extern void mag_deletetab ( void ); extern magdata *mag_search ( char *file ); extern void mag_load_pixel ( char *image, int width, int height, magdata *mh ); extern int pho_load_pixel ( char *image, int width, int height, char *filename ); #endif // __W32G_MAG_H__ TiMidity++-2.13.2/interface/w32g_dib.c0100644004711200001440000000660607502512344016413 0ustar tamukiusers#include #include #include #include "w32g_dib.h" w32g_dib_t *dib_create (int width, int height ) { BITMAPINFO bi; w32g_dib_t *dib; dib = (w32g_dib_t *) malloc ( sizeof (w32g_dib_t) ); if ( dib == NULL ) return NULL; memset ( dib, 0, sizeof (w32g_dib_t) ); memset ( &bi, 0, sizeof (BITMAPINFO) ); bi.bmiHeader.biSize = sizeof (BITMAPINFOHEADER); bi.bmiHeader.biWidth = width; bi.bmiHeader.biHeight = -height; bi.bmiHeader.biPlanes = 1; bi.bmiHeader.biBitCount = 8; bi.bmiHeader.biCompression = BI_RGB; bi.bmiHeader.biSizeImage = 0; bi.bmiHeader.biXPelsPerMeter= 0; bi.bmiHeader.biYPelsPerMeter= 0; bi.bmiHeader.biClrImportant = 0; bi.bmiHeader.biClrUsed = 0; dib->hbmp = CreateDIBSection ( NULL, &bi, DIB_RGB_COLORS, (void **)&dib->bits, NULL, 0); dib->width = width; dib->height = height; dib->pals_max = 16; dib->modified_rect_max = 0; return dib; } void dib_free ( w32g_dib_t *dib ) { if ( dib == NULL ) return; GdiFlush (); DeleteObject ( dib->hbmp ); free ( dib ); } void dib_add_modified_rect ( w32g_dib_t *dib, RECT *lprc ) { RECT rc; int i; for ( i = 0; i < dib->modified_rect_max; i ++ ) { if ( dib->modified_rect[i].left <= lprc->left && lprc->right <= dib->modified_rect[i].right && dib->modified_rect[i].top <= lprc->top && lprc->bottom <= dib->modified_rect[i].bottom ) return; } if ( dib->modified_rect_max >= W32G_DIB_MODIFIED_RECT_MAX ) { if ( UnionRect ( &rc, &dib->modified_rect[dib->modified_rect_max - 1], lprc ) ) memcpy ( &dib->modified_rect[dib->modified_rect_max - 1], &rc, sizeof (RECT) ); } else { memcpy ( &dib->modified_rect[dib->modified_rect_max], lprc, sizeof (RECT) ); dib->modified_rect_max++; } } void dib_modified_rect_whole ( w32g_dib_t *dib ) { dib->modified_rect_max = 1; SetRect ( &dib->modified_rect[0], 0, 0, dib->width, dib->height ); } void dib_set_pal1 ( w32g_dib_t *dib, int pal_index, RGBQUAD rq ) { HDC hmdc; if ( pal_index >= dib->pals_max ) return; if ( memcmp ( &dib->pals[pal_index], &rq, sizeof (RGBQUAD) ) == 0 ) return; memcpy ( &dib->pals[pal_index], &rq, sizeof (RGBQUAD) ); GdiFlush (); hmdc = CreateCompatibleDC ( (HDC)NULL ); SelectObject ( hmdc, dib->hbmp ); SetDIBColorTable ( hmdc, pal_index, 1, &dib->pals[pal_index] ); DeleteDC ( hmdc ); dib_modified_rect_whole ( dib ); } void dib_set_pals ( w32g_dib_t *dib, RGBQUAD *pals, int pals_max ) { int i; BOOL modified = FALSE; if ( pals_max <= 0 ) return; if ( pals_max >= dib->pals_max ) pals_max = dib->pals_max; for ( i = 0; i < pals_max; i ++ ) { if ( memcmp ( &dib->pals[i], &pals[i], sizeof (RGBQUAD) ) != 0 ) { memcpy ( &dib->pals[i], &pals[i], sizeof (RGBQUAD) ); modified = TRUE; } } if ( modified ) { HDC hmdc; GdiFlush (); hmdc = CreateCompatibleDC ( (HDC)NULL ); SelectObject ( hmdc, dib->hbmp ); SetDIBColorTable ( hmdc, 0, dib->pals_max, dib->pals ); DeleteDC ( hmdc ); dib_modified_rect_whole ( dib ); } } void dib_apply ( w32g_dib_t *dib, HDC hdc ) { HDC hmdc; int i; if ( dib->modified_rect_max <= 0 ) return; GdiFlush (); hmdc = CreateCompatibleDC ( hdc ); SelectObject ( hmdc, dib->hbmp ); for ( i = 0; i < dib->modified_rect_max; i++ ) { RECT *lprc = &dib->modified_rect[i]; BitBlt ( hdc, lprc->left, lprc->top, lprc->right - lprc->left, lprc->bottom - lprc->top, hmdc, lprc->left, lprc->top, SRCCOPY ); } dib->modified_rect_max = 0; DeleteDC ( hmdc ); } TiMidity++-2.13.2/interface/w32g_dib.h0100644004711200001440000000133507502512344016412 0ustar tamukiusers#ifndef __W32G_DIB_H__ #define __W32G_DIB_H__ #define W32G_DIB_PALS_MAX 16 #define W32G_DIB_MODIFIED_RECT_MAX 16 typedef struct w32g_dib_t_ { HBITMAP hbmp; int width; int height; char *bits; RGBQUAD pals[W32G_DIB_PALS_MAX]; int pals_max; RECT modified_rect[W32G_DIB_MODIFIED_RECT_MAX]; int modified_rect_max; } w32g_dib_t; w32g_dib_t *dib_create (int width, int height ); void dib_free ( w32g_dib_t *dib ); void dib_add_modified_rect ( w32g_dib_t *dib, RECT *lprc ); void dib_modified_rect_whole ( w32g_dib_t *dib ); void dib_set_pal1 ( w32g_dib_t *dib, int pal_index, RGBQUAD rq ); void dib_set_pals ( w32g_dib_t *dib, RGBQUAD *pals, int pals_max ); void dib_apply ( w32g_dib_t *dib, HDC hdc ); #endif // __W32G_DIB_H__ TiMidity++-2.13.2/interface/winsyn_c.c0100644004711200001440000002467710014231163016641 0ustar tamukiusers /* TiMidity++ -- MIDI to WAVE converter and player Copyright (C) 1999-2002 Masanao Izumo Copyright (C) 1995 Tuukka Toivonen 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA winsyn_c.c - Windows synthesizer interface Copyright (c) 2002 2003 Keishi Suenaga I referenced following sources. alsaseq_c.c - ALSA sequencer server interface Copyright (c) 2000 Takashi Iwai readmidi.c DESCRIPTION =========== This interface provides a Windows MIDI device interface which receives events and plays it in real-time. On this mode, TiMidity works purely as software (real-time) MIDI render. For invoking Windows synthesizer interface, run timidity as folows: % timidity -iW (interactively select an Input MIDI device) or % timidity -iW 2 (connect to MIDI device No. 2) TiMidity loads instruments dynamically at each time a PRM_CHANGE event is received. It sometimes causes a noise. If you are using a low power machine, invoke timidity as follows: % timidity -s 11025 -iW (set sampling freq. to 11025Hz) or % timidity -EFreverb=0 -iW (disable MIDI reverb effect control) TiMidity keeps all loaded instruments during executing. To use TiMidity as output device, you need a MIDI loopback device. I use MIDI Yoke. It can freely be obtained MIDI-OX site (http://www.midiox.com). */ //#define USE_PORTMIDI 1 //#define USE_GTK_GUI 1 #ifdef HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ #include "rtsyn.h" #ifdef USE_GTK_GUI #include "wsgtk_main.h" #endif #ifndef __W32__ #include #include //#include #include #endif #ifndef __W32__ static struct termios initial_settings, new_settings; static int peek_character = -1; #endif extern int volatile stream_max_compute; // play_event() compute_data() ŌvZő厞 int seq_quit=~0; static int ctl_open(int using_stdin, int using_stdout); static void ctl_close(void); static int ctl_read(int32 *valp); static int cmsg(int type, int verbosity_level, char *fmt, ...); static void ctl_event(CtlEvent *e); static void ctl_pass_playing_list(int n, char *args[]); #ifndef __W32__ static void init_keybord(void); static void close_keybord(void); static int kbhit(void); static char readch(void); #endif /**********************************/ /* export the interface functions */ #define ctl winsyn_control_mode ControlMode ctl= { "Windows Synthesizer interface", 'W', 1,0,0, 0, ctl_open, ctl_close, ctl_pass_playing_list, ctl_read, cmsg, ctl_event }; static int32 event_time_offset; static FILE *outfp; /*ARGSUSED*/ static int ctl_open(int using_stdin, int using_stdout) { ctl.opened = 1; ctl.flags &= ~(CTLF_LIST_RANDOM|CTLF_LIST_SORT); if (using_stdout) outfp = stderr; else outfp = stdout; return 0; } static void ctl_close(void) { fflush(outfp); if(seq_quit==0){ rtsyn_synth_stop(); rtsyn_close(); seq_quit=~0; } ctl.opened=0; } static int ctl_read(int32 *valp) { return RC_NONE; } #ifdef IA_W32G_SYN extern void PutsConsoleWnd(char *str); extern int ConsoleWndFlag; #endif static int cmsg(int type, int verbosity_level, char *fmt, ...) { #ifndef IA_W32G_SYN va_list ap; if ((type==CMSG_TEXT || type==CMSG_INFO || type==CMSG_WARNING) && ctl.verbosity MAX_PORT ){ printf( "Usage: timidity -iW [Midi interface No s]\n"); return; } #endif if(n>0){ port=0; while(port MAX_PORT); printf("\n"); printf("Opening Device drivers:"); printf("Available Midi Input devices:\n"); for(i=0;i 2000 ) { winplaymidi_sleep_level = 2; } } else if ( winplaymidi_sleep_level == 0 ) { winplaymidi_active_start_time = 0; } rtsyn_play_calculate(); if ( winplaymidi_sleep_level >= 2) { Sleep ( 100 ); } else if ( winplaymidi_sleep_level > 0 ) { Sleep ( 1 ); } } #endif /* * interface__loader(); */ ControlMode *interface_W_loader(void) { return &ctl; } TiMidity++-2.13.2/interface/rtsyn.h0100644004711200001440000001115407750165044016177 0ustar tamukiusers/* TiMidity++ -- MIDI to WAVE converter and player Copyright (C) 1999-2002 Masanao Izumo Copyright (C) 1995 Tuukka Toivonen 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA rtsyn.h Copyright (c) 2003 Keishi Suenaga I referenced following sources. alsaseq_c.c - ALSA sequencer server interface Copyright (c) 2000 Takashi Iwai readmidi.c */ #include "interface.h" #include #include #ifdef HAVE_UNISTD_H #include #endif #include #ifdef TIME_WITH_SYS_TIME #include #endif #ifndef NO_STRING_H #include #else #include #endif #include #include #include "server_defs.h" #ifdef __W32__ #include #include #endif #if !defined(__MACOS__) #define USE_WINSYN_TIMER_I 1 #ifndef __W32__ #include #ifdef HAVE_STDLIB_H #include #endif #endif #endif #include "timidity.h" #include "common.h" #include "controls.h" #include "instrum.h" #include "playmidi.h" #include "readmidi.h" #include "recache.h" #include "output.h" #include "aq.h" #include "timer.h" #define USE_PORTMIDI 1 /******************************************************************************/ /* */ /* Interface independent functions (see rtsyn_common.c) */ /* */ /******************************************************************************/ /* peek playmidi.c */ extern int32 current_sample; extern FLOAT_T midi_time_ratio; /* peek timidity.c */ extern VOLATILE int intr; /* How often play data. */ #define TICKTIME_HZ 100 extern double rtsyn_reachtime; extern int rtsyn_system_mode; /* reset synth */ void rtsyn_gm_reset(void); void rtsyn_gs_reset(void); void rtsyn_xg_reset(void); void rtsyn_normal_reset(void); /* mode change * * only in nomalmode program can accept reset(sysex) data */ void rtsyn_gm_modeset(void); void rtsyn_gs_modeset(void); void rtsyn_xg_modeset(void); void rtsyn_normal_modeset(void); void rtsyn_init(void); void rtsyn_close(void); void rtsyn_play_event(MidiEvent *ev); void rtsyn_server_reset(void); void rtsyn_reset(void); void rtsyn_stop_playing(void); int rtsyn_play_one_data (int port, int32 dwParam1); void rtsyn_play_one_sysex (char *sysexbuffer, int exlen ); void rtsyn_play_calculate(void); /******************************************************************************/ /* */ /* Interface dependent functions (see rtsyn_winmm.c rtsyn_portmidi.c) */ /* */ /******************************************************************************/ #define MAX_PORT 4 extern int rtsyn_portnumber; extern unsigned int portID[MAX_PORT]; extern char rtsyn_portlist[32][80]; extern int rtsyn_nportlist; void rtsyn_get_port_list(void); int rtsyn_synth_start(void); void rtsyn_synth_stop(void); int rtsyn_play_some_data (void); void rtsyn_midiports_close(void); #if defined(IA_WINSYN) || defined(IA_W32G_SYN) int rtsyn_buf_check(void); #endif #ifdef USE_WINSYN_TIMER_I #if defined(__W32__) typedef CRITICAL_SECTION rtsyn_mutex_t; #define rtsyn_mutex_init(_m) InitializeCriticalSection(&_m) #define rtsyn_mutex_destroy(_m) DeleteCriticalSection(&_m) #define rtsyn_mutex_lock(_m) EnterCriticalSection(&_m) #define rtsyn_mutex_unlock(_m) LeaveCriticalSection(&_m) #else typedef pthread_mutex_t rtsyn_mutex_t; #define rtsyn_mutex_init(_m) pthread_mutex_init(&(_m), NULL) #define rtsyn_mutex_destroy(_m) pthread_mutex_destroy(&(_m)) #define rtsyn_mutex_lock(_m) pthread_mutex_lock(&(_m)) #define rtsyn_mutex_unlock(_m) pthread_mutex_unlock(&(_m)) #endif #endif TiMidity++-2.13.2/interface/rtsyn_common.c0100644004711200001440000003413110073674564017546 0ustar tamukiusers/* TiMidity++ -- MIDI to WAVE converter and player Copyright (C) 1999-2004 Masanao Izumo Copyright (C) 1995 Tuukka Toivonen 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA rtsyn_common.c Copyright (c) 2003 Keishi Suenaga I referenced following sources. alsaseq_c.c - ALSA sequencer server interface Copyright (c) 2000 Takashi Iwai readmidi.c */ #ifdef HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ #include "interface.h" #include #include #ifdef HAVE_UNISTD_H #include #endif #include #ifdef TIME_WITH_SYS_TIME #include #endif #ifndef NO_STRING_H #include #else #include #endif #include #include #include "server_defs.h" #ifdef __W32__ #include #endif #include "timidity.h" #include "common.h" #include "controls.h" #include "instrum.h" #include "playmidi.h" #include "readmidi.h" #include "recache.h" #include "output.h" #include "aq.h" #include "timer.h" #include "rtsyn.h" //int seq_quit; int rtsyn_system_mode=DEFAULT_SYSTEM_MODE; static int32 event_time_offset; static double starttime; double rtsyn_reachtime; static int time_advance; static int set_time_first=2; //acitive sensing static int active_sensing_flag=0; static double active_sensing_time=0; //timer interrupt #ifdef USE_WINSYN_TIMER_I rtsyn_mutex_t timerMUTEX; #ifdef __W32__ MMRESULT timerID; #else pthread_t timer_thread; int thread_on_f=0; #endif #endif #define EX_RESET_NO 7 static char sysex_resets[EX_RESET_NO][11]={ '\xf0','\x7e','\x7f','\x09','\x00','\xf7','\x00','\x00','\x00','\x00','\x00', '\xf0','\x7e','\x7f','\x09','\x01','\xf7','\x00','\x00','\x00','\x00','\x00', '\xf0','\x7e','\x7f','\x09','\x03','\xf7','\x00','\x00','\x00','\x00','\x00', '\xf0','\x41','\x10','\x42','\x12','\x40','\x00','\x7f','\x00','\x41','\xf7', '\xf0','\x41','\x10','\x42','\x12','\x00','\x00','\x7f','\x00','\x01','\xf7', '\xf0','\x41','\x10','\x42','\x12','\x00','\x00','\x7f','\x01','\x00','\xf7', '\xf0','\x43','\x10','\x4c','\x00','\x00','\x7E','\x00','\xf7','\x00','\x00' }; /* #define EX_RESET_NO 9 static char sysex_resets[EX_RESET_NO][11]={ '\xf0','\x7e','\x7f','\x09','\x00','\xf7','\x00','\x00','\x00','\x00','\x00', //gm off '\xf0','\x7e','\x7f','\x09','\x01','\xf7','\x00','\x00','\x00','\x00','\x00', //gm1 '\xf0','\x7e','\x7f','\x09','\x02','\xf7','\x00','\x00','\x00','\x00','\x00', //gm off '\xf0','\x7e','\x7f','\x09','\x03','\xf7','\x00','\x00','\x00','\x00','\x00', //gm2 '\xf0','\x41','\x10','\x42','\x12','\x40','\x00','\x7f','\x00','\x41','\xf7', //GS '\xf0','\x41','\x10','\x42','\x12','\x40','\x00','\x7f','\x7f','\x41','\xf7', //GS off '\xf0','\x41','\x10','\x42','\x12','\x00','\x00','\x7f','\x00','\x01','\xf7', //88 '\xf0','\x41','\x10','\x42','\x12','\x00','\x00','\x7f','\x01','\x00','\xf7', //88 '\xf0','\x43','\x10','\x4c','\x00','\x00','\x7E','\x00','\xf7','\x00','\x00' //XG on }; */ static void seq_set_time(MidiEvent *ev); void rtsyn_gm_reset(){ MidiEvent ev; rtsyn_server_reset(); ev.type=ME_RESET; ev.a=GM_SYSTEM_MODE; rtsyn_play_event(&ev); } void rtsyn_gs_reset(){ MidiEvent ev; rtsyn_server_reset(); ev.type=ME_RESET; ev.a=GS_SYSTEM_MODE; rtsyn_play_event(&ev); } void rtsyn_xg_reset(){ MidiEvent ev; rtsyn_server_reset(); ev.type=ME_RESET; ev.a=XG_SYSTEM_MODE; ev.time=0; rtsyn_play_event(&ev); } void rtsyn_normal_reset(){ MidiEvent ev; rtsyn_server_reset(); ev.type=ME_RESET; ev.a=rtsyn_system_mode; rtsyn_play_event(&ev); } void rtsyn_gm_modeset(){ MidiEvent ev; rtsyn_server_reset(); rtsyn_system_mode=GM_SYSTEM_MODE; ev.type=ME_RESET; ev.a=GM_SYSTEM_MODE; rtsyn_play_event(&ev); change_system_mode(rtsyn_system_mode); } void rtsyn_gs_modeset(){ MidiEvent ev; rtsyn_server_reset(); rtsyn_system_mode=GS_SYSTEM_MODE; ev.type=ME_RESET; ev.a=GS_SYSTEM_MODE; rtsyn_play_event(&ev); change_system_mode(rtsyn_system_mode); } void rtsyn_xg_modeset(){ MidiEvent ev; rtsyn_server_reset(); rtsyn_system_mode=XG_SYSTEM_MODE; ev.type=ME_RESET; ev.a=XG_SYSTEM_MODE; rtsyn_play_event(&ev); change_system_mode(rtsyn_system_mode); } void rtsyn_normal_modeset(){ MidiEvent ev; rtsyn_server_reset(); rtsyn_system_mode=DEFAULT_SYSTEM_MODE; ev.type=ME_RESET; ev.a=GS_SYSTEM_MODE; rtsyn_play_event(&ev); change_system_mode(rtsyn_system_mode); } #ifdef USE_WINSYN_TIMER_I #ifdef __W32__ VOID CALLBACK timercalc(UINT uTimerID, UINT uMsg, DWORD dwUser, DWORD dummy1, DWORD dummy2){ MidiEvent ev; double time_div, currenttime; rtsyn_mutex_lock(timerMUTEX); currenttime=get_current_calender_time(); time_div=currenttime-starttime; if( time_div > 1.0/TICKTIME_HZ*2.0){ time_div= 1.0/TICKTIME_HZ-3/(play_mode->rate); } ev.time= ((double)current_sample + (play_mode->rate)*time_div+0.5); starttime=currenttime; ev.type = ME_NONE; play_event(&ev); // compute_data(tmdy_struct,(tmdy_struct->output->play_mode->rate)*time_div); aq_fill_nonblocking(); rtsyn_reachtime=currenttime + (double)(1.0f/TICKTIME_HZ); rtsyn_mutex_unlock(timerMUTEX); return; } #else void *timercalc(void *arg){ MidiEvent ev; unsigned int slt; double reachtime,delay; delay=(double)(1.0/TICKTIME_HZ); while(thread_on_f==1){ rtsyn_mutex_lock(timerMUTEX); reachtime=get_current_calender_time()+delay; ev.type = ME_NONE; seq_set_time(&ev); play_event(&ev); aq_fill_nonblocking(); rtsyn_mutex_unlock(timerMUTEX); do{ sleep(0); }while(get_current_calender_time()rate/TICKTIME_HZ*2; if (!(play_mode->encoding & PE_MONO)) time_advance >>= 1; if (play_mode->encoding & PE_24BIT) time_advance /= 3; else if (play_mode->encoding & PE_16BIT) time_advance >>= 1; i = current_keysig + ((current_keysig < 8) ? 7 : -9), j = 0; while (i != 7) i += (i < 7) ? 5 : -7, j++; j += note_key_offset, j -= floor(j / 12.0) * 12; current_freq_table = j; #ifdef USE_WINSYN_TIMER_I rtsyn_mutex_init(timerMUTEX); #ifdef __W32__ timeBeginPeriod(1); { DWORD data = 0; UINT delay; delay=(1000/TICKTIME_HZ); timerID = timeSetEvent( delay, 0, timercalc, data, TIME_PERIODIC | TIME_CALLBACK_FUNCTION ); if( !timerID ){ ctl->cmsg( CMSG_ERROR, VERB_NORMAL,"Fail to setup Timer Interrupt (winsyn) \n"); } } #else thread_on_f=1; if(0!=pthread_create(&timer_thread,NULL,timercalc,NULL)){ ctl->cmsg( CMSG_ERROR, VERB_NORMAL,"Fail to setup Timer Interrupt (winsyn) \n"); } #endif #endif rtsyn_server_reset(); } void rtsyn_close(void){ #ifdef USE_WINSYN_TIMER_I #ifdef __W32__ timeKillEvent( timerID ); timeEndPeriod(1); #else thread_on_f=0; pthread_join(timer_thread, NULL); #endif rtsyn_mutex_destroy(timerMUTEX); #endif } void rtsyn_play_event(MidiEvent *ev) { int gch; int32 cet; #ifdef USE_WINSYN_TIMER_I rtsyn_mutex_lock(timerMUTEX); #endif gch = GLOBAL_CHANNEL_EVENT_TYPE(ev->type); if(gch || !IS_SET_CHANNELMASK(quietchannels, ev->channel) ){ // if ( !seq_quit ) { ev->time=0; play_event(ev); // } } #ifdef USE_WINSYN_TIMER_I rtsyn_mutex_unlock(timerMUTEX); #endif } void rtsyn_reset(void){ rtsyn_stop_playing(); #ifdef USE_WINSYN_TIMER_I rtsyn_mutex_lock(timerMUTEX); #endif free_instruments(0); //also in rtsyn_server_reset free_global_mblock(); #ifdef USE_WINSYN_TIMER_I rtsyn_mutex_unlock(timerMUTEX); #endif rtsyn_server_reset(); // printf("system reseted\n"); } void rtsyn_server_reset(void){ #ifdef USE_WINSYN_TIMER_I rtsyn_mutex_lock(timerMUTEX); #endif play_mode->close_output(); // PM_REQ_PLAY_START wlll called in playmidi_stream_init() play_mode->open_output(); // but w32_a.c does not have it. readmidi_read_init(); playmidi_stream_init(); starttime=get_current_calender_time(); reduce_voice_threshold = 0; // * Disable auto reduction voice * auto_reduce_polyphony = 0; event_time_offset = 0; #ifdef USE_WINSYN_TIMER_I rtsyn_mutex_unlock(timerMUTEX); #endif } void rtsyn_stop_playing(void) { if(upper_voices) { MidiEvent ev; ev.type = ME_EOT; ev.a = 0; ev.b = 0; rtsyn_play_event(&ev); #ifdef USE_WINSYN_TIMER_I rtsyn_mutex_lock(timerMUTEX); #endif aq_flush(1); #ifdef USE_WINSYN_TIMER_I rtsyn_mutex_unlock(timerMUTEX); #endif } } extern int32 current_sample; extern FLOAT_T midi_time_ratio; extern int volatile stream_max_compute; static void seq_set_time(MidiEvent *ev) { double currenttime, time_div; currenttime=get_current_calender_time(); time_div=currenttime-starttime; ev->time=((double) current_sample + (play_mode->rate)*time_div+0.5); starttime=currenttime; rtsyn_reachtime=currenttime + (double)(1.0f/TICKTIME_HZ); } #if 0 static void seq_set_time(MidiEvent *ev) { double past_time,btime; static int shift=0; if(set_time_first==2){ starttime=get_current_calender_time()-(double)current_sample/(double)play_mode->rate; } past_time = (int32)((get_current_calender_time() - starttime)*play_mode->rate); // printf("%f,%f\n",(double)past_time,( (double)current_sample-(double)past_time ) ); if (set_time_first==1){ shift=(double)past_time-(double)current_sample; /// printf("%d\n",shift); } if (set_time_first>0) set_time_first--; event_time_offset=play_mode->rate/TICKTIME_HZ; ev->time = past_time; if(set_time_first==0 && (past_time-current_sample>stream_max_compute*play_mode->rate/1000)){ starttime=get_current_calender_time()-(double)(current_sample+shift)/(double)play_mode->rate; ev->time=current_sample+shift; } ev->time += (int32)event_time_offset; rtsyn_reachtime=get_current_calender_time()+ (double)(1.0f/TICKTIME_HZ); #if 0 btime = (double)((ev->time-current_sample/midi_time_ratio)/play_mode->rate); btime *= 1.01; /* to be sure */ aq_set_soft_queue(btime, 0.0); #endif } #endif void rtsyn_play_calculate(){ MidiEvent ev; #ifndef USE_WINSYN_TIMER_I ev.type = ME_NONE; seq_set_time(&ev); play_event(&ev); aq_fill_nonblocking(); #endif if(active_sensing_flag==~0 && (get_current_calender_time() > active_sensing_time+0.5)){ //normaly acitive sensing expiering time is 330ms(>300ms) but this loop is heavy play_mode->close_output(); play_mode->open_output(); ctl->cmsg( CMSG_ERROR, VERB_NORMAL,"Active Sensing Expired\n"); active_sensing_flag=0; } } int rtsyn_play_one_data (int port, int32 dwParam1){ MidiEvent ev; ev.type = ME_NONE; ev.channel = dwParam1 & 0x0000000f; ev.channel = ev.channel+port*16; ev.a = (dwParam1 >> 8) & 0xff; ev.b = (dwParam1 >> 16) & 0xff; switch ((int) (dwParam1 & 0x000000f0)) { case 0x80: ev.type = ME_NOTEOFF; // rtsyn_play_event(&ev); break; case 0x90: ev.type = (ev.b) ? ME_NOTEON : ME_NOTEOFF; // rtsyn_play_event(&ev); break; case 0xa0: ev.type = ME_KEYPRESSURE; // rtsyn_play_event(&ev); break; case 0xb0: if (! convert_midi_control_change(ev.channel, ev.a, ev.b, &ev)) ev.type = ME_NONE; break; case 0xc0: ev.type = ME_PROGRAM; // rtsyn_play_event(&ev); break; case 0xd0: ev.type = ME_CHANNEL_PRESSURE; // rtsyn_play_event(&ev); break; case 0xe0: ev.type = ME_PITCHWHEEL; // rtsyn_play_event(&ev); break; case 0xf0: #ifdef IA_PORTMIDISYN if ( (dwParam1 & 0x000000ff) == 0xf0) { //SysEx return 1; } #endif if ((dwParam1 & 0x000000ff) == 0xf2) { ev.type = ME_PROGRAM; // rtsyn_play_event(&ev); } #if 0 if ((dwParam1 & 0x000000ff) == 0xf1) //MIDI Time Code Qtr. Frame (not need) printf("MIDI Time Code Qtr\n"); if ((dwParam1 & 0x000000ff) == 0xf3) //Song Select(Song #) (not need) if ((dwParam1 & 0x000000ff) == 0xf6) //Tune request (not need) printf("Tune request\n"); if ((dwParam1 & 0x000000ff) == 0xf8) //Timing Clock (not need) printf("Timing Clock\n"); if ((dwParam1&0x000000ff)==0xfa) //Start if ((dwParam1 & 0x000000ff) == 0xfb) //Continue if ((dwParam1 & 0x000000ff) == 0xfc) { //Stop printf("Stop\n"); } #endif if ((dwParam1 & 0x000000ff) == 0xfe) { //Active Sensing // printf("Active Sensing\n"); active_sensing_flag = ~0; active_sensing_time = get_current_calender_time(); } if ((dwParam1 & 0x000000ff) == 0xff) { //System Reset printf("System Reset\n"); } break; default: // printf("Unsup/ed event %d\n", aevp->type); break; } if (ev.type != ME_NONE) { rtsyn_play_event(&ev); } return 0; } void rtsyn_play_one_sysex (char *sysexbuffer, int exlen ){ int i,j,chk,ne; MidiEvent ev; MidiEvent evm[260]; if(sysexbuffer[exlen-1] == '\xf7'){ // I don't konw why this need for(i=0;i Copyright (C) 1995 Tuukka Toivonen 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA rtsyn_winmm.c Copyright (c) 2003 Keishi Suenaga I referenced following sources. alsaseq_c.c - ALSA sequencer server interface Copyright (c) 2000 Takashi Iwai readmidi.c */ #ifdef HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ #include "interface.h" #include #include #ifdef HAVE_UNISTD_H #include #endif #include #ifdef TIME_WITH_SYS_TIME #include #endif #ifndef NO_STRING_H #include #else #include #endif #include #include #include "server_defs.h" #ifdef __W32__ #include #include #endif #include "timidity.h" #include "common.h" #include "controls.h" #include "instrum.h" #include "playmidi.h" #include "readmidi.h" #include "recache.h" #include "output.h" #include "aq.h" #include "timer.h" #include "rtsyn.h" int rtsyn_portnumber=1; unsigned int portID[MAX_PORT]; char rtsyn_portlist[32][80]; int rtsyn_nportlist; #define MAX_EXBUF 20 #define BUFF_SIZE 512 UINT InNum; HMIDIIN hMidiIn[MAX_PORT]; HMIDIOUT hMidiOut[MAX_PORT]; MIDIHDR *IMidiHdr[MAX_PORT][MAX_EXBUF]; char sIMidiHdr[MAX_PORT][MAX_EXBUF][sizeof(MIDIHDR)]; char sImidiHdr_data[MAX_PORT][MAX_EXBUF][BUFF_SIZE]; struct evbuf_t{ int status; UINT wMsg; DWORD dwInstance; DWORD dwParam1; DWORD dwParam2; }; #define EVBUFF_SIZE 512 struct evbuf_t evbuf[EVBUFF_SIZE]; UINT evbwpoint=0; UINT evbrpoint=0; UINT evbsysexpoint; UINT mvbuse=0; enum{B_OK, B_WORK, B_END}; void CALLBACK MidiInProc(HMIDIIN,UINT,DWORD,DWORD,DWORD); void rtsyn_get_port_list(){ int i; MIDIINCAPS InCaps; InNum = midiInGetNumDevs(); for (i=1;i <=InNum && i<=32;i++){ midiInGetDevCaps(i-1,(LPMIDIINCAPSA) &InCaps,sizeof(InCaps)); sprintf(rtsyn_portlist[i-1],"%d:%s",i,(LPSTR)InCaps.szPname); } rtsyn_nportlist=i-1; } int rtsyn_synth_start(){ int i; UINT port; MidiEvent ev; #ifdef __W32__ DWORD processPriority; processPriority = GetPriorityClass(GetCurrentProcess()); #endif rtsyn_reset(); rtsyn_system_mode=DEFAULT_SYSTEM_MODE; change_system_mode(rtsyn_system_mode); ev.type=ME_RESET; ev.a=GS_SYSTEM_MODE; //GM is mor better ??? rtsyn_play_event(&ev); port=0; for(port=0;portlpData = sImidiHdr_data[port][i]; memset((IMidiHdr[port][i]->lpData),0,BUFF_SIZE); IMidiHdr[port][i]->dwBufferLength = BUFF_SIZE; } } evbuf[0].status=B_END; evbwpoint=0; evbrpoint=0; mvbuse=0; for(port=0;portcmsg( CMSG_ERROR, VERB_NORMAL, "midiInStarterror\n" ); return 0; } void rtsyn_synth_stop(){ rtsyn_stop_playing(); // play_mode->close_output(); rtsyn_midiports_close(); return; } void rtsyn_midiports_close(void){ UINT port; for(port=0;portcmsg( CMSG_ERROR, VERB_NORMAL,"MIDI Stop Error\n"); if( MMSYSERR_NOERROR!=midiInReset(hMidiIn[port]) ) ctl->cmsg( CMSG_ERROR, VERB_NORMAL,"MIDI Rest Error\n"); if( MMSYSERR_NOERROR!=midiInClose(hMidiIn[port]) ) ctl->cmsg( CMSG_ERROR, VERB_NORMAL,"MIDI Close Error\n"); } } int rtsyn_buf_check(void){ if( (evbuf[evbrpoint].status==B_OK)&&(evbrpoint!=evbwpoint) ){ return ~0; }else{ return 0; } } int rtsyn_play_some_data(void){ UINT wMsg; DWORD dwInstance; DWORD dwParam1; DWORD dwParam2; MidiEvent ev; MidiEvent evm[260]; int port; UINT evbpoint; MIDIHDR *IIMidiHdr; int exlen; char *sysexbuffer; int ne,i,j,chk,played; played=0; #ifndef USE_WINSYN_TIMER_I do{ Sleep(1); #endif if( !(evbuf[evbrpoint].status==B_OK)&&(evbrpoint!=evbwpoint) ) played=~0; while( (evbuf[evbrpoint].status==B_OK)&&(evbrpoint!=evbwpoint) ){ evbpoint=evbrpoint; if (++evbrpoint >= EVBUFF_SIZE) evbrpoint -= EVBUFF_SIZE; wMsg=evbuf[evbpoint].wMsg; dwInstance=evbuf[evbpoint].dwInstance; dwParam1=evbuf[evbpoint].dwParam1; dwParam2=evbuf[evbpoint].dwParam2; port=(UINT)dwInstance; switch (wMsg) { case MIM_DATA: rtsyn_play_one_data (port, dwParam1); break; case MIM_LONGDATA: IIMidiHdr = (MIDIHDR *) dwParam1; exlen=(int)IIMidiHdr->dwBytesRecorded; sysexbuffer=IIMidiHdr->lpData; rtsyn_play_one_sysex (sysexbuffer,exlen ); if (MMSYSERR_NOERROR != midiInUnprepareHeader( hMidiIn[port], IIMidiHdr, sizeof(MIDIHDR))) ctl->cmsg( CMSG_ERROR, VERB_NORMAL,"error1\n"); if (MMSYSERR_NOERROR != midiInPrepareHeader( hMidiIn[port], IIMidiHdr, sizeof(MIDIHDR))) ctl->cmsg( CMSG_ERROR, VERB_NORMAL,"error5\n"); if (MMSYSERR_NOERROR != midiInAddBuffer( hMidiIn[port], IIMidiHdr, sizeof(MIDIHDR))) ctl->cmsg( CMSG_ERROR, VERB_NORMAL,"error6\n"); break; } } #ifndef USE_WINSYN_TIMER_I }while(rtsyn_reachtime>get_current_calender_time()); #endif return played; } void CALLBACK MidiInProc(HMIDIIN hMidiInL, UINT wMsg, DWORD dwInstance, DWORD dwParam1, DWORD dwParam2) { UINT evbpoint; UINT port; port=(UINT)dwInstance; switch (wMsg) { case MIM_DATA: case MIM_LONGDATA: evbpoint = evbwpoint; if (++evbwpoint >= EVBUFF_SIZE) evbwpoint -= EVBUFF_SIZE; evbuf[evbwpoint].status = B_END; evbuf[evbpoint].status = B_WORK; evbuf[evbpoint].wMsg = wMsg; evbuf[evbpoint].dwInstance = dwInstance; evbuf[evbpoint].dwParam1 = dwParam1; evbuf[evbpoint].dwParam2 = dwParam2; evbuf[evbpoint].status = B_OK; break; case MIM_OPEN: // ctl->cmsg( CMSG_ERROR, VERB_NORMAL,"MIM_OPEN\n"); break; case MIM_CLOSE: // ctl->cmsg( CMSG_ERROR, VERB_NORMAL,"MIM_CLOSE\n"); break; case MIM_LONGERROR: ctl->cmsg( CMSG_ERROR, VERB_NORMAL,"MIM_LONGERROR\n"); break; case MIM_ERROR: ctl->cmsg( CMSG_ERROR, VERB_NORMAL,"MIM_ERROR\n"); break; case MIM_MOREDATA: ctl->cmsg( CMSG_ERROR, VERB_NORMAL,"MIM_MOREDATA\n"); break; } } TiMidity++-2.13.2/interface/rtsyn_portmidi.c0100644004711200001440000001343307745454043020107 0ustar tamukiusers/* TiMidity++ -- MIDI to WAVE converter and player Copyright (C) 1999-2002 Masanao Izumo Copyright (C) 1995 Tuukka Toivonen 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA rtsyn_portmidi.c Copyright (c) 2003 Keishi Suenaga I referenced following sources. alsaseq_c.c - ALSA sequencer server interface Copyright (c) 2000 Takashi Iwai readmidi.c */ #ifdef HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ #include "interface.h" #include #include #ifdef HAVE_UNISTD_H #include #endif #include #ifdef TIME_WITH_SYS_TIME #include #endif #ifndef NO_STRING_H #include #else #include #endif #include #include #include "server_defs.h" #ifdef __W32__ #include #endif #include #include #include "timidity.h" #include "common.h" #include "controls.h" #include "instrum.h" #include "playmidi.h" #include "readmidi.h" #include "recache.h" #include "output.h" #include "aq.h" #include "timer.h" #include "rtsyn.h" int rtsyn_portnumber=1; unsigned int portID[MAX_PORT]; char rtsyn_portlist[32][80]; int rtsyn_nportlist; #define MAX_EXBUF 20 #define BUFF_SIZE 512 PmError pmerr; static unsigned int InNum; struct midistream_t{ PortMidiStream* stream; }; static struct midistream_t midistream[MAX_PORT]; //static PmDeviceID portID[MAX_PORT]; #define PMBUFF_SIZE 8192 #define EXBUFF_SIZE 512 static PmEvent pmbuffer[PMBUFF_SIZE]; static char sysexbuffer[EXBUFF_SIZE]; void rtsyn_get_port_list(){ int i,j; PmDeviceInfo *deviceinfo; pmerr=Pm_Initialize(); if( pmerr != pmNoError ) goto pmerror; InNum = Pm_CountDevices(); j=0; for (i=1;i <=InNum && i<=32;i++){ deviceinfo=(PmDeviceInfo *)Pm_GetDeviceInfo(i-1); if(TRUE==deviceinfo->input){ sprintf(rtsyn_portlist[j],"%d:%s",i,deviceinfo->name); j++; } } rtsyn_nportlist=j; Pm_Terminate(); return; pmerror: Pm_Terminate(); ctl->cmsg( CMSG_ERROR, VERB_NORMAL, "PortMIDI error: %s\n", Pm_GetErrorText( pmerr ) ); return; } int rtsyn_synth_start(){ int i; unsigned int port; MidiEvent ev; rtsyn_reset(); rtsyn_system_mode=DEFAULT_SYSTEM_MODE; change_system_mode(rtsyn_system_mode); ev.type=ME_RESET; ev.a=GS_SYSTEM_MODE; //GM is mor better ??? rtsyn_play_event(&ev); port=0; pmerr=Pm_Initialize(); if( pmerr != pmNoError ) goto pmerror; for(port=0;portcmsg( CMSG_ERROR, VERB_NORMAL, "PortMIDI error: %s\n", Pm_GetErrorText( pmerr ) ); return 0; } void rtsyn_synth_stop(){ rtsyn_stop_playing(); // play_mode->close_output(); rtsyn_midiports_close(); return; pmerror: Pm_Terminate(); ctl->cmsg( CMSG_ERROR, VERB_NORMAL, "PortMIDI error: %s\n", Pm_GetErrorText( pmerr ) ); return ; } void rtsyn_midiports_close(void){ unsigned int port; for(port=0;port> shift) & 0x0FF; sysexbuffer[j++]=data; } if(data!=0x0f7){ if(pmbpoint>=pmlength){ { pmerr=Pm_Read(midistream[port].stream, pmbuffer, PMBUFF_SIZE); if(pmerr<0){goto pmerror; } sleep(0); }while(pmerr==8); pmlength=pmerr; pmbpoint=0; } while(j> shift) & 0x0FF; sysexbuffer[j++]=data; } pmbpoint++; if(data==0x0f7) break; if( pmbpoint>=pmlength ){ { pmerr=Pm_Read(midistream[port].stream, pmbuffer, PMBUFF_SIZE); if(pmerr<0){goto pmerror;} sleep(0); }while(pmerr==0); pmlength=pmerr; pmbpoint=0; } } } exlen=j; rtsyn_play_one_sysex (sysexbuffer,exlen ); } } } }while(rtsyn_reachtime>get_current_calender_time()); return played; pmerror: Pm_Terminate(); ctl->cmsg( CMSG_ERROR, VERB_NORMAL, "PortMIDI error: %s\n", Pm_GetErrorText( pmerr ) ); return 0; } TiMidity++-2.13.2/interface/portmidisyn_c.c0100644004711200001440000002513707750130055017676 0ustar tamukiusers /* TiMidity++ -- MIDI to WAVE converter and player Copyright (C) 1999-2002 Masanao Izumo Copyright (C) 1995 Tuukka Toivonen 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA portmidisyn_c.c - PortMIDI synthesizer interface Copyright (c) 2003 Keishi Suenaga I referenced following sources. alsaseq_c.c - ALSA sequencer server interface Copyright (c) 2000 Takashi Iwai readmidi.c DESCRIPTION =========== This interface provides a Portmidi MIDI device interface which receives events and plays it in real-time. On this mode, TiMidity works purely as software (real-time) MIDI render. For invoking PrtMIDI synthesizer interface, run timidity as folows: % timidity -iP (interactively select an Input MIDI device) or % timidity -iP 2 (connect to MIDI device No. 2) TiMidity loads instruments dynamically at each time a PRM_CHANGE event is received. It sometimes causes a noise. If you are using a low power machine, invoke timidity as follows: % timidity -s 11025 -iP (set sampling freq. to 11025Hz) or % timidity -EFreverb=0 -iP (disable MIDI reverb effect control) TiMidity keeps all loaded instruments during executing. To use TiMidity as output device, you need a MIDI loopback device. (for windows) I use MIDI Yoke. It can freely be obtained MIDI-OX site (http://www.midiox.com). (for ALSA) You can easily meke it. See MIDI router section of Alsa 0.9.0 howto (http://www.suse.de/~mana/alsa090_howto.html#sect05 ). */ //#define USE_PORTMIDI 1 //#define USE_GTK_GUI 1 #ifdef HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ #include "rtsyn.h" #ifdef USE_GTK_GUI #include "wsgtk_main.h" #endif #ifndef __W32__ #include #include //#include #include #endif #ifndef __W32__ static struct termios initial_settings, new_settings; static int peek_character = -1; #endif extern int volatile stream_max_compute; // play_event() compute_data() ŌvZő厞 int seq_quit=~0; static int ctl_open(int using_stdin, int using_stdout); static void ctl_close(void); static int ctl_read(int32 *valp); static int cmsg(int type, int verbosity_level, char *fmt, ...); static void ctl_event(CtlEvent *e); static void ctl_pass_playing_list(int n, char *args[]); #ifndef __W32__ static void init_keybord(void); static void close_keybord(void); static int kbhit(void); static char readch(void); #endif /**********************************/ /* export the interface functions */ #define ctl portmidisyn_control_mode ControlMode ctl= { "PortMIDI Synthesizer interface", 'P', 1,0,0, 0, ctl_open, ctl_close, ctl_pass_playing_list, ctl_read, cmsg, ctl_event }; static int32 event_time_offset; static FILE *outfp; /*ARGSUSED*/ static int ctl_open(int using_stdin, int using_stdout) { ctl.opened = 1; ctl.flags &= ~(CTLF_LIST_RANDOM|CTLF_LIST_SORT); if (using_stdout) outfp = stderr; else outfp = stdout; return 0; } static void ctl_close(void) { fflush(outfp); if(seq_quit==0){ rtsyn_synth_stop(); rtsyn_close(); seq_quit=~0; } ctl.opened=0; } static int ctl_read(int32 *valp) { return RC_NONE; } #ifdef IA_W32G_SYN extern void PutsConsoleWnd(char *str); extern int ConsoleWndFlag; #endif static int cmsg(int type, int verbosity_level, char *fmt, ...) { #ifndef IA_W32G_SYN va_list ap; if ((type==CMSG_TEXT || type==CMSG_INFO || type==CMSG_WARNING) && ctl.verbosity MAX_PORT ){ printf( "Usage: timidity -iW [Midi interface No s]\n"); return; } #endif if(n>0){ port=0; while(port MAX_PORT); printf("\n"); printf("Opening Device drivers:"); printf("Available Midi Input devices:\n"); for(i=0;i 2000 ) { winplaymidi_sleep_level = 2; } } else if ( winplaymidi_sleep_level == 0 ) { winplaymidi_active_start_time = 0; } rtsyn_play_calculate(); if ( winplaymidi_sleep_level >= 2) { Sleep ( 100 ); } else if ( winplaymidi_sleep_level > 0 ) { Sleep ( 1 ); } } #endif /* * interface__loader(); */ ControlMode *interface_P_loader(void) { return &ctl; } TiMidity++-2.13.2/interface/escape_sjis.pl0100644004711200001440000000062707673600270017476 0ustar tamukiusers#!/usr/bin/perl # escape_sjis.pl binmode(STDIN); binmode(STDOUT); while (read(STDIN, $buf, 1)) { if ($sjis) { $sjis = 0; if ($buf eq "\\") { print("\\"); } } elsif ((((ord($buf) ^ 0x20) - 0xA1) & 0xFF) < 0x3C) { $sjis = !0; } print($buf); } # [EOF] TiMidity++-2.13.2/interface/tkmidity.ptcl0100755004711200001440000000375407725104746017407 0ustar tamukiusers#!/usr/local/bin/wishx -f # # TiMidity++ -- MIDI to WAVE converter and player # Copyright (C) 1999-2002 Masanao Izumo # Copyright (C) 1995 Tuukka Toivonen # # 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # # # TkMidity -- Tcl/Tk Interface for TiMidity # written by Takashi IWAI # # Version 1.3; Dec. 5, 1995 # # system path and configuration file path set TclRoot %TCL_DIR% set bitmap_path %TCL_DIR%/bitmaps set ConfigFile "~/.tkmidity" # append library path lappend auto_path $TclRoot # # window fonts # option add *menu*font "-adobe-helvetica-bold-r-normal--12-*" option add *body.curfile.font "-adobe-helvetica-bold-o-normal--18-*" option add *body.file*font "-adobe-helvetica-medium-r-normal--14-*" option add *body*label.font "-adobe-times-bold-i-normal--18-*" option add *body*Scale.font "-adobe-times-medium-i-normal--14-*" option add *body.text*font "-adobe-helvetica-medium-r-normal--14-*" # # main routine # InitGlobal LoadConfig InitCmdLine $argc $argv CreateWindow AppendMsg "TiMidity Tcl/Tk Version\n written by Takashi Iwai\n" init-random [pid] if {$Stat(new_tcltk)} { fileevent stdin readable HandleInput } else { addinput -read stdin HandleInput } if {$Config(AutoStart)} { PlayCmd } tkwait window . # send quit message to the main process before die... WriteMsg "QUIT" WriteMsg "ZAPP" exit 0 # end of file TiMidity++-2.13.2/interface/tkpanel.tcl0100755004711200001440000004731707421005040017006 0ustar tamukiusers#!/usr/local/bin/wishx -f # # TiMidity++ -- MIDI to WAVE converter and player # Copyright (C) 1999-2002 Masanao Izumo # Copyright (C) 1995 Tuukka Toivonen # # 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # # TkMidity -- Tcl/Tk Interface for TiMidity # written by Takashi IWAI # # Tk control panel routine # #---------------- # initialize global variables # proc InitGlobal {} { global Stat tk_patchLevel if [catch {expr $Stat(new_tcltk) == 0 || $Stat(new_tcltk) == 1}] { set Stat(new_tcltk) 0 if [regexp "(\[0-9\]+\.\[0-9\]+)" $tk_patchLevel cur] { if {$cur >= 4.0} { set Stat(new_tcltk) 1 } } } # time table and volume set Stat(MaxSecs) 0 set Stat(LastSec) 0 set Stat(TotalTimeStr) "/ 0:00" # message lines set Stat(CurMsgs) 0 set Stat(MaxMsgs) 500 # current status set Stat(Playing) 0 set Stat(Paused) 0 set Stat(Blinking) 0 # MIDI file list set Stat(CurIdx) -1 set Stat(MaxFiles) 0 set Stat(FileList) {} set Stat(ShuffleList) {} set Stat(CurFile) "--------" set Stat(NextFile) "--------" global Config # playing mode set Config(Tracing) 0 set Config(RepeatPlay) 0 set Config(ShufflePlay) 0 set Config(AutoStart) 0 set Config(AutoExit) 0 set Config(ConfirmExit) 1 # display configuration set Config(Disp:file) 1 set Config(Disp:time) 1 set Config(Disp:text) 1 set Config(Disp:volume) 1 set Config(Disp:button) 1 set Config(Disp:trace) 1 set Config(CurFileMode) 0 # current volume set Config(CurVol) 75 wm title . "TkMidity" wm iconname . "TkMidity" global bitmap_path wm iconbitmap . @$bitmap_path/timidity.xbm } #---------------- # read a message from stdin # proc HandleInput {} { global Stat Config set mlist [gets stdin] set msg [lindex $mlist 0] if {$msg == "RSET"} { if {$Config(Tracing)} { TraceReset } } elseif {$msg == "TIME"} { # set total time set csecs [expr [lindex $mlist 1] / 100] set mins [expr $csecs / 60] set secs [expr $csecs % 60] set Stat(TotalTimeStr) [format "/ %d:%02d" $mins $secs] set Stat(MaxSecs) $csecs set tics [expr $csecs / 8] set tics [expr (($tics + 4) / 5) * 5] .body.time.scale configure -tickinterval $tics -to $csecs SetTime 0 } elseif {$msg == "MVOL"} { # set master volume SetVolume [lindex $mlist 1] } elseif {$msg == "FILE"} { # set playing file set Stat(CurFile) [retrieve-filename [lindex $mlist 1]] wm title . "TkMidity: $Stat(CurFile)" wm iconname . "TkMidity: $Stat(CurFile)" if {$Config(CurFileMode) == 0} { .body.curfile configure -text "$Stat(CurFile) / 00:00" } else { .body.curfile configure -text "$Stat(CurFile) / -$Stat(TotalTimeStr)" } AppendMsg "------" } elseif {$msg == "LIST"} { # set file list .body.file.list delete 0 end set Stat(MaxFiles) [lindex $mlist 1] set Stat(FileList) {} for {set i 0} {$i < $Stat(MaxFiles)} {incr i} { set file [gets stdin] .body.file.list insert end $file lappend Stat(FileList) $file } set Stat(CurIdx) -1 SelectNumber } elseif {$msg == "ALST"} { # append file list set i $Stat(MaxFiles) set Stat(MaxFiles) [expr $i + [lindex $mlist 1]] for {} {$i < $Stat(MaxFiles)} {incr i} { set file [gets stdin] .body.file.list insert end $file if {$Config(ShufflePlay)} { lappend Stat(ShuffleList) [llength $Stat(FileList)] } lappend Stat(FileList) $file } .body.file.list select set $Stat(CurIdx) } elseif {$msg == "ERRR"} { # delete file list .body.file.list delete $Stat(CurIdx) set Stat(MaxFiles) [expr $Stat(MaxFiles) - 1] set tmplist {} for {set i 0} {$i < $Stat(CurIdx)} {incr i} { lappend tmplist [lindex $Stat(FileList) $i] } for {set i $Stat(CurIdx)} {$i < $Stat(MaxFiles)} {incr i} { lappend tmplist [lindex $Stat(FileList) [expr $i + 1]] } set Stat(FileList) {} for {set i 0} {$i < $Stat(MaxFiles)} {incr i} { lappend Stat(FileList) [lindex $tmplist $i] } if {$Stat(CurIdx) >= $Stat(MaxFiles)} { if {$Config(RepeatPlay)} { set Stat(CurIdx) 0 } elseif {$Config(AutoExit)} { QuitCmd } else { StopCmd } } SelectNumber } elseif {$msg == "PREV"} { # previous file set Stat(CurIdx) [expr $Stat(CurIdx) - 1] if {$Stat(CurIdx) < 0} {set Stat(CurIdx) 0} SelectNumber } elseif {$msg == "NEXT"||$msg == "TEND"} { # next file incr Stat(CurIdx) if {$Stat(CurIdx) >= $Stat(MaxFiles)} { if {$Config(RepeatPlay)} { set Stat(CurIdx) 0 } elseif {$Config(AutoExit)} { QuitCmd } else { StopCmd } } SelectNumber } elseif {$msg == "CMSG"} { # put message set type [lindex $mlist 1] set str [gets stdin] AppendMsg $str } elseif {$msg == "LYRC"} { # put message set type [lindex $mlist 1] set str [gets stdin] .body.text.buf insert end $str } elseif {$msg == "CERR"} { error [format "%s: %s" $Stat(NextFile) [gets stdin]] WriteMsg "NEXT" } elseif {$msg == "QUIT"} { # quit exit } elseif {$msg == "RSTA"} { # restart file SelectNumber } } #---------------- # make shuffled list # proc MakeShuffleList {} { global Stat set Stat(ShuffleList) {} for {set i 0} {$i < $Stat(MaxFiles)} {incr i} { lappend Stat(ShuffleList) $i } set len [expr $Stat(MaxFiles) - 1] while {$len > 0} { set pos [my-random [expr $len + 1]] set tmp [lindex $Stat(ShuffleList) $pos] set Stat(ShuffleList) [lreplace $Stat(ShuffleList) $pos $pos \ [lindex $Stat(ShuffleList) $len]] set Stat(ShuffleList) [lreplace $Stat(ShuffleList) $len $len $tmp] set len [expr $len - 1] } } # # append a string to message buffer # proc AppendMsg {str} { global Stat incr Stat(CurMsgs) if {$Stat(CurMsgs) >= $Stat(MaxMsgs)} { ClearMsg } .body.text.buf insert end $str\n .body.text.buf yview -pickplace end } # # clear message buffer # proc ClearMsg {} { global Stat .body.text.buf delete 0.0 end .body.text.buf yview 0 set Stat(CurMsgs) 0 } #---------------- # select the file in listbox and load it # proc SelectNumber {} { global Stat Config if {$Stat(new_tcltk)} { .body.file.list select clear 0 end } else { .body.file.list select clear } set idx -1 if {$Stat(CurIdx) >= 0 && $Stat(CurIdx) < [llength $Stat(FileList)]} { if {$Config(ShufflePlay)} { if {$Stat(ShuffleList) == {}} { MakeShuffleList } set idx [lindex $Stat(ShuffleList) $Stat(CurIdx)] } else { set idx $Stat(CurIdx) } set thefile [lindex $Stat(FileList) $idx] set Stat(NextFile) $thefile } if {$idx >= 0} { if {$Stat(new_tcltk)} { # .body.file.list select set $idx } else { # .body.file.list select from $idx # .body.file.list select to $idx } .body.curfile configure -text\ "Playing: [lindex $Stat(FileList) $idx]" LoadCmd $idx set Stat(Playing) 1 } else { SetTime 0 .body.curfile configure -text "-------- / 00:00" set Stat(Playing) 0 set Stat(Paused) 0 } DispButtonPlay } # # update current time # proc SetTime {val} { global Stat Config if {$Stat(CurIdx) == -1} { return } set Stat(LastSec) $val if {$Config(CurFileMode) == 0} { set curt [sec2time $val] .body.curfile configure\ -text "$Stat(CurFile) / $curt" } else { set curt [sec2time [expr $val - $Stat(MaxSecs)]] .body.curfile configure\ -text "$Stat(CurFile) / $curt" } set curt [sec2time $val] .body.time.label configure\ -text "$curt / $Stat(TotalTimeStr)" .body.time.scale set $val DispButtonPlay } # # colorize buttons with each state # proc DispButtonPlay {} { global Stat if {$Stat(Playing)} { if {$Stat(Blinking)} { set color green set Stat(Blinking) 0 } else { set color red set Stat(Blinking) 1 } .body.button.play configure -fg $color -activeforeground $color } else { .body.button.play configure -fg black -activeforeground black } if {$Stat(Playing) && $Stat(Paused)} { .body.button.pause configure -fg red -activeforeground red } else { .body.button.pause configure -fg black -activeforeground black } } # # update current volume # proc SetVolume {val} { global Config set Config(CurVol) $val .body.volume.scale set $val } #---------------- # write message # messages are: PREV, NEXT, QUIT, FWRD, BACK, RSET, STOP # LOAD\n, JUMP