]> git.pld-linux.org Git - packages/festival.git/blob - festival-asterisk.patch
- added patch for Asterisk PBX
[packages/festival.git] / festival-asterisk.patch
1 diff -u -r festival-1.4.2/lib/tts.scm festival-1.4.2-asterisk/lib/tts.scm
2 --- festival-1.4.2/lib/tts.scm  Wed Jan  8 09:54:14 2003
3 +++ festival-1.4.2-asterisk/lib/tts.scm Tue Jan  7 08:51:44 2003
4 @@ -236,6 +236,15 @@
5         (utt.synth
6         (eval (list 'Utterance 'Text string))))))
7  
8 +(define (tts_textasterisk string mode)
9 +  "(tts_textasterisk STRING MODE)
10 +Apply tts to STRING.  This function is specifically designed for
11 +use in server mode so a single function call may synthesize the string.
12 +This function name may be added to the server safe functions."
13 +  (utt.send.wave.asterisk 
14 +   (utt.synth
15 +    (eval (list 'Utterance 'Text string)))))
16 +
17  (define (tts_return_to_client)
18    "(tts_return_to_client)
19  This function is called by clients who wish to return waveforms of
20 diff -u -r festival-1.4.2/src/arch/festival/wave.cc festival-1.4.2-asterisk/src/arch/festival/wave.cc
21 --- festival-1.4.2/src/arch/festival/wave.cc    Mon Jun  4 07:40:10 2001
22 +++ festival-1.4.2-asterisk/src/arch/festival/wave.cc   Tue Jan  7 08:53:09 2003
23 @@ -377,6 +377,38 @@
24         type = "nist";
25      else
26         type = get_c_string(ltype);
27 +
28 +    w->save(tmpfile,type);
29 +    write(ft_server_socket,"WV\n",3);
30 +    socket_send_file(ft_server_socket,tmpfile);
31 +    unlink(tmpfile);
32 +
33 +    return utt;
34 +}
35 +
36 +static LISP utt_send_wave_asterisk(LISP utt)
37 +{
38 +    // Send the waveform to a client (must be acting as server)
39 +    EST_Utterance *u = utterance(utt);
40 +    EST_Wave *w;
41 +    EST_String tmpfile = make_tmp_filename();
42 +    LISP ltype;
43 +    EST_String type;
44 +
45 +    w = get_utt_wave(u);
46 +    if (ft_server_socket == -1)
47 +    {
48 +       cerr << "utt_send_wave_client: not in server mode" << endl;
49 +       festival_error();
50 +    }
51 +       
52 +    ltype = ft_get_param("Wavefiletype");
53 +    if (ltype == NIL)
54 +       type = "nist";
55 +    else
56 +       type = get_c_string(ltype);
57 +    w->resample(8000);
58 +    w->rescale(5);
59      w->save(tmpfile,type);
60      write(ft_server_socket,"WV\n",3);
61      socket_send_file(ft_server_socket,tmpfile);
62 @@ -454,6 +486,13 @@
63   "(utt.send.wave.client UTT)\n\
64    Sends wave in UTT to client.  If not in server mode gives an error\n\
65    Note the client must be expecting to receive the waveform.");
66 +
67 +    init_subr_1("utt.send.wave.asterisk",utt_send_wave_asterisk,
68 + "(utt.send.wave.asterisk UTT)\n\
69 +  Sends wave in UTT to client.  If not in server mode gives an error\n\
70 +  Note the client must be expecting to receive the waveform. The waveform
71 +  is rescaled and resampled according to what asterisk needs");
72 +
73      init_subr_1("send_sexpr_to_client", send_sexpr_to_client,
74   "(send_sexpr_to_client SEXPR)\n\
75  Sends given sexpression to currently connected client.");
This page took 0.099369 seconds and 3 git commands to generate.