Examples of NSSpeechStatus


Examples of org.rococoa.contrib.appkit.NSSpeechSynthesizer.NSSpeechStatus

    @Test
    public void testGetStatus() {
        NSSpeechSynthesizer ss = NSSpeechSynthesizer.synthesizerWithVoice(null);
        SynthesizerDelegate sd = new SynthesizerDelegate(ss);       
        NSSpeechStatus status = ss.getStatus();
        assertEquals(status.isOutputBusy(), ss.isSpeaking());
        assertFalse(status.isOutputPaused());
        assertEquals("Should have no characters left", 0, status.getNumberOfCharactersLeft());
        assertEquals(0, status.getPhonemeCode());
       
        ss.startSpeakingString("Status check");
        status = ss.getStatus();
        assertEquals(status.isOutputBusy(), ss.isSpeaking());
        assertFalse(status.isOutputPaused());
        assertTrue("Should have characters left", status.getNumberOfCharactersLeft() > 0);
        //assertTrue("Opcode should not be zero", status.getPhonemeCode() != 0); always zero... seems to have word granularity
        sd.waitForSpeechDone(TIME_TO_WAIT, true);
    }
View Full Code Here

Examples of org.rococoa.contrib.appkit.NSSpeechSynthesizer.NSSpeechStatus

        SynthesizerDelegate sd = new SynthesizerDelegate(ss);
        ss.startSpeakingString("Status check number two");
        sd.waitForNextWord(1000);
        ss.pauseSpeakingAtBoundary(NSSpeechSynthesizer.NSSpeechBoundary.WordBoundary);
        Thread.sleep(1000); //this API is very asynchronous ... need to sleep before polling status
        NSSpeechStatus status = ss.getStatus();  
        assertFalse("Output should not be busy", status.isOutputBusy());
        assertTrue("Output should be paused", status.isOutputPaused());
        assertEquals("Check number of characters left failed", 16, status.getNumberOfCharactersLeft());       
        ss.continueSpeaking();
        sd.waitForNextWord(2500);
        ss.pauseSpeakingAtBoundary(NSSpeechSynthesizer.NSSpeechBoundary.ImmediateBoundary);
        Thread.sleep(TIME_TO_WAIT);
        status = ss.getStatus();  
        assertFalse("Output should not be busy", status.isOutputBusy());
        assertTrue("Output should be paused", status.isOutputPaused());
        assertEquals("Check number of characters left failed", 10, status.getNumberOfCharactersLeft());
        ss.continueSpeaking();
        sd.waitForSpeechDone(TIME_TO_WAIT, true);
    }
View Full Code Here

Examples of org.rococoa.contrib.appkit.NSSpeechSynthesizer.NSSpeechStatus

        ss.startSpeakingString("This is the way the world ends. Not with a bang.");
        sd.waitForNextWord(1000);
        ss.pauseSpeakingAtBoundary(NSSpeechSynthesizer.NSSpeechBoundary.SentenceBoundary);
        sd.waitForWord(10000, "ends"); //this tells you the word is _about_ to be spoken
        Thread.sleep(750); //so we need to wait a bit more
        NSSpeechStatus status = ss.getStatus();  
        assertFalse("Output should not be busy", status.isOutputBusy());
        assertTrue("Output should be paused", status.isOutputPaused());
        //often returns 22, which is just before 'ends'. There's a heck of a lag, basically, in the getStatus interface
        assertTrue("Check number of characters left failed", status.getNumberOfCharactersLeft() >= 16);
        ss.continueSpeaking();
        sd.waitForSpeechDone(5000, true);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.