Package javax.sound.sampled

Examples of javax.sound.sampled.LineListener


          if(mTestSound != null) {
            soundTestBt.setText(mLocalizer.msg("stop", "Stop"));
          }
          if(mTestSound != null) {
            if(mTestSound instanceof SourceDataLine) {
              ((SourceDataLine)mTestSound).addLineListener(new LineListener() {
                public void update(LineEvent event) {
                  if(event.getType() == Type.CLOSE) {
                    soundTestBt.setText(mLocalizer.msg("test", "Test"));
                  }
                }
View Full Code Here


      stream = AudioSystem.getAudioInputStream(ClientGUI.getResource(file));
      DataLine.Info info = new DataLine.Info(Clip.class, stream.getFormat());
      clip = (Clip) AudioSystem.getLine(info);
      clip.open(stream);
      clip.start();
      clip.addLineListener(new LineListener() {
       
        public void update(LineEvent event) {
          if (event.getType() == LineEvent.Type.STOP)
            event.getLine().close();
        }
View Full Code Here

   * Notify the line listeners
   * @param e The LineEvent
   */
  private void notifyListeners(LineEvent e){
    for (Iterator<LineListener> iter = listeners.iterator(); iter.hasNext();) {
      LineListener listener = iter.next();
      listener.update(e);
    }
  }
View Full Code Here

   * @param e
   *            The LineEvent
   */
  private void notifyListeners(LineEvent e) {
    for (Iterator<LineListener> iter = listeners.iterator(); iter.hasNext();) {
      LineListener listener = iter.next();
      listener.update(e);
    }
  }
View Full Code Here

//   new BufferedOutputStream(new FileOutputStream(args[1]));

        DataLine.Info info = new DataLine.Info(SourceDataLine.class, audioFormat);
        SourceDataLine line = (SourceDataLine) AudioSystem.getLine(info);
        line.open(audioFormat);
        line.addLineListener(new LineListener() {
            public void update(LineEvent ev) {
Debug.println(ev.getType());
            if (LineEvent.Type.STOP == ev.getType()) {
                System.exit(0);
            }
View Full Code Here

        {
            try
            {
                clip = AudioSystem.getClip();
                AudioInputStream ais = AudioSystem.getAudioInputStream(soundFile);
                LineListener listener = new LineListener()
                {
                    public void update(LineEvent event)
                    {
                        if (event.getType() == Type.STOP)
                        {
View Full Code Here

    public static void playSound(String filename) {
        URL resource = ClassLoader.getSystemClassLoader().getResource(filename);
        try {
            final Clip clip = (Clip) AudioSystem.getLine(new Line.Info(Clip.class));
            clip.addLineListener(new LineListener() {
                @Override
                public void update(LineEvent event) {
                    if (event.getType() == LineEvent.Type.STOP) {
                        clip.close();
                    }
View Full Code Here

  public static void playSfx(String path) {
    final Sound s = loadSfx(path);
   
    final Sound snd = s;
    s.play();
    snd.addLineListener(new LineListener() {
      public void update(LineEvent event) {
        if (event.getType() == LineEvent.Type.STOP) {
          snd.close();
          SoundEngine.sfxs.remove(this);
        }
View Full Code Here

  public static void loopSfx(String path) {
    final Sound s = loadSfx(path);
   
    final Sound snd = s;
    s.loop();
    snd.addLineListener(new LineListener() {
      public void update(LineEvent event) {
        if (event.getType() == LineEvent.Type.STOP) {
          snd.close();
          SoundEngine.sfxs.remove(this);
        }
View Full Code Here

TOP

Related Classes of javax.sound.sampled.LineListener

Copyright © 2018 www.massapicom. 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.