summaryrefslogtreecommitdiffstats
path: root/examples/speech/quickspeech/main.qml
Commit message (Collapse)AuthorAgeFilesLines
* Add cmake and qmake project files to quickspeech exampleElias Hautala2023-08-221-194/+0
| | | | | | | | | | Adds cmake and qmake project files to the quickspeech example which allows the example to be built and deployd. Fixes: QTBUG-113820 Pick-to: 6.5 6.6 Change-Id: Ie52f70ccfbd173c43621a20604fffd46182f9e20 Reviewed-by: Nicholas Bennett <nicholas.bennett@qt.io>
* Add PauseResume capability flagVolker Hilsheimer2023-05-251-0/+2
| | | | | | | | | | | | | | | | | Android lacks this capability as the native TextToSpeech class has no API for this. Since we now have the capabilities enum, add PauseResume and don't list that for Android, so that applications can disable the respective UI. Do that for our examples - hide the pause & resume buttons if the capability flag is not set. Document the unsupported capabilities for all engines that lacks some features Fixes: QTBUG-113805 Change-Id: Ia8139e235f4cd968519423515e31c81285a2d349 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* API review: add word string to sayingWord signal parametersVolker Hilsheimer2023-05-241-1/+1
| | | | | | | | | | | For UIs that just want to display the currently spoken word, this is easier to connect to existing APIs. Also add the ID of the utterance, as returned by enqueue(). The index and length into the overall string stay as the final parameters. Change-Id: I70bf35eeadd24540670cad2edd42126331796f4b Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Emit information about speech progressVolker Hilsheimer2023-02-181-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is useful information in a UI that wants to visualize the progress by highlighting the words and sentences as they get read. For this to work, we ideally can emit data through a signal for each word that allows an application to the progress information to the text that was previously passed into QTextToSpeech::say, i.e the index and length of the word within that text. Implement this for all engines where we can, and add a test that verifies that we get correct information: On the macos and darwin backends, the delegate gets called for each word about to be spoken, with index and length of the content relative to the text. We don't get access to more detailed information, like the length of the stream in second or samples, or the current playback state. Android provides an equivalent listener callback that tells us which slice of the text is about to be spoken. In the WinRT backend, we can ask the speech synthesizer to generate track data for the generated audio, which gives us access for each sentence and word, with the start time for each. Since we play the PCM data ourselves, we don't get called with progress updates, but we can use the track information to run a timer that iterates over the boundaries with each tick. This has a risk of getting out of sync with the actual playback though, but we can try to compensate for that. We can use a similar strategy on flite, where the symbol tree provides start times for each token. So we can use a timer, and follow the progress through the input text for each token. On speechd we don't have reliable access to anything; it theoretically supports reporting of embedded <mark> tags when the input is SSML. So for now, speechd cannot support this functionality. Add highlighting of the spoken word to the Qt Quick example. Change-Id: I36ff208b2f0112c9eb261864515ba20c4bf55f25 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Remove handler for sayingWord signal from exampleVolker Hilsheimer2023-02-141-6/+0
| | | | | | | | | | Amends ed0bafb89a0245c6ea14b59ed177ecbcbe83a2d5. The new signal isn't merged yet and won't be in Qt 6.5, so this shouldn't have been included. Pick-to: 6.5 Change-Id: Iccbc4b6e762d0ac8598eb3d2eb13b6387caf7558 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* Documentation and example improvementsVolker Hilsheimer2023-02-131-0/+18
| | | | | | | | | | | Mark relevant bits of the examples as snippets and use those in the reference documentation. Replace very short slots in the C++ example with lambdas. Pick-to: 6.5 Change-Id: I8deeeda7924f1721676147718e9a6fbdd408aaa0 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* Quick example: turn on word wrapVolker Hilsheimer2023-01-201-0/+1
| | | | | | Pick-to: 6.5 Change-Id: I54794f66448f9e64941950cbc5fb5c7e9fd332fd Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* Quick example: improve layout codeVolker Hilsheimer2022-09-121-5/+2
| | | | | | | | | | | | | | Give the text area a minimum height, it is invisible otherwise. Remove unnecessary constraints on the root item. The layout is still not perfect, it seems to lack margin on the right when run on macOS, but those are probably bugs in Quick Layouts that need to be fixed there. Pick-to: 6.4 Change-Id: Icd91ffb66cfec4e5a940d5a6767a8c24329c61ea Reviewed-by: Jeremy Whiting <jpwhiting@kde.org> Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Fix and edit the example documentationVolker Hilsheimer2022-07-131-0/+1
| | | | | | | | | | | | | | | | | | If the exampledirs variable in qdocconf doesn't include the /speech subdirectory, but each example page does, then the link generated to code.qt.io is incorrect. Since the qdocconf is for the texttospeech module, all examples will live in the same tree anyway. Link to Qt Widgets and Qt Quick Controls from the respective examples, which requires that those modules are added as dependencies. Improve the phrasing of the text, and update and optimize the screenshots of the examples. Pick-to: 6.4 Change-Id: I3de4e707c2aeed40735a714934adea59afdea1e8 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Use SPDX license identifiersLucie Gérard2022-06-221-49/+2
| | | | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. License files are organized under LICENSES directory. Pick-to: 6.4 Task-number: QTBUG-67283 Change-Id: I5a15004abaab3f2d002adf47ae053b95abb41cb8 Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* Fix syntax errorVolker Hilsheimer2022-05-231-1/+1
| | | | | | | Amends 9b60e7bd06c26507141a8e1de156638bc7dd9252. Change-Id: If0b530d2cab209e62ac8c83078f0b226a1a1cf3b Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Documentation fixesVolker Hilsheimer2022-05-211-1/+1
| | | | | | | | | | | | | | | | | | The name of the module is QtTextToSpeech, not Qt Speech, rename things accordingly, esp the QML import URI, and adjust examples. Update the module's index page to use the global macro for generating the "Using the module" section, and add a changes file with some first bits about porting to Qt 6. Add an examples page and a documentation page for the Qt Quick example, which also needs a qmake project file to prevent a qdoc warning (even though there is no project that needs to be built). Change-Id: I29d9126f52dc0f3a0294a27a34af89daa249db5d Reviewed-by: Axel Spoerl <axel.spoerl@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Jarkko Koivikko <jarkko.koivikko@code-q.fi>
* Improve error handling in QTextToSpeechAxel Spoerl2022-05-201-1/+1
| | | | | | | | | | | | | | | | | | Add an enum class ErrorReason for error handling in QTextToSpeech. Rename BackendError to Error in enum QTextToSpeech::State, as the error might not be in the synthesizer, but the audio playback, or due to invalid input. Update all sources and tests referring to BackendError to use new name. Update documentation of enum QTextToSpeech::State, add documentation for new enum QTextToSpeech::ErrorReason. Add getters, setters, signals, and slots for error handling. Implement error handling for flite plugin, covering audio backend, initialization and synthesizing errors. For the other plugins, handle basic initialization errors. Change-Id: I233cf3876511176dd1a327546233d527596e1e7e Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Add a Qt Quick exampleVolker Hilsheimer2022-04-261-0/+221
Does what the widget example does, but suffers from some layout bugs in Qt Quick (Controls) that need to be addressed elsewhere. Change-Id: Ieabfef01667c2426bd2e590cad01a2815faaa3e6 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>