2004-01-14  Daniele Tamino  <aslo@wmdimp.cjb.net>

	* README (wmdimp): Added reference to wmdimprc man page.

2003-12-28  Daniele Tamino  <aslo@wmdimp.cjb.net>

	* gen-wmdimprc-man.pl: New file, perl script to generate
	wmdimprc.1 from sample.wmdimprc (replaces make-wmdimprc.man.sh).

	* Makefile.am: Changed rule to generate wmdimprc.1 .

	* configure.ac: Added a check for perl.

	* INSTALL: Added reference to wmdimprc man page.

	* wmdimp.1: Added reference to wmdimprc man page and web site.
	
2003-12-27  Daniele Tamino  <aslo@wmdimp.cjb.net>

	* wmdimp.1: New file, man page for wmdimp.
	
	* make-wmdimprc-man.sh: New file, generate wmdimprc.1, man page
	for ~/.wmdimprc, from sample.wmdimprc. It does not a really good
	job at the moment, but it's better than nothing.

2003-12-16  Daniele Tamino  <aslo@wmdimp.cjb.net>

	* player_mad.c (decoder_thread): Unlocked scan_thread_mtx before
	waiting for messages, and re-lock it after (deadlock fixed).

2003-12-11  Daniele Tamino  <aslo@wmdimp.cjb.net>

	* main.c (main): Fixed call to AddMouseRegion to pass the right
	and bottom values lowered by 1 (x + w - 1 and y + h - 1).

	* wmgeneral.c (draw_char, draw_string): Changed all magic numbers
	6 and 7 to char_width and char_height, respectively. 'char_width'
	and 'char_height' are defined in gui.c and are skin-dependant.

	* gui.c, redskin/gui.c, wmmp3-like-skin/gui.c: Defined
	char_height (to be 7). Before, its vaule was hard coded in
	wmgeneral.c .

2003-12-10  Daniele Tamino  <aslo@wmdimp.cjb.net>

	* player.c (player_init): New configuration options, "repeat" and
	"random", to set the initial state of the repeat and random
	flags.

	* player.h (get_random, get_repeat): New functions, return the
	state of the random or repeat flag.

	* main.c (main): Fetch the state of repeat and random flags and
	set the respective toggle buttons accordingly.

	* INSTALL: Changed the description of --with-libmad and
	--with-mpg123, to explain pros and cons of each player instead of
	just stating that the internal player is always better.

	* sample.wmdimprc: Fixed a little typo (';' instead of ',').
	(repeat, random): New options, added and documented.

2003-12-03  Daniele Tamino  <aslo@wmdimp.cjb.net>

	* configure.ac: Defined the variable NEED_OUTPUT_C when some
	modules (currently only player_mad.c) need output.c
	Defined WITH_MAD when compiling the mad player.
	Renamed the automake variable HAVE_MAD_AND_ID3 to WITH_MAD.
	Print a warning message when no player module is selected for
	compilation (when libmad is not installed and --without-mpg123 is
	passed to ./configure, for example).

	* Makefile.am: Renamed the automake variable HAVE_MAD_AND_ID3
	to WITH_MAD as in configure.ac.
	Restructured the code to ease adding new player modules.

	* main.c: Use NEED_OUTPUT_C config.h macro to conditionally
	initialize output module instead of HAVE_LIBMAD.

	* output.c (output_finish): set devices = NULL after freeing it.

	* player.h: Fixed a wrong comment relative to the setup method.

	* player_mad.h: renamed msg_tx/rx_value to mad_msg_tx_rx_value.

	* playertab.c: Correctly use WITH_MPG123 and WITH_MAD to
	conditionally include only selected players (do not use
	HAVE_LIBMAD anymore).

2003-11-20  Daniele Tamino  <aslo@wmdimp.cjb.net>

	* Makefile.am: Moved the sources of the output module to a
	separate variable, to include them only when needed (currently,
	when using the mad player).

	* main.c: Added some #ifdef's to cut out the output.c-related code
	when output.c is not to be compiled.

2003-11-19  Daniele Tamino  <aslo@wmdimp.cjb.net>

	* player.c (show_list_name): Added 'button_redraw(B_LISTNAME)'
	(list_up, list_down): Don't deal with button pushing, this is done
	in main.c.

	* main.c: New micro widget library to manage buttons.

