[xiph-commits] r10795 - in trunk/speex: include/speex libspeex
jm at svn.xiph.org
jm at svn.xiph.org
Fri Feb 10 19:22:45 PST 2006
Author: jm
Date: 2006-02-10 19:22:41 -0800 (Fri, 10 Feb 2006)
New Revision: 10795
Modified:
trunk/speex/include/speex/speex_echo.h
trunk/speex/libspeex/mdf.c
Log:
added a _ctl() call at least to set the sampling rate
Modified: trunk/speex/include/speex/speex_echo.h
===================================================================
--- trunk/speex/include/speex/speex_echo.h 2006-02-10 20:12:24 UTC (rev 10794)
+++ trunk/speex/include/speex/speex_echo.h 2006-02-11 03:22:41 UTC (rev 10795)
@@ -40,6 +40,15 @@
extern "C" {
#endif
+/** Obtain frame size used by the AEC */
+#define SPEEX_ECHO_GET_FRAME_SIZE 3
+
+/** Set sampling rate */
+#define SPEEX_ECHO_SET_SAMPLING_RATE 24
+/** Get sampling rate */
+#define SPEEX_ECHO_GET_SAMPLING_RATE 25
+
+
/*struct drft_lookup;*/
struct SpeexEchoState_;
@@ -57,6 +66,15 @@
/** Reset the echo canceller state */
void speex_echo_state_reset(SpeexEchoState *st);
+/** Used like the ioctl function to control the echo canceller parameters
+ *
+ * @param state Encoder state
+ * @param request ioctl-type request (one of the SPEEX_ECHO_* macros)
+ * @param ptr Data exchanged to-from function
+ * @return 0 if no error, -1 if request in unknown
+ */
+int speex_echo_ctl(SpeexEchoState *st, int request, void *ptr);
+
#ifdef __cplusplus
}
#endif
Modified: trunk/speex/libspeex/mdf.c
===================================================================
--- trunk/speex/libspeex/mdf.c 2006-02-10 20:12:24 UTC (rev 10794)
+++ trunk/speex/libspeex/mdf.c 2006-02-11 03:22:41 UTC (rev 10795)
@@ -704,3 +704,38 @@
}
}
+
+int speex_echo_ctl(SpeexEchoState *st, int request, void *ptr)
+{
+ switch(request)
+ {
+
+ case SPEEX_ECHO_GET_FRAME_SIZE:
+ (*(int*)ptr) = st->frame_size;
+ break;
+ case SPEEX_ECHO_SET_SAMPLING_RATE:
+ st->sampling_rate = (*(int*)ptr);
+ st->spec_average = DIV32_16(SHL32(st->frame_size, 15), st->sampling_rate);
+#ifdef FIXED_POINT
+ st->beta0 = DIV32_16(SHL32(st->frame_size, 16), st->sampling_rate);
+ st->beta_max = DIV32_16(SHL32(st->frame_size, 14), st->sampling_rate);
+#else
+ st->beta0 = (2.0f*st->frame_size)/st->sampling_rate;
+ st->beta_max = (.5f*st->frame_size)/st->sampling_rate;
+#endif
+ if (st->sampling_rate<12000)
+ st->notch_radius = QCONST16(.9, 15);
+ else if (st->sampling_rate<24000)
+ st->notch_radius = QCONST16(.982, 15);
+ else
+ st->notch_radius = QCONST16(.992, 15);
+ break;
+ case SPEEX_ECHO_GET_SAMPLING_RATE:
+ (*(int*)ptr) = st->sampling_rate;
+ break;
+ default:
+ speex_warning_int("Unknown speex_echo_ctl request: ", request);
+ return -1;
+ }
+ return 0;
+}
More information about the commits
mailing list