if a proxy is set, pre-fill the proxy setting dialog with the old value.
[Rockbox.git] / apps / talk.h
blobd5a6bc70602a79f21b414a6c878cf3465f9f85e6
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Copyright (C) 2004 Jörg Hohensohn
12 * This module collects the Talkbox and voice UI functions.
13 * (Talkbox reads directory names from mp3 clips called thumbnails,
14 * the voice UI lets menus and screens "talk" from a voicefont in memory.
16 * All files in this archive are subject to the GNU General Public License.
17 * See the file COPYING in the source tree root for full license agreement.
19 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
20 * KIND, either express or implied.
22 ****************************************************************************/
24 #ifndef __TALK_H__
25 #define __TALK_H__
27 #include <stdbool.h>
29 enum {
30 /* See array "unit_voiced" in talk.c function "talk_value" */
31 UNIT_INT = 1, /* plain number */
32 UNIT_SIGNED, /* number with mandatory sign (even if positive) */
33 UNIT_MS, /* milliseconds */
34 UNIT_SEC, /* seconds */
35 UNIT_MIN, /* minutes */
36 UNIT_HOUR, /* hours */
37 UNIT_KHZ, /* kHz */
38 UNIT_DB, /* dB, mandatory sign */
39 UNIT_PERCENT, /* % */
40 UNIT_MAH, /* milliAmp hours */
41 UNIT_PIXEL, /* pixels */
42 UNIT_PER_SEC, /* per second */
43 UNIT_HERTZ, /* hertz */
44 UNIT_MB, /* Megabytes */
45 UNIT_KBIT, /* kilobits per sec */
46 UNIT_LAST /* END MARKER */
49 #define UNIT_SHIFT (32-5) /* this many bits left from UNIT_xx enum */
51 /* make a "talkable" ID from number + unit
52 unit is upper 4 bits, number the remaining (in regular 2's complement) */
53 #define TALK_ID(n,u) (((long)(u))<<UNIT_SHIFT | ((n) & ~(-1L<<UNIT_SHIFT)))
55 /* convenience macro to have both virtual pointer and ID as arguments */
56 #define STR(id) ID2P(id), id
58 /* publish these strings, so they're stored only once (better than #define) */
59 extern const char* const dir_thumbnail_name; /* "_dirname.talk" */
60 extern const char* const file_thumbnail_ext; /* ".talk" for file voicing */
62 void talk_init(void);
63 #if CONFIG_CODEC == SWCODEC
64 bool talk_voice_required(void); /* returns true if voice codec required */
65 #endif
66 int talk_get_bufsize(void); /* get the loaded voice file size */
67 /* talk_buffer_steal - on SWCODEC, for use by buffer functions only */
68 int talk_buffer_steal(void); /* claim the mp3 buffer e.g. for play/record */
69 int talk_id(long id, bool enqueue); /* play a voice ID from voicefont */
70 int talk_file(const char* filename, bool enqueue); /* play a thumbnail from file */
71 int talk_number(long n, bool enqueue); /* say a number */
72 int talk_value(long n, int unit, bool enqueue); /* say a numeric value */
73 int talk_spell(const char* spell, bool enqueue); /* spell a string */
74 bool talk_menus_enabled(void); /* returns true if menus should be voiced */
75 void talk_disable_menus(void); /* disable voice menus (temporarily, not persisted) */
76 void talk_enable_menus(void); /* re-enable voice menus */
77 #endif /* __TALK_H__ */