diff options
author | Narayan Kamath <narayan@google.com> | 2011-05-19 12:58:09 +0100 |
---|---|---|
committer | Narayan Kamath <narayan@google.com> | 2011-05-19 13:05:06 +0100 |
commit | 7ffd31ba2584359996e04cd3d4d92f810d651066 (patch) | |
tree | 2bbf666287f40747e9312d472e36716ce6647dce /pico/tts/com_svox_picottsengine.cpp | |
parent | bfbc7bf7fe84b27752a9da51caab1cc96718ee67 (diff) | |
download | external_svox-7ffd31ba2584359996e04cd3d4d92f810d651066.zip external_svox-7ffd31ba2584359996e04cd3d4d92f810d651066.tar.gz external_svox-7ffd31ba2584359996e04cd3d4d92f810d651066.tar.bz2 |
Break dependency between pico and the audio system.
The TTS engine should use only TTS defined constants, and
not constants from the audiosystem. This happened to work
because PCM_16_BIT in native was the same as DEFAULT in
java, which happened to be PCM_16_BIT.
Change-Id: I0f43a46afff8c45d1eb18c1beaab62dce87b8055
Diffstat (limited to 'pico/tts/com_svox_picottsengine.cpp')
-rw-r--r-- | pico/tts/com_svox_picottsengine.cpp | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/pico/tts/com_svox_picottsengine.cpp b/pico/tts/com_svox_picottsengine.cpp index 885429f..bafd300 100644 --- a/pico/tts/com_svox_picottsengine.cpp +++ b/pico/tts/com_svox_picottsengine.cpp @@ -43,7 +43,6 @@ #include <TtsEngine.h> #include <cutils/jstring.h> -#include <system/audio.h> #include <picoapi.h> #include <picodefs.h> @@ -1291,11 +1290,11 @@ tts_result TtsEngine::getLanguage(char *language, char *country, char *variant) * @channels - reference to number of channels * return tts_result * */ -tts_result TtsEngine::setAudioFormat(audio_format_t& encoding, uint32_t& rate, +tts_result TtsEngine::setAudioFormat(tts_audio_format& encoding, uint32_t& rate, int& channels) { // ignore the input parameters, the enforced audio parameters are fixed here - encoding = AUDIO_FORMAT_PCM_16_BIT; + encoding = TTS_AUDIO_FORMAT_PCM_16_BIT; rate = 16000; channels = 1; return TTS_SUCCESS; @@ -1586,7 +1585,7 @@ tts_result TtsEngine::synthesizeText( const char * text, int8_t * buffer, size_t bufused += bytes_recv; } else { /* The buffer filled; pass this on to the callback function. */ - cbret = picoSynthDoneCBPtr(userdata, 16000, AUDIO_FORMAT_PCM_16_BIT, 1, buffer, + cbret = picoSynthDoneCBPtr(userdata, 16000, TTS_AUDIO_FORMAT_PCM_16_BIT, 1, buffer, bufused, TTS_SYNTH_PENDING); if (cbret == TTS_CALLBACK_HALT) { LOGI("Halt requested by caller. Halting."); @@ -1604,7 +1603,7 @@ tts_result TtsEngine::synthesizeText( const char * text, int8_t * buffer, size_t /* This chunk of synthesis is finished; pass the remaining samples. Use 16 KHz, 16-bit samples. */ if (!picoSynthAbort) { - picoSynthDoneCBPtr( userdata, 16000, AUDIO_FORMAT_PCM_16_BIT, 1, buffer, bufused, + picoSynthDoneCBPtr( userdata, 16000, TTS_AUDIO_FORMAT_PCM_16_BIT, 1, buffer, bufused, TTS_SYNTH_PENDING); } picoSynthAbort = 0; @@ -1617,7 +1616,7 @@ tts_result TtsEngine::synthesizeText( const char * text, int8_t * buffer, size_t free(local_text); } LOGV("Synth loop: sending TTS_SYNTH_DONE after error"); - picoSynthDoneCBPtr( userdata, 16000, AUDIO_FORMAT_PCM_16_BIT, 1, buffer, bufused, + picoSynthDoneCBPtr( userdata, 16000, TTS_AUDIO_FORMAT_PCM_16_BIT, 1, buffer, bufused, TTS_SYNTH_DONE); pico_resetEngine( picoEngine, PICO_RESET_SOFT ); return TTS_FAILURE; @@ -1626,7 +1625,7 @@ tts_result TtsEngine::synthesizeText( const char * text, int8_t * buffer, size_t /* Synthesis is done; notify the caller */ LOGV("Synth loop: sending TTS_SYNTH_DONE after all done, or was asked to stop"); - picoSynthDoneCBPtr( userdata, 16000, AUDIO_FORMAT_PCM_16_BIT, 1, buffer, bufused, + picoSynthDoneCBPtr( userdata, 16000, TTS_AUDIO_FORMAT_PCM_16_BIT, 1, buffer, bufused, TTS_SYNTH_DONE); if (local_text) { |