2003-11-18  Daniele Tamino  <aslo@wmdimp.cjb.net>

	* player.c (next_list): Fixed a typo ("> num_lists" instead of ">=
	num_lists");
	(set_playlist): always set curr_song = 0, even when failing,
	because other routines expects this.
	(player_specs): Added default values for lists (load current
	directory).
	(set_lists): Fixed to correctly load the default values if none is
	found the the config file (or there's no config file at all).

	* INSTALL: Added some information about the behaviour of the
	program without a configuration file.

	* TODO: Put the 'TODO' section before the 'DONE' section.

	* README: Some little refinements.

2003-11-17  Daniele Tamino  <aslo@wmdimp.cjb.net>

	* player_mad.c (start_decoder_thread, start_scan_thread): Detach
	the new thread right after creation, because pthread_join is not
	used anymore, and this is the only way to get the associated
	resources deallocated automatically (this was a memory leak).
	(send_dec_msg): If the message wasn't sent, free the allocated
	memory.
	(mad_static_finish): free'd cfg_title and cfg_title_notag, just to
	get consistent diagnostic from mtrace.

	* utils.c (free_str_list): Memory leak fixed: forgot to free the
	actual string values.

	* parsecfg.c (parseit, opt_hash_free): Trying to get all memory
	freed as it should to get consistent results when using mtrace.

2003-11-15  Daniele Tamino  <aslo@wmdimp.cjb.net>

	* player.c (show_progress_bar): Removed a compiler warning saying
	that the two variables 'frames' and 'total' "may be used
	uninitialized" (they were, in fact...).
	(player_finish): Cleaned up song hash (empty_hash), especially to
	ease malloc tracing.

	* debug.c (dbg_init): added a call to mtrace and atexit(muntrace)
	when DBG_MEMORY is true, to hunt memory leaks.

	* README: Added a reference to the INSTALL file.

2003-11-14  Daniele Tamino  <aslo@wmdimp.cjb.net>

	* output.c (output_open): Bug fixed: if reopening the device, free
	temp buffer ('tmpbuf') and 'channels' too.
	(output_thread): Check that 'minbuf' is not bigger than buffer
	size, or else a deadlock may happen (that shouldn't happen too,
	unless there are bugs outside, and they were...).

	* debug.c: Added a fairly good support for debugging after a crash
	(SIGSEGV): When it's catched, all threads are paused for 10
	seconds, while the raising thread is paused for 5 seconds, and gdb
	is started on that thread. In this way, using the gdb command
	'continue' you'll get to the error position (after 5 sec), and,
	if you want, you can clean up program state and continue again,
	after waiting the remaining 5 secs to wake up all other threads.
	(dbg_start_debugger): New function, stops the program at the
	current position and start gdb (programmatically).
	(errsig_handler, wait_handler): New signal handlers, does the
	dirty work of handling a program error (SIGSEGV, SIGILL or
	SIGFPE).

2003-11-12  Daniele Tamino  <aslo@wmdimp.cjb.net>

	* sample.wmdimprc: Put the 'lists' variable on top, so after
	installing one can easily find out how to set up wmdimp quickly,
	since all other options have reasonable default values.
	Better marked in the descriptive comments the options which
	accepts multiple values.

	* output.c: Added debug messages everywhere buf_cond is signalled
	and waited for. It seems that there is still a (very rare)
	deadlock chance... (I got it once, and never again).

	* player_mad.c (decoder_thread): Added assert(me->buffer) wherever
	is called mad_stream_buffer with an mmap'ed file.
	(decoder_thread): Added a local boolean variable, song_finished,
	set to 1 when the song that was playing is finished (eof). Flushed
	the output buffer when get a MSG_SONGCHANGE but song_finished ==
	0. After the eof check, if song_finished is true, wait for
	messages (instead of receiving the auto-sent MSG_PAUSE from
	handle_eof).
	(handle_eof): Do not auto-send MSG_PAUSE after an eof when
	my_callback returns 1, decoder_thread will do better by itself.
	
	* output.c: Protected every pthread_cond_broadcast with buf_mtx
	(I've learnt that if someone says that things must be done in a
	certain way, maybe there's a reason sometimes...)
	
2003-11-09  Daniele Tamino  <aslo@wmdimp.cjb.net>

	* thrcomm.h: New file, simple communication layer to send messages
	between threads.

	* player_mad.c (decmsg, decmsg_seek): New structures, to hold the
	messages sent between threads.
	(send_dec_msg, send_dec_seek): Send a message to dec_thr (from a
	different thread), and special case for MSG_SEEK.
	(auto_send_msg, auto_send_seek): Send a message from dec_thr to
	itself (different to avoid waiting => deadlock).
	(stop_on_error): commented out, to be removed.
	(*): changed all code that previously used dec_msg_* to use
	thrcomm_* methods on me->dec_thr_chn to communicate with dec_thr.
	(mad_test): Fixed: forgot to rewind file descriptor before
	retrying to load the first header.
	(mad_jump_time): If information is available (or
	scan_thread is running and we can wait for it), correctly
	calculate the seconds of the new position (non accurate), instead
	of setting it to -1.
	
	* player_mad.h (player_mad): Removed dec_msg_*, added a new
	thrchannel object to send messages, dec_thr_chn (see thrcomm.h).
	Now it's more stable (Dijkstra wasn't a dumb after all :-)

	* player.c (init_player, finish_player): Renamed to player_init
	and player_finish respectively.

	* main.c (handle_button_press): Changed the structure from a big
	switch instruction to an access on a table of function pointer,
	each for each button/widget.
	(handle_<widget>): New functions, handlers for each widget.
	This was done to have a more extensible, but still simple, widget
	event handling (and to add keyboard shortcut, but, anyway who will
	ever use them, except me to run some stress tests?).

2003-11-01  Daniele Tamino  <aslo@wmdimp.cjb.net>

	* player_mad.c (scan_thread): Fixed: when the scan is aborted, do
	not change the title with CB_TITCHANGE.
	(term_decoder_thread): Fixed: protected "me->dec_msg_tx =
	MSG_TERM" with dec_msg_mtx.
	(handle_eof): Fixed: protected "me->dec_msg_tx = MSG_PAUSE" with
	dec_msg_mtx.

	* player.c: Reorganized every critical section (protected by some
	mutexes) to reduce the need to lock.
	Fixed: forgot to protect the use of the song hash, now protected
	with song_mtx (see threads.txt).
	Sooner or later that song_hash will disappear anyway...
	(init_player): Renamed to player_init.
	(finish_player): Renamed to player_finish.
	(set_title): If title is scrolling, do not reset scroll_pos to the
	beginning, do it only if the old position is too big.
	(draw_progress_bar): Take the position and the length as
	arguments, instead of asking the player.
	(show_progress_bar): New function, redraws the progress bar asking
	the player what's the current position.
	(draw_time): New function to draw the time, takes minutes and
	seconds as arguments, and a flag to say if it's the elapsed or the
	remaining time.
	(do_update): Use the new draw_progress_bar and draw_time that
	takes the values to be shown as arguments, to avoid locking too
	many global variables (an to be called directly from
	my_callback). Takes the player as a parameter.
	(call_cb_thread): The counter cb_async is decremented protected by
	the mutex callback_mtx.
	(call_cb_async): cb_async in incremented here (synchronously)
	instead of in the new thread being created.
	(my_callback): Recalls itself in another thread only when
	what==CB_SONGCHANGE and what==CB_TITCHANGE.
	(my_callback): When what==CB_TITCHANGE, do not show_title() if the
	title is already scrolling.
	(setup_song): Returns an int (boolean, 1 = ok, 0 = error) instead
	of a 'struct hash_elt*'.

	* All files: changed email address from arkaam@libero.it to
	aslo@wmdimp.cjb.net.

2003-10-25  Daniele Tamino  <aslo@wmdimp.cjb.net>

	* player.h: now the callback returns an int, which is used when
	what == CB_SONGCHANGE to say if a song is to be loaded soon or the
	player should stop. Moreover, even when what==CB_SONGCHANGE it
	cannot call any of the play/stop/etc methods, it should manage to
	do it asynchronously (in another thread). This was needed to
	enforce strict mutex priority and avoid many deadlocks.

	* player.c (my_callback): Implemented strict mutex priority (every
	time we need to lock something, do it in another thread).
	(my_callback): MSG_SONGCHANGE: Returns always 1, since we always
	load another song after the next.

	* player_mad.c (scan_thread): If cfg_title contains '%b', remake
	the title after the scan (when the bitrate is known).
	(get_title): Returns a reference to me->title and not a strdup'd
	copy (this is to be called by scan_thread too).
	(mad_setup): Rearranged to strdup the string returned by get_title.
	(mad_static_init): Added option to disable mmap (after all it
	doesn't do so much good, maybe it's better without).
	(handle_eof): Check return value of callback instead of checking
	dec_msg_tx for MSG_SONGCHANGE, since now callback has been
	forbidden to load a new song even when what == CB_SONGCHANGE.
	(mad_setup): Added madvise(me->buffer, buffer_size, MADV_WILLNEED)
	to prefetch some data when using mmap.

2003-10-24  Daniele Tamino  <aslo@wmdimp.cjb.net>

	* player_mad.c (make_title): New format specifier '%b' to show the
	bitrate. (==> buggy!)
	(scan_thread): Fixed support for mmap.
	(decoder_thread): Fixed support for mmap.
	(mad_setup): Added support for mmap.

2003-10-23  Daniele Tamino  <aslo@wmdimp.cjb.net>

	* player.c (my_callback): fixed a deadlock when
	what==CB_SONGCHANGE  but the next song cannot be played by the
	current player.
	(setup_song): added a boolean arg to (try to) setup the song only
	with the current player.
	(try_play_next): tries to play the next song only with the current
	player.

2003-10-17  Daniele Tamino  <aslo@wmdimp.cjb.net>

	* output.c (oss_bufwait): new config variable, sets how much to
	wait when the device buffer (or our buffer) is full.
	(oss_minspace): new global variable, it's the size in bytes of
	buffer space to wait for.
	(allocate_temp_buffer): Sets oss_minspace, checks that the buffer
	size os a multiple of out_bps (this was a bug).
	(write_to_device): New helper function for output_thread.
	(output_thread): Rewritten so now it does what it's supposed to
	do (i.e. implement the correct buffer policy). It now uses select,
	if this works (hack to find out taken from xmms). If buffer size
	and bufwait are set in the right way, it uses less cpu than
	before. When debugging, and if output.c and debug.c are compiled
	with DBG_METER set to 1, it shows two meters of the internal and
	kernel buffer levels (has been useful when debugging ;).
	(do_write): Don't just wait for some space > 0 in buffer if this
	is full, wait for oss_minspace (see above).
	(output_write, output_write_chans): signal buf_cond, before was
	signalled by do_write. This way it's signalled fewer times.
	(do_copy): Fixed a bug when conv_type == conv_none, it was copying
	nsamp samples even if the buffer was smaller.

2003-10-16  Daniele Tamino  <aslo@wmdimp.cjb.net>

	* output.c (buffer_data, buffer_space): these were broken, I really
	can't guess how did they work before.

2003-10-15  Daniele Tamino  <aslo@wmdimp.cjb.net>

	* output.c (do_write): Changed condition on buffer to wait for
	from  'not to be full' to 'be at least 1/4 empty'. Experience says
	that this is more effective (the 1/4 is choosen empirically).

	* player_mad.c (cfg_halfrate): New global, says to use the
	half-rate decoding provided by libmad.
	(cfg_nocrc): New global, says to ignore crc in frames.
	(mad_halfrate, mad_nocrc): corresponding config variables.
	(mad_static_init): Sets cfg_halfrate and cfg_nocrc.
	(decoder_init): Set the mad_stream_options according to
	cfg_halfrate and cfg_nocrc.
	(decoder_thread): Open the audio device with half the normal rate
	if cfg_halfrate is set.

2003-10-14  Daniele Tamino  <aslo@wmdimp.cjb.net>

	* player_mad.c (insert_tag_value): Show any kind of tag in a
	hopefully useful way.

	* wmgeneral.c (draw_char): Show a space if a control char is asked
	to be drawn.

	* player.c (wait_cb): wait an asynchronous call to my_callback to
	terminate.
	(finish_player): wait for an asynchronous my_callback
	before destroying player.

2003-10-13  Daniele Tamino  <aslo@wmdimp.cjb.net>
	
	* str.h: New file to handle a simple dynamic growing string

	* song_hash.c, utils.c (getname, getext): Functions moved from the
	first to the second file.
	* utils.h, song_hash.h: Updated functions declarations
	accordingly.

	* player_mad.c: Finally added ID3 tag reading and title
	formatting! It took me few hours to write and get it work, don't
	know how many it'll take to debug...
	(cfg_title): Global variable containing strings
	saying how to format the title using information from ID3 and
	filename.
	(cfg_title_notag): Same as cfg_title, but used when no ID3 tag is
	found.
	(mad_title, mad_title_notag): Configuration variables
	corresponding to cfg_title and cfg_title_notag.
	(insert_tag_comment): New function, insert the value of a COMM tag
	into a 'string' structure.
	(insert_tag_genre): New func, insert the TCON tag into a string.
	(insert_tag_strlist): New func, insert a stringlist field into a
	string.
	(insert_tag_value): New func, insert the value of the specified
	tag into a string.
	(make_title): New func, make and return the formatted song title.
	(get_title): Read ID3 tag and call make_title to return a suitable
	title to be displayed.
	(mad_setup): Rearranged to let the title be returned correctly.
	(mad_test): If it doesn't seem an MP3 file, and mad_decode_header
	returned MAD_ERROR_LOSTSYNC, try to reload the first header, so it
	will skip eventual junk at the beginning.

2003-10-12  Daniele Tamino  <aslo@wmdimp.cjb.net>

	* player.c (set_title): new helper function to set the 'title'
	global variable.
	(CB_TITCHANGE): new callback message, sent when the song title
	changes (or it is more accurate).
	(my_callback): Handled CB_TITCHANGE. Changed behaviour when
	callback_mtx is locked: instead of returning, it spawn itself as a
	separate thread.
	(setup_song): Added a call to show_title, and moved the
	title-related code outside of the critical sections.
	Corrected some other violations of the mutex priorities.
	
	* mpg123_player.c (play_thread): Send CB_TITCHANGE when received ID3
	from mpg123. Removed the last call to call_cb_async, since all
	methods are already reentrant.
	(mpg123_setup): Don't do acrobatic jumps anymore to get ID3 info
	before returning, simply set the title to NULL, and play_thread
	will send CB_TITCHANGE when it's the moment.
	(mpg123_play): fixed a stupid typo, it was returning a negated
	value (why it never showed up before?).

2003-10-11  Daniele Tamino <aslo@wmdimp.cjb.net>

	* INSTALL: Added the description of the --with-mpg123 configure
	option, and changed the one of --with-mad.

2003-10-09  Daniele Tamino  <aslo@wmdimp.cjb.net>

	* new beta version (0.3 beta1).
	
	* Makefile.am (EXTRA_DIST): added skins.txt .
	
	* configure.ac: changed version number to 0.3beta1 .

	* skins.txt: new file on how to compile with a different skin

	* README, INSTALL, sample.wmdimprc: Revisited, they were a little
	old ...

2003-10-01  Daniele Tamino  <aslo@wmdimp.cjb.net>

	* Makefile.am, configure.ac: Now by default do not link
	mpg123_player.c if player_mad.c is. Do it only if the new option
	--with-mpg123 is passed to configure.

	* mpg123_player.c (mpg123_test): Removed old slow test and copied
	the one used for ht libmad player (which in turn was borrowed from
	xmms-mad).

	* player_mad.c (mad_setup): It used to call mad_pause to put
	decoder_thread to sleep, forgetting that mad_pause also sets the
	status to st_pause... now after that it restores the status to
	st_play if needed.

	* player.c (show_title, scroll_handler): Little bug fix to show
	song title at start scroll position when !alwaysscroll and a loop
	is ended (it was getting stuck at the last position).
	(wgt_vprintf): Fixed a buffer overflow which caused a segfault
	when it was called with arguments that generated a string bigger
	than the widget length (snprintf and vsnprintf return the number
	of characters that *would* be written if there were enough
	space!!!).
	(setup_song): If a song cannot be loaded, set the title to the
	song filename without the directory (but with the extension).

2003-09-30  Daniele Tamino  <aslo@wmdimp.cjb.net>

	* player_mad.c: Protected all calls to the callback against
	deadlocks, unlocking on entrance scan_thread_mtx and re-locking
	it after the call.

	* main.c (handle_button_press): When clicked on B_TITLE and
	there's a message showing, undisplay it and show title, and
	when clicked on B_LISTNAME and a song is playing, use
	show_message/unshow_message to show list name for 3 seconds.
	(handle_button_press): When clicking B_NEXT/B_PREV are clicked,
	display list number for 3 sec if not playing, else for 0.5 sec.

	* player.c (redraw_listbar): New name for show_list_name, which
	was ambiguous.
	(redraw_titlebar): New function, just call show_title by now.
	(__show_message_vl): New helper function for show_message_vl.
	(show_message_vl): Now just call __show_message_vl with the right
	arguments.
	(unshow_listbar_hnd, unshow_titlebar_hnd): New timer handler in
	replace of reset_flag_handler; they reset the correct flag (as the
	previous one) and redraw the bar with the default content.
	(show_title): Do not SIGSEGV when title==NULL, and use wgt_printf
	instead of draw_string (so it'll pad with blanks if the title is
	shorter than the titlebar).
	(show_list_number): Now it's just a wrapper for show_message.
	(sum_timeval): Little change, smaller code, removed a sum ;-)
	(setup_song): Test if the current player supports the file before
	calling do_setup_song. Fixed those stupid "return NULL"'s that
	returned without releasing the mutexes.
	(user_play): After a successful play, hide messages and call
	do_update to draw progress bar and show time.
	(show_list_number): Added the duration of the display (in usec) as
	a parameter.

	* main.c, player.c: Removed (almost) all stale #if 0's and such
	things.

2003-09-29  Daniele Tamino  <aslo@wmdimp.cjb.net>

	* timer.c (timer_cancel): New function to cancel a queued job.

	* player.c (random_toggle, repeat_toggle): using show_message to
	show a little message ("random", "no random", "repeat",
	"no repeat") in the titlebar fom 1.5 seconds.

	* main.c (handle_button_press): When B_NEXT or B_PREV are pressed,
	use show_list_number to display the song number even if a song is
	playing.
	
2003-09-27  Daniele Tamino  <aslo@wmdimp.cjb.net>

	* player.c: (mpg123_argv) Removed stale global variable (I've
	moved it to mpg123_player.c but I forgot to remove it).
	(next_song): Removed variable, kept curr_song. Now all song
	management is done using only curr_song, in a cleaner way.
	(curr_song_num): New global variable, holds the playlist number
	of the currently playing song (it is undefined if no song is
	playing). Usefun when random_flag==1, where it says the original
	song number, not the position in the random permutation.
	(set_playlist): using only curr_song, not next_song.
	Removed call to exit(-1) if malloc fails (just disable random).
	(setup_song): set new global variable curr_song_num.
	(setup_next): using curr_song instead of next_song. Fixed some
	minor bug/misfeatures, now the "next song" of the last of the list
	is the first of the next list if !repeat_flag, else is the first
	of the current one.
	(play_prev): same as setup_next/play_next, the "prev" song of a
	list is the last of the prev list if !repeat_flag, else the last
	of the current one.
	(play): new function, plays current song (if not yet).
	(user_play, user_stop): using curr_song, not next_song.
	(user_next, user_back): using curr_song instead of next_song, and
	implemented the correct meaning (as for play_next/play_prev) of
	"next of the last" and "prev of the first" songs.
	(user_jump*): removed next_song references.
	(list_up, list_down): realized that after load_prev/next_list,
	curr_song is always 0, so no need to read it (and lock
	song_num_mtx).
	(show_list_number, show_time): using curr_song_num instead of
	curr_song.
	(next_list): Wrap to the first list when curr_list is the last.
	(prev_list): Wrap to the last list when curr_list is the first.
	(show_message_vl, show_message): New functions to display a
	message in the titlebar or in the list bar.

Wed Sep 24 21:34:58 2003  Daniele Tamino  <aslo@wmdimp.cjb.net>

	* output.h (output_bufinfo): new prototype.
	
	* output.c (oss_fragsize, oss_nfrags): New global variables.
	(allocate_temp_buffer): set the new global variables above.
	(output_bufinfo): new function to get total and current buffer
	sizes in samples.

	* player_mad.c (scan_thread): scan_thread_mtx is locked and
	immediately unlocked to avoid blocking decoder_thread.
	(decoder_thread): while writing data with output_write_chans,
	unlock scan_thread_mtx only if that call would block (i.e. if
	there's less free space in the output buffer that data to write).
	This way scan_thread gets even lower chances to run, and only when
	that won't make decoder_thread to wait.

Tue Sep 23 23:07:22 2003  Daniele Tamino  <aslo@wmdimp.cjb.net>

	* wmdimp.xpm: Tired of the old wmmp3-like skin, I've decided to
	learn to use gimp and draw a new one.
	This one is really nice, isn't it? ;-)

	* charset.xpm: the character set is the same, just changed
	foreground and background colors for the new skin.

	* main.c (handle_button_press): Now clicking the play button while
	playing will pause the song. This is because the new skin doesn't
	have a pause button (the space is little, and, after all, you'll
	never need the pause and play buttons together).

	* player.c (show_title): Fixed a little cosmetic bug that caused
	scrolling to pause a little when alwaysscroll = true and a scroll
	loop is just finished (scroll_pos >= title_len instead of ">").

Thu Sep 18 17:43:28 2003  Daniele Tamino  <aslo@wmdimp.cjb.net>

	* output.c: Changed buffering, now a separate thread reads from
	an internal buffer and feeds oss device.
	Now the cpu usage on my pc is dropped from 4.5-5% to 1.5-2% and
	kernel buffer underruns are very rare now.
	(output_init): Now the config variable
	oss_bufsizems specifies the length of the internal buffer in msec.
	(output_thread): new function, the start point of the new thread.
	(buffer_*): new function to handle the buffer (see comments).
	(start/term_output_thread: new functions
	(allocate_temp_buffer): changed to allocate the buffer in the new way.
	(output_open): Added code to start output_thread when it succeed,
	and to calculate a better fragment size than the default one.
	(output_pause, output_close): changed to be aware of the new
	buffering system.
	(do_write): completely rewritten to use the new buffer.
	(output_write_chans): fixed a stupid bug that caused subsequent
	calls to do_write to write to the same memory (cut'n'paste must be
	used with care :).

	* player_mad.c (decoder_thread): added a call to output_stop(1, 0)
	when seeking and when terminating.
	(mad_setup): added a call to output_stop(1, 0) after successfully
	loading the new song.
	
Mon Sep 15 16:28:04 2003  Daniele Tamino  <aslo@wmdimp.cjb.net>

	* player.c: removed all mutexes and redesigned everything to
	protect shared variables. Now it should be rather difficult to
	cause a deadlock, though it's difficult to ensure.
	See threads.txt.
	(finish_player): free file_ext, list_ext and lists correctly (not
	a great memory leak, but useful for debugging them).

	* player_mad.c (start_scan_thread): if scan thread is running,
	first terminate it, to avoid zombies!
	(scan_thread): memory leak fixed: forgot to free inbuf.data and to
	close infd.
	(decoder_thread): memory leak fixed: as in scan_thread, inbuf.data
	was floating in the void forever.
	
	* song_hash.c (free_elt): Memory leak fixed: forgot to free
	elt->filename and elt->title.
	Changed HASH_TABLE_SIZE from 11 to 53, much better!

Sun Sep 14 11:59:33 2003  Daniele Tamino  <aslo@wmdimp.cjb.net>

	* player.c (finish_player): I forgot to destroy curr_player, so
	it continued playing, eventually causing deadlocks. Fixed.

Sat Sep 13 19:14:28 2003  Daniele Tamino  <aslo@wmdimp.cjb.net>

	* output.c (output_open): Better handling of errors when a sample
	format is not available; now I do not trust so much the
	alternative format returned by oss anymore.
	Fixed a bug in setting up out_fmt.
	(select_pre_post_convert_func): fixed a typo (in_bpc instead of
	out_bpc). Now unsigned/big-endian output formats works correctly.

	* parsecfg.c, player_mad.h: moved enum's declared into
	structures outside, because gcc 3.x does not allow them (and
	neither the standard I think).
	
Fri Sep 12 23:18:50 2003  Daniele Tamino  <aslo@wmdimp.cjb.net>

	* new alpha version (0.3 alpha3).

	* output.c: changed everything another time: now everything to
	convert input samples to output samples is done in output_funcs.h,
	an m4-generated file with some hundred of little specialized
	functions.

	* output_func.h.m4: (new file) generates output_funcs.h, with
	many many little sample conversion functions.

	* wmgeneral.c: protected every call to xlib functions with
	XLockDisplay and XUnlockDisplay
	(openXwindow): added a call to XInitThreads.
	(draw_string): now it's written a little better, and generate
	slightly better (faster) code.

	* player.c: protected every direct xlib function call with
	XLock/XUnlockDisplay and removed every call to wake_up_main_thread
	to ask the main thread to draw the gui, now this is done directly.
	This saves much cpu time (actually the old way was a badly
	designed way to avoid the need to synchronize threads even more).
	
Sun Jun  8 22:13:37 2003  Daniele Tamino  <aslo@wmdimp.cjb.net>

	* output.c: changed the convert_X_Y function family (X=bits in,
	Y=bits out) not to handle big/little endian and signed/unsigned
	conversions, so now the inner loop is faster. Those
	conversions are done, if needed, outside the main loop.

	* output.c: Added option to disable dithering.

Sun Jun  8 17:35:27 2003  Daniele Tamino  <aslo@wmdimp.cjb.net>

	* main.c (signal_thread): New thread to handle signals safely
	(i.e. so now I can safely call wake_up_main_thread in respose to a
	signal).
	(signal_init,signal_finish): start/stop signal handling thread.

	* player.c: since my_callback can be (and in fact it is) called
	asynchronously, protected with a recursive mutex (song_mtx)
	sensible variables.
	(draw_progress_bar): fixed a bug that, given an invalid	position
	from pl->get_pos (which is itself a bug, but we should protect us
	anyway), caused X server to crash.

	* player_mad.c: it finally works! (except for not-so-evident bugs
	which I haven't discovered yet). Still need to add ID3 support.
	It is very slow, too, but profiling shows that most of the time
	(~90%) is spent within output_write, and the remaining ~9-10% is
	in copying from dec.synth.pcm to the temporary buffer!
	*No, this is wrong, I've mistaken interpreting profiling output*

	* output.c (convert_samesize_*): removed, implemented the same way
	as the convert_*_* function family (since optimizing will give the
	same code).
	
Wed Jun  4 21:32:13 2003  Daniele Tamino  <aslo@wmdimp.cjb.net>

	* player_mad.c: (new file) mp3 player that uses libmad to play
	files. This is still very buggy and unexpectedly slow (clicky).

Wed May 21 22:24:00 2003  Daniele Tamino  <aslo@wmdimp.cjb.net>

	* mpg123ctl.c: file removed, substituited by player.c (and header
	mpg123ctl.h with player.h)

	* player.c: (new file) New player code, with (almost) the same
	interface provided by old mpg123.c code (some function name
	changes). This player is completely indipendent from mpg123, and
	rely on a table (stored in playertab.c) with a set of "players"
	(you may call them "plug-in"'s).

	* mpg123_player.c: (new file) Player that uses mpg123 as input and
	output. Code from old mpg123ctl.c, readapted and improved.
	This is mainly a transition step between a shell around mpg123 and
	a completely indipendent player. It's rather slow, because it
	reads ID3 and song length by starting player and suddenly stopping
	it (so it may produce some clicks).

Wed Apr 30 21:01:27 2003  Daniele Tamino  <aslo@wmdimp.cjb.net>

	* parsecfg.c (parseit): Better show of error summary

	* mpg123ctl.c (load_str_list): Fixed a bug to correctly use the
	default value if list is empty

wmdimp-0.2:
	
Thu Apr 24 23:40:41 2003  Daniele Tamino  <aslo@wmdimp.cjb.net>

	* Taken wmmp3 and started wmdimp (many changes, I'm sorry I forgot
	to log every change, I just sat down and started coding. So now I
	put here in one block every important change, as in the NEWS
	file).

	* Rearranged main loop (passive wait, removed usleep(50000), ...)

	* Removed alarm() call to implement scrolling, used an auxiliary thread
	instead (alarm was creating problems with event handling, and had a
	granularity of 1 sec).

	* Optimized drawing routines: now, in response to Expose, only changed
	areas are redrawn.

	* When you stop the player, the next time you press play it will restart
	from the song you were listening to.

	* Now you can select a song without start playing it.

	* Clicking on the titlebar stops scrolling (if autoscroll=no)

	* Use mpg123 -R interface to control the playback (so we can pause, jump,
	get id3 info, get playback info).

	* Implemented pause button.

	* Changed GUI: now there is only one button to browse directories/lists,
	left-click to go down, right-click to go up. This was to make room for the
	pause button.
	  
	* Show ID3 information in the titlebar (only "Title - Artist" and only
	after the first play).

	* Implemented clickable progress bar (i.e. you can click to jump to that
	position).

	* Show elapsed/remaining time and sequence number during playback
	(left-click to toggle between elapsed/remaining).
	  	
	* Changed configuration file format (see sample.wmdimprc for details)

	* You can enter a playlist file ("m3u" if you like) in the config file.

	* You can enter an inline playlist in the config file (i.e. enter directly
	the mp3 files of the list)

	* If a directory is not available (ENOENT) when loading, it will be
	skipped (not removed) until it becomes available (i.e. you can enter a
	path in your cdrom in the list and use it only when the appropriate cd is
	mounted).

	* Changed scrolling thread to a more general interface (timer.c) to
	schedule simple jobs in the near future.

	* Show sequence number when browsing a playlist.

	* You can enter commandline options for mpg123 (or compatible) in
	the configuration file.

	* Show playlist name while playing by left or middle clicking the
	directory/time bar.
	
	* Sort files when loading a directory.
	
	* Many bugfixes ;-)
	

Fri Nov 19 23:15:00 1999  Matthew D. Campbell <matt@campbellhome.dhs.org>
	* added random play
	* added continuous filename scrolling

Wed Oct 6 16:56:00 1999  Patrick Crosby <xb@dotfiles.com>
	* changed pixmap
	* added support for directory changing
	* added repeat support


Wed Oct 6 12:55:00 1999  Patrick Crosby <xb@dotfiles.com>

	* configure.in added
	* Makefile.am  added
	* configure    added...whole building process should be working
	now.
