Skip to content

Commit

Permalink
commit
Browse files Browse the repository at this point in the history
  • Loading branch information
jeevithiesh committed Jul 4, 2019
1 parent 9c8b9ca commit 8555316
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
2 changes: 1 addition & 1 deletion mainapp/Classes/Games/Books/BookPage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down
14 changes: 11 additions & 3 deletions mainapp/Classes/Games/Books/TodoBook.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -127,10 +128,17 @@ void TodoBook::readData(string &filedata)
TodoSentence &currentSentence = 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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down

0 comments on commit 8555316

Please sign in to comment.