Package javax.sound.sampled

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


              System.out.println("testplaying " + name + " "
                  + playStream.getFormat());

              final Clip line = (Clip) defaultMixer.getLine(info);
              line.open(playStream);
              line.loop(2);
              final TestLineListener testListener = new TestLineListener();
              line.addLineListener(testListener);
              while (testListener.active) {
                Thread.yield();
View Full Code Here


        try {
            audioInputStream = AudioSystem.getAudioInputStream(resourceURL);
            AudioFormat audioFormat = audioInputStream.getFormat();
            DataLine.Info dataLineInfo = new DataLine.Info(Clip.class, audioFormat);
            Clip clip = getClip(dataLineInfo);
            clip.open(audioInputStream);
            FloatControl volctrl=(FloatControl)clip.getControl(FloatControl.Type.MASTER_GAIN);
            volctrl.setValue(volume);
            clip.start();
        } catch (UnsupportedAudioFileException ex) {
            resourceLogger.log(Level.SEVERE, null, ex);
View Full Code Here

  }
 
  public static void playSound(String alias) throws LineUnavailableException, IOException {
    AudioInputStream audioInputStream = sounds.get(alias);
    Clip clip = AudioSystem.getClip();
    clip.open(audioInputStream);
   
  }
}
View Full Code Here

    Clip clip = null;
    try {
      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)
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

            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();
        }
        catch (Exception exc) {
            exc.printStackTrace(System.out);
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

            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();
        }
        catch (Exception exc) {
            exc.printStackTrace(System.out);
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

            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

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.