-
Notifications
You must be signed in to change notification settings - Fork 94
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Change the Text to speech api #55
base: master
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,7 +35,9 @@ | |
#include <QDir> | ||
#include <QFile> | ||
#include <QTextStream> | ||
|
||
#include <QMediaPlayer> | ||
#include <QUrl> | ||
|
||
#if !defined(Q_OS_OS2) | ||
#if QT_VERSION >= 0x050000 | ||
#include <QSound> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Replace this with line 38. |
||
|
@@ -51,7 +53,11 @@ IOFactory::IOFactory() { | |
|
||
void IOFactory::playWaveFile(const QString &file_path) { | ||
#if QT_VERSION >= 0x050000 | ||
QSound::play(file_path); | ||
QMediaPlayer *player = new QMediaPlayer(); | ||
player->setMedia(QUrl::fromLocalFile(file_path)); | ||
player->setVolume(100); | ||
player->play(); | ||
//QSound::play(file_path); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove commented line if your solution works. |
||
#elif !defined(Q_OS_OS2) | ||
Phonon::AudioOutput *out = new Phonon::AudioOutput(Phonon::MusicCategory, qApp); | ||
out->setVolume(100.0f); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -160,7 +160,7 @@ void LearnSpellingsSimulator::playWord() { | |
|
||
// Store downloaded sound file. | ||
QString sound_file_name = qApp->templateManager()->tempDirectory() + QDir::separator() + | ||
"sound_" + QDateTime::currentDateTime().toString("yyyy-MM-dd-hhmmss") + ".wav"; | ||
"sound_" + QDateTime::currentDateTime().toString("yyyy-MM-dd-hhmmss") + ".mp3"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Did you tested if mp3 files play also when you build the application with Qt4? Toolkit must be compilable and runnable in both Qt4 and Qt5 because Qt4 is mandatory for OS/2 platform, which toolkit also supports. |
||
QFile sound_file(sound_file_name); | ||
sound_file.open(QIODevice::WriteOnly | QIODevice::Truncate | QIODevice::Unbuffered); | ||
sound_file.write(output); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please, solve those #includes correctly. QMediaPlayer class is only available in Qt5. You commented out QSound usages, therefore QSound #ïnclude is not needed anymore. You could for example replace line 43 with line 38.