Dr.Knowitall
Dr.Knowitall

Reputation: 10468

Understanding Java Sound API: Finding MIC on Mixer

I'm trying to find a particular mixer that supports mic headphone jack. Please let me know what I'm doing wrong in my code. I don't fully understand what I need to do.

    Mixer.Info[] mixerInfo = AudioSystem.getMixerInfo();
    Mixer myMixer;

    for(int i = 0; i < mixerInfo.length; i++){

        //System.out.println("Name: " + mixerInfo[i].getName());
        myMixer = AudioSystem.getMixer(mixerInfo[i]);

    if(myMixer.isLineSupported(Port.Info.MICROPHONE)){
        System.out.println("Mic is supported!");
    }

    }

This code makes sense to me, however it doesn't ever return "Mic is supported". I do have a headphone mic jack and everything ought to work. Just to let you know I'm using fedora, I know that Java has worked differently in the past given the platform.

Upvotes: 1

Views: 1264

Answers (1)

Elior
Elior

Reputation: 3266

I created a new project to debug your code, at the beginning it doesn't print "Mic is supported" but when I enabled my microphone in the Recording Device at the windows audio panel (Because I have Windows...) it showed me "Mic is Supported" so i'll suggest you to check if your microphone is on enable state

i think this link would be useful to you, to check if your microphone is enabled or something like that..

Upvotes: 1

Related Questions