本文整理了Java中javax.sound.sampled.Clip.stop()
方法的一些代码示例,展示了Clip.stop()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Clip.stop()
方法的具体详情如下:
包路径:javax.sound.sampled.Clip
类名称:Clip
方法名:stop
暂无
代码示例来源:origin: marytts/marytts
public void run() {
System.err.println("Timer task running");
if (!clip.isActive() // already stopped?
|| clip.getFramePosition() >= endFrame) {
System.err.println("Timer task stopping clip.");
clip.stop();
this.cancel();
}
}
}
代码示例来源:origin: marytts/marytts
public void run() {
System.err.println("Timer task running");
if (!clip.isActive() // already stopped?
|| clip.getFramePosition() >= endFrame) {
System.err.println("Timer task stopping clip.");
clip.stop();
this.cancel();
}
}
}
代码示例来源:origin: marytts/marytts
/**
* Stop wav play back
*
*/
public static void stopWavFile() {
m_clip.stop();
m_clip.flush();
m_clip.close();
}
代码示例来源:origin: marytts/marytts
/**
* Stop wav play back
*
*/
public static void stopWavFile() {
m_clip.stop();
m_clip.flush();
m_clip.close();
}
代码示例来源:origin: marytts/marytts
public void actionPerformed(ActionEvent e) {
synchronized (clip) {
if (clip.isActive()) {
System.err.println("Stopping clip.");
clip.stop();
} else {
System.err.println("Rewinding clip.");
if (Double.isNaN(positionCursor.x)) { // no cursor, play from start
clip.setFramePosition(0);
} else { // play from cursor position
clip.setFramePosition(X2indexX(positionCursor.x));
}
if (!Double.isNaN(rangeCursor.x)) { // range set?
System.err.println("Setting timer task");
int endFrame = X2indexX(rangeCursor.x);
timer.schedule(new ClipObserver(clip, endFrame), 50, 50);
}
System.err.println("Starting clip.");
clip.start();
}
}
}
});
代码示例来源:origin: marytts/marytts
public void actionPerformed(ActionEvent e) {
synchronized (clip) {
if (clip.isActive()) {
System.err.println("Stopping clip.");
clip.stop();
} else {
System.err.println("Rewinding clip.");
if (Double.isNaN(positionCursor.x)) { // no cursor, play from start
clip.setFramePosition(0);
} else { // play from cursor position
clip.setFramePosition(X2indexX(positionCursor.x));
}
if (!Double.isNaN(rangeCursor.x)) { // range set?
System.err.println("Setting timer task");
int endFrame = X2indexX(rangeCursor.x);
timer.schedule(new ClipObserver(clip, endFrame), 50, 50);
}
System.err.println("Starting clip.");
clip.start();
}
}
}
});
代码示例来源:origin: tomighty/tomighty
public void stop(Sound sound) {
Clip clip = activeClips.get(sound);
if(clip != null) {
clip.stop();
}
}
代码示例来源:origin: ddf/Minim
public void pause()
{
c.stop();
playing = false;
}
代码示例来源:origin: org.jvnet.hudson/netx
/**
* Stops playing the clip.
*/
public void stop() {
if (clip == null)
return;
clip.stop();
}
代码示例来源:origin: com.googlecode.playn/playn-java
@Override
protected void stopImpl() {
impl.stop();
impl.flush();
}
代码示例来源:origin: robo-code/robocode
private Clip next() {
Clip c = clips[idx];
idx = (idx + 1) % clips.length;
c.stop();
c.setFramePosition(0);
return c;
}
}
代码示例来源:origin: threerings/playn
@Override
protected void stopImpl() {
impl.stop();
impl.flush();
}
代码示例来源:origin: org.apache.ant/ant-jmf
private void playClip(Clip clip, long duration) {
clip.loop(Clip.LOOP_CONTINUOUSLY);
try {
Thread.sleep(duration);
} catch (InterruptedException e) {
// Ignore Exception
}
clip.stop();
}
代码示例来源:origin: ru.sbtqa/monte-media
public synchronized void stop() {
if (clip != null) {
clip.stop();
clip.close();
clip = null;
}
}
代码示例来源:origin: playn/playn
@Override
protected void stopImpl() {
impl.stop();
impl.flush();
}
代码示例来源:origin: nroduit/Weasis
/** Stop playing the sound, but retain the current position */
public void stop() {
timer.stop();
clip.stop();
play.setText(Messages.getString("AuView.play")); //$NON-NLS-1$
playing = false;
}
代码示例来源:origin: com.github.bloodshura/shurax-assets
@Override
public void stop() {
if (isPlaying()) {
clip.stop();
}
}
}
代码示例来源:origin: robo-code/robocode
/**
* Stops the background music.
*/
public void stopBackgroundMusic() {
Clip c = getSounds().getSound("background");
if (c != null) {
c.stop();
}
}
代码示例来源:origin: org.jvnet.hudson/netx
/**
* Plays the clip from the beginning.
*/
public void play() {
if (clip == null)
return;
// applet audio clip resets to beginning when played again
clip.stop();
clip.setFramePosition(0);
clip.start();
}
代码示例来源:origin: stackoverflow.com
File soundFile = new File("path_to_file\\doorbell.wav");
Clip clip = AudioSystem.getClip();
AudioInputStream inputStream = AudioSystem.getAudioInputStream(soundFile);
clip.open(inputStream);
clip.stop();//to avoid overlaps
clip.setFramePosition(0);
clip.start();
内容来源于网络,如有侵权,请联系作者删除!