diff --git a/apps/OboeTester/app/src/main/java/com/mobileer/oboetester/StreamConfigurationView.java b/apps/OboeTester/app/src/main/java/com/mobileer/oboetester/StreamConfigurationView.java
index d9589ad3f..3b7edca4c 100644
--- a/apps/OboeTester/app/src/main/java/com/mobileer/oboetester/StreamConfigurationView.java
+++ b/apps/OboeTester/app/src/main/java/com/mobileer/oboetester/StreamConfigurationView.java
@@ -22,6 +22,7 @@
import android.media.audiofx.AutomaticGainControl;
import android.media.audiofx.BassBoost;
import android.media.audiofx.LoudnessEnhancer;
+import android.media.audiofx.NoiseSuppressor;
import android.util.AttributeSet;
import android.util.Log;
import android.view.LayoutInflater;
@@ -100,7 +101,11 @@ public class StreamConfigurationView extends LinearLayout {
private LinearLayout mOutputEffectsLayout;
private CheckBox mAutomaticGainControlCheckBox;
+ private CharSequence mAutomaticGainControlText;
private CheckBox mAcousticEchoCancelerCheckBox;
+ private CharSequence mAcousticEchoCancelerText;
+ private CheckBox mNoiseSuppressorCheckBox;
+ private CharSequence mNoiseSuppressorText;
private TextView mBassBoostTextView;
private SeekBar mBassBoostSeekBar;
private TextView mLoudnessEnhancerTextView;
@@ -112,8 +117,9 @@ public class StreamConfigurationView extends LinearLayout {
private BassBoost mBassBoost;
private LoudnessEnhancer mLoudnessEnhancer;
- private AcousticEchoCanceler mAcousticEchoCanceler;
private AutomaticGainControl mAutomaticGainControl;
+ private AcousticEchoCanceler mAcousticEchoCanceler;
+ private NoiseSuppressor mNoiseSuppressor;
// Create an anonymous implementation of OnClickListener
private View.OnClickListener mToggleListener = new View.OnClickListener() {
@@ -229,13 +235,18 @@ public void onClick(View view) {
mAutomaticGainControlCheckBox = (CheckBox) findViewById(R.id.checkBoxAutomaticGainControl);
mAcousticEchoCancelerCheckBox = (CheckBox) findViewById(R.id.checkBoxAcousticEchoCanceler);
+ mNoiseSuppressorCheckBox = (CheckBox) findViewById(R.id.checkBoxNoiseSuppressor);
mBassBoostTextView = (TextView) findViewById(R.id.textBassBoost);
mBassBoostSeekBar = (SeekBar) findViewById(R.id.seekBarBassBoost);
mLoudnessEnhancerTextView = (TextView) findViewById(R.id.textLoudnessEnhancer);
mLoudnessEnhancerSeekBar = (SeekBar) findViewById(R.id.seekBarLoudnessEnhancer);
mAutomaticGainControlCheckBox.setEnabled(AutomaticGainControl.isAvailable());
+ mAutomaticGainControlText = mAutomaticGainControlCheckBox.getText();
mAcousticEchoCancelerCheckBox.setEnabled(AcousticEchoCanceler.isAvailable());
+ mAcousticEchoCancelerText = mAcousticEchoCancelerCheckBox.getText();
+ mNoiseSuppressorCheckBox.setEnabled(NoiseSuppressor.isAvailable());
+ mNoiseSuppressorText = mNoiseSuppressorCheckBox.getText();
mBassBoostSeekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
@@ -276,6 +287,11 @@ public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
onAcousticEchoCancelerCheckBoxChanged(isChecked);
}
});
+ mNoiseSuppressorCheckBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
+ public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
+ onNoiseSuppressorCheckBoxChanged(isChecked);
+ }
+ });
mActualSampleRateView = (TextView) findViewById(R.id.actualSampleRate);
mSampleRateSpinner = (Spinner) findViewById(R.id.spinnerSampleRate);
@@ -566,20 +582,40 @@ public void setupEffects(int sessionId) {
if (mAcousticEchoCancelerCheckBox.isEnabled()) {
mAcousticEchoCanceler = AcousticEchoCanceler.create(sessionId);
if (mAcousticEchoCanceler != null) {
+ boolean wasOn = mAcousticEchoCanceler.getEnabled();
+ String text = mAcousticEchoCancelerText + "(" + (wasOn ? "Y" : "N") + ")";
+ mAcousticEchoCancelerCheckBox.setText(text);
mAcousticEchoCanceler.setEnabled(mAcousticEchoCancelerCheckBox.isChecked());
} else {
Log.e(TAG, String.format(Locale.getDefault(), "Could not create AcousticEchoCanceler"));
}
}
+
// If AGC is not available, the checkbox will be disabled in initializeViews().
if (mAutomaticGainControlCheckBox.isEnabled()) {
mAutomaticGainControl = AutomaticGainControl.create(sessionId);
if (mAutomaticGainControl != null) {
+ boolean wasOn = mAutomaticGainControl.getEnabled();
+ String text = mAutomaticGainControlText + "(" + (wasOn ? "Y" : "N") + ")";
+ mAutomaticGainControlCheckBox.setText(text);
mAutomaticGainControl.setEnabled(mAutomaticGainControlCheckBox.isChecked());
} else {
Log.e(TAG, String.format(Locale.getDefault(), "Could not create AutomaticGainControl"));
}
}
+
+ // If Noise Suppressor is not available, the checkbox will be disabled in initializeViews().
+ if (mNoiseSuppressorCheckBox.isEnabled()) {
+ mNoiseSuppressor = NoiseSuppressor.create(sessionId);
+ if (mNoiseSuppressor != null) {
+ boolean wasOn = mNoiseSuppressor.getEnabled();
+ String text = mNoiseSuppressorText + "(" + (wasOn ? "Y" : "N") + ")";
+ mNoiseSuppressorCheckBox.setText(text);
+ mNoiseSuppressor.setEnabled(mNoiseSuppressorCheckBox.isChecked());
+ } else {
+ Log.e(TAG, String.format(Locale.getDefault(), "Could not create NoiseSuppressor"));
+ }
+ }
}
}
@@ -608,4 +644,10 @@ private void onAcousticEchoCancelerCheckBoxChanged(boolean isChecked) {
mAcousticEchoCanceler.setEnabled(isChecked);
}
}
+
+ private void onNoiseSuppressorCheckBoxChanged(boolean isChecked) {
+ if (mNoiseSuppressorCheckBox.isEnabled() && mNoiseSuppressor != null) {
+ mNoiseSuppressor.setEnabled(isChecked);
+ }
+ }
}
diff --git a/apps/OboeTester/app/src/main/res/layout/stream_config.xml b/apps/OboeTester/app/src/main/res/layout/stream_config.xml
index e24d53d8f..f06a71e9c 100644
--- a/apps/OboeTester/app/src/main/res/layout/stream_config.xml
+++ b/apps/OboeTester/app/src/main/res/layout/stream_config.xml
@@ -330,14 +330,21 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="8sp"
- android:text="Automatic Gain Control" />
+ android:text="AGC" />
+ android:text="AEC" />
+
+