Package javax.sound.sampled

Examples of javax.sound.sampled.Clip


      if (filename.toLowerCase().endsWith(".mp3")) {
        Player player = new Player(is);
        playInThread(player);
      } else {
        AudioInputStream ais = AudioSystem.getAudioInputStream(is);
        Clip clip = AudioSystem.getClip();
        clip.open(ais);
        playInThread(clip);
      }
    } catch (FileNotFoundException e) {
      logger.error("Cannot play sound '{}': {}", new String[] { filename, e.getMessage() } );
    } catch (JavaLayerException e) {
View Full Code Here


           
            DataLine.Info info = new DataLine.Info(Clip.class, ain
                    .getFormat(),
                    ((int) ain.getFrameLength() * format
                            .getFrameSize()));
            Clip clip = (Clip) AudioSystem.getLine(info);
           
            clip.open(ain);
           
            WaveRenderer.volumeSupported = clip
                    .isControlSupported(FloatControl.Type.VOLUME)
                    || clip
                            .isControlSupported(FloatControl.Type.MASTER_GAIN);
           
            clip.drain();
            clip.close();
           
            // workaround for Java 1.5
            Mixer.Info[] mixers = AudioSystem.getMixerInfo();
            for (int i = 0; i < mixers.length; i++) {
              if ("Java Sound Audio Engine".equals(mixers[i]
View Full Code Here

TOP

Related Classes of javax.sound.sampled.Clip

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.