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_NOTIFY=&Notifications:
impl.media.configform.AUDIO_OUT=Audio &Out:
impl.media.configform.AUTOMATICGAINCONTROL=Automatic gain control
impl.media.configform.DENOISE=Enable noise suppression
impl.media.configform.DEVICES=Devices
impl.media.configform.DOWN=&Down

@ -991,54 +991,75 @@ public void createAudioSystemControls(
container.add(notifyCombo, cnstrnts);
}
if ((AudioSystem.FEATURE_ECHO_CANCELLATION & audioSystemFeatures) != 0)
{
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()
int[] checkBoxAudioSystemFeatures
= new int[]
{
public void itemStateChanged(ItemEvent e)
{
audioSystem.setEchoCancel(
echoCancelCheckBox.isSelected());
}
});
container.add(echoCancelCheckBox, cnstrnts);
}
AudioSystem.FEATURE_ECHO_CANCELLATION,
AudioSystem.FEATURE_DENOISE,
AudioSystem.FEATURE_AGC
};
if ((AudioSystem.FEATURE_DENOISE & audioSystemFeatures) != 0)
for (int i = 0; i < checkBoxAudioSystemFeatures.length; i++)
{
final SIPCommCheckBox denoiseCheckBox
= new SIPCommCheckBox(
NeomediaActivator.getResources().getI18NString(
"impl.media.configform.DENOISE"));
final int f = checkBoxAudioSystemFeatures[i];
/*
* 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.
*/
denoiseCheckBox.setSelected(audioSystem.isDenoise());
denoiseCheckBox.addItemListener(
new ItemListener()
{
public void itemStateChanged(ItemEvent e)
if ((f & audioSystemFeatures) != 0)
{
String textKey;
boolean selected;
switch (f)
{
case AudioSystem.FEATURE_AGC:
textKey = "impl.media.configform.AUTOMATICGAINCONTROL";
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(
denoiseCheckBox.isSelected());
}
});
container.add(denoiseCheckBox, cnstrnts);
public void itemStateChanged(ItemEvent e)
{
boolean b = checkBox.isSelected();
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.
@ -1583,7 +1604,8 @@ private Component createPreview(
!= mediaServiceDeviceConfigurationAudioSystem)
{
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
= NeomediaActivator.getResources().getI18NString(
"impl.media.configform.NO_AVAILABLE_AUDIO_DEVICE");
"impl.media.configform"
+ ".NO_AVAILABLE_AUDIO_DEVICE");
preview = new TransparentPanel(new GridBagLayout());
preview.add(new JLabel(noAvailableAudioDevice));

Loading…
Cancel
Save