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 { ...@@ -236,7 +236,7 @@ ActivityBase {
GCAudio { GCAudio {
id: letterAudio id: letterAudio
source: "" onError: questionItem.visible = true
function playDelayed(ms) { function playDelayed(ms) {
if (letterAudioTimer.running) if (letterAudioTimer.running)
......
...@@ -150,14 +150,16 @@ function initLevel() { ...@@ -150,14 +150,16 @@ function initLevel() {
if (GCompris.ApplicationSettings.isAudioEnabled) { if (GCompris.ApplicationSettings.isAudioEnabled) {
items.nextLevelAudio.stop(); items.nextLevelAudio.stop();
items.nextLevelAudio.play(); items.nextLevelAudio.play();
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); items.letterAudio.playDelayed(1500);
} else { } else {
// no sound -> show question // no sound -> show question
items.questionItem.visible = true; items.questionItem.visible = true;
items.questionItem.text = currentLetter;
} }
// Maybe we will display it if sound fails
items.questionItem.text = currentLetter;
} }
function nextLevel() { function nextLevel() {
......
...@@ -7,8 +7,11 @@ Item { ...@@ -7,8 +7,11 @@ Item {
property bool muted: !ApplicationSettings.isAudioEnabled property bool muted: !ApplicationSettings.isAudioEnabled
property alias source: audio.source property alias source: audio.source
property alias errorString: audio.errorString
property bool autoPlay property bool autoPlay
signal error
function play() { function play() {
if(!muted) { if(!muted) {
audio.play() audio.play()
...@@ -23,6 +26,9 @@ Item { ...@@ -23,6 +26,9 @@ Item {
Audio { Audio {
id: audio id: audio
autoPlay: gcaudio.autoPlay && !gcaudio.muted 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