Path: blob/master/thirdparty/linuxbsd_headers/speechd/libspeechd.h
10278 views
/*1* libspeechd.h - Shared library for easy acces to Speech Dispatcher functions (header)2*3* Copyright (C) 2001, 2002, 2003, 2004 Brailcom, o.p.s.4*5* This is free software; you can redistribute it and/or modify it6* under the terms of the GNU Lesser General Public License as published by7* the Free Software Foundation; either version 2.1, or (at your option)8* any later version.9*10* This software is distributed in the hope that it will be useful,11* but WITHOUT ANY WARRANTY; without even the implied warranty of12* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU13* Lesser General Public License for more details.14*15* You should have received a copy of the GNU Lesser General Public License16* along with this package; see the file COPYING. If not, write to17* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,18* Boston, MA 02110-1301, USA.19*20* $Id: libspeechd.h,v 1.29 2008-07-30 09:47:00 hanke Exp $21*/2223#ifndef _LIBSPEECHD_H24#define _LIBSPEECHD_H2526#include <stdio.h>27#include <stddef.h>28#include <pthread.h>2930#include "libspeechd_version.h"31#include "speechd_types.h"3233/* *INDENT-OFF* */34#ifdef __cplusplus35extern "C" {36#endif37/* *INDENT-ON* */38/* Speech Dispatcher's default port for inet communication */39#define SPEECHD_DEFAULT_PORT 65604041/* Arguments for spd_send_data() */42#define SPD_WAIT_REPLY 1 /* Wait for reply */43#define SPD_NO_REPLY 0 /* No reply requested */4445/* --------------------- Public data types ------------------------ */4647typedef enum {48SPD_MODE_SINGLE = 0,49SPD_MODE_THREADED = 150} SPDConnectionMode;5152typedef enum {53SPD_METHOD_UNIX_SOCKET = 0,54SPD_METHOD_INET_SOCKET = 1,55} SPDConnectionMethod;5657typedef struct {58SPDConnectionMethod method;59char *unix_socket_name;60char *inet_socket_host;61int inet_socket_port;62char *dbus_bus;63} SPDConnectionAddress;6465void SPDConnectionAddress__free(SPDConnectionAddress * address);6667typedef void (*SPDCallback) (size_t msg_id, size_t client_id,68SPDNotificationType state);69typedef void (*SPDCallbackIM) (size_t msg_id, size_t client_id,70SPDNotificationType state, char *index_mark);7172typedef struct {7374/* PUBLIC */75SPDCallback callback_begin;76SPDCallback callback_end;77SPDCallback callback_cancel;78SPDCallback callback_pause;79SPDCallback callback_resume;80SPDCallbackIM callback_im;8182/* PRIVATE */83int socket;84FILE *stream;85SPDConnectionMode mode;8687pthread_mutex_t *ssip_mutex;8889pthread_t *events_thread;90pthread_mutex_t *comm_mutex;91pthread_cond_t *cond_reply_ready;92pthread_mutex_t *mutex_reply_ready;93pthread_cond_t *cond_reply_ack;94pthread_mutex_t *mutex_reply_ack;9596char *reply;9798} SPDConnection;99100/* -------------- Public functions --------------------------*/101102/* Opening and closing Speech Dispatcher connection */103SPDConnectionAddress *spd_get_default_address(char **error);104SPDConnection *spd_open(const char *client_name, const char *connection_name,105const char *user_name, SPDConnectionMode mode);106SPDConnection *spd_open2(const char *client_name, const char *connection_name,107const char *user_name, SPDConnectionMode mode,108SPDConnectionAddress * address, int autospawn,109char **error_result);110111void spd_close(SPDConnection * connection);112113/* Speaking */114int spd_say(SPDConnection * connection, SPDPriority priority, const char *text);115int spd_sayf(SPDConnection * connection, SPDPriority priority,116const char *format, ...);117118/* Speech flow */119int spd_stop(SPDConnection * connection);120int spd_stop_all(SPDConnection * connection);121int spd_stop_uid(SPDConnection * connection, int target_uid);122123int spd_cancel(SPDConnection * connection);124int spd_cancel_all(SPDConnection * connection);125int spd_cancel_uid(SPDConnection * connection, int target_uid);126127int spd_pause(SPDConnection * connection);128int spd_pause_all(SPDConnection * connection);129int spd_pause_uid(SPDConnection * connection, int target_uid);130131int spd_resume(SPDConnection * connection);132int spd_resume_all(SPDConnection * connection);133int spd_resume_uid(SPDConnection * connection, int target_uid);134135/* Characters and keys */136int spd_key(SPDConnection * connection, SPDPriority priority,137const char *key_name);138int spd_char(SPDConnection * connection, SPDPriority priority,139const char *character);140int spd_wchar(SPDConnection * connection, SPDPriority priority,141wchar_t wcharacter);142143/* Sound icons */144int spd_sound_icon(SPDConnection * connection, SPDPriority priority,145const char *icon_name);146147/* Setting parameters */148int spd_set_voice_type(SPDConnection *, SPDVoiceType type);149int spd_set_voice_type_all(SPDConnection *, SPDVoiceType type);150int spd_set_voice_type_uid(SPDConnection *, SPDVoiceType type,151unsigned int uid);152SPDVoiceType spd_get_voice_type(SPDConnection *);153154int spd_set_synthesis_voice(SPDConnection *, const char *voice_name);155int spd_set_synthesis_voice_all(SPDConnection *, const char *voice_name);156int spd_set_synthesis_voice_uid(SPDConnection *, const char *voice_name,157unsigned int uid);158159int spd_set_data_mode(SPDConnection * connection, SPDDataMode mode);160161int spd_set_notification_on(SPDConnection * connection,162SPDNotification notification);163int spd_set_notification_off(SPDConnection * connection,164SPDNotification notification);165int spd_set_notification(SPDConnection * connection,166SPDNotification notification, const char *state);167168int spd_set_voice_rate(SPDConnection * connection, signed int rate);169int spd_set_voice_rate_all(SPDConnection * connection, signed int rate);170int spd_set_voice_rate_uid(SPDConnection * connection, signed int rate,171unsigned int uid);172int spd_get_voice_rate(SPDConnection * connection);173174int spd_set_voice_pitch(SPDConnection * connection, signed int pitch);175int spd_set_voice_pitch_all(SPDConnection * connection, signed int pitch);176int spd_set_voice_pitch_uid(SPDConnection * connection, signed int pitch,177unsigned int uid);178int spd_get_voice_pitch(SPDConnection * connection);179180int spd_set_volume(SPDConnection * connection, signed int volume);181int spd_set_volume_all(SPDConnection * connection, signed int volume);182int spd_set_volume_uid(SPDConnection * connection, signed int volume,183unsigned int uid);184int spd_get_volume(SPDConnection * connection);185186int spd_set_punctuation(SPDConnection * connection, SPDPunctuation type);187int spd_set_punctuation_all(SPDConnection * connection, SPDPunctuation type);188int spd_set_punctuation_uid(SPDConnection * connection, SPDPunctuation type,189unsigned int uid);190191int spd_set_capital_letters(SPDConnection * connection, SPDCapitalLetters type);192int spd_set_capital_letters_all(SPDConnection * connection,193SPDCapitalLetters type);194int spd_set_capital_letters_uid(SPDConnection * connection,195SPDCapitalLetters type, unsigned int uid);196197int spd_set_spelling(SPDConnection * connection, SPDSpelling type);198int spd_set_spelling_all(SPDConnection * connection, SPDSpelling type);199int spd_set_spelling_uid(SPDConnection * connection, SPDSpelling type,200unsigned int uid);201202int spd_set_language(SPDConnection * connection, const char *language);203int spd_set_language_all(SPDConnection * connection, const char *language);204int spd_set_language_uid(SPDConnection * connection, const char *language,205unsigned int uid);206char *spd_get_language(SPDConnection * connection);207208int spd_set_output_module(SPDConnection * connection,209const char *output_module);210int spd_set_output_module_all(SPDConnection * connection,211const char *output_module);212int spd_set_output_module_uid(SPDConnection * connection,213const char *output_module, unsigned int uid);214215int spd_get_client_list(SPDConnection * connection, char **client_names,216int *client_ids, int *active);217int spd_get_message_list_fd(SPDConnection * connection, int target,218int *msg_ids, char **client_names);219220char **spd_list_modules(SPDConnection * connection);221void free_spd_modules(char **);222char *spd_get_output_module(SPDConnection * connection);223224char **spd_list_voices(SPDConnection * connection);225SPDVoice **spd_list_synthesis_voices(SPDConnection * connection);226void free_spd_voices(SPDVoice ** voices);227char **spd_execute_command_with_list_reply(SPDConnection * connection,228char *command);229230/* Direct SSIP communication */231int spd_execute_command(SPDConnection * connection, char *command);232int spd_execute_command_with_reply(SPDConnection * connection, char *command,233char **reply);234int spd_execute_command_wo_mutex(SPDConnection * connection, char *command);235char *spd_send_data(SPDConnection * connection, const char *message, int wfr);236char *spd_send_data_wo_mutex(SPDConnection * connection, const char *message,237int wfr);238239240241/* *INDENT-OFF* */242#ifdef __cplusplus243}244#endif /* __cplusplus */245/* *INDENT-ON* */246247#endif /* ifndef _LIBSPEECHD_H */248249250