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

click_on_letter, display the letter if the sound is not found

Added the error signal in GCAudio to let the caller catch it.
parent 09aa4a35
......@@ -236,7 +236,7 @@ ActivityBase {
GCAudio {
id: letterAudio
source: ""
onError: questionItem.visible = true
function playDelayed(ms) {
if (letterAudioTimer.running)
......
......@@ -150,14 +150,16 @@ function initLevel() {
if (GCompris.ApplicationSettings.isAudioEnabled) {
items.nextLevelAudio.stop();
items.nextLevelAudio.play();
items.questionItem.visible = false;
items.letterAudio.source = GCompris.ApplicationInfo.getAudioFilePath("voices/$LOCALE/alphabet/"
+ Core.getSoundFilenamForChar(currentLetter));
items.letterAudio.playDelayed(1500);
} else {
} else {
// no sound -> show question
items.questionItem.visible = true;
items.questionItem.text = currentLetter;
}
// Maybe we will display it if sound fails
items.questionItem.text = currentLetter;
}
function nextLevel() {
......
......@@ -7,8 +7,11 @@ Item {
property bool muted: !ApplicationSettings.isAudioEnabled
property alias source: audio.source
property alias errorString: audio.errorString
property bool autoPlay
signal error
function play() {
if(!muted) {
audio.play()
......@@ -23,6 +26,9 @@ Item {
Audio {
id: audio
autoPlay: gcaudio.autoPlay && !gcaudio.muted
onError: console.log("error while playing: " + source + ": " + errorString)
onError: {
console.log("error while playing: " + source + ": " + errorString)
gcaudio.error()
}
}
}
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