Package javax.sound.sampled

Examples of javax.sound.sampled.LineUnavailableException


  public static void startOutput(AudioFormat playFormat) throws LineUnavailableException {
    DataLine.Info info= new DataLine.Info(SourceDataLine.class, playFormat);

    if (!AudioSystem.isLineSupported(info)) {
      throw new LineUnavailableException("sorry, the sound format cannot be played");
    }
    line = (SourceDataLine)AudioSystem.getLine(info);
    line.open(playFormat);
    line.start();
  }
View Full Code Here


                resourceLogger.warning("Matching line not available: " + ex.getLocalizedMessage());
            } catch (IllegalArgumentException ex) {
                resourceLogger.warning("Mixer does not support this format. " + ex.getLocalizedMessage());
            }
        }
        throw new LineUnavailableException("Failed to get any line for info: " + info);
    }
View Full Code Here

  public void open(AudioFormat format, int buffersize) throws LineUnavailableException {
    if(open) return;
    if(ASIOMixerProvider.isFullCheck())
      if(!info.isFormatSupported(format))
        throw new LineUnavailableException("Audio Format not supported.");
   
    this.format = format;
    channels = format.getChannels();
    desiredBufferSize = buffersize;
    open();
View Full Code Here

  public void open(AudioFormat format) throws LineUnavailableException {
    if(open) return;
    if(ASIOMixerProvider.isFullCheck())
      if(!info.isFormatSupported(format))
        throw new LineUnavailableException("Audio Format not supported.");
    this.format = format;
    channels = format.getChannels();
    open();
  }
View Full Code Here

   *
   * @see javax.sound.sampled.Mixer#getLine(javax.sound.sampled.Line.Info)
   */
  public ASIODataLine getLine(Line.Info info) throws LineUnavailableException {
    if (!isLineSupported(info))
      throw new LineUnavailableException("Line not supported.");

    boolean isInput;
    if (SourceDataLine.class.isAssignableFrom(info.getLineClass()))
      isInput = false;
    else if (TargetDataLine.class.isAssignableFrom(info.getLineClass()))
      isInput = true;
    else
      throw new LineUnavailableException("Line not supported.");

    if (allLines == null)
      createLines(isInput);

    if (info instanceof ASIOLineInfo) {
      ASIOLineInfo asioInfo = (ASIOLineInfo) info;
      if (allLines.containsKey(asioInfo.toString()))
        return allLines.get(asioInfo.toString());
    }

    /*
     * boolean isInput;
     * if(SourceDataLine.class.isAssignableFrom(info.getLineClass()))
     * isInput = false; else
     * if(TargetDataLine.class.isAssignableFrom(info.getLineClass()))
     * isInput = true; else throw new LineUnavailableException("Line not
     * supported.");
     */

    for (Iterator<String> iter = allLines.keySet().iterator(); iter
        .hasNext();) {
      ASIODataLine line = allLines.get(iter.next());
      ASIOLineInfo lineInfo = line.getLineInfo();
      if (lineInfo.getChannelInfo().isInput() == isInput) {
        AudioFormat[] formats = ((DataLine.Info) info).getFormats();
        for (int i = 0; i < formats.length; i++) {
          if (lineInfo.isFormatSupported(formats[i]))
            return line;
        }
      }
    }
    throw new LineUnavailableException("Line not supported.");
  }
View Full Code Here

   */
  public void open() throws LineUnavailableException {
    try {
      initSeq = ASIOInit();
    } catch (ASIOError e) {
      throw new LineUnavailableException(e.getMessage());
    }
  }
View Full Code Here

      throws LineUnavailableException {
    if (line.isOpen())
      return;
    //TODO:Pr・ung ob das funktioniert
    if (status >= PREPARED)
      throw new LineUnavailableException(
          "ASIO is already activated with another Line.");
    ASIODataLine[] lines;

    if (linesToSync.contains(line)) {
      lines = new ASIODataLine[linesToSync.size()];
      int i = 0;
      if (ASIOMixerProvider.isFullCheck()) {
        for (Iterator<ASIODataLine> iter = linesToSync.iterator(); iter
            .hasNext(); i++) {
          lines[i] = (ASIODataLine) iter.next();
          if (!((DataLine.Info) lines[i].getLineInfo())
              .isFormatSupported(lines[i].getFormat()))
            throw new LineUnavailableException("Format "
                + lines[i].getFormat() + " not supported.");
        }
      } else
        for (Iterator<ASIODataLine> iter = linesToSync.iterator(); iter
            .hasNext(); i++) {
          lines[i] = iter.next();
        }
    } else {
      if (ASIOMixerProvider.isFullCheck()) {
        DataLine.Info info = (DataLine.Info) line.getLineInfo();
        if (!info.isFormatSupported(line.getFormat()))
          throw new LineUnavailableException("Format "
              + line.getFormat() + " not supported.");
      }
      lines = new ASIODataLine[] { line };
    }
View Full Code Here

  private int frameSize;
 
  public LineInputReader(int frameSize) throws LineUnavailableException {
    DataLine.Info info = new DataLine.Info(TargetDataLine.class, format);
    if (!AudioSystem.isLineSupported(info)) {
      throw new LineUnavailableException("No input device");
    } else {
      if (line == null) {
        line = (TargetDataLine) AudioSystem.getLine(info);     
        line.open(format);
      }
View Full Code Here

                pusher.start();

            } catch (LineUnavailableException e) {
                if (isOpen())
                    close();
                throw new LineUnavailableException(e.toString());
            }

        }
    }
View Full Code Here

    public AudioInputStream openStream(AudioFormat targetFormat)
            throws LineUnavailableException {

        if (isOpen())
            throw new LineUnavailableException("Mixer is already open");

        synchronized (control_mutex) {

            open = true;
View Full Code Here

TOP

Related Classes of javax.sound.sampled.LineUnavailableException

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.