[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Tabulation problem, possibly a mac speech server bug



Hi,

Ok, tracked it down.

Would still like some feedback as to if this effects only the mac server
or others as well.

Firstly, the issue was caused by two extra spaces at the end of the line
that is sent to the speech process as well as an additional space after
the newline.  (haven't tracked down exactly what's happening in the
speech server).

I found two ways to fix this and would like advice on what is preferred.

First way is to simply remove the additional spaces.  See the first
defmacro below.

Second is to not interact with the speech process directly from
tts-with-punctuations and instead call dtk-interp-set-punctuations which
does the same thing but sends the correct string.  I've pasted a copy of
the defmacro using this aproach second.

I feel that calling dtk-interp-set-punctuations is the better option as
it minimizes places that talk to the speech server process as well as
makes tts-with-punctuations more readable (for me anyway).

Here are the two approaches.

Firstly just the removed spaces:

(defmacro tts-with-punctuations (setting &rest body)
  "Safely set punctuation mode for duration of body form."
  `(progn
     (declare (special dtk-punctuation-mode))
     (let    ((save-punctuation-mode dtk-punctuation-mode))
       (unwind-protect
           (progn
             (unless (eq ,setting save-punctuation-mode)
               (process-send-string dtk-speaker-process
                                    (format "tts_set_punctuations %s\n"
                                            ,setting))
               (setq dtk-punctuation-mode ,setting))
             ,@body
             (dtk-force))
         (unless (eq  ,setting  save-punctuation-mode)
           (setq dtk-punctuation-mode save-punctuation-mode)
           (process-send-string dtk-speaker-process
                                (format "tts_set_punctuations %s\n"
                                        dtk-punctuation-mode ))
           (dtk-force))))))


And the one using dtk-interp-set-punctuations:

(defmacro tts-with-punctuations (setting &rest body)
  "Safely set punctuation mode for duration of body form."
  `(progn
     (declare (special dtk-punctuation-mode))
     (let    ((save-punctuation-mode dtk-punctuation-mode))
       (unwind-protect
           (progn
             (unless (eq ,setting save-punctuation-mode)
	       (dtk-interp-set-punctuations ,setting)
               (setq dtk-punctuation-mode ,setting))
             ,@body
             (dtk-force))
         (unless (eq  ,setting  save-punctuation-mode)
           (setq dtk-punctuation-mode save-punctuation-mode)
	   (dtk-interp-set-punctuations ,setting))
           (dtk-force)))))


Regards
Bart

-----------------------------------------------------------------------------
To unsubscribe from the emacspeak list or change your address on the
emacspeak list send mail to "emacspeak-request@cs.vassar.edu" with a
subject of "unsubscribe" or "help".



If you have questions about this archive or had problems using it, please send mail to:

priestdo@cs.vassar.edu No Soliciting!

Emacspeak List Archive | 2010 | 2009 | 2008 | 2007 | 2006 | 2005 | 2004 | 2003 | 2002 | 2001 | 2000 | 1999 | 1998 | Pre 1998

Emacspeak Files | Emacspeak Blog | Search the archive