Package javax.sound.sampled

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


            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);
        } catch (LineUnavailableException ex) {
            resourceLogger.warning("cannot play audio resource, due to " + ex.getLocalizedMessage());
        } catch (IOException ex) {
View Full Code Here


    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)
            event.getLine().close();
View Full Code Here

                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

                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

      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();
//           }
    } catch (Exception e) {
View Full Code Here

                        {
                            volume=flc.getMaximum();
                        }
                        flc.setValue(volume);
                    }
                    clip.start();
                }
            }
            //cleanup
            if(!singleLine)
            {
View Full Code Here

         
                flc.setValue(volume);
            }
         
            //clip.setFramePosition(0);
            clip.start()
            try
            {//wait until clip finishes and then close it so it works on OS/2
                sleep(clip.getMicrosecondLength()/1000);
                clip.stop();
                clip.close();
View Full Code Here

                            throw ioException;
                        }
                    }

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

                // Will the Clip give to stop notifications?
                if (clip.isActive()) {
                    clip.stop();
                }
                clip.setFramePosition(0);
                clip.start();
            }
        }
        return true;
    }
View Full Code Here

    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

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.