Commit 48a49460 authored by Bruno Coudoin's avatar Bruno Coudoin
Browse files

gletter, replaced sound effect by sound letter

It is more educational to play the sound of the letter entered
by the user. It associate the typed letter and its audio.
parent 62ee54a2
......@@ -70,6 +70,7 @@ ActivityBase {
id: items
property Item main: activity.main
property Item ourActivity: activity
property GCAudio audioVoices: activity.audioVoices
property alias background: background
property alias bar: bar
property alias bonus: bonus
......
......@@ -28,6 +28,7 @@
.pragma library
.import QtQuick 2.0 as Quick
.import GCompris 1.0 as GCompris //for ApplicationInfo
.import "qrc:/gcompris/src/core/core.js" as Core
var currentLevel = 0;
var currentSubLevel = 0;
......@@ -149,6 +150,7 @@ function initLevel() {
function processKeyPress(text) {
var typedText = uppercaseOnly ? text.toLocaleUpperCase() : text;
playLetter(text)
if (currentWord !== null) {
// check against a currently typed word
......@@ -169,7 +171,6 @@ function processKeyPress(text) {
if (currentWord !== null && currentWord.isCompleted()) {
// win!
items.audioEffects.play("qrc:/gcompris/src/core/resource/sounds/flip.wav");
currentWord.won(); // note: deleteWord() is triggered after fadeout
currentWord = null
nextSubLevel();
......@@ -323,3 +324,8 @@ function nextSubLevel() {
} else
initLevel();
}
function playLetter(letter) {
items.audioVoices.append(GCompris.ApplicationInfo.getAudioFilePath("voices/$LOCALE/alphabet/"
+ Core.getSoundFilenamForChar(letter)))
}
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