NSSpeechSynthesizer extends NSObject { public NSSpeechError getError() { return new NSSpeechError(Rococoa.cast(getProperty(SpeechProperty.ErrorsProperty), NSMutableDictionary.class)); }  static NSSpeechSynthesizer synthesizerWithVoiceIdentifier(String voiceIdentifer); static NSSpeechSynthesizer synthesizerWithVoice(NSVoice voice); static NSVoice defaultVoice(); static List<NSVoice> availableVoices(); static boolean isAnyApplicationSpeaking(); synchronized void setDelegate(final NSSpeechSynthesizerDelegate delegate); synchronized NSSpeechSynthesizerDelegate getDelegate(); String opcodeToPhoneme(short opcode); static String createSyncPoint(int marker); NSObject getProperty(SpeechProperty property); void setProperty(SpeechProperty property, NSObject value); void addSpeechDictionary(NSSpeechDictionary dictionary); NSSpeechStatus getStatus(); NSSpeechError getError(); NSSpeechMode getInputMode(); void setInputMode(NSSpeechMode mode); NSSpeechMode getCharacterMode(); void setCharacterMode(NSSpeechMode mode); NSSpeechMode getNumberMode(); void setNumberMode(NSSpeechMode mode); NSSpeechSynthesizerInfo getSynthesizerInfo(); float getPitchBase(); void setPitchBase(float baselinePitch); float getPitchMod(); void setPitchMod(float modulation); List<NSSpeechPhonemeInfo> getPhonemeInfo(); int getRecentSync(); boolean setVoice(NSVoice voice); NSVoice getVoice(); void setCommandDelimiter(NSSpeechCommand delimiters); void reset(); void setOutputToFileURL(URI uri); boolean startSpeakingStringToURL(String text, URI uri); abstract void continueSpeaking(); abstract boolean isSpeaking(); abstract void pauseSpeakingAtBoundary(NSSpeechBoundary boundary); abstract String phonemesFromText(String text); abstract float rate(); abstract void setRate(float rate); abstract void setUsesFeedbackWindow(boolean useFeedbackWindow); abstract boolean setVoice(String voiceIdentifier); abstract void setVolume(float volume); abstract boolean startSpeakingString(String text); abstract void stopSpeaking(); abstract void stopSpeakingAtBoundary(NSSpeechBoundary boundary); abstract boolean usesFeedbackWindow(); String getVoiceIdentifier(); float getVolume(); static final _Class CLASS; }
@Test public void testGetError() throws InterruptedException { NSSpeechSynthesizer ss = NSSpeechSynthesizer.synthesizerWithVoice(null); SynthesizerDelegate sd = new SynthesizerDelegate(ss); ss.startSpeakingString("Try this one [[pbas foobar]] two three"); sd.waitForWord(1000, "three"); assertTrue("Should have error position", sd.position > 0); assertTrue("Should have error message", sd.errorMessage != null); NSSpeechSynthesizer.NSSpeechError error = ss.getError(); assertTrue("Should find error", error.getErrorCount() > 0); assertTrue("Should have error position", error.getNewestCharacterOffset() > 0); assertTrue("Should have error code", error.getNewestCode() != 0); sd.waitForSpeechDone(5000, true); }