diff --git a/src/native/portaudio/AudioQualityImprovement.c b/src/native/portaudio/AudioQualityImprovement.c
index 68df67e90..95e241066 100644
--- a/src/native/portaudio/AudioQualityImprovement.c
+++ b/src/native/portaudio/AudioQualityImprovement.c
@@ -29,6 +29,16 @@ static void AudioQualityImprovement_setFrameSize
(AudioQualityImprovement *aqi, jint frameSize);
static void AudioQualityImprovement_setOutputLatency
(AudioQualityImprovement *aqi, jlong outputLatency);
+
+/**
+ * Updates the indicator of the specified AudioQualityImprovement which
+ * determines whether AudioQualityImprovement#play delays the access to
+ * it from AudioQualityImprovement#echo.
+ *
+ * @param aqi the AudioQualityImprovement of which to update the
+ * indicator which determines whether AudioQualityImprovement#play
+ * delays the access to it from AudioQualityImprovement#echo
+ */
static void AudioQualityImprovement_updatePlayDelay
(AudioQualityImprovement *aqi);
static void AudioQualityImprovement_updatePlayIsDelaying
@@ -432,6 +442,16 @@ AudioQualityImprovement_retain(AudioQualityImprovement *aqi)
}
}
+/**
+ * Sets the indicator which determines whether noise suppression is to be
+ * performed by the specified AudioQualityImprovement (for captured
+ * audio).
+ *
+ * @param aqi the AudioQualityImprovement on which to set the indicator
+ * which determines whether it is to perform noise suppression (for captured audio)
+ * @param denoise JNI_TRUE if the specified aqi is to perform
+ * noise suppression (for captured audio); otherwise, JNI_FALSE
+ */
void
AudioQualityImprovement_setDenoise
(AudioQualityImprovement *aqi, jboolean denoise)
@@ -447,6 +467,18 @@ AudioQualityImprovement_setDenoise
}
}
+/**
+ * Sets the filter length in milliseconds of the echo cancellation
+ * implementation of the specified AudioQualityImprovement. The
+ * recommended filter length is approximately the third of the room
+ * reverberation time. For example, in a small room, reverberation time is in
+ * the order of 300 ms, so a filter length of 100 ms is a good choice (800
+ * samples at 8000 Hz sampling rate).
+ *
+ * @param aqi the AudioQualityImprovement to set the filter length of
+ * @param echoFilterLengthInMillis the filter length in milliseconds of the echo
+ * cancellation of aqi
+ */
void
AudioQualityImprovement_setEchoFilterLengthInMillis
(AudioQualityImprovement *aqi, jlong echoFilterLengthInMillis)
@@ -532,6 +564,15 @@ AudioQualityImprovement_updatePlayDelay(AudioQualityImprovement *aqi)
}
}
+/**
+ * Updates the indicator of the specified AudioQualityImprovement which
+ * determines whether AudioQualityImprovement#play delays the access to
+ * it from AudioQualityImprovement#echo.
+ *
+ * @param aqi the AudioQualityImprovement of which to update the
+ * indicator which determines whether AudioQualityImprovement#play
+ * delays the access to it from AudioQualityImprovement#echo
+ */
static void
AudioQualityImprovement_updatePlayIsDelaying(AudioQualityImprovement *aqi)
{
@@ -633,11 +674,14 @@ AudioQualityImprovement_updatePreprocess(AudioQualityImprovement *aqi)
aqi->sampleRateOfPreprocess = aqi->sampleRate;
if (aqi->preprocess)
{
- int vad = 1;
+ int on = 1;
speex_preprocess_ctl(
aqi->preprocess,
- SPEEX_PREPROCESS_SET_VAD, &vad);
+ SPEEX_PREPROCESS_SET_DEREVERB, &on);
+ speex_preprocess_ctl(
+ aqi->preprocess,
+ SPEEX_PREPROCESS_SET_VAD, &on);
}
}
if (aqi->preprocess)
diff --git a/src/native/portaudio/AudioQualityImprovement.h b/src/native/portaudio/AudioQualityImprovement.h
index 4254b24fd..05a3014e6 100644
--- a/src/native/portaudio/AudioQualityImprovement.h
+++ b/src/native/portaudio/AudioQualityImprovement.h
@@ -112,7 +112,7 @@ typedef struct _AudioQualityImprovement
spx_uint32_t playDelay;
/**
- * The indicator which determines whether play is currently delaying the
+ * The indicator which determines whether #play is currently delaying the
* access to it from #echo.
*/
jboolean playIsDelaying;
@@ -131,7 +131,16 @@ typedef struct _AudioQualityImprovement
typedef enum
{
+ /**
+ * The constant which indicates that the associated samples have originated
+ * from an input stream i.e. capture.
+ */
AUDIO_QUALITY_IMPROVEMENT_SAMPLE_ORIGIN_INPUT,
+
+ /**
+ * The constant which indicates that the associated samples have originated
+ * from an output stream i.e. playback.
+ */
AUDIO_QUALITY_IMPROVEMENT_SAMPLE_ORIGIN_OUTPUT
} AudioQualityImprovementSampleOrigin;
@@ -144,8 +153,32 @@ void AudioQualityImprovement_process
jlong latency,
void *buffer, unsigned long length);
void AudioQualityImprovement_release(AudioQualityImprovement *aqi);
+
+/**
+ * Sets the indicator which determines whether noise suppression is to be
+ * performed by the specified AudioQualityImprovement (for captured
+ * audio).
+ *
+ * @param aqi the AudioQualityImprovement on which to set the indicator
+ * which determines whether it is to perform noise suppression (for captured audio)
+ * @param denoise JNI_TRUE if the specified aqi is to perform
+ * noise suppression (for captured audio); otherwise, JNI_FALSE
+ */
void AudioQualityImprovement_setDenoise
(AudioQualityImprovement *aqi, jboolean denoise);
+
+/**
+ * Sets the filter length in milliseconds of the echo cancellation
+ * implementation of the specified AudioQualityImprovement. The
+ * recommended filter length is approximately the third of the room
+ * reverberation time. For example, in a small room, reverberation time is in
+ * the order of 300 ms, so a filter length of 100 ms is a good choice (800
+ * samples at 8000 Hz sampling rate).
+ *
+ * @param aqi the AudioQualityImprovement to set the filter length of
+ * @param echoFilterLengthInMillis the filter length in milliseconds of the echo
+ * cancellation of aqi
+ */
void AudioQualityImprovement_setEchoFilterLengthInMillis
(AudioQualityImprovement *aqi, jlong echoFilterLengthInMillis);
void AudioQualityImprovement_setSampleRate
diff --git a/src/native/portaudio/net_java_sip_communicator_impl_neomedia_portaudio_PortAudio.c b/src/native/portaudio/net_java_sip_communicator_impl_neomedia_portaudio_PortAudio.c
index 8a1998a29..c2823b183 100644
--- a/src/native/portaudio/net_java_sip_communicator_impl_neomedia_portaudio_PortAudio.c
+++ b/src/native/portaudio/net_java_sip_communicator_impl_neomedia_portaudio_PortAudio.c
@@ -19,8 +19,12 @@ typedef struct
int channels;
JNIEnv *env;
long inputFrameSize;
+
+ /** The input latency of #stream. */
jlong inputLatency;
long outputFrameSize;
+
+ /** The output latency of #stream. */
jlong outputLatency;
double sampleRate;
int sampleSizeInBits;