| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include <math.h> | 5 #include <math.h> |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/debug/leak_annotations.h" | 10 #include "base/debug/leak_annotations.h" |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 libspeechd_loader_.spd_set_output_module(conn_, it->second.module.c_str()); | 185 libspeechd_loader_.spd_set_output_module(conn_, it->second.module.c_str()); |
| 186 libspeechd_loader_.spd_set_synthesis_voice(conn_, it->second.name.c_str()); | 186 libspeechd_loader_.spd_set_synthesis_voice(conn_, it->second.name.c_str()); |
| 187 } | 187 } |
| 188 | 188 |
| 189 // Map our multiplicative range to Speech Dispatcher's linear range. | 189 // Map our multiplicative range to Speech Dispatcher's linear range. |
| 190 // .334 = -100. | 190 // .334 = -100. |
| 191 // 3 = 100. | 191 // 3 = 100. |
| 192 libspeechd_loader_.spd_set_voice_rate(conn_, 100 * log10(rate) / log10(3)); | 192 libspeechd_loader_.spd_set_voice_rate(conn_, 100 * log10(rate) / log10(3)); |
| 193 libspeechd_loader_.spd_set_voice_pitch(conn_, 100 * log10(pitch) / log10(3)); | 193 libspeechd_loader_.spd_set_voice_pitch(conn_, 100 * log10(pitch) / log10(3)); |
| 194 | 194 |
| 195 // Support languages other than the default |
| 196 if (!lang.empty()) |
| 197 libspeechd_loader_.spd_set_language(conn_, lang.c_str()); |
| 198 |
| 195 utterance_ = utterance; | 199 utterance_ = utterance; |
| 196 utterance_id_ = utterance_id; | 200 utterance_id_ = utterance_id; |
| 197 | 201 |
| 198 if (libspeechd_loader_.spd_say(conn_, SPD_TEXT, utterance.c_str()) == -1) { | 202 if (libspeechd_loader_.spd_say(conn_, SPD_TEXT, utterance.c_str()) == -1) { |
| 199 Reset(); | 203 Reset(); |
| 200 return false; | 204 return false; |
| 201 } | 205 } |
| 202 return true; | 206 return true; |
| 203 } | 207 } |
| 204 | 208 |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 343 // static | 347 // static |
| 344 TtsPlatformImplLinux* TtsPlatformImplLinux::GetInstance() { | 348 TtsPlatformImplLinux* TtsPlatformImplLinux::GetInstance() { |
| 345 return Singleton<TtsPlatformImplLinux, | 349 return Singleton<TtsPlatformImplLinux, |
| 346 LeakySingletonTraits<TtsPlatformImplLinux> >::get(); | 350 LeakySingletonTraits<TtsPlatformImplLinux> >::get(); |
| 347 } | 351 } |
| 348 | 352 |
| 349 // static | 353 // static |
| 350 TtsPlatformImpl* TtsPlatformImpl::GetInstance() { | 354 TtsPlatformImpl* TtsPlatformImpl::GetInstance() { |
| 351 return TtsPlatformImplLinux::GetInstance(); | 355 return TtsPlatformImplLinux::GetInstance(); |
| 352 } | 356 } |
| OLD | NEW |