Allows automatic gain control (AGC) to be enabled/disabled for Windows Audio Session API (WASAPI). Patch by Timothy Price.

cusax-fix 4885
Lyubomir Marinov 12 years ago
parent 6a4f51f267
commit 833358c13a

@ -1420,6 +1420,7 @@ impl.media.configform.AUDIO=&Audio System:
impl.media.configform.AUDIO_IN=Audio &In: impl.media.configform.AUDIO_IN=Audio &In:
impl.media.configform.AUDIO_NOTIFY=&Notifications: impl.media.configform.AUDIO_NOTIFY=&Notifications:
impl.media.configform.AUDIO_OUT=Audio &Out: impl.media.configform.AUDIO_OUT=Audio &Out:
impl.media.configform.AUTOMATICGAINCONTROL=Automatic gain control
impl.media.configform.DENOISE=Enable noise suppression impl.media.configform.DENOISE=Enable noise suppression
impl.media.configform.DEVICES=Devices impl.media.configform.DEVICES=Devices
impl.media.configform.DOWN=&Down impl.media.configform.DOWN=&Down

@ -991,54 +991,75 @@ public void createAudioSystemControls(
container.add(notifyCombo, cnstrnts); container.add(notifyCombo, cnstrnts);
} }
if ((AudioSystem.FEATURE_ECHO_CANCELLATION & audioSystemFeatures) != 0) int[] checkBoxAudioSystemFeatures
{ = new int[]
final SIPCommCheckBox echoCancelCheckBox
= new SIPCommCheckBox(
NeomediaActivator.getResources().getI18NString(
"impl.media.configform.ECHOCANCEL"));
/*
* First set the selected one, then add the listener in order to
* avoid saving the value when using the default one and only
* showing to user without modification.
*/
echoCancelCheckBox.setSelected(audioSystem.isEchoCancel());
echoCancelCheckBox.addItemListener(
new ItemListener()
{ {
public void itemStateChanged(ItemEvent e) AudioSystem.FEATURE_ECHO_CANCELLATION,
{ AudioSystem.FEATURE_DENOISE,
audioSystem.setEchoCancel( AudioSystem.FEATURE_AGC
echoCancelCheckBox.isSelected()); };
}
});
container.add(echoCancelCheckBox, cnstrnts);
}
if ((AudioSystem.FEATURE_DENOISE & audioSystemFeatures) != 0) for (int i = 0; i < checkBoxAudioSystemFeatures.length; i++)
{ {
final SIPCommCheckBox denoiseCheckBox final int f = checkBoxAudioSystemFeatures[i];
= new SIPCommCheckBox(
NeomediaActivator.getResources().getI18NString(
"impl.media.configform.DENOISE"));
/* if ((f & audioSystemFeatures) != 0)
* First set the selected one, then add the listener in order to {
* avoid saving the value when using the default one and only String textKey;
* showing to user without modification. boolean selected;
*/
denoiseCheckBox.setSelected(audioSystem.isDenoise()); switch (f)
denoiseCheckBox.addItemListener( {
new ItemListener() case AudioSystem.FEATURE_AGC:
{ textKey = "impl.media.configform.AUTOMATICGAINCONTROL";
public void itemStateChanged(ItemEvent e) selected = audioSystem.isAutomaticGainControl();
break;
case AudioSystem.FEATURE_DENOISE:
textKey = "impl.media.configform.DENOISE";
selected = audioSystem.isDenoise();
break;
case AudioSystem.FEATURE_ECHO_CANCELLATION:
textKey = "impl.media.configform.ECHOCANCEL";
selected = audioSystem.isEchoCancel();
break;
default:
continue;
}
final SIPCommCheckBox checkBox
= new SIPCommCheckBox(
NeomediaActivator.getResources().getI18NString(
textKey));
/*
* First set the selected one, then add the listener in order to
* avoid saving the value when using the default one and only
* showing to user without modification.
*/
checkBox.setSelected(selected);
checkBox.addItemListener(
new ItemListener()
{ {
audioSystem.setDenoise( public void itemStateChanged(ItemEvent e)
denoiseCheckBox.isSelected()); {
} boolean b = checkBox.isSelected();
});
container.add(denoiseCheckBox, cnstrnts); switch (f)
{
case AudioSystem.FEATURE_AGC:
audioSystem.setAutomaticGainControl(b);
break;
case AudioSystem.FEATURE_DENOISE:
audioSystem.setDenoise(b);
break;
case AudioSystem.FEATURE_ECHO_CANCELLATION:
audioSystem.setEchoCancel(b);
break;
}
}
});
container.add(checkBox, cnstrnts);
}
} }
// Adds the play buttons for testing playback and notification devices. // Adds the play buttons for testing playback and notification devices.
@ -1583,7 +1604,8 @@ private Component createPreview(
!= mediaServiceDeviceConfigurationAudioSystem) != mediaServiceDeviceConfigurationAudioSystem)
{ {
logger.warn( logger.warn(
"JComboBox.selectedItem is not identical to MediaService.deviceConfiguration.audioSystem!"); "JComboBox.selectedItem is not identical to"
+ " MediaService.deviceConfiguration.audioSystem!");
} }
} }
} }
@ -1616,7 +1638,8 @@ private Component createPreview(
{ {
String noAvailableAudioDevice String noAvailableAudioDevice
= NeomediaActivator.getResources().getI18NString( = NeomediaActivator.getResources().getI18NString(
"impl.media.configform.NO_AVAILABLE_AUDIO_DEVICE"); "impl.media.configform"
+ ".NO_AVAILABLE_AUDIO_DEVICE");
preview = new TransparentPanel(new GridBagLayout()); preview = new TransparentPanel(new GridBagLayout());
preview.add(new JLabel(noAvailableAudioDevice)); preview.add(new JLabel(noAvailableAudioDevice));

Loading…
Cancel
Save