summaryrefslogtreecommitdiff
path: root/gr-vocoder/lib/codec2/codec2.h
diff options
context:
space:
mode:
Diffstat (limited to 'gr-vocoder/lib/codec2/codec2.h')
-rw-r--r--gr-vocoder/lib/codec2/codec2.h54
1 files changed, 43 insertions, 11 deletions
diff --git a/gr-vocoder/lib/codec2/codec2.h b/gr-vocoder/lib/codec2/codec2.h
index f812a05983..2f0c2b1246 100644
--- a/gr-vocoder/lib/codec2/codec2.h
+++ b/gr-vocoder/lib/codec2/codec2.h
@@ -2,10 +2,10 @@
FILE........: codec2.h
AUTHOR......: David Rowe
- DATE CREATED: 21/8/2010
+ DATE CREATED: 21 August 2010
- Codec2 fully quantised encoder and decoder functions. If you want use
- codec2, these are the functions you need to call.
+ Codec 2 fully quantised encoder and decoder functions. If you want use
+ Codec 2, these are the functions you need to call.
\*---------------------------------------------------------------------------*/
@@ -26,17 +26,49 @@
along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
#ifndef __CODEC2__
#define __CODEC2__
-#define CODEC2_SAMPLES_PER_FRAME 160
-#define CODEC2_BITS_PER_FRAME 50
-#define CODEC2_BYTES_PER_FRAME ((CODEC2_BITS_PER_FRAME + 7) / 8) // == 8 bytes when packing the 50 bits
+/* set up the calling convention for DLL function import/export for
+ WIN32 cross compiling */
+
+#ifdef __CODEC2_WIN32__
+#ifdef __CODEC2_BUILDING_DLL__
+#define CODEC2_WIN32SUPPORT __declspec(dllexport) __stdcall
+#else
+#define CODEC2_WIN32SUPPORT __declspec(dllimport) __stdcall
+#endif
+#else
+#define CODEC2_WIN32SUPPORT
+#endif
+
+#define CODEC2_MODE_3200 0
+#define CODEC2_MODE_2400 1
+#define CODEC2_MODE_1600 2
+#define CODEC2_MODE_1400 3
+#define CODEC2_MODE_1300 4
+#define CODEC2_MODE_1200 5
-void *codec2_create();
-void codec2_destroy(void *codec2_state);
-void codec2_encode(void *codec2_state, unsigned char * bits, short speech_in[]);
-void codec2_decode(void *codec2_state, short speech_out[],
- const unsigned char * bits);
+struct CODEC2;
+
+struct CODEC2 * CODEC2_WIN32SUPPORT codec2_create(int mode);
+void CODEC2_WIN32SUPPORT codec2_destroy(struct CODEC2 *codec2_state);
+void CODEC2_WIN32SUPPORT codec2_encode(struct CODEC2 *codec2_state, unsigned char * bits, short speech_in[]);
+ void CODEC2_WIN32SUPPORT codec2_decode(struct CODEC2 *codec2_state, short speech_out[], const unsigned char *bits, float ber_est);
+int CODEC2_WIN32SUPPORT codec2_samples_per_frame(struct CODEC2 *codec2_state);
+int CODEC2_WIN32SUPPORT codec2_bits_per_frame(struct CODEC2 *codec2_state);
+
+void CODEC2_WIN32SUPPORT codec2_set_lpc_post_filter(struct CODEC2 *codec2_state, int enable, int bass_boost, float beta, float gamma);
+int CODEC2_WIN32SUPPORT codec2_get_spare_bit_index(struct CODEC2 *codec2_state);
+int CODEC2_WIN32SUPPORT codec2_rebuild_spare_bit(struct CODEC2 *codec2_state, int unpacked_bits[]);
#endif
+
+#ifdef __cplusplus
+}
+#endif
+