| // Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| |
| #include <stdlib.h> |
| #include <iostream> |
| #include <chromeos/dbus/dbus.h> |
| #include <chromeos/dbus/service_constants.h> |
| #include <chromeos/glib/object.h> |
| #include <string> |
| #include <time.h> |
| |
| #include "bindings/client.h" |
| |
| #include "marshal.h" // NOLINT |
| |
| namespace speech_synthesis { |
| const std::string welcome_message = "Welcome to Chromium O S."; |
| } // namespace chromeos |
| |
| int main(int argc, char* argv[]) { |
| g_type_init(); |
| chromeos::dbus::BusConnection bus = chromeos::dbus::GetSystemBusConnection(); |
| chromeos::dbus::Proxy proxy(bus, |
| speech_synthesis::kSpeechSynthesizerServiceName, |
| speech_synthesis::kSpeechSynthesizerServicePath, |
| speech_synthesis::kSpeechSynthesizerInterface); |
| |
| DCHECK(proxy.gproxy()) << "Failed to acquire proxy"; |
| |
| chromeos::glib::ScopedError error; |
| |
| std::string ttsString = ""; |
| if (argc >= 2) { |
| for (int i = 1; i < argc; i++) { |
| ttsString += argv[i]; |
| ttsString += " "; |
| } |
| } else { |
| ttsString = speech_synthesis::welcome_message; |
| } |
| |
| if (!::org_chromium_SpeechSynthesizerInterface_set_properties(proxy.gproxy(), |
| "rate=1;pitch=1", NULL)) { |
| std::cout << "Failed to set properties.\n"; |
| } |
| |
| if (!::org_chromium_SpeechSynthesizerInterface_speak(proxy.gproxy(), |
| ttsString.c_str(), NULL)) { |
| std::cout << "Failed to call Speak.\n"; |
| } |
| return 0; |
| } |
| |