diff --git a/mainapp/Classes/Games/Books/BookPage.cpp b/mainapp/Classes/Games/Books/BookPage.cpp index be1ca1736..b243b985a 100644 --- a/mainapp/Classes/Games/Books/BookPage.cpp +++ b/mainapp/Classes/Games/Books/BookPage.cpp @@ -140,8 +140,8 @@ void BookPage::update(float delta) { readSentence.append(" "); readSentence.append(w.word); - VoiceMoldManager::shared()->speak(readSentence); } + VoiceMoldManager::shared()->speak(readSentence); _timeSentence = 0.0; } } diff --git a/mainapp/Classes/Games/Books/TodoBook.cpp b/mainapp/Classes/Games/Books/TodoBook.cpp index 90fb5f28b..41bd1cfe2 100644 --- a/mainapp/Classes/Games/Books/TodoBook.cpp +++ b/mainapp/Classes/Games/Books/TodoBook.cpp @@ -113,7 +113,8 @@ void TodoBook::readData(string &filedata) else { sentence.sentenceAudioFilename = row[1]; - sentence.startTimingInPage = TodoUtil::stod(row[2]); + sentence.startTimingInPage = currentPage.timeGuessedinPage; + CCLOG("LOG: %d, %f", TodoUtil::stod(row[2]), currentPage.timeGuessedinPage); } currentParagraph.sentences.push_back(sentence); @@ -127,10 +128,17 @@ void TodoBook::readData(string &filedata) TodoSentence ¤tSentence = currentParagraph.sentences.back(); TodoWord word; - word.startTimingInSentence = TodoUtil::stod(row[1]); + word.startTimingInSentence = currentSentence.timeGuessedinSentence; + CCLOG("LOG: %f, %f", TodoUtil::stod(row[1]), currentSentence.timeGuessedinSentence); + std::string spoken = ""; + spoken.append(word.word); + spoken.append(" "); + currentSentence.timeGuessedinSentence += VoiceMoldManager::shared()->guessSpeakDuration(spoken); word.startTimingInPage = currentSentence.startTimingInPage + word.startTimingInSentence; - word.endTimingInSentence = TodoUtil::stod(row[2]); + word.endTimingInSentence = currentSentence.timeGuessedinSentence; + CCLOG("%f, %f", TodoUtil::stod(row[2]), currentSentence.timeGuessedinSentence); word.endTimingInPage = currentSentence.startTimingInPage + word.endTimingInSentence; + currentPage.timeGuessedinPage += currentSentence.timeGuessedinSentence; word.word = row[3]; word.wordAudioFilename = row[4]; word.wordAudioLength = 0; diff --git a/mainapp/proj.android-studio/app/src/org/cocos2dx/cpp/VoiceMold.java b/mainapp/proj.android-studio/app/src/org/cocos2dx/cpp/VoiceMold.java index 58bc4109a..78455a811 100755 --- a/mainapp/proj.android-studio/app/src/org/cocos2dx/cpp/VoiceMold.java +++ b/mainapp/proj.android-studio/app/src/org/cocos2dx/cpp/VoiceMold.java @@ -64,8 +64,10 @@ public void speak(String text) { String header = " "; text = header + text; } - - wrapper.getTts().speak(text, TextToSpeech.QUEUE_FLUSH, null); + + for(String word : text){ + wrapper.getTts().speak(word, TextToSpeech.QUEUE_FLUSH, createParamsForSpeak()); + } } public void warmup() {