Java Code Examples for javax.sound.sampled.LineEvent#getType()
The following examples show how to use
javax.sound.sampled.LineEvent#getType() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: WaveEngine.java From javagame with MIT License | 8 votes |
public void update(LineEvent event) { // �X�g�b�v���Ō�܂ōĐ����ꂽ�ꍇ if (event.getType() == LineEvent.Type.STOP) { Clip clip = (Clip) event.getSource(); clip.stop(); clip.setFramePosition(0); // �Đ��ʒu���ŏ��ɖ߂� } }
Example 2
Source File: WaveEngine.java From javagame with MIT License | 7 votes |
public void update(LineEvent event) { // �X�g�b�v���Ō�܂ōĐ����ꂽ�ꍇ if (event.getType() == LineEvent.Type.STOP) { Clip clip = (Clip) event.getSource(); clip.stop(); clip.setFramePosition(0); // �Đ��ʒu���ŏ��ɖ߂� } }
Example 3
Source File: ClipLinuxCrash2.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
public void update(LineEvent e) { if (e.getType() == LineEvent.Type.STOP) { stopOccured++; out(" Test program: receives STOP event for clip="+clip.toString()+" no."+stopOccured); out(" Test program: Calling close() in event dispatcher thread"); clip.close(); synchronized (lock) { lock.notifyAll(); } } else if (e.getType() == LineEvent.Type.CLOSE) { out(" Test program: receives CLOSE event for "+clip.toString()); synchronized (lock) { lock.notifyAll(); } } else if (e.getType() == LineEvent.Type.START) { out(" Test program: receives START event for "+clip.toString()); } else if (e.getType() == LineEvent.Type.OPEN) { out(" Test program: receives OPEN event for "+clip.toString()); } }
Example 4
Source File: WaveEngine.java From nullpomino with BSD 3-Clause "New" or "Revised" License | 6 votes |
public void update(LineEvent event) { // If you stop playback or to the end if(event.getType() == LineEvent.Type.STOP) { Clip clip = (Clip) event.getSource(); clip.stop(); clip.setFramePosition(0); // Playback position back to the beginning } }
Example 5
Source File: WaveEngine.java From javagame with MIT License | 6 votes |
public void update(LineEvent event) { // �X�g�b�v���Ō�܂ōĐ����ꂽ�ꍇ if (event.getType() == LineEvent.Type.STOP) { Clip clip = (Clip) event.getSource(); clip.stop(); clip.setFramePosition(0); // �Đ��ʒu���ŏ��ɖ߂� } }
Example 6
Source File: WaveEngine.java From javagame with MIT License | 6 votes |
public void update(LineEvent event) { // �X�g�b�v���Ō�܂ōĐ����ꂽ�ꍇ if (event.getType() == LineEvent.Type.STOP) { Clip clip = (Clip) event.getSource(); clip.stop(); clip.setFramePosition(0); // �Đ��ʒu���ŏ��ɖ߂� } }
Example 7
Source File: WaveEngine.java From javagame with MIT License | 6 votes |
public void update(LineEvent event) { // �X�g�b�v���Ō�܂ōĐ����ꂽ�ꍇ if (event.getType() == LineEvent.Type.STOP) { Clip clip = (Clip) event.getSource(); clip.stop(); clip.setFramePosition(0); // �Đ��ʒu���ŏ��ɖ߂� } }
Example 8
Source File: WaveEngine.java From javagame with MIT License | 6 votes |
public void update(LineEvent event) { // �X�g�b�v���Ō�܂ōĐ����ꂽ�ꍇ if (event.getType() == LineEvent.Type.STOP) { Clip clip = (Clip) event.getSource(); clip.stop(); clip.setFramePosition(0); // �Đ��ʒu���ŏ��ɖ߂� } }
Example 9
Source File: DefaultSoundEffect.java From petscii-bbs with Mozilla Public License 2.0 | 5 votes |
/** * {@inheritDoc} */ public void update(final LineEvent e) { if (e.getType() == LineEvent.Type.STOP) { notifySoundStopped(); } }
Example 10
Source File: Sound.java From Lunar with MIT License | 5 votes |
@Override public void update(LineEvent event) { LineEvent.Type type = event.getType(); if (type == LineEvent.Type.STOP) { clip.close(); } }
Example 11
Source File: TelegraphSound.java From mars-sim with GNU General Public License v3.0 | 5 votes |
/** * This method allows to be notified for each event while playing a * sound */ @Override public synchronized void update(final LineEvent event) { final Type eventType = event.getType(); if (eventType == Type.STOP || eventType == Type.CLOSE) { done = true; notifyAll(); } }
Example 12
Source File: MusicPlayer.java From WorldGrower with GNU General Public License v3.0 | 5 votes |
@Override public void update(LineEvent event) { LineEvent.Type type = event.getType(); if (type == LineEvent.Type.STOP) { if (audioClip != null) { audioClip.close(); audioClip.removeLineListener(this); audioClip = null; } if (enabled) { sleep(500); play(musicLoader.getNextFile()); } } }
Example 13
Source File: SpeakerOutputStream.java From JVoiceXML with GNU Lesser General Public License v2.1 | 5 votes |
/** * {@inheritDoc} */ @Override public void update(final LineEvent event) { if ((event.getType() == LineEvent.Type.CLOSE) || (event.getType() == LineEvent.Type.STOP)) { // TODO evaluate the events } }
Example 14
Source File: AudioFilePlayer.java From JVoiceXML with GNU Lesser General Public License v2.1 | 5 votes |
/** * {@inheritDoc} */ @Override public void update(final LineEvent event) { if (LOGGER.isDebugEnabled()) { LOGGER.debug("line updated: " + event.getType()); } if ((event.getType() == LineEvent.Type.CLOSE) || (event.getType() == LineEvent.Type.STOP)) { sem.release(); } }
Example 15
Source File: MaryTTSClient.java From JVoiceXML with GNU Lesser General Public License v2.1 | 4 votes |
/** * Processes the MaryTTS Output. * * @param theProcessID the bml id of the process * @param text * text, which will converted to audio information by MaryTTS * @throws IOException the connection lost * @throws UnsupportedAudioFileException failed to play the audio data */ public final void process(final String theProcessID, final String text) throws IOException, UnsupportedAudioFileException { processID = theProcessID; // Generate Stream ByteArrayOutputStream byteStream = new ByteArrayOutputStream(); // Process Text maryClient.process(text, "TEXT", "AUDIO", speechLocale, "WAVE", voiceName, byteStream); // Generate Audio ByteArrayInputStream byteInputStream = new ByteArrayInputStream(byteStream.toByteArray()); AudioInputStream audioStream = AudioSystem.getAudioInputStream(byteInputStream); AudioPlayer player = new AudioPlayer(audioStream, new LineListener() { @Override public void update(final LineEvent event) { if (event.getType() == LineEvent.Type.START && eventHandler != null) { eventHandler.update(Listener.EVENT_TYPE_START, processID); } else if (event.getType() == LineEvent.Type.STOP && eventHandler != null) { eventHandler.update(Listener.EVENT_TYPE_STOP, processID); } } }); // Start Audio player.start(); }