is sound Named Target Data Line - Java javax.sound.sampled

Java examples for javax.sound.sampled:Sound

Description

is sound Named Target Data Line

Demo Code


//package com.java2s;
import javax.sound.sampled.*;

public class Main {
    private static Line.Info tdInfo = new Line.Info(TargetDataLine.class);

    public static boolean isNamedTargetDataLine(Mixer mixer, String nm)
    // is this a TargetDataLine containing nm
    {//from  w ww. j a va  2  s.co  m
        return (mixer.isLineSupported(tdInfo) && containsName(mixer, nm));
    }

    public static boolean containsName(Mixer mixer, String nm)
    /* is this a mixer with nm in its name, ignoring case */
    {
        Mixer.Info mi = mixer.getMixerInfo();
        String name = mi.getName().toLowerCase();
        return name.contains(nm.toLowerCase());
    }
}

Related Tutorials