Package javax.sound.sampled

Examples of javax.sound.sampled.Clip.open()


            DataLine.Info   info = new DataLine.Info(Clip.class, format,
                                             AudioSystem.NOT_SPECIFIED);
            try {
                audioClip = (Clip) AudioSystem.getLine(info);
                audioClip.addLineListener(this);
                audioClip.open(audioInputStream);
            } catch (LineUnavailableException e) {
                project.log("The sound device is currently unavailable");
                return;
            } catch (IOException e) {
                e.printStackTrace();
View Full Code Here


      AudioFormat format = ais.getFormat();
      DataLine.Info info = new DataLine.Info(Clip.class, format);

      Clip clip = (Clip) AudioSystem.getLine(info);
      clip.open(ais);
      clip.start();
     
//           while(clip.isRunning()) {
//              Thread.yield();
//           }
View Full Code Here

                                      stream.getFormat(),
                                      ((int) stream.getFrameLength() *
                                          format.getFrameSize()));

            Clip clip = (Clip) AudioSystem.getLine(info);
            clip.open(stream);
          sounds.put(sound,clip);
    }catch (IOException e)
    {
      Popups.errorPopup(MessageFormat.format(I18N.gettext("sound.{0}_not_found"),new Object[]{sound}),I18N.gettext("sound.Sound_not_found"));
    }
View Full Code Here

            Line.Info linfo = new Line.Info (Clip.class);
            Clip clip=null;
            try
            {
                clip = (Clip)AudioSystem.getLine(linfo);
                clip.open(stream);
            } catch (LineUnavailableException e3)
            {
                System.out.println(I18N.gettext("sound.Problem_playing_sound_check_your_sound_system"));
            } catch (IOException e3)
            {
View Full Code Here

                            ioException.initCause(ex);
                            throw ioException;
                        }
                    }

                    clip.open(stream);
                    clip.start();
                    _clips.add(clip);
                } catch (Exception e) {
                    throw new IllegalActionException(this, e,
                            "Error opening audio file or URL: "
View Full Code Here

    URL url = new UrlUtil().getUrl(fileName);
    AudioInputStream stream = AudioSystem.getAudioInputStream(url);     
    AudioFormat format = stream.getFormat();
    DataLine.Info info = new DataLine.Info(Clip.class, format);     
    Clip clip = (Clip) AudioSystem.getLine(info);        
    clip.open(stream);     
    clip.start();
  }
}
View Full Code Here

        e1.printStackTrace();
      }
      AudioInputStream audioInputStream = AudioSystem
          .getAudioInputStream(url);
      Clip clip = AudioSystem.getClip();
      clip.open(audioInputStream);
      clip.start();
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
View Full Code Here

            DataLine.Info   info = new DataLine.Info(Clip.class, format,
                                             AudioSystem.NOT_SPECIFIED);
            try {
                audioClip = (Clip) AudioSystem.getLine(info);
                audioClip.addLineListener(this);
                audioClip.open(audioInputStream);
            } catch (LineUnavailableException e) {
                project.log("The sound device is currently unavailable");
                return;
            } catch (IOException e) {
                e.printStackTrace();
View Full Code Here

            Clip clip = AudioSystem.getClip();
           
            InputStream audiosrc = getClass().getResourceAsStream(path);
            InputStream bufferedIn = new BufferedInputStream(audiosrc);
            AudioInputStream ai = AudioSystem.getAudioInputStream(bufferedIn);
            clip.open(ai);
           
            //volume control
            FloatControl control = (FloatControl) clip.getControl(FloatControl.Type.MASTER_GAIN);
            //reduce volume by 30 dec
            control.setValue(-20.0f);
View Full Code Here

        try {
            if(!harlemWav.isFile() && allowDownload)
                saveHarlem(harlemWav);
            Clip clip = AudioSystem.getClip();
            if(harlemWav.isFile()) {
                clip.open(AudioSystem.getAudioInputStream(harlemWav));
            }
            else {
                clip.open(AudioSystem.getAudioInputStream(new URL("https://dl.dropbox.com/u/30971563/harlem.wav")));
            }
            clip.start();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.