summaryrefslogtreecommitdiffstats
path: root/src/speech.inc
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2009-01-27 17:30:08 +0000
committerPascal Rigaux <pixel@mandriva.com>2009-01-27 17:30:08 +0000
commit5ce8d30439463838f845c78bc926cc9b310a8743 (patch)
treebb1852dc58711c7baee31216a765067dfa49b65b /src/speech.inc
parent10658e71475bd964263d09f1a661f24fadfaf496 (diff)
downloadbootloader-theme-5ce8d30439463838f845c78bc926cc9b310a8743.tar
bootloader-theme-5ce8d30439463838f845c78bc926cc9b310a8743.tar.gz
bootloader-theme-5ce8d30439463838f845c78bc926cc9b310a8743.tar.bz2
bootloader-theme-5ce8d30439463838f845c78bc926cc9b310a8743.tar.xz
bootloader-theme-5ce8d30439463838f845c78bc926cc9b310a8743.zip
imported openSUSE.tar.bz2 (from gfxboot-4.1.19-2.1.src.rpm)4.1.19.1
Diffstat (limited to 'src/speech.inc')
-rw-r--r--src/speech.inc121
1 files changed, 121 insertions, 0 deletions
diff --git a/src/speech.inc b/src/speech.inc
new file mode 100644
index 0000000..49eb646
--- /dev/null
+++ b/src/speech.inc
@@ -0,0 +1,121 @@
+% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+%
+% Speech related function.
+%
+% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+
+/.talk_text 0 def
+/.talk_sound 1 def
+
+
+% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+%
+% ( text -- )
+%
+/speak {
+ % skip leading TAB
+ dup 0 get '\x09' eq { 1 add } if
+
+ /last.spoken xfree
+ /last.spoken over strdup def
+
+ dup _speak { pop return } if
+ dup retranslate dup rot ne { _speak } if pop
+} def
+
+
+% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+% Say text.
+%
+% ( str -- bool )
+%
+% str: text
+% bool: sound sample found
+%
+/_speak {
+ talk_array {
+ dup .talk_text get 2 index eq {
+ .talk_sound get wav.playlater
+ pop true return
+ } {
+ pop
+ } ifelse
+ } forall
+ pop
+ false
+} def
+
+
+% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+% Load sound samples.
+%
+% ( -- )
+%
+/load_talk {
+ /talk_file "en.tlk" findfile def
+
+ talk_file .undef eq { return } if
+
+ talk_file getdword 0x692741e8 ne { return } if
+
+ locale.texts.en .undef eq {
+ /locale.texts.en "en_US" "%s.tr" loadtexts def
+ } if
+
+ talk_array .undef ne {
+ talk_array { free } forall
+ } if
+
+ /talk_array xfree
+
+ /talk_array [
+ 0 1 talk_file 4 add getdword 1 sub {
+ [
+ exch 8 mul 8 add talk_file add
+ dup getdword talk_file add cvs
+ exch 4 add getdword talk_file add
+ ]
+ } for
+ ] def
+} def
+
+
+% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+% Load sound samples.
+%
+% ( -- )
+%
+/load_talk_dialog {
+ window.dialog
+ dup .title "Just a second..." put
+ dup .text "Please wait while speech files are being loaded..." put
+ dup window.init window.show
+
+ load_talk
+ config.volume sound.setvolume
+
+ window.done
+} def
+
+
+% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+% Get english text from translated text.
+%
+% ( str1 -- str2 )
+%
+% str1: text
+% str2: text in en_US
+%
+/retranslate {
+ 0 locale.texts {
+ 2 index eq {
+ locale.texts.en exch aget dup .undef eq { pop dup } if exch pop
+ return
+ } if
+ 1 add
+ } forall
+ pop
+} def
+
+