Commit 3d96776f authored by Bruno Coudoin's avatar Bruno Coudoin
Browse files

core, add a $CA replacement token for Compressed Audio

Now getAudioFilePath() replaces also '$CA' by the Compressed Audio
format. It also accept an absolute path in order to perform token
replacement on absolute files.

Replace all references of 'ogg' by '$CA'.
parent 0069246c
......@@ -144,7 +144,7 @@ function initLevel() {
GCompris.DownloadManager.haveLocalResource(
GCompris.DownloadManager.getVoicesResourceForLocale(
GCompris.ApplicationSettings.locale))) {
items.audioVoices.append(GCompris.ApplicationInfo.getAudioFilePath("voices-ogg/$LOCALE/misc/click_on_letter.ogg"));
items.audioVoices.append(GCompris.ApplicationInfo.getAudioFilePath("voices-$CA/$LOCALE/misc/click_on_letter.$CA"));
items.audioVoices.silence(100)
playLetter(currentLetter)
items.questionItem.visible = false
......@@ -159,7 +159,7 @@ function initLevel() {
}
function playLetter(letter) {
items.audioVoices.append(GCompris.ApplicationInfo.getAudioFilePath("voices-ogg/$LOCALE/alphabet/"
items.audioVoices.append(GCompris.ApplicationInfo.getAudioFilePath("voices-$CA/$LOCALE/alphabet/"
+ Core.getSoundFilenamForChar(letter)))
}
......
......@@ -22,116 +22,116 @@ function get() {
{
"image": "qrc:/gcompris/src/activities/colors/resource/yellow_duck.svg",
"text": qsTr("Find the yellow duck"),
"audio": ApplicationInfo.getAudioFilePath("voices-ogg/$LOCALE/colors/yellow.ogg")
"audio": ApplicationInfo.getAudioFilePath("voices-$CA/$LOCALE/colors/yellow.$CA")
},
{
"image": "qrc:/gcompris/src/activities/colors/resource/black_duck.svg",
"text": qsTr("Find the black duck"),
"audio": ApplicationInfo.getAudioFilePath("voices-ogg/$LOCALE/colors/black.ogg")
"audio": ApplicationInfo.getAudioFilePath("voices-$CA/$LOCALE/colors/black.$CA")
},
{
"image": "qrc:/gcompris/src/activities/colors/resource/green_duck.svg",
"text": qsTr("Find the green duck"),
"audio": ApplicationInfo.getAudioFilePath("voices-ogg/$LOCALE/colors/green.ogg")
"audio": ApplicationInfo.getAudioFilePath("voices-$CA/$LOCALE/colors/green.$CA")
},
{
"image": "qrc:/gcompris/src/activities/colors/resource/red_duck.svg",
"text": qsTr("Find the red duck"),
"audio": ApplicationInfo.getAudioFilePath("voices-ogg/$LOCALE/colors/red.ogg")
"audio": ApplicationInfo.getAudioFilePath("voices-$CA/$LOCALE/colors/red.$CA")
},
{
"image": "qrc:/gcompris/src/activities/colors/resource/white_duck.svg",
"text": qsTr("Find the white duck"),
"audio": ApplicationInfo.getAudioFilePath("voices-ogg/$LOCALE/colors/white.ogg")
"audio": ApplicationInfo.getAudioFilePath("voices-$CA/$LOCALE/colors/white.$CA")
},
{
"image": "qrc:/gcompris/src/activities/colors/resource/blue_duck.svg",
"text": qsTr("Find the blue duck"),
"audio": ApplicationInfo.getAudioFilePath("voices-ogg/$LOCALE/colors/blue.ogg")
"audio": ApplicationInfo.getAudioFilePath("voices-$CA/$LOCALE/colors/blue.$CA")
}
],
[ // Level 2
{
"image": "qrc:/gcompris/src/activities/colors/resource/yellow_duck.svg",
"text": qsTr("Find the yellow duck"),
"audio": ApplicationInfo.getAudioFilePath("voices-ogg/$LOCALE/colors/yellow.ogg")
"audio": ApplicationInfo.getAudioFilePath("voices-$CA/$LOCALE/colors/yellow.$CA")
},
{
"image": "qrc:/gcompris/src/activities/colors/resource/black_duck.svg",
"text": qsTr("Find the black duck"),
"audio": ApplicationInfo.getAudioFilePath("voices-ogg/$LOCALE/colors/black.ogg")
"audio": ApplicationInfo.getAudioFilePath("voices-$CA/$LOCALE/colors/black.$CA")
},
{
"image": "qrc:/gcompris/src/activities/colors/resource/brown_duck.svg",
"text": qsTr("Find the brown duck"),
"audio": ApplicationInfo.getAudioFilePath("voices-ogg/$LOCALE/colors/brown.ogg")
"audio": ApplicationInfo.getAudioFilePath("voices-$CA/$LOCALE/colors/brown.$CA")
},
{
"image": "qrc:/gcompris/src/activities/colors/resource/green_duck.svg",
"text": qsTr("Find the green duck"),
"audio": ApplicationInfo.getAudioFilePath("voices-ogg/$LOCALE/colors/green.ogg")
"audio": ApplicationInfo.getAudioFilePath("voices-$CA/$LOCALE/colors/green.$CA")
},
{
"image": "qrc:/gcompris/src/activities/colors/resource/grey_duck.svg",
"text": qsTr("Find the grey duck"),
"audio": ApplicationInfo.getAudioFilePath("voices-ogg/$LOCALE/colors/grey.ogg")
"audio": ApplicationInfo.getAudioFilePath("voices-$CA/$LOCALE/colors/grey.$CA")
},
{
"image": "qrc:/gcompris/src/activities/colors/resource/orange_duck.svg",
"text": qsTr("Find the orange duck"),
"audio": ApplicationInfo.getAudioFilePath("voices-ogg/$LOCALE/colors/orange.ogg")
"audio": ApplicationInfo.getAudioFilePath("voices-$CA/$LOCALE/colors/orange.$CA")
},
{
"image": "qrc:/gcompris/src/activities/colors/resource/purple_duck.svg",
"text": qsTr("Find the purple duck"),
"audio": ApplicationInfo.getAudioFilePath("voices-ogg/$LOCALE/colors/purple.ogg")
"audio": ApplicationInfo.getAudioFilePath("voices-$CA/$LOCALE/colors/purple.$CA")
},
{
"image": "qrc:/gcompris/src/activities/colors/resource/white_duck.svg",
"text": qsTr("Find the white duck"),
"audio": ApplicationInfo.getAudioFilePath("voices-ogg/$LOCALE/colors/white.ogg")
"audio": ApplicationInfo.getAudioFilePath("voices-$CA/$LOCALE/colors/white.$CA")
}
],
[ // Level 3
{
"image": "qrc:/gcompris/src/activities/colors/resource/yellow_duck.svg",
"text": qsTr("Find the yellow duck"),
"audio": ApplicationInfo.getAudioFilePath("voices-ogg/$LOCALE/colors/yellow.ogg")
"audio": ApplicationInfo.getAudioFilePath("voices-$CA/$LOCALE/colors/yellow.$CA")
},
{
"image": "qrc:/gcompris/src/activities/colors/resource/brown_duck.svg",
"text": qsTr("Find the brown duck"),
"audio": ApplicationInfo.getAudioFilePath("voices-ogg/$LOCALE/colors/brown.ogg")
"audio": ApplicationInfo.getAudioFilePath("voices-$CA/$LOCALE/colors/brown.$CA")
},
{
"image": "qrc:/gcompris/src/activities/colors/resource/green_duck.svg",
"text": qsTr("Find the green duck"),
"audio": ApplicationInfo.getAudioFilePath("voices-ogg/$LOCALE/colors/green.ogg")
"audio": ApplicationInfo.getAudioFilePath("voices-$CA/$LOCALE/colors/green.$CA")
},
{
"image": "qrc:/gcompris/src/activities/colors/resource/grey_duck.svg",
"text": qsTr("Find the grey duck"),
"audio": ApplicationInfo.getAudioFilePath("voices-ogg/$LOCALE/colors/grey.ogg")
"audio": ApplicationInfo.getAudioFilePath("voices-$CA/$LOCALE/colors/grey.$CA")
},
{
"image": "qrc:/gcompris/src/activities/colors/resource/orange_duck.svg",
"text": qsTr("Find the orange duck"),
"audio": ApplicationInfo.getAudioFilePath("voices-ogg/$LOCALE/colors/orange.ogg")
"audio": ApplicationInfo.getAudioFilePath("voices-$CA/$LOCALE/colors/orange.$CA")
},
{
"image": "qrc:/gcompris/src/activities/colors/resource/purple_duck.svg",
"text": qsTr("Find the purple duck"),
"audio": ApplicationInfo.getAudioFilePath("voices-ogg/$LOCALE/colors/purple.ogg")
"audio": ApplicationInfo.getAudioFilePath("voices-$CA/$LOCALE/colors/purple.$CA")
},
{
"image": "qrc:/gcompris/src/activities/colors/resource/red_duck.svg",
"text": qsTr("Find the red duck"),
"audio": ApplicationInfo.getAudioFilePath("voices-ogg/$LOCALE/colors/red.ogg")
"audio": ApplicationInfo.getAudioFilePath("voices-$CA/$LOCALE/colors/red.$CA")
},
{
"image": "qrc:/gcompris/src/activities/colors/resource/blue_duck.svg",
"text": qsTr("Find the blue duck"),
"audio": ApplicationInfo.getAudioFilePath("voices-ogg/$LOCALE/colors/blue.ogg")
"audio": ApplicationInfo.getAudioFilePath("voices-$CA/$LOCALE/colors/blue.$CA")
}
]
];
......
This diff is collapsed.
This diff is collapsed.
......@@ -48,47 +48,47 @@ var images = [
var sounds = [
["",
GCompris.ApplicationInfo.getAudioFilePath("voices-ogg/$LOCALE/alphabet/U0030.ogg")],
GCompris.ApplicationInfo.getAudioFilePath("voices-$CA/$LOCALE/alphabet/U0030.$CA")],
["",
GCompris.ApplicationInfo.getAudioFilePath("voices-ogg/$LOCALE/alphabet/U0031.ogg")],
GCompris.ApplicationInfo.getAudioFilePath("voices-$CA/$LOCALE/alphabet/U0031.$CA")],
["",
GCompris.ApplicationInfo.getAudioFilePath("voices-ogg/$LOCALE/alphabet/U0032.ogg")],
GCompris.ApplicationInfo.getAudioFilePath("voices-$CA/$LOCALE/alphabet/U0032.$CA")],
["",
GCompris.ApplicationInfo.getAudioFilePath("voices-ogg/$LOCALE/alphabet/U0033.ogg")],
GCompris.ApplicationInfo.getAudioFilePath("voices-$CA/$LOCALE/alphabet/U0033.$CA")],
["",
GCompris.ApplicationInfo.getAudioFilePath("voices-ogg/$LOCALE/alphabet/U0034.ogg")],
GCompris.ApplicationInfo.getAudioFilePath("voices-$CA/$LOCALE/alphabet/U0034.$CA")],
["",
GCompris.ApplicationInfo.getAudioFilePath("voices-ogg/$LOCALE/alphabet/U0035.ogg")],
GCompris.ApplicationInfo.getAudioFilePath("voices-$CA/$LOCALE/alphabet/U0035.$CA")],
["",
GCompris.ApplicationInfo.getAudioFilePath("voices-ogg/$LOCALE/alphabet/U0036.ogg")],
GCompris.ApplicationInfo.getAudioFilePath("voices-$CA/$LOCALE/alphabet/U0036.$CA")],
["",
GCompris.ApplicationInfo.getAudioFilePath("voices-ogg/$LOCALE/alphabet/U0037.ogg")],
GCompris.ApplicationInfo.getAudioFilePath("voices-$CA/$LOCALE/alphabet/U0037.$CA")],
["",
GCompris.ApplicationInfo.getAudioFilePath("voices-ogg/$LOCALE/alphabet/U0038.ogg")],
GCompris.ApplicationInfo.getAudioFilePath("voices-$CA/$LOCALE/alphabet/U0038.$CA")],
["",
GCompris.ApplicationInfo.getAudioFilePath("voices-ogg/$LOCALE/alphabet/U0039.ogg")],
GCompris.ApplicationInfo.getAudioFilePath("voices-$CA/$LOCALE/alphabet/U0039.$CA")],
["",
GCompris.ApplicationInfo.getAudioFilePath("voices-ogg/$LOCALE/alphabet/10.ogg")],
GCompris.ApplicationInfo.getAudioFilePath("voices-$CA/$LOCALE/alphabet/10.$CA")],
["",
GCompris.ApplicationInfo.getAudioFilePath("voices-ogg/$LOCALE/alphabet/11.ogg")],
GCompris.ApplicationInfo.getAudioFilePath("voices-$CA/$LOCALE/alphabet/11.$CA")],
["",
GCompris.ApplicationInfo.getAudioFilePath("voices-ogg/$LOCALE/alphabet/12.ogg")],
GCompris.ApplicationInfo.getAudioFilePath("voices-$CA/$LOCALE/alphabet/12.$CA")],
["",
GCompris.ApplicationInfo.getAudioFilePath("voices-ogg/$LOCALE/alphabet/13.ogg")],
GCompris.ApplicationInfo.getAudioFilePath("voices-$CA/$LOCALE/alphabet/13.$CA")],
["",
GCompris.ApplicationInfo.getAudioFilePath("voices-ogg/$LOCALE/alphabet/14.ogg")],
GCompris.ApplicationInfo.getAudioFilePath("voices-$CA/$LOCALE/alphabet/14.$CA")],
["",
GCompris.ApplicationInfo.getAudioFilePath("voices-ogg/$LOCALE/alphabet/15.ogg")],
GCompris.ApplicationInfo.getAudioFilePath("voices-$CA/$LOCALE/alphabet/15.$CA")],
["",
GCompris.ApplicationInfo.getAudioFilePath("voices-ogg/$LOCALE/alphabet/16.ogg")],
GCompris.ApplicationInfo.getAudioFilePath("voices-$CA/$LOCALE/alphabet/16.$CA")],
["",
GCompris.ApplicationInfo.getAudioFilePath("voices-ogg/$LOCALE/alphabet/17.ogg")],
GCompris.ApplicationInfo.getAudioFilePath("voices-$CA/$LOCALE/alphabet/17.$CA")],
["",
GCompris.ApplicationInfo.getAudioFilePath("voices-ogg/$LOCALE/alphabet/18.ogg")],
GCompris.ApplicationInfo.getAudioFilePath("voices-$CA/$LOCALE/alphabet/18.$CA")],
["",
GCompris.ApplicationInfo.getAudioFilePath("voices-ogg/$LOCALE/alphabet/19.ogg")],
GCompris.ApplicationInfo.getAudioFilePath("voices-$CA/$LOCALE/alphabet/19.$CA")],
["",
GCompris.ApplicationInfo.getAudioFilePath("voices-ogg/$LOCALE/alphabet/20.ogg")]
GCompris.ApplicationInfo.getAudioFilePath("voices-$CA/$LOCALE/alphabet/20.$CA")]
]
......
......@@ -44,47 +44,47 @@ var texts = [
var sounds = [
["",
GCompris.ApplicationInfo.getAudioFilePath("voices-ogg/$LOCALE/alphabet/U0030.ogg")],
GCompris.ApplicationInfo.getAudioFilePath("voices-$CA/$LOCALE/alphabet/U0030.$CA")],
["",
GCompris.ApplicationInfo.getAudioFilePath("voices-ogg/$LOCALE/alphabet/U0031.ogg")],
GCompris.ApplicationInfo.getAudioFilePath("voices-$CA/$LOCALE/alphabet/U0031.$CA")],
["",
GCompris.ApplicationInfo.getAudioFilePath("voices-ogg/$LOCALE/alphabet/U0032.ogg")],
GCompris.ApplicationInfo.getAudioFilePath("voices-$CA/$LOCALE/alphabet/U0032.$CA")],
["",
GCompris.ApplicationInfo.getAudioFilePath("voices-ogg/$LOCALE/alphabet/U0033.ogg")],
GCompris.ApplicationInfo.getAudioFilePath("voices-$CA/$LOCALE/alphabet/U0033.$CA")],
["",
GCompris.ApplicationInfo.getAudioFilePath("voices-ogg/$LOCALE/alphabet/U0034.ogg")],
GCompris.ApplicationInfo.getAudioFilePath("voices-$CA/$LOCALE/alphabet/U0034.$CA")],
["",
GCompris.ApplicationInfo.getAudioFilePath("voices-ogg/$LOCALE/alphabet/U0035.ogg")],
GCompris.ApplicationInfo.getAudioFilePath("voices-$CA/$LOCALE/alphabet/U0035.$CA")],
["",
GCompris.ApplicationInfo.getAudioFilePath("voices-ogg/$LOCALE/alphabet/U0036.ogg")],
GCompris.ApplicationInfo.getAudioFilePath("voices-$CA/$LOCALE/alphabet/U0036.$CA")],
["",
GCompris.ApplicationInfo.getAudioFilePath("voices-ogg/$LOCALE/alphabet/U0037.ogg")],
GCompris.ApplicationInfo.getAudioFilePath("voices-$CA/$LOCALE/alphabet/U0037.$CA")],
["",
GCompris.ApplicationInfo.getAudioFilePath("voices-ogg/$LOCALE/alphabet/U0038.ogg")],
GCompris.ApplicationInfo.getAudioFilePath("voices-$CA/$LOCALE/alphabet/U0038.$CA")],
["",
GCompris.ApplicationInfo.getAudioFilePath("voices-ogg/$LOCALE/alphabet/U0039.ogg")],
GCompris.ApplicationInfo.getAudioFilePath("voices-$CA/$LOCALE/alphabet/U0039.$CA")],
["",
GCompris.ApplicationInfo.getAudioFilePath("voices-ogg/$LOCALE/alphabet/10.ogg")],
GCompris.ApplicationInfo.getAudioFilePath("voices-$CA/$LOCALE/alphabet/10.$CA")],
["",
GCompris.ApplicationInfo.getAudioFilePath("voices-ogg/$LOCALE/alphabet/11.ogg")],
GCompris.ApplicationInfo.getAudioFilePath("voices-$CA/$LOCALE/alphabet/11.$CA")],
["",
GCompris.ApplicationInfo.getAudioFilePath("voices-ogg/$LOCALE/alphabet/12.ogg")],
GCompris.ApplicationInfo.getAudioFilePath("voices-$CA/$LOCALE/alphabet/12.$CA")],
["",
GCompris.ApplicationInfo.getAudioFilePath("voices-ogg/$LOCALE/alphabet/13.ogg")],
GCompris.ApplicationInfo.getAudioFilePath("voices-$CA/$LOCALE/alphabet/13.$CA")],
["",
GCompris.ApplicationInfo.getAudioFilePath("voices-ogg/$LOCALE/alphabet/14.ogg")],
GCompris.ApplicationInfo.getAudioFilePath("voices-$CA/$LOCALE/alphabet/14.$CA")],
["",
GCompris.ApplicationInfo.getAudioFilePath("voices-ogg/$LOCALE/alphabet/15.ogg")],
GCompris.ApplicationInfo.getAudioFilePath("voices-$CA/$LOCALE/alphabet/15.$CA")],
["",
GCompris.ApplicationInfo.getAudioFilePath("voices-ogg/$LOCALE/alphabet/16.ogg")],
GCompris.ApplicationInfo.getAudioFilePath("voices-$CA/$LOCALE/alphabet/16.$CA")],
["",
GCompris.ApplicationInfo.getAudioFilePath("voices-ogg/$LOCALE/alphabet/17.ogg")],
GCompris.ApplicationInfo.getAudioFilePath("voices-$CA/$LOCALE/alphabet/17.$CA")],
["",
GCompris.ApplicationInfo.getAudioFilePath("voices-ogg/$LOCALE/alphabet/18.ogg")],
GCompris.ApplicationInfo.getAudioFilePath("voices-$CA/$LOCALE/alphabet/18.$CA")],
["",
GCompris.ApplicationInfo.getAudioFilePath("voices-ogg/$LOCALE/alphabet/19.ogg")],
GCompris.ApplicationInfo.getAudioFilePath("voices-$CA/$LOCALE/alphabet/19.$CA")],
["",
GCompris.ApplicationInfo.getAudioFilePath("voices-ogg/$LOCALE/alphabet/20.ogg")]
GCompris.ApplicationInfo.getAudioFilePath("voices-$CA/$LOCALE/alphabet/20.$CA")]
]
......
......@@ -170,7 +170,7 @@ ActivityBase {
signal hit
onHit: {
activity.audioEffects.play(Activity.url + "pickaxe.ogg")
activity.audioEffects.play(Activity.url + "pickaxe.$CA")
background.gotIt = true
tuto.setState("Unzoom")
}
......@@ -203,7 +203,7 @@ ActivityBase {
opacity: !modelData.isTarget ? 1 : (background.gotIt ? 0 : 1)
Component.onCompleted: {
activity.audioEffects.play(Activity.url + "realrainbow.ogg")
activity.audioEffects.play(Activity.url + "realrainbow.$CA")
}
ParallelAnimation {
......
......@@ -253,6 +253,6 @@ function createLastLevel()
}
function playLetter(letter) {
items.audioVoices.append(GCompris.ApplicationInfo.getAudioFilePath("voices-ogg/$LOCALE/alphabet/"
items.audioVoices.append(GCompris.ApplicationInfo.getAudioFilePath("voices-$CA/$LOCALE/alphabet/"
+ Core.getSoundFilenamForChar(letter)))
}
......@@ -324,10 +324,10 @@ function handleCollisionsWithCloud() {
function playLetterSound(number) {
if(number < 10)
items.audioVoices.play(
GCompris.ApplicationInfo.getAudioFilePath("voices-ogg/$LOCALE/alphabet/"
GCompris.ApplicationInfo.getAudioFilePath("voices-$CA/$LOCALE/alphabet/"
+ Core.getSoundFilenamForChar(number)))
else
items.audioVoices.play(GCompris.ApplicationInfo.getAudioFilePath("voices-ogg/$LOCALE/alphabet/"
+ number + ".ogg"))
items.audioVoices.play(GCompris.ApplicationInfo.getAudioFilePath("voices-$CA/$LOCALE/alphabet/"
+ number + ".$CA"))
}
......@@ -141,7 +141,12 @@ QString ApplicationInfo::getAudioFilePath(const QString &file)
QString filename = file;
filename.replace("$LOCALE", localeName);
return getResourceDataPath() + '/' + filename;
filename.replace("$CA", COMPRESSED_AUDIO);
if(file.startsWith("/") || file.startsWith("qrc:") || file.startsWith(":"))
return filename;
else
return getResourceDataPath() + '/' + filename;
}
QString ApplicationInfo::getLocaleFilePath(const QString &file)
......
......@@ -239,12 +239,15 @@ protected slots:
QString getResourceDataPath();
/**
* Returns an absolute path to a langauge specific sound/voices file.
* Returns an absolute path to a language specific sound/voices file. If
* the file is already absolute only the token replacement is applied.
*
* @param file A templated relative path to a language specific file. Any
* occurence of the '$LOCALE' placeholder will be replaced by
* the currently active locale string.
* Example: 'voices-ogg/$LOCALE/misc/click_on_letter.ogg'
* Any occurence of '$CA' placeholder will be replaced by
* the current compressed audio format ('ogg' or 'aac).
* Example: 'voices-$CA/$LOCALE/misc/click_on_letter.$CA'
* @returns An absolute path to the corresponding resource file.
*/
Q_INVOKABLE QString getAudioFilePath(const QString &file);
......
......@@ -92,7 +92,7 @@ class ApplicationSettings : public QObject
Q_PROPERTY(bool showLockedActivities READ showLockedActivities WRITE setShowLockedActivities NOTIFY showLockedActivitiesChanged)
/**
* Whether audio voices-ogg/speech should be enabled.
* Whether audio voices/speech should be enabled.
*/
Q_PROPERTY(bool isAudioVoicesEnabled READ isAudioVoicesEnabled WRITE setIsAudioVoicesEnabled NOTIFY audioVoicesEnabledChanged)
......
......@@ -71,17 +71,17 @@ Image {
property string url: "qrc:/gcompris/src/core/resource/"
property bool isWin: false
property var winVoices: [
"voices-ogg/$LOCALE/misc/congratulation.ogg",
"voices-ogg/$LOCALE/misc/great.ogg",
"voices-ogg/$LOCALE/misc/good.ogg",
"voices-ogg/$LOCALE/misc/awesome.ogg",
"voices-ogg/$LOCALE/misc/fantastic.ogg",
"voices-ogg/$LOCALE/misc/waytogo.ogg",
"voices-ogg/$LOCALE/misc/super.ogg",
"voices-ogg/$LOCALE/misc/perfect.ogg"
"voices-$CA/$LOCALE/misc/congratulation.$CA",
"voices-$CA/$LOCALE/misc/great.$CA",
"voices-$CA/$LOCALE/misc/good.$CA",
"voices-$CA/$LOCALE/misc/awesome.$CA",
"voices-$CA/$LOCALE/misc/fantastic.$CA",
"voices-$CA/$LOCALE/misc/waytogo.$CA",
"voices-$CA/$LOCALE/misc/super.$CA",
"voices-$CA/$LOCALE/misc/perfect.$CA"
]
property var looseVoices: [
"voices-ogg/$LOCALE/misc/check_answer.ogg"
"voices-$CA/$LOCALE/misc/check_answer.$CA"
]
/// @endcond
......
......@@ -33,8 +33,12 @@ import GCompris 1.0
* sequentially, to which the user can enqueue files that should be scheduled
* for playback.
*
* It makes sure that all audio sources are normalized with respect to
* ApplicationInfo.CompressedAudio.
* To make sure an audio voice will be localized, replace the locale part
* of the file by '$LOCALE'.
*
* To makes sure that all audio sources are normalized with respect to
* ApplicationInfo.CompressedAudio replace the 'ogg' part of the file by
* '$CA'.
*
* @inherit QtQuick.Item
*/
......@@ -84,22 +88,6 @@ Item {
*/
signal done
/**
* Helper to normalize audio filename extensions.
*
* @param type:string file Audio source url.
* @returns Url to the passed file with the extension adjusted to what is
* set in ApplicationInfo.CompressedAudio
* @sa ApplicationInfo.CompressedAudio
*/
function normalize(file) {
if(ApplicationInfo.CompressedAudio === "ogg")
return file
return file.replace('-ogg', "-" + ApplicationInfo.CompressedAudio).
replace('.ogg', "." + ApplicationInfo.CompressedAudio)
}
/**
* Plays back the audio resource @p file.
*
......@@ -108,8 +96,7 @@ Item {
* exist or audio is muted
*/
function play(file) {
file = normalize(file)
console.log("play ", file)
if(!fileId.exists(file) || muted)
return false
......@@ -142,7 +129,7 @@ Item {
* audio is muted
*/
function append(file) {
file = normalize(file)
console.log("append ", file)
if(!fileId.exists(file) || muted)
return false
......
......@@ -60,7 +60,7 @@ function getSoundFilenamForChar(c)
while (codeHex.length < 4) {
codeHex = "0" + codeHex;
}
result += codeHex + ".ogg";
result += codeHex + ".$CA";
return result;
}
......
......@@ -78,13 +78,13 @@ Window {
}
function playWelcome() {
audioVoices.append(ApplicationInfo.getAudioFilePath("voices-ogg/$LOCALE/misc/welcome.ogg"));
audioVoices.append(ApplicationInfo.getAudioFilePath("voices-$CA/$LOCALE/misc/welcome.$CA"));
}
}
Component.onCompleted: {
if(ApplicationSettings.isAudioEffectsEnabled)
append("qrc:/gcompris/src/core/resource/intro.ogg")
append(ApplicationInfo.getAudioFilePath("qrc:/gcompris/src/core/resource/intro.$CA"))
if (DownloadManager.areVoicesRegistered())
delayedWelcomeTimer.playWelcome();
......@@ -103,7 +103,7 @@ Window {
function playIntroVoice(name) {
name = name.split("/")[0]
audioVoices.append(ApplicationInfo.getAudioFilePath("voices-ogg/$LOCALE/intro/" + name + ".ogg"))
audioVoices.append(ApplicationInfo.getAudioFilePath("voices-$CA/$LOCALE/intro/" + name + ".$CA"))
}
Component.onCompleted: {
......
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