[Update by Artem: This code example has been submitted by Michele. I included the code excerpt into the post. Artem]
The following example allows for using the text to speech in Nokia S60 3rd edition phones. See also the 2nd edition text to speech example
...
void CTtsPlayer::ConstructL()
{
iPlayer = CMdaAudioPlayerUtility::NewL( *this );
iWaiter = new (ELeave) CActiveSchedulerWait;
}
void CTtsPlayer::PlayTextL( TDesC& aText )
{
__ASSERT_ALWAYS( iPlaybackInProgress == EFalse,
User::Leave( KErrNotReady ) );
HBufC8* playableText = HBufC8::NewLC( aText.Length() +
KTtsPrefix().Length() );
playableText->Des().Append( KTtsPrefix );
playableText->Des().Append( aText );
iPlayer->OpenDesL( *playableText );
iPlaybackInProgress = ETrue;
iWaiter->Start();
// At this point playback is already completed or failed
User::LeaveIfError( iErr );
CleanupStack::PopAndDestroy( playableText );
}
...
Artem,
there is the zipped code :)
Michele
| Attachment | Size |
|---|---|
| HelloWorldBasic.zip | 260.77 KB |
Comments
Solved
I had the same problem, I had to modify a header file from the SDK in order to solve it.
Edit the following file:
C:\Symbian\9.1\S60_3rd_MR\Epoc32\include\mmf\plugin\mmfplugininterfaceuids.hrh
Look for this line
#include <mmfPluginInterfaceUIDs.hrh>
and replace it with:
#include <mmf\plugin\mmfPluginInterfaceUIDs.hrh>
It worked for me,
Hope it helps.
Probably not
I afraid, it is not possible, Cyke. After all this TTS usage is a hack. Not forbidden, but not officially supported. At least I am not aware of a way to specify the TTS language for the TTS calles in this hack way
This example has been
This example has been submitted by Michele and as far as I see it is for the Carbide.C++ only. I'll try submitting a traditional project once I am back from the vacation (end of Feb).
As for the -5 (KErrNotSupported) on emulator, it is because TTS can be used on hardware only.
Nope, it works on relatively
Nope, it works on relatively new models only, starting from N70 and N90