Package javax.sound.sampled

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


//  OutputStream os =
//   new BufferedOutputStream(new FileOutputStream(args[1]));

        DataLine.Info info = new DataLine.Info(SourceDataLine.class, audioFormat);
        SourceDataLine line = (SourceDataLine) AudioSystem.getLine(info);
        line.open(audioFormat);
        line.addLineListener(new LineListener() {
            public void update(LineEvent ev) {
Debug.println(ev.getType());
            if (LineEvent.Type.STOP == ev.getType()) {
                System.exit(0);
View Full Code Here


        SourceDataLine auline = null;
        final DataLine.Info info = new DataLine.Info(SourceDataLine.class, format);

        try {
            auline = (SourceDataLine) AudioSystem.getLine(info);
            auline.open(format);
        } catch (final LineUnavailableException e) {
            o.failure(null, e, "playsound:noline", "Error opening output line.");
            return;
        } catch (final Exception e) {
            o.failure(null, e, "playsound:unknown", "General error opening output line.");
View Full Code Here

    DataLine.Info info = new DataLine.Info(SourceDataLine.class,
        audioFormat);
   
    try {
      line = (SourceDataLine) AudioSystem.getLine(info);
      line.open(audioFormat);
    } catch (LineUnavailableException e) {
      e.printStackTrace();
      System.exit(1);
    } catch (Exception e) {
      e.printStackTrace();
View Full Code Here

    DataLine.Info info = new DataLine.Info(SourceDataLine.class,
        soundFormat);
   
    try {
      line = (SourceDataLine) AudioSystem.getLine(info);
      line.open(soundFormat);
    } catch (LineUnavailableException e) {
      e.printStackTrace();
      System.exit(1);
    } catch (Exception e) {
      e.printStackTrace();
View Full Code Here

      tl.start();
      SourceDataLine sl = (SourceDataLine) AudioSystem.getLine(sinfo); // Neu:
                                        // Line
                                        // f�r
                                        // Tonausgabe
      sl.open(af); // �ffnen
      sl.start(); // starten
      int numBytesRead;
      int durchlauf = 0;
      byte[] ba = new byte[256]; // definieren und gleich einmal
                    // initialisieren.
View Full Code Here

        audioInputStream = AudioSystem.getAudioInputStream(soundFile);
        AudioFormat audioFormat = audioInputStream.getFormat();
        SourceDataLine line = null;
        DataLine.Info info = new DataLine.Info(SourceDataLine.class, audioFormat);
        line = (SourceDataLine) AudioSystem.getLine(info);
        line.open(audioFormat);
        line.start();

        int nBytesRead = 0;
        byte[] abData = new byte[EXTERNAL_BUFFER_SIZE];
        while (nBytesRead != -1)
View Full Code Here

/*     */
/*  80 */       DataLine.Info info = new DataLine.Info(SourceDataLine.class, this.audioFormat);
/*     */
/*  82 */       line = (SourceDataLine)AudioSystem.getLine(info);
/*     */
/*  88 */       line.open(this.audioFormat);
/*     */
/*  95 */       line.start();
/*     */     }
/*     */     catch (Exception e)
/*     */     {
View Full Code Here

        SourceDataLine auline = null;
        DataLine.Info info = new DataLine.Info(SourceDataLine.class, format);
        try {
            auline = (SourceDataLine) AudioSystem.getLine(info);
            auline.open(format);
        } catch (LineUnavailableException e) {
            e.printStackTrace();
            return;
        } catch (Exception e) {
            e.printStackTrace();
View Full Code Here

                    }

                    AudioFormat af = ais.getFormat();
                    DataLine.Info inf = new DataLine.Info( SourceDataLine.class, af );
                    SourceDataLine sdl = ( SourceDataLine ) AudioSystem.getLine( inf );
                    sdl.open( af );
                    sdl.start();
                    byte[] buf = new byte[ 65536 ];
                    for ( int n = 0; (n = ais.read( buf, 0, buf.length )) > 0; )
                    {
                        sdl.write( buf, 0, n );
View Full Code Here

    @Test
    public void StreamingPlayerTest() throws MalformedURLException, UnsupportedAudioFileException, IOException, LineUnavailableException, InterruptedException {

        DataLine.Info info = new DataLine.Info(SourceDataLine.class, TargetFormat);
        SourceDataLine line = (SourceDataLine) AudioSystem.getLine(info);
        line.open();

        StreamPlayer player = StreamPlayer.create(line, "Music-Thread");

        URL url = new URL("http://www.twelvepm.de/vorbis/Agogo.ogg");
        AudioFileFormat fmt = AudioSystem.getAudioFileFormat(url);
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.