複数のチャネル (8 チャネル) を備えたサウンド カードに、Java プログラムでオーディオを出力します。このために、サウンドカードの異なるチャンネルで異なるサウンドを送信したい(異なるスピーカーで再生できるようにする)送信されるオーディオは異なるファイル(おそらくmp3)です。
Javaでこれを行う方法について何か提案はありますか? これまでに試したのは、javax.sound.sampled ライブラリです。スピーカーから音を出すことはできましたが、使用するチャンネルを決定することはできませんでした。Port.Info を使用してみましたが、その構文を処理できないようです。
これまでのコードとこの作業は次のとおりです。
// open up an audio stream
private static void init() {
try {
// 44,100 samples per second, 16-bit audio, mono, signed PCM, little Endian
AudioFormat format = new AudioFormat((float) SAMPLE_RATE, BITS_PER_SAMPLE, 1, true, false);
DataLine.Info info = new DataLine.Info(SourceDataLine.class, format);
//Port.Info port = new Port.Info((Port.class), Port.Info.SPEAKER, false);
//Port.Info pi = new Port.Info((Port.class), "HEADPHONES", false);
line = (SourceDataLine) AudioSystem.getLine(info);
//line = (SourceDataLine) AudioSystem.getLine(port);
line.open(format, SAMPLE_BUFFER_SIZE * BYTES_PER_SAMPLE);
// the internal buffer is a fraction of the actual buffer size, this choice is arbitrary
// it gets divided because we can't expect the buffered data to line up exactly with when
// the sound card decides to push out its samples.
buffer = new byte[SAMPLE_BUFFER_SIZE * BYTES_PER_SAMPLE/3];
} catch (Exception e) {
System.out.println(e.getMessage());
System.exit(1);
}
// no sound gets made before this call
line.start();
}