print Sound Source Line Info - Java javax.sound.sampled

Java examples for javax.sound.sampled:Sound

Description

print Sound Source Line Info

Demo Code


//package com.java2s;

import javax.sound.sampled.Control;

import javax.sound.sampled.SourceDataLine;

public class Main {
    public static void printSourceLineInfo(SourceDataLine s) {
        System.out.println("Buffer size: " + s.getBufferSize());
        System.out.println("Level: " + s.getLevel());
        System.out.println("Format: " + s.getFormat());
        System.out.println("Frame Position: " + s.getFramePosition());
        System.out.println("Long Frame Position: "
                + s.getLongFramePosition());
        System.out.println("Microsecond Position: "
                + s.getMicrosecondPosition());
        printControlInfo(s.getControls(), 1);
    }/*from   w  w w . j a va  2  s.com*/

    private static void printControlInfo(Control[] controls, int numTabs) {
        for (Control c : controls) {
            System.out.println(indent(numTabs) + c.getType().toString());
        }
    }

    public static String indent(int numTabs) {
        String indent = "";
        while (numTabs-- > 0) {
            indent += "\t";
        }
        return indent;
    }
}

Related Tutorials