packaging: bumped version, updated changelog.
[profile/ivi/speech-recognition.git] / src / daemon / voice-api-types.h
1 /*
2  * Copyright (c) 2012 - 2013, Intel Corporation
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions are
6  * met:
7  *
8  *   * Redistributions of source code must retain the above copyright notice,
9  *     this list of conditions and the following disclaimer.
10  *   * Redistributions in binary form must reproduce the above copyright
11  *     notice, this list of conditions and the following disclaimer in the
12  *     documentation and/or other materials provided with the distribution.
13  *   * Neither the name of Intel Corporation nor the names of its contributors
14  *     may be used to endorse or promote products derived from this software
15  *     without specific prior written permission.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28  */
29
30 #ifndef __SRS_VOICE_API_TYPES_H__
31 #define __SRS_VOICE_API_TYPES_H__
32
33 /** Failure/invalid voice identifier. */
34 #define SRS_VOICE_INVALID ((uint32_t)-1)
35
36 /** Voice rendering notification callback events. */
37 typedef enum {
38     SRS_VOICE_EVENT_STARTED,             /* TTS started */
39     SRS_VOICE_EVENT_PROGRESS,            /* TTS progressing */
40     SRS_VOICE_EVENT_COMPLETED,           /* TTS finished successfully */
41     SRS_VOICE_EVENT_TIMEOUT,             /* TTS timed out */
42     SRS_VOICE_EVENT_ABORTED,             /* TTS finished abnormally */
43     SRS_VOICE_EVENT_MAX
44 } srs_voice_event_type_t;
45
46 /** Voice rendering notification event masks. */
47 #define SRS_VOICE_MASK_NONE        0
48 #define SRS_VOICE_MASK_STARTED    (1 << SRS_VOICE_EVENT_STARTED)
49 #define SRS_VOICE_MASK_PROGRESS   (1 << SRS_VOICE_EVENT_PROGRESS)
50 #define SRS_VOICE_MASK_COMPLETED  (1 << SRS_VOICE_EVENT_COMPLETED)
51 #define SRS_VOICE_MASK_TIMEOUT    (1 << SRS_VOICE_EVENT_TIMEOUT)
52 #define SRS_VOICE_MASK_ABORTED    (1 << SRS_VOICE_EVENT_ABORTED)
53
54 #define SRS_VOICE_MASK_ALL       ((1 << SRS_VOICE_EVENT_MAX) - 1)
55 #define SRS_VOICE_MASK_DONE       (SRS_VOICE_MASK_COMPLETED | \
56                                    SRS_VOICE_MASK_TIMEOUT   | \
57                                    SRS_VOICE_MASK_ABORTED)
58
59 typedef struct {
60     srs_voice_event_type_t type;         /* event type */
61     uint32_t               id;           /* voice stream id */
62     union {                              /* event-specific data */
63         struct {
64             double   pcnt;               /* progress in percentages */
65             uint32_t msec;               /* progress in millisconds */
66         } progress;
67     } data;
68 } srs_voice_event_t;
69
70 /** Voice actor genders. */
71 typedef enum {
72     SRS_VOICE_GENDER_ANY,                /* any voice actor */
73     SRS_VOICE_GENDER_MALE,               /* a male voice actor */
74     SRS_VOICE_GENDER_FEMALE,             /* a female voice actor */
75 } srs_voice_gender_t;
76
77 #define SRS_VOICE_FEMALE "female"        /* any female actor */
78 #define SRS_VOICE_MALE   "male"          /* any male actor */
79
80 /** Voice timeout/queuing constants. */
81 #define SRS_VOICE_IMMEDIATE     0        /* render immediately or fail */
82 #define SRS_VOICE_QUEUE        -1        /* allow queuing indefinitely */
83 #define SRS_VOICE_TIMEOUT(sec) (sec)     /* fail if can't start in time */
84
85
86 /*
87  * voice actors
88  */
89 typedef struct {
90     uint32_t            id;              /* backend actor id */
91     char               *lang;            /* spoken language */
92     char               *dialect;         /* language dialect, if any */
93     uint16_t            gender;          /* gender */
94     uint16_t            age;             /* actor age */
95     char               *name;            /* backend actor name */
96     char               *description;     /* human-readable description */
97 } srs_voice_actor_t;
98
99
100 #endif /* __SRS_VOICE_API_TYPES_H__ */