Book Image

Delphi Cookbook

By : Daniele Teti
Book Image

Delphi Cookbook

By: Daniele Teti

Overview of this book

Intended to refresh the basics of Delphi as well as advance your knowledge to the next level, it is assumed you will know RAD studio and the Object Pascal language. However, if you are not an experienced RAD studio programmer this accessible guide will still develop those initial crucial skills.
Table of Contents (9 chapters)
8
Index

Letting your phone talk – using the Android TextToSpeech engine


In this recipe, we'll do some fun stuff. On your Android phone, run an app with a listening UDP server on it. When another application, in our case a VCL application, sends a UDP broadcast with some text, the Android app will pronounce the text using the Android TTS engine.

Getting ready

The first thing to do is import the TTS classes from the Android SDK in our Delphi project. This is not a simple task; however, luckily, someone already did the job. Indeed, Jeff Overcash, the maintainer of the InterBase Express (IBX) components wrote Android Text To Speech JNI Translation. His translation with a simple demo app is available at CodeCentral (http://cc.embarcadero.com/item/29594).

In this recipe, we'll use the imported classes to let our Android device read the text sent via a UDP broadcast. Note that the message will be read by each device that receives it. Thus, if you have two, three, or four phones, you will be able to listen...