diff options
-rw-r--r-- | apps/playback.c | 32 | ||||
-rw-r--r-- | apps/playlist.c | 3 |
2 files changed, 26 insertions, 9 deletions
diff --git a/apps/playback.c b/apps/playback.c index dfe0ab7300..ff2f9d58cc 100644 --- a/apps/playback.c +++ b/apps/playback.c | |||
@@ -1527,7 +1527,12 @@ static int skip_next_track(void) | |||
1527 | { | 1527 | { |
1528 | logf("Loading from disk..."); | 1528 | logf("Loading from disk..."); |
1529 | ci.reload_codec = true; | 1529 | ci.reload_codec = true; |
1530 | //queue_post(&audio_queue, AUDIO_PLAY, 0); | 1530 | /* Stop playback if manual track change. */ |
1531 | if (new_track != 0 && !pcmbuf_is_crossfade_enabled()) | ||
1532 | pcmbuf_play_stop(); | ||
1533 | |||
1534 | /* Don't flush buffer */ | ||
1535 | queue_post(&audio_queue, AUDIO_PLAY, (bool *)false); | ||
1531 | return SKIP_OK_DISK; | 1536 | return SKIP_OK_DISK; |
1532 | } | 1537 | } |
1533 | 1538 | ||
@@ -1559,7 +1564,12 @@ static int skip_previous_track(void) | |||
1559 | /*+ (off_t)tracks[track_ridx].codecsize*/ > filebuflen) { | 1564 | /*+ (off_t)tracks[track_ridx].codecsize*/ > filebuflen) { |
1560 | logf("Loading from disk..."); | 1565 | logf("Loading from disk..."); |
1561 | ci.reload_codec = true; | 1566 | ci.reload_codec = true; |
1562 | queue_post(&audio_queue, AUDIO_PLAY, 0); | 1567 | /* Stop playback. */ |
1568 | /* FIXME: Only stop playback if disk is not spinning! */ | ||
1569 | if (!pcmbuf_is_crossfade_enabled()) | ||
1570 | pcmbuf_play_stop(); | ||
1571 | |||
1572 | queue_post(&audio_queue, AUDIO_PLAY, (bool *)true); | ||
1563 | return SKIP_OK_DISK; | 1573 | return SKIP_OK_DISK; |
1564 | } | 1574 | } |
1565 | 1575 | ||
@@ -1597,8 +1607,8 @@ static void audio_change_track(void) | |||
1597 | 1607 | ||
1598 | ci.reload_codec = false; | 1608 | ci.reload_codec = false; |
1599 | /* Needed for fast skipping. */ | 1609 | /* Needed for fast skipping. */ |
1600 | if (cur_ti->codecsize > 0) | 1610 | //if (cur_ti->codecsize > 0) |
1601 | queue_post(&codec_queue, CODEC_LOAD, 0); | 1611 | // queue_post(&codec_queue, CODEC_LOAD, 0); |
1602 | } | 1612 | } |
1603 | 1613 | ||
1604 | bool codec_request_next_track_callback(void) | 1614 | bool codec_request_next_track_callback(void) |
@@ -1644,7 +1654,7 @@ bool codec_request_next_track_callback(void) | |||
1644 | if (cur_ti->codecsize == 0) | 1654 | if (cur_ti->codecsize == 0) |
1645 | { | 1655 | { |
1646 | logf("Loading from disk [2]..."); | 1656 | logf("Loading from disk [2]..."); |
1647 | queue_post(&audio_queue, AUDIO_PLAY, 0); | 1657 | queue_post(&audio_queue, AUDIO_PLAY, (bool *)(new_track != 0)); |
1648 | } | 1658 | } |
1649 | else | 1659 | else |
1650 | ci.reload_codec = true; | 1660 | ci.reload_codec = true; |
@@ -1682,7 +1692,7 @@ static void initiate_track_change(int peek_index) | |||
1682 | { | 1692 | { |
1683 | /* Detect if disk is spinning or already loading. */ | 1693 | /* Detect if disk is spinning or already loading. */ |
1684 | if (filling || ci.reload_codec || !audio_codec_loaded) { | 1694 | if (filling || ci.reload_codec || !audio_codec_loaded) { |
1685 | queue_post(&audio_queue, AUDIO_PLAY, 0); | 1695 | queue_post(&audio_queue, AUDIO_PLAY, (bool *)true); |
1686 | } else { | 1696 | } else { |
1687 | new_track = peek_index; | 1697 | new_track = peek_index; |
1688 | ci.reload_codec = true; | 1698 | ci.reload_codec = true; |
@@ -1698,7 +1708,7 @@ static void initiate_dir_change(int direction) | |||
1698 | if(!playlist_next_dir(direction)) | 1708 | if(!playlist_next_dir(direction)) |
1699 | return; | 1709 | return; |
1700 | 1710 | ||
1701 | queue_post(&audio_queue, AUDIO_PLAY, 0); | 1711 | queue_post(&audio_queue, AUDIO_PLAY, (bool *)true); |
1702 | 1712 | ||
1703 | codec_track_changed(); | 1713 | codec_track_changed(); |
1704 | } | 1714 | } |
@@ -1725,7 +1735,7 @@ void audio_thread(void) | |||
1725 | if (ev.id == SYS_TIMEOUT && play_pending) | 1735 | if (ev.id == SYS_TIMEOUT && play_pending) |
1726 | { | 1736 | { |
1727 | ev.id = AUDIO_PLAY; | 1737 | ev.id = AUDIO_PLAY; |
1728 | ev.data = 0; | 1738 | ev.data = (bool *)1; |
1729 | } | 1739 | } |
1730 | 1740 | ||
1731 | switch (ev.id) { | 1741 | switch (ev.id) { |
@@ -1760,7 +1770,11 @@ void audio_thread(void) | |||
1760 | ci.stop_codec = true; | 1770 | ci.stop_codec = true; |
1761 | ci.reload_codec = false; | 1771 | ci.reload_codec = false; |
1762 | ci.seek_time = 0; | 1772 | ci.seek_time = 0; |
1763 | pcmbuf_crossfade_init(); | 1773 | |
1774 | /* Only flush audio if it has been requested. */ | ||
1775 | if ((bool)ev.data) | ||
1776 | pcmbuf_crossfade_init(); | ||
1777 | |||
1764 | while (audio_codec_loaded) | 1778 | while (audio_codec_loaded) |
1765 | yield(); | 1779 | yield(); |
1766 | audio_play_start((int)ev.data); | 1780 | audio_play_start((int)ev.data); |
diff --git a/apps/playlist.c b/apps/playlist.c index 46556bff12..e8239b21f2 100644 --- a/apps/playlist.c +++ b/apps/playlist.c | |||
@@ -2256,7 +2256,10 @@ int playlist_next(int steps) | |||
2256 | ft_build_playlist(tree_get_context(), 0); | 2256 | ft_build_playlist(tree_get_context(), 0); |
2257 | if (global_settings.playlist_shuffle) | 2257 | if (global_settings.playlist_shuffle) |
2258 | playlist_shuffle(current_tick, -1); | 2258 | playlist_shuffle(current_tick, -1); |
2259 | #if CONFIG_CODEC != SWCODEC | ||
2259 | playlist_start(0, 0); | 2260 | playlist_start(0, 0); |
2261 | #endif | ||
2262 | playlist->index = 0; | ||
2260 | index = 0; | 2263 | index = 0; |
2261 | } | 2264 | } |
2262 | } | 2265 | } |