Commit d07f13d6 authored by Bruno Coudoin's avatar Bruno Coudoin
Browse files

click on letter, play the voice letter in sync

Now we trig the play of the voice letter after the completion of the
message 'click on letter'. Before there was a fixed 1500ms but the
message is of variable length depending on the locale.

Extended GCAudio with the signals Error and Done.
parent a27f1aaf
...@@ -232,6 +232,9 @@ ActivityBase { ...@@ -232,6 +232,9 @@ ActivityBase {
GCAudio { GCAudio {
id: nextLevelAudio id: nextLevelAudio
source: ApplicationInfo.getAudioFilePath("voices/$LOCALE/misc/click_on_letter.ogg") source: ApplicationInfo.getAudioFilePath("voices/$LOCALE/misc/click_on_letter.ogg")
onError: letterAudio.play()
// When this sound is complete, play the letter
onDone: letterAudio.playDelayed(100);
} }
GCAudio { GCAudio {
......
...@@ -153,7 +153,6 @@ function initLevel() { ...@@ -153,7 +153,6 @@ function initLevel() {
items.questionItem.visible = false; items.questionItem.visible = false;
items.letterAudio.source = GCompris.ApplicationInfo.getAudioFilePath("voices/$LOCALE/alphabet/" items.letterAudio.source = GCompris.ApplicationInfo.getAudioFilePath("voices/$LOCALE/alphabet/"
+ Core.getSoundFilenamForChar(currentLetter)); + Core.getSoundFilenamForChar(currentLetter));
items.letterAudio.playDelayed(1500);
} else { } else {
// no sound -> show question // no sound -> show question
items.questionItem.visible = true; items.questionItem.visible = true;
......
...@@ -11,6 +11,7 @@ Item { ...@@ -11,6 +11,7 @@ Item {
property bool autoPlay property bool autoPlay
signal error signal error
signal done
function play() { function play() {
if(!muted) { if(!muted) {
...@@ -30,5 +31,6 @@ Item { ...@@ -30,5 +31,6 @@ Item {
console.log("error while playing: " + source + ": " + errorString) console.log("error while playing: " + source + ": " + errorString)
gcaudio.error() gcaudio.error()
} }
onStopped: gcaudio.done()
} }
} }
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