1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
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 ****************************************************************************/
30 UNIT_INT
= 1, /* plain number */
31 UNIT_SIGNED
, /* number with mandatory sign (even if positive) */
32 UNIT_MS
, /* milliseconds */
33 UNIT_SEC
, /* seconds */
34 UNIT_MIN
, /* minutes */
35 UNIT_HOUR
, /* hours */
37 UNIT_DB
, /* dB, mandatory sign */
39 UNIT_MB
, /* megabyte */
40 UNIT_GB
, /* gigabyte */
41 UNIT_MAH
, /* milliAmp hours */
42 UNIT_PIXEL
, /* pixels */
43 UNIT_PER_SEC
, /* per second */
44 UNIT_HERTZ
, /* hertz */
45 UNIT_LAST
/* END MARKER */
48 #define UNIT_SHIFT (32-4) /* this many bits left from UNIT_xx enum */
50 /* make a "talkable" ID from number + unit
51 unit is upper 4 bits, number the remaining (in regular 2's complement) */
52 #define TALK_ID(n,u) (((long)(u))<<UNIT_SHIFT | ((n) & ~(-1L<<UNIT_SHIFT)))
54 /* convenience macro to have both virtual pointer and ID as arguments */
55 #define STR(id) ID2P(id), id
57 /* publish these strings, so they're stored only once (better than #define) */
58 extern const char* const dir_thumbnail_name
; /* "_dirname.talk" */
59 extern const char* const file_thumbnail_ext
; /* ".talk" for file voicing */
62 int talk_buffer_steal(void); /* claim the mp3 buffer e.g. for play/record */
63 int talk_id(long id
, bool enqueue
); /* play a voice ID from voicefont */
64 int talk_file(const char* filename
, bool enqueue
); /* play a thumbnail from file */
65 int talk_number(long n
, bool enqueue
); /* say a number */
66 int talk_value(long n
, int unit
, bool enqueue
); /* say a numeric value */
67 int talk_spell(const char* spell
, bool enqueue
); /* spell a string */
69 #endif /* __TALK_H__ */