Alright, here it is with diff -u (but still against the stable version). Maybe this is more useful?
Grts. Allen ------------------------ diff -u mpd-0.16.6/src/player_control.c mpd-0.16.6-mine/src/player_control.c --- mpd-0.16.6/src/player_control.c 2011-12-01 14:44:01.000000000 +0100 +++ mpd-0.16.6-mine/src/player_control.c 2011-12-30 23:11:44.000000000 +0100 @@ -108,8 +108,14 @@ player_lock(); + /* if (pc.state != PLAYER_STATE_STOP) player_command_locked(PLAYER_COMMAND_STOP); + */ + + if (pc.state != PLAYER_STATE_STOP) { + player_command_locked( pc_get_cross_fade() == 0.0 ? PLAYER_COMMAND_STOP : PLAYER_COMMAND_PLAY_IMMEDIATE ); + } assert(pc.next_song == NULL); diff -u mpd-0.16.6/src/player_control.h mpd-0.16.6-mine/src/player_control.h --- mpd-0.16.6/src/player_control.h 2011-12-01 14:44:01.000000000 +0100 +++ mpd-0.16.6-mine/src/player_control.h 2011-12-30 23:10:33.000000000 +0100 @@ -62,6 +62,8 @@ * e.g. elapsed_time. */ PLAYER_COMMAND_REFRESH, + + PLAYER_COMMAND_PLAY_IMMEDIATE, }; enum player_error { diff -u mpd-0.16.6/src/player_thread.c mpd-0.16.6-mine/src/player_thread.c --- mpd-0.16.6/src/player_thread.c 2011-12-01 14:44:01.000000000 +0100 +++ mpd-0.16.6-mine/src/player_thread.c 2011-12-30 23:11:21.000000000 +0100 @@ -121,6 +121,8 @@ * precisly. */ float elapsed_time; + + bool next_immediately; }; static struct music_buffer *player_buffer; @@ -145,6 +147,7 @@ * * Player lock is not held. */ + static void player_dc_start(struct player *player, struct music_pipe *pipe) { @@ -522,6 +525,11 @@ case PLAYER_COMMAND_CLOSE_AUDIO: break; + case PLAYER_COMMAND_PLAY_IMMEDIATE: + player->next_immediately = 1; + player_command_finished_locked(); + break; + case PLAYER_COMMAND_UPDATE_AUDIO: player_unlock(); audio_output_all_enable_disable(); @@ -829,6 +837,35 @@ return true; } +void +check_cross_fade(struct player *player, struct decoder_control *dc) { + + /* enable cross fading in this song? if yes, + calculate how many chunks will be required + for it */ + player->cross_fade_chunks = + cross_fade_calc(pc.cross_fade_seconds, dc->total_time, + pc.mixramp_db, + pc.mixramp_delay_seconds, + dc->replay_gain_db, + dc->replay_gain_prev_db, + dc->mixramp_start, + dc->mixramp_prev_end, + &dc->out_audio_format, + &player->play_audio_format, + music_buffer_size(player_buffer) - + pc.buffered_before_play); + if (player->cross_fade_chunks > 0) { + player->xfade = XFADE_ENABLED; + player->cross_fading = false; + } else { + /* cross fading is disabled or the + next song is too short */ + player->xfade = XFADE_DISABLED; + } +} + + /* * The main loop of the player thread, during playback. This is * basically a state machine, which multiplexes data between the @@ -849,6 +886,8 @@ .cross_fade_chunks = 0, .cross_fade_tag = NULL, .elapsed_time = 0.0, + + .next_immediately = false, }; player_unlock(); @@ -930,6 +969,15 @@ */ #endif + if ( player.next_immediately ) { + + check_cross_fade(&player, dc); + + assert(dc->pipe == NULL || dc->pipe == player.pipe); + if (player.xfade == XFADE_ENABLED) dc->command = DECODE_COMMAND_STOP; + player.next_immediately = 0; + } + if (decoder_lock_is_idle(dc) && player.queued && dc->pipe == player.pipe) { /* the decoder has finished the current song; @@ -943,28 +991,8 @@ if (player_dc_at_next_song(&player) && player.xfade == XFADE_UNKNOWN && !decoder_lock_is_starting(dc)) { - /* enable cross fading in this song? if yes, - calculate how many chunks will be required - for it */ - player.cross_fade_chunks = - cross_fade_calc(pc.cross_fade_seconds, dc->total_time, - pc.mixramp_db, - pc.mixramp_delay_seconds, - dc->replay_gain_db, - dc->replay_gain_prev_db, - dc->mixramp_start, - dc->mixramp_prev_end, - &dc->out_audio_format, - &player.play_audio_format, - music_buffer_size(player_buffer) - - pc.buffered_before_play); - if (player.cross_fade_chunks > 0) { - player.xfade = XFADE_ENABLED; - player.cross_fading = false; - } else - /* cross fading is disabled or the - next song is too short */ - player.xfade = XFADE_DISABLED; + + check_cross_fade(&player, dc); } if (player.paused) { @@ -1062,6 +1090,8 @@ /* fall through */ + case PLAYER_COMMAND_PLAY_IMMEDIATE: + case PLAYER_COMMAND_PAUSE: pc.next_song = NULL; player_command_finished_locked(); @@ -1129,3 +1159,4 @@ if (pc.thread == NULL) MPD_ERROR("Failed to spawn player task: %s", e->message); } + -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ------------------------------------------------------------------------------ Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex infrastructure or vast IT resources to deliver seamless, secure access to virtual desktops. With this all-in-one solution, easily deploy virtual desktops for less than the cost of PCs and save 60% on VDI infrastructure costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox _______________________________________________ Musicpd-dev-team mailing list Musicpd-dev-team@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/musicpd-dev-team