当前位置: 首页>>代码示例>>Java>>正文


Java Type.STOP属性代码示例

本文整理汇总了Java中javax.sound.sampled.LineEvent.Type.STOP属性的典型用法代码示例。如果您正苦于以下问题:Java Type.STOP属性的具体用法?Java Type.STOP怎么用?Java Type.STOP使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在javax.sound.sampled.LineEvent.Type的用法示例。


在下文中一共展示了Type.STOP属性的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: playClip

public static void playClip(File clipFile) throws IOException, 
  UnsupportedAudioFileException, LineUnavailableException, InterruptedException {
  class AudioListener implements LineListener {
    private boolean done = false;
    @Override public synchronized void update(LineEvent event) {
      Type eventType = event.getType();
      if (eventType == Type.STOP || eventType == Type.CLOSE) {
        done = true;
        notifyAll();
      }
    }
    public synchronized void waitUntilDone() throws InterruptedException {
      while (!done) { wait(); }
    }
  }
  AudioListener listener = new AudioListener();
  AudioInputStream audioInputStream = AudioSystem.getAudioInputStream(clipFile);
  try {
    Clip clip = AudioSystem.getClip();
    clip.addLineListener(listener);
    clip.open(audioInputStream);
    try {
      clip.start();
      listener.waitUntilDone();
    } finally {
      clip.close();
    }
  } finally {
    audioInputStream.close();
  }
}
 
开发者ID:Jahani,项目名称:EnchantedForest,代码行数:31,代码来源:Sound.java

示例2: VentanaInternaGrabador

public VentanaInternaGrabador(final File f) {
    initComponents();

    recorder = new SMSoundPlayerRecorder(f);
    this.setTitle(f.getName());
    LineListener lineListener = new LineListener() {
        @Override
        public void update(LineEvent event) {
            if (event.getType() == Type.START) {
                recorderButton.setEnabled(false);
                stopButton.setEnabled(true);
            }
            if (event.getType() == Type.STOP) {
                recorderButton.setEnabled(true);
                stopButton.setEnabled(false);
                VentanaInternaReproductor vir = new VentanaInternaReproductor(f);
                VentanaPrincipal.getEscritorio().add(vir);
                vir.setVisible(true);
            }

        }
    };
    ((SMSoundPlayerRecorder) recorder).setLineListener(lineListener);
    this.pack();
}
 
开发者ID:oskyar,项目名称:Sistemas-Multimedia,代码行数:25,代码来源:VentanaInternaGrabador.java

示例3: VentanaInternaReproductor

public VentanaInternaReproductor(File f) {
    initComponents();

    player = new SMSoundPlayerRecorder(f);
    this.setTitle(f.getName());
    LineListener lineListener = new LineListener() {
        @Override
        public void update(LineEvent event) {
            if (event.getType() == Type.START) {
                play.setEnabled(false);
                stop.setEnabled(true);
            }
            if (event.getType() == Type.STOP) {
                play.setEnabled(true);
                play.setSelected(false);
                stop.setEnabled(false);
            }
        }
    };
    ((SMSoundPlayerRecorder)player).setLineListener(lineListener);
    this.pack();
}
 
开发者ID:oskyar,项目名称:Sistemas-Multimedia,代码行数:22,代码来源:VentanaInternaReproductor.java

示例4: VentanaInternaGrabador

public VentanaInternaGrabador() {
    initComponents();
    exist=true;
    recorder = new SMSoundPlayerRecorder(new File("nuevo"));
    LineListener lineListener = new LineListener() {
        @Override
        public void update(LineEvent event) {
            if (event.getType() == Type.START) {
                recorderButton.setEnabled(false);
                stopButton.setEnabled(true);
            }
            if (event.getType() == Type.STOP) {
                recorderButton.setEnabled(true);
                stopButton.setEnabled(false);
            }

        }
    };
    ((SMSoundPlayerRecorder) recorder).setLineListener(lineListener);
    this.pack();
}
 
开发者ID:oskyar,项目名称:Sistemas-Multimedia,代码行数:21,代码来源:VentanaInternaGrabador.java

示例5: VentanaInternaReproductor

public VentanaInternaReproductor(File f) {
    initComponents();
    if (f != null) {
        player = new SMSoundPlayer(f);
        this.setTitle(f.getName());
        LineListener lineListener = new LineListener() {
            @Override
            public void update(LineEvent event) {
                if (event.getType() == Type.START) {
                    play.setEnabled(false);
                    stop.setEnabled(true);
                }
                if (event.getType() == Type.STOP) {
                    play.setEnabled(true);
                    play.setSelected(false);
                    stop.setEnabled(false);
                }
            }
        };
        ((SMSoundPlayer) player).setLineListener(lineListener);
        this.pack();
    }
}
 
开发者ID:oskyar,项目名称:Sistemas-Multimedia,代码行数:23,代码来源:VentanaInternaReproductor.java

示例6: update

/**
 * 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();
	}
}
 
开发者ID:mars-sim,项目名称:mars-sim,代码行数:12,代码来源:TelegraphSound.java

示例7: update

/**
 * This method allows to be notified for each event while playing a
 * sound
 */
@Override
public synchronized void update(LineEvent event) {
	Type eventType = event.getType();
	if (eventType == Type.STOP || eventType == Type.CLOSE) {
		done = true;
		notifyAll();
	}
}
 
开发者ID:thahn0720,项目名称:agui_framework,代码行数:12,代码来源:AchievementSound.java

示例8: update

@Override
public synchronized void update(LineEvent event) {
    Type eventType = event.getType();
    if (eventType == Type.STOP || eventType == Type.CLOSE) {
        done = true;
        notifyAll();
    }
}
 
开发者ID:pleonex,项目名称:UniversityCP,代码行数:8,代码来源:Audio.java


注:本文中的javax.sound.sampled.LineEvent.Type.STOP属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。