Package javax.sound.sampled

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


            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

        new Thread(new Runnable() {
          public void run() {
            try {
              Clip clip = AudioSystem.getClip();
              AudioInputStream inputStream = AudioSystem.getAudioInputStream(ChatClient.class.getResourceAsStream("/resources/" + url));
              clip.open(inputStream);
              clip.start();
            } catch (Exception e) {
              System.err.println(e.getMessage());
            }
          }
View Full Code Here

            InputStream audioSrc = getClass().getResourceAsStream("/archivos/corto.wav");
            InputStream bufferedIn = new BufferedInputStream(audioSrc);
            AudioInputStream audioStream = AudioSystem.getAudioInputStream(bufferedIn);
            Thread.sleep(sleep);
            Clip clip = AudioSystem.getClip();
            clip.open(audioStream);
            clip.start();
            Thread.sleep(sleep);
        }
        catch (InterruptedException | LineUnavailableException | UnsupportedAudioFileException | IOException exc)
        {
View Full Code Here

            InputStream audioSrc = getClass().getResourceAsStream("/archivos/largo.wav");
            InputStream bufferedIn = new BufferedInputStream(audioSrc);
            AudioInputStream audioStream = AudioSystem.getAudioInputStream(bufferedIn);
            Thread.sleep(sleep);
            Clip clip = AudioSystem.getClip();
            clip.open(audioStream);
            clip.start();
            Thread.sleep(sleep);
        }
        catch (InterruptedException | LineUnavailableException | UnsupportedAudioFileException | IOException exc)
        {
View Full Code Here

   
    if (currentSound != null) {
      if (currentSound instanceof AudioInputStream) {
        try {
          Clip clip = (Clip) AudioSystem.getLine(new Info(Clip.class, ((AudioInputStream) currentSound).getFormat()));
          clip.open((AudioInputStream) currentSound);
          soundEvents.put(destination, clip);
        } catch (LineUnavailableException e1) {
          // This will happen if the underlying platform does not support sound
          // System.err.println(e1.getMessage());
          // e1.printStackTrace();
View Full Code Here

        final Clip clip;
        try {
            DataLine.Info info = new DataLine.Info(Clip.class, format);
            clip = (Clip) AudioSystem.getLine(info);
            clip.open(audioInputStream);
        } catch (LineUnavailableException e) {
            System.out.println("Sorry, sound is not available");
            return null;
        } catch (IOException e) {
            return null;
View Full Code Here

  {
    Clip result = AudioSystem.getClip();
    //add buffer for mark/reset support
    InputStream bufferedInput = new BufferedInputStream(inputstream);
   
    result.open(AudioSystem.getAudioInputStream(bufferedInput));
    return result;
  }
 
}
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.