Java sound recording and mixer settings

I'm using the javax.sound.sampled package in a radio data mode decoding program. To use the program the user feeds audio from their radio receiver into their PC's line input. The user is also required to use their mixer program to select the line in as the recording input. The trouble is some users don't know how to do this and also sometimes other programs alter the recording input setting. So my question is how can my program detect if the line in is set as the recording input ? Also is it possible for my program to change the recording input setting if it detects it is incorrect ?

Thanks for your time.



To answer your first question, you can check if the Line.Info object for your recording input matches Port.Info.LINE_IN like this:

public static boolean isLineIn(Line.Info lineInfo) {
    Line.Info[] detected = AudioSystem.getSourceLineInfo(Port.Info.LINE_IN);
    for (Line.Info lineIn : detected) {
        if (lineIn.matches(lineInfo)) {
            return true;
    return false;

However, this doesn't work with operating systems or soundcard driver APIs that don't provide the type of each available mixer channel. So when I test it on Windows it works, but not on Linux or Mac. For more information and recommendations, see this FAQ.

Regarding your second question, you can try changing the recording input settings through a Control class. In particular, see FloatControl.Type for some common settings. Keep in mind that the availability of these controls depends on the operating system and soundcard drivers, just like line-in detection.

Need Your Help

itoa to std::to_string

c++ tostring itoa

This may be a vaugue question but im getting this error

How can I make UILable to respond to IBAction?

iphone uitableview uilabel customization nib

I have customized UITableViewCell (Static Content Loaded from nib). This cell contains one UILable and I would like to change its value when user taps on it. (PickerView will be displayed and from ...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.