;;; -*- Emacs-Lisp -*-
;;; A front-end program to mpg123
;;; (c)1999-2001 by HIROSE Yuuji [yuuji@gentei.org]
;;; $Id: mpg123.el,v 1.24 2001/02/23 06:54:30 yuuji Exp $
;;; Last modified Fri Feb 23 15:51:02 2001 on buell
;;; Update count: 857

;;[News]
;;	Key binding to Delete-file is changed from `C-d' to `D'.
;;	
;;[Commentary]
;;	
;;	This package is a front-end program to mpg123 audio player.
;;	mpg123κեȥɤǤ
;;	
;;[Requirement]
;;	
;;	The `mpg123' program version 0.59q or later, and enough CPU
;;	power to run it.
;;	mpg123 0.59qȤ餹Τ˽ʬCPUѥ
;;	ǤMMX??
;;	
;;[Installation]
;;	
;;	You have to install mpg123 0.59q or later first, and get it work
;;	fine.   Check `mpg123  -v' option  if it  displays  the decoding
;;	frame number or not.  If it looks good, then the preparation has
;;	been  done.    Install  this  emacs-lisp   into  your  load-path
;;	directory.  And put the expression below into your ~/.emacs.
;;	
;;	  [~/.emacs]
;;		(autoload 'mpg123 "mpg123" "A Front-end to mpg123" t)
;;	
;;	ޤmpg123ưǧƤιԤ~/.emacsɲäޤ
;;	ʤmpg1230.59qʾǤʤưʤǽޤ(
;;	ȿΤФޤ⤷)mpg123  -v ץ
;;	ĤƵưڤκȤȤ˥ǥΥե졼ֹ椬
;;	ɽ뤫ɤǧƤ줬ޤԤʤȤ
;;	ץ⤦ޤưޤ
;;	
;;[How to Play the music]
;;	
;;	It is  assumed that you  already have MPEG1  audio LayerI/II/III
;;	files - you might be only  familiar with MPEG1 Layer III aka mp3
;;	- in the  certain directory.  This program plays  all music in A
;;	direcotry.  If you want to listen, exec Emacs and type:
;;	
;;		M-x mpg123 RET
;;		SomeMP3DirectoryName (or playlist file) RET
;;	
;;	Then you will get the music  list in the directory.  Type SPC to
;;	start the  music.  All key bindings  are shown at  the bottom of
;;	music list buffer.  Please take a look at it.
;;	
;;	 MPEG1 audio Layer I/II/III եϻäƤΤȤ
;;	ޤ(֤󤤤MP3äƤʤȻפɵˤʤ路
;;	Layer23ϺäȤʤ)ǡΥեϤäȤɤ
;;	ǥ쥯ȥƤƤȻפΤǡڤʹʤä
;;	顢ޤEmacsư
;;	
;;		M-x mpg123 ڤ
;;		ǥ쥯ȥ̾ (ޤϥץ쥤ꥹȥե̾) ڤ
;;	
;;	ǤޤȡΥǥ쥯ȥˤ벻ڥեФ
;;	Τǡʹʤ˹碌SPCǤĤȱդϤޤޤ¾
;;	ޥɤϲڰХåեɽƤΤǤä
;;	Ƥ
;;	
;;[Playlist]
;;	
;;	If you  give `M-x mpg123' a  simple file which  consists of file
;;	name list;  one file  name per line,  mpg123.el assumes it  as a
;;	playlist file.   All of  mp3 files listed  in playlist  file are
;;	incorporated in *mpg123* playing  buffer.  If a line in playlist
;;	points  to another  playlist file,  file is  parsed recursively.
;;	There are mainly two ways to create a playlist file.
;;	
;;		* Typing `S' in *mpg123* buffer
;;		* Create directly on the shell;
;;		  Ex. % ls */*.mp3 > playlist
;;	
;;	Because a playlist is very simple, you can edit it manually to
;;	arrange the order of music list.
;;	
;;	M-x mpg123 ΤȤˡԤ˰MP3ե̾񤫤줿̤
;;	եꤹmpg123.elϤץ쥤ꥹȥեȤ
;;	ʤ˽񤫤ƤMP3ե뷲 *mpg123* ڰХåե
;;	Ƽߤޤץ쥤ꥹȥեˤĤˡ
;;	ޤ
;;	
;;		* ڰ(*mpg123*)Хåե S 򲡤
;;		* ξľܺ
;;		   % ls */*.mp3 > playlist
;;	
;;	ץ쥤ꥹȥեϤȤƤñʤΤǡľԽƹʶʽ
;;	ꥹȤΤϴñǤ礦ץ쥤ꥹȥե̤Υץ쥤
;;	ꥹȤꤹ뤳ȤǤޤ
;;	
;;[Configuration]
;;	
;;	Here are the variables for your customization.
;;	
;;	  [Variable]		[Default value/Meaning]
;;	  mpg123-command	"mpg123"
;;				Command name of mpg123
;;	  mpg123-command-args	nil
;;				Argument list to pass mpg123 command
;;	  mpg123-mixer-command	"mixer"
;;				Command name of mixer(FreeBSD)
;;	  mpg123-preserve-playtime t
;;				If you want to mpg123 to play all music
;;				from the beginning even if the last
;;				played time is shown in the buffer, set
;;				this variable to `nil'.
;;	  mpg123-startup-volume 30
;;				Initialize sound volume with this value.
;;	  mpg123-default-repeat	0
;;				Default number of repetition
;;	  mpg123-show-help	t
;;				Whether show help under the music list
;;				or not
;;	  mpg123-omit-id3-artist nil
;;				Whether omit the artist name in ID3
;;	  mpg123-lazy-check	nil
;;				Check sound file or not by filename
;;	
;;	  mpg123-face-playing	'("yellow" . "#004080")
;;				Cons of default playing cursor color
;;				'(FGCOLOR . BGCOLOR)
;;	  mpg123-face-slider	'("black" . "yellow")
;;				Cons of default playing position slider color
;;	  mpg123-need-slider	t on color display, else nil
;;				Whether the playing position slider is
;;				needed or not
;;	
;;	ۤ mpg123 0.59q ˷ǤȤʤΤǡޤꤤȤ
;;	̵ɡ˽񤤤Ƥѿޤ
;;	
;;	ʤLinuxǤϲĴᥳޥɤȤ aumix -w ѤȤޤ
;;	Υץǲ̤򤤤ꤿȤ aumix 򥤥󥹥ȡ뤷Ƥ
;;	ޤ礦
;;	
;;[More comfortable]
;;	
;;	Yes, Emacs is the editor.  Even though you are listening to the
;;	music, you have to edit something!! :)
;;	
;;	This  program occupies  one  Emacs window.   Using this  program
;;	without any  window manager is  hard job.  Please use  this with
;;	windows.el  -  The Window  Manager  for  Emacs  - which  can  be
;;	obtained   from   http://www.gentei.org/~yuuji/software/.   With
;;	windows.el,  you can  listen the  music  which is  run in  other
;;	frame. Or  if you use  emacs -nw, you  can run mpg123.el  in the
;;	background  window and  can  switch from  and  to mpg123  buffer
;;	alternatively.   Of  course,  I'm  writing this  document  while
;;	mpg123.el is running in the background window.
;;	
;;	EmacsȤäƤʹФäꤸʤԽʤ!  Ƥ
;;	ǡե졼񤹤mpg123.elǤEmacsǻȤäƤѡ
;;	ᤷ windows.el ȰˤĤƤߤƤ͡ե졼ȤäƤȤ
;;	̥ե졼ǥХå饦ɺ-nw ǵưƤȤ΢
;;	ɥǥХå饦ɺǤơ΢ɥȤĤ
;;	ԽɥؤƻȤʤƻǽ󤳤ʸϤ΢
;;	ȾʬƤե졼mpg123餻ʤ񤤤Ƥޤ
;;	windows.el  http://www.gentei.org/~yuuji/software/ ɤ
;;	
;;[Bugs]
;;	
;;	It is  perhaps only on  my system that sometimes  mpg123 command
;;	gets confused to decode and  ticks playing time very slowly.  In
;;	such case, mpg123.el cannot  detect that condition.  If you come
;;	to see such behavior, please pause and restart player by SPC key.
;;	
;;	ޤmpg123ޥɤưƤϤΤβФʤʤäƤޤ
;;	ȤޤΤ褦ʵưmpg123.elϸФǤʤΤǡ
;;	ʤäSPCǰöߤưľƤEmacs19١
;;	MuleǤʣͳˤ̥ե졼Ǳ˼ζʤ˿ʤȡ
;;	ʤ˰ܤäľΥѥХåե˼Ƥޤʤı
;;	ջ֤ι(ߤ)˥ϤޤǻߤޤäƤޤޤ
;;	ʤäƤޤΨ褦ʹפϤƤߤޤŪ
;;	ˤϻޤǤ
;;	
;;	Play/Stop control against the  music in the stack buffer doesn't
;;	work.   Although  it is  feasible,  the  feature isn't  actually
;;	usefull and ends in self-satisfaction.  So, no plan to make it.
;;	
;;[No Warranty]
;;	
;;	This  program is  free  software and  comes  with absolutely  NO
;;	WARRANTY.   The  author  is  not responsible  for  any  possible
;;	defects caused by this software.  You can freely modify this
;;	program for your convenience.  But if you want to publish
;;	modified program, please tell me before announcement.  Take it
;;	easy to write me comments and bug-reports.
;;							yuuji@gentei.org
;;	
;;	Υץϥե꡼եȥȤۤޤΥץ
;;	Ѥˤäʤ̤ФƤԤǤ餤ޤ
;;	󡣥ȤХݡȤϤ˴ޤޤΤǸ浤ڤ˸Ϣ
;;	ޤץФĿŪʽϼͳˤĺƹ
;;	ޤ󤬡ϻޤǸϢϢϰ
;;	Υɥ쥹ޤǤꤤޤ(2000/12)
;;							yuuji@gentei.org
;;[Acknowledgements]
;;	
;;	Tijs van Bakel, <smoke@casema.net>
;;		Reported mpg123 termination problem on mpg123 0.59r on
;;		linux 2.2.10.
;;	sen_ml@eccosys.com
;;		Reported problem at playing music more than 100.
;;	Kenichi OKADA, <okada@opaopa.org>
;;		Sent a patch of setting sound volume on Solaris/sparc.
;;	Takuro Horikawa <takuroho@tky3.3web.ne.jp>
;;		Reported running on WinNT.
;;		Port `mixer command' to Windows.
;;		(See http://www3.tky.3web.ne.jp/~takuroho/mpg123.html)
;;	TAOKA Satoshi <taoka@infonets.hiroshima-u.ac.jp>
;;		Put mpg123.el into FreeBSD ports collection
;;	T. V. Raman <ramantv@earthlink.net>
;;		Made emacspeak-mpg123.el.  Many comments.
;;	Per Weijnitz <Per.Weijnitz@etl.ericsson.se>
;;		Sent a patch to enable mixer command on NT4
;;	Takayuki TSUKAGOSHI <tsuka@soft.ics.keio.ac.jp>
;;		Sent a patch for mule2@19.34.
;;	Ryuichi Arafune <arafune@debian.org>
;;		Put mpg123.el to Debian package.
;;	Laurent Martelli <martelli@iie.cnam.fr>
;;		Sent a patch of passing optional arguments to mpg123.
;;		Volume control for Linux.
;;	T. Amano <tomoo@cheri.sh>
;;		Reported running on Linux.
;;	OHTAKI Naoto <ohtaki@wig.nu>
;;		Reported running on Windows98
;;	MOROHOSHI Akihiko <moro@nii.ac.jp>
;;		Sent a patch on coding-system detection for XEmacs+emu.el
;;	Alex Shinn <foof@debian.org>
;;		Patch to handle mp3 files in multiple directories.
;;		Implemented `playlist'.
;;	Seiichi Namba <sn@asahi-net.email.ne.jp>
;;		Many collaboration codes for working with dired-dd.
;;		Made dired-dd-mpg123.
;;	Serge Arsenault <boggles@openface.ca>
;;		Sent information on OpenBSD.
;;	Toni Ronkko <tronkko@hytti.uku.fi>
;;		Many suggestions.
;;
;;
;;[History]
;; $Log: mpg123.el,v $
;; Revision 1.24  2001/02/23 06:54:30  yuuji
;; Only `>' obeys repetition count.
;;
;; Revision 1.23  2001/02/23 05:39:26  yuuji
;; Delete-file key-binding is changed from `C-d' to `D' for trivial reason..
;;
;; Revision 1.22  2001/02/23 05:20:12  yuuji
;; `>' at the end of music list obeys the repetition counter.
;; Music list in a stack doesn't appear in the result of shuffle any more.
;; Shuffle preserves highlighted line any time.
;; Now nil for mpg123-preserve-playtime plays a music from the beginning.
;;
;; Revision 1.21  2001/02/21 03:41:10  yuuji
;; Support for OpenBSD is confirmed.
;;
;; Revision 1.20  2001/01/30 03:35:54  yuuji
;; (Win)convert music filename to dos file name for music over shared folder
;;
;; Revision 1.19  2001/01/19 04:41:37  yuuji
;; Fix the invalid 'cond form.
;;
;; Revision 1.18  2000/12/23 07:41:23  yuuji
;; Slider stays wrong position when music list added.  Fixed
;;
;; Revision 1.17  2000/12/08 00:54:09  yuuji
;; Variable mpg123-face-playing specifies the color of cursor for playing music.
;; Variable mpg123-face-slider specifies the color of slider of playing position.
;; Variable mpg123-need-slider specifies wheter the slider is needed or not.
;; Mouse-2 selects directly a music on the mouse pointer(in music list) or
;; playing position(in delimiter line).
;; RET(M-x mpg123-play) on the delimiter line move the playing position
;; according to the proportion of the window width from left side.
;;
;; Revision 1.16  2000/11/24 15:09:22  yuuji
;; Support emacs-21.0.9x (in mpg123:mp3-p)
;;
;; Revision 1.15  2000/10/20 14:43:06  yuuji
;; (if (featurep 'xemacs) (require 'overlay))
;;
;; Revision 1.14  2000/10/16 08:52:44  yuuji
;; 'mpg123*cur-face renamed to 'mpg123-cur-face (For XEmacs)
;;
;; Revision 1.13  2000/08/06 03:56:37  yuuji
;; Support volume setting on NetBSD(mixerctl)
;;
;; Revision 1.12  2000/08/06 02:27:58  yuuji
;; Set it default to use hilighting.
;;
;; Revision 1.11  2000/08/05 15:40:57  yuuji
;; Revise document.
;;
;; Revision 1.10  2000/08/05 15:37:50  yuuji
;; Handle mp3 files in multiple directories.
;; Playlist support.
;;
;; Revision 1.9  2000/06/25 14:38:17  yuuji
;; Fix for XEmacs+emu.el
;;
;; Revision 1.8  2000/02/09 04:15:31  yuuji
;; Fix for mule2 (mpg123:sound-p).
;;
;; Revision 1.7  1999/09/25 07:09:44  yuuji
;; mpg123-delete-file can delete music only from the list, not on the disk.
;; Shuffle after mpg123-delete-file now works correctly.
;;
;; Revision 1.6  1999/09/10 02:09:02  yuuji
;; mpg123-mp3-scan-bytes
;; defmacro changed to defsubst
;;
;; Revision 1.5  1999/07/24 03:58:52  yuuji
;; mule2Ǥʤ٤Ϣڤʤ褦˹(ǤϤʤ)
;;
;; Revision 1.4  1999/07/05 09:00:19  yuuji
;; ܸե̾б(֤)
;; \C-d (mpg123-delete-file)
;;

