4

I have never worked with OpenAL before, and have been looking at some example code. However, before I start testing code in my program, I want to know if there's a way to select a specific recording device for input (perhaps by way of a combo box with different microphones). I know it isn't possible in the Java Sound API, which is why I'm inquiring about AL.

Jeff Demanche
  • 624
  • 7
  • 25

1 Answers1

1

Yes.

Get the list of devices. Prompt the user to select one. Set it with alcCaptureOpenDevice.

See ALC11 API.

Something like:

String[] capDevices = ALC11.alcGetString(null, ALC11.ALC_CAPTURE_DEVICE_SPECIFIER).split("\0");
for (int i = 0; i < capDevices.length; i++) {
    System.out.println("Capture device "+ i + ": " + capDevices[i]);
}
//Selection code goes here
String chosenDevice = ...;

ALCdevice device = ALC11.alcCaptureOpenDevice(chosenDevice, freq, format, bufferSize);

(Disclaimer: Haven't compiled/tested)

RJFalconer
  • 10,890
  • 5
  • 51
  • 66