Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Using a Mixer with two SourceDataLines and one TargetDataLine

843802Jul 7 2009 — edited Jul 7 2009
Hi!

Im trying to obtain a Mixer that can take two inputs from SourceDataLine objects and convert them to a single output (as far as I've understood this is what all mixers do) in a TargetDataLine object. However I cant manage to find a Mixer in my system that is capable of doing this. I've created the following method, which supposedly prints out all the mixers in the system and their compatible lines:
public void printInfoMixers(){
        Mixer.Info[] infoMixers = AudioSystem.getMixerInfo();
        if(infoMixers!=null && infoMixers.length>0){
            for (int i = 0; i < infoMixers.length; i++) {
                Mixer.Info info = infoMixers;
Mixer objMixer = AudioSystem.getMixer(info);
try {
objMixer.open();
Line.Info[] lineasCompatibles = objMixer.getSourceLineInfo();
Line.Info[] targetsCompatibles = objMixer.getTargetLineInfo();
Line[] lineas = objMixer.getTargetLines();
logger.debug("Mixer: " + info.getName());
logger.debug("===================================================================================================");
for (int j = 0; j < lineasCompatibles.length; j++) {
logger.debug("Source " + j + " - " + lineasCompatibles[j]);
}
for (int j = 0; j < targetsCompatibles.length; j++) {
logger.debug("Target " + j + " - " + targetsCompatibles[j]);
}
for (int j = 0; j < lineas.length; j++) {
logger.debug("Line " + j + " - " + lineas[j].getLineInfo());
}
logger.debug("===================================================================================================");
} catch (LineUnavailableException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

}
}
}
This is what is printed out on screen:

[07/07/2009 - 09:34:59][DEBUG][DataSourceMixer] - Mixer: Controlador primario de sonido
[07/07/2009 - 09:34:59][DEBUG][DataSourceMixer] - ===================================================================================================
[07/07/2009 - 09:34:59][DEBUG][DataSourceMixer] - Source 0 - interface SourceDataLine supporting 8 audio formats, and buffers of at least 32 bytes
[07/07/2009 - 09:34:59][DEBUG][DataSourceMixer] - Source 1 - interface Clip supporting 8 audio formats, and buffers of at least 32 bytes
[07/07/2009 - 09:34:59][DEBUG][DataSourceMixer] - ===================================================================================================
[07/07/2009 - 09:34:59][DEBUG][DataSourceMixer] - Mixer: SoundMAX HD Audio
[07/07/2009 - 09:34:59][DEBUG][DataSourceMixer] - ===================================================================================================
[07/07/2009 - 09:34:59][DEBUG][DataSourceMixer] - Source 0 - interface SourceDataLine supporting 8 audio formats, and buffers of at least 32 bytes
[07/07/2009 - 09:34:59][DEBUG][DataSourceMixer] - Source 1 - interface Clip supporting 8 audio formats, and buffers of at least 32 bytes
[07/07/2009 - 09:34:59][DEBUG][DataSourceMixer] - ===================================================================================================
[07/07/2009 - 09:34:59][DEBUG][DataSourceMixer] - Mixer: Controlador primario de captura de sonido
[07/07/2009 - 09:34:59][DEBUG][DataSourceMixer] - ===================================================================================================
[07/07/2009 - 09:34:59][DEBUG][DataSourceMixer] - Target 0 - interface TargetDataLine supporting 8 audio formats, and buffers of at least 32 bytes
[07/07/2009 - 09:34:59][DEBUG][DataSourceMixer] - ===================================================================================================
[07/07/2009 - 09:34:59][DEBUG][DataSourceMixer] - Mixer: SoundMAX HD Audio
[07/07/2009 - 09:34:59][DEBUG][DataSourceMixer] - ===================================================================================================
[07/07/2009 - 09:34:59][DEBUG][DataSourceMixer] - Target 0 - interface TargetDataLine supporting 8 audio formats, and buffers of at least 32 bytes
[07/07/2009 - 09:34:59][DEBUG][DataSourceMixer] - ===================================================================================================
[07/07/2009 - 09:34:59][DEBUG][DataSourceMixer] - Mixer: Java Sound Audio Engine
[07/07/2009 - 09:34:59][DEBUG][DataSourceMixer] - ===================================================================================================
[07/07/2009 - 09:34:59][DEBUG][DataSourceMixer] - Source 0 - interface SourceDataLine supporting 8 audio formats
[07/07/2009 - 09:34:59][DEBUG][DataSourceMixer] - Source 1 - interface Clip supporting 8 audio formats, and buffers of 0 to 4194304 bytes
[07/07/2009 - 09:34:59][DEBUG][DataSourceMixer] - ===================================================================================================
[07/07/2009 - 09:34:59][DEBUG][DataSourceMixer] - Mixer: Port SoundMAX HD Audio
[07/07/2009 - 09:34:59][DEBUG][DataSourceMixer] - ===================================================================================================
[07/07/2009 - 09:34:59][DEBUG][DataSourceMixer] - Source 0 - LINE_IN source port
[07/07/2009 - 09:34:59][DEBUG][DataSourceMixer] - Source 1 - MICROPHONE source port
[07/07/2009 - 09:34:59][DEBUG][DataSourceMixer] - Source 2 - Mezcla est&eacute;reo source port
[07/07/2009 - 09:34:59][DEBUG][DataSourceMixer] - Target 0 - SPEAKER target port
[07/07/2009 - 09:34:59][DEBUG][DataSourceMixer] - ===================================================================================================

As you can see there's no Mixer that will accept a SourceDataLine aswell as a TargetDataLine.......any ideas about how I can work around this problem?

Thanks in advance!                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 4 2009
Added on Jul 7 2009
1 comment
225 views