summaryrefslogtreecommitdiffstats
path: root/include/tts
diff options
context:
space:
mode:
authorAndroid (Google) Code Review <android-gerrit@google.com>2009-06-05 14:11:08 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2009-06-05 14:11:08 -0700
commit327da854e8fbc444150b40941668b3c9187c34b9 (patch)
tree1298e99a8cd34895642c5f56f972f167bb13e90f /include/tts
parentd299b8194dde8c4875e5f032918ab35ebad8b1f1 (diff)
parent83e712a1420adf035f66bc7656ddd8a87069f6a7 (diff)
downloadframeworks_base-327da854e8fbc444150b40941668b3c9187c34b9.zip
frameworks_base-327da854e8fbc444150b40941668b3c9187c34b9.tar.gz
frameworks_base-327da854e8fbc444150b40941668b3c9187c34b9.tar.bz2
Merge change 3344 into donut
* changes: Updating TtsEngine.h and SynthProxy.cpp so that buffer memory management is handled on the system side.
Diffstat (limited to 'include/tts')
-rw-r--r--include/tts/TtsEngine.h39
1 files changed, 22 insertions, 17 deletions
diff --git a/include/tts/TtsEngine.h b/include/tts/TtsEngine.h
index bf62995..e0220ea 100644
--- a/include/tts/TtsEngine.h
+++ b/include/tts/TtsEngine.h
@@ -25,24 +25,29 @@
namespace android {
+enum tts_synth_status {
+ TTS_SYNTH_DONE = 0,
+ TTS_SYNTH_PENDING = 1
+};
+
+enum tts_callback_status {
+ TTS_CALLBACK_HALT = 0,
+ TTS_CALLBACK_CONTINUE = 1
+};
+
// The callback is used by the implementation of this interface to notify its
// client, the Android TTS service, that the last requested synthesis has been
-// completed.
+// completed. // TODO reword
// The callback for synthesis completed takes:
-// void * - The userdata pointer set in the original synth call
-// uint32_t - Track sampling rate in Hz
-// audio_format - The AudioSystem::audio_format enum
-// int - The number of channels
-// int8_t * - A buffer of audio data only valid during the execution of the callback
-// size_t - The size of the buffer
-// Note about memory management:
-// The implementation of TtsEngine is responsible for the management of the memory
-// it allocates to store the synthesized speech. After the execution of the callback
-// to hand the synthesized data to the client of TtsEngine, the TTS engine is
-// free to reuse or free the previously allocated memory.
-// This implies that the implementation of the "synthDoneCB" callback cannot use
-// the pointer to the buffer of audio samples outside of the callback itself.
-typedef void (synthDoneCB_t)(void *, uint32_t, AudioSystem::audio_format, int, int8_t *, size_t);
+// [inout] void *& - The userdata pointer set in the original synth call
+// [in] uint32_t - Track sampling rate in Hz
+// [in] audio_format - The AudioSystem::audio_format enum
+// [in] int - The number of channels
+// [inout] int8_t *& - A buffer of audio data only valid during the execution of the callback
+// [inout] size_t & - The size of the buffer
+// [in] tts_synth_status - Status of the synthesis; 0 for done, 1 for more data to be synthesized.
+// Returns the status of the consumer of the synthesis. 0 for stop, 1 for continue.
+typedef tts_callback_status (synthDoneCB_t)(void *&, uint32_t, AudioSystem::audio_format, int, int8_t *&, size_t&, tts_synth_status);
class TtsEngine;
extern "C" TtsEngine* getTtsEngine();
@@ -155,13 +160,13 @@ public:
// @param text the UTF-8 text to synthesize
// @param userdata pointer to be returned when the call is invoked
// @return TTS_SUCCESS or TTS_FAILURE
- virtual tts_result synthesizeText(const char *text, void *userdata);
+ virtual tts_result synthesizeText(const char *text, int8_t *buffer, size_t bufferSize, void *userdata);
// Synthesize IPA text. When synthesis completes, the engine must call the given callback to notify the TTS API.
// @param ipa the IPA data to synthesize
// @param userdata pointer to be returned when the call is invoked
// @return TTS_FEATURE_UNSUPPORTED if IPA is not supported, otherwise TTS_SUCCESS or TTS_FAILURE
- virtual tts_result synthesizeIpa(const char *ipa, void *userdata);
+ virtual tts_result synthesizeIpa(const char *ipa, int8_t *buffer, size_t bufferSize, void *userdata);
};
} // namespace android