Rockbox open source high quality audio player as a Music Player Daemon
mpris rockbox mpd libadwaita audio rust zig deno
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

pcm: Make pcm_is_ready a per-sink property instead of a global.

All that matters is that the _current_ sink is ready, not all possible
sinks. When switching sinks we will need to ensure tehy are initialized
before switching over.

Change-Id: I341f7e9dcb4e2add4d0b292b68b69eb08dec0194

+11 -11
+1
firmware/export/pcm_sink.h
··· 47 47 /* runtime states */ 48 48 unsigned long pending_freq; 49 49 unsigned long configured_freq; 50 + unsigned long pcm_is_ready; 50 51 }; 51 52 52 53 enum pcm_sink_ids {
+10 -11
firmware/pcm.c
··· 76 76 * 77 77 */ 78 78 79 - /* 'true' when all stages of pcm initialization have completed */ 80 - static bool pcm_is_ready = false; 81 - 82 79 static struct pcm_sink* sinks[1] = { 83 80 [PCM_SINK_BUILTIN] = &builtin_pcm_sink, 84 81 }; ··· 142 139 143 140 static void pcm_wait_for_init(void) 144 141 { 145 - while (!pcm_is_ready) 142 + while (!sinks[cur_sink]->pcm_is_ready) 146 143 sleep(0); 147 144 } 148 145 ··· 251 248 logf("pcm_init"); 252 249 253 250 for(size_t i = 0; i < ARRAYLEN(sinks); i += 1) { 254 - sinks[i]->pending_freq = sinks[i]->caps.default_freq; 255 - sinks[i]->configured_freq = -1UL; 256 - sinks[i]->ops.init(); 251 + struct pcm_sink* sink = sinks[i]; 252 + sink->pending_freq = sink->caps.default_freq; 253 + sink->configured_freq = -1UL; 254 + sink->pcm_is_ready = false; 255 + sink->ops.init(); 257 256 } 258 257 } 259 258 ··· 263 262 logf("pcm_postinit"); 264 263 265 264 for(size_t i = 0; i < ARRAYLEN(sinks); i += 1) { 266 - sinks[i]->ops.postinit(); 265 + struct pcm_sink* sink = sinks[i]; 266 + sink->ops.postinit(); 267 + sink->pcm_is_ready = true; 267 268 } 268 - 269 - pcm_is_ready = true; 270 269 } 271 270 272 271 bool pcm_is_initialized(void) 273 272 { 274 - return pcm_is_ready; 273 + return sinks[cur_sink]->pcm_is_ready; 275 274 } 276 275 277 276 enum pcm_sink_ids pcm_current_sink(void)