Jsapi10SynthesizedOutput implements SynthesizedOutput, SpeakableListener,
        StreamableSynthesizedOutput { @Override public void waitNonBargeInPlayed() { if (LOGGER.isDebugEnabled()) { LOGGER.debug("waiting until all non-barge-in has been played..."); } if (!bargein) { if (LOGGER.isDebugEnabled()) { LOGGER.debug("bargein not active for current output"); } return; } boolean stopWaiting = false; while (!stopWaiting) { synchronized (endplayLock) { try { endplayLock.wait(WAIT_EMPTY_TIMEINTERVALL); } catch (InterruptedException e) { return; } } synchronized (queuedSpeakables) { if (queuedSpeakables.isEmpty()) { stopWaiting = true; } else { final SpeakableText speakable = queuedSpeakables.peek(); if (speakable instanceof SpeakableSsmlText) { final SpeakableSsmlText ssml = (SpeakableSsmlText) speakable; stopWaiting = ssml.getBargeInType() == null; } } } } if (LOGGER.isDebugEnabled()) { LOGGER.debug("...all non barge-in has been played"); } } Jsapi10SynthesizedOutput(final SynthesizerModeDesc defaultDescriptor); void open(); void close(); Synthesizer getSynthesizer(); DocumentServer getDocumentServer(); String getSessionid(); void addListener(final SynthesizedOutputListener outputListener); void removeListener(final SynthesizedOutputListener outputListener); @Override void queueSpeakable(final SpeakableText speakable, final String id,
            final DocumentServer server); void speakPlaintext(final String text); @Override boolean supportsBargeIn(); @Override void cancelOutput(final BargeInType type); boolean isOutputCanceled(); void waitEngineState(final long state); @Override void waitNonBargeInPlayed(); @Override void waitQueueEmpty(); void reachedMark(final String mark); void activate(); void passivate(); void connect(final ConnectionInformation connectionInformation); void disconnect(final ConnectionInformation connectionInformation); String getType(); void setType(final String resourceType); void setSynthesizedOutputConnectionHandler(
            final SynthesizedOutputConnectionHandler connectionHandler); URI getUriForNextSynthesisizedOutput(); void markerReached(final SpeakableEvent event); void speakableCancelled(final SpeakableEvent event); void speakableEnded(final SpeakableEvent event); void speakablePaused(final SpeakableEvent event); void speakableResumed(final SpeakableEvent event); void speakableStarted(final SpeakableEvent event); void topOfQueue(final SpeakableEvent event); void wordStarted(final SpeakableEvent event); boolean isBusy(); int readSynthesizerStream(final byte[] buffer, final int offset,
            final int length); void addSynthesizerStream(final InputStream input);  }
@Test public void testWaitNonBargeInPlayed() throws JVoiceXMLEvent, Exception { final SsmlDocument doc1 = new SsmlDocument(); final Speak speak1 = doc1.getSpeak(); speak1.addText("Test1"); final SpeakableText text1 = new SpeakableSsmlText(doc1, true, BargeInType.HOTWORD); ; final SsmlDocument doc2 = new SsmlDocument(); final Speak speak2 = doc2.getSpeak(); speak2.addText("Test2"); final SpeakableText text2 = new SpeakableSsmlText(doc2, true, BargeInType.SPEECH); final SsmlDocument doc3 = new SsmlDocument(); final Speak speak3 = doc3.getSpeak(); speak3.addText("Test3"); final SpeakableText text3 = new SpeakableSsmlText(doc3); synthesizer.queueSpeakable(text1, sessionId, documentServer); synthesizer.queueSpeakable(text2, sessionId, documentServer); synthesizer.queueSpeakable(text3, sessionId, documentServer); synthesizer.waitNonBargeInPlayed(); }