Commit 6c135712 authored by Holger Kaelberer's avatar Holger Kaelberer
Browse files

core: Startup: delay playing welcome voices until voices are available

Without playing the intro music AND activated automatic downloads,
there was a race condition between registering voices rcc and the
playback of welcome.ogg.

We now delay it if voices are not yet available about max. 10 secs.
parent 769520f6
......@@ -40,10 +40,33 @@ Window {
id: audioVoices
muted: !ApplicationSettings.isAudioVoicesEnabled
Timer {
id: delayedWelcomeTimer
interval: 10000 /* Make sure, that playing welcome.ogg if delayed
* because of not yet registered voices, will only
* happen max 10sec after startup */
repeat: false
onTriggered: {
DownloadManager.voicesRegistered.disconnect(playDelayed);
}
function playWelcome() {
audioVoices.append(ApplicationInfo.getAudioFilePath("voices/$LOCALE/misc/welcome.ogg"));
}
}
Component.onCompleted: {
if(ApplicationSettings.isAudioEffectsEnabled)
append("qrc:/gcompris/src/core/resource/intro.ogg")
append(ApplicationInfo.getAudioFilePath("voices/$LOCALE/misc/welcome.ogg"))
if (DownloadManager.areVoicesRegistered())
delayedWelcomeTimer.playWelcome();
else {
DownloadManager.voicesRegistered.connect(
delayedWelcomeTimer.playWelcome);
delayedWelcomeTimer.start();
}
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment