summaryrefslogtreecommitdiff
path: root/apps/playback.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/playback.c')
-rw-r--r--apps/playback.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/apps/playback.c b/apps/playback.c
index a2f1672ea1..6f5084e14a 100644
--- a/apps/playback.c
+++ b/apps/playback.c
@@ -146,7 +146,11 @@ enum {
146#endif 146#endif
147#define CODEC_IRAM_SIZE 0xc000 147#define CODEC_IRAM_SIZE 0xc000
148 148
149#ifndef SIMULATOR
149extern bool audio_is_initialized; 150extern bool audio_is_initialized;
151#else
152static bool audio_is_initialized = false;
153#endif
150 154
151/* Buffer control thread. */ 155/* Buffer control thread. */
152static struct event_queue audio_queue; 156static struct event_queue audio_queue;
@@ -2726,7 +2730,7 @@ void audio_set_buffer_margin(int setting)
2726void audio_set_crossfade(int enable) 2730void audio_set_crossfade(int enable)
2727{ 2731{
2728 size_t size; 2732 size_t size;
2729 bool was_playing = playing; 2733 bool was_playing = (playing && audio_is_initialized);
2730 size_t offset = 0; 2734 size_t offset = 0;
2731 int seconds = 1; 2735 int seconds = 1;
2732 2736
@@ -2885,11 +2889,10 @@ static void playback_init(void)
2885 2889
2886 filebuf = (char *)&audiobuf[MALLOC_BUFSIZE]; 2890 filebuf = (char *)&audiobuf[MALLOC_BUFSIZE];
2887 2891
2888 /* FIXME: This call will infinite loop if called on the audio thread
2889 * while playing, fortunately this is an init call so that should be
2890 * impossible. */
2891 audio_set_crossfade(global_settings.crossfade); 2892 audio_set_crossfade(global_settings.crossfade);
2892 2893
2894 audio_is_initialized = true;
2895
2893 sound_settings_apply(); 2896 sound_settings_apply();
2894} 2897}
2895 2898