summaryrefslogtreecommitdiff
path: root/gr-vocoder/include
diff options
context:
space:
mode:
authorJohnathan Corgan <johnathan@corganlabs.com>2014-04-21 09:41:31 -0700
committerJohnathan Corgan <johnathan@corganlabs.com>2014-04-21 09:41:31 -0700
commit33e5aeb722ba4fc1c2ae3162c4940b546037717f (patch)
treec3f1e57feeab5ea07e0bc5d7d56791c881f457b7 /gr-vocoder/include
parenta3998949d9c65076d91e3165733a5abd381ad882 (diff)
parent5efae492bb690e8e92fe18fb0abe0aff345c3935 (diff)
Merge branch 'merge-codec2-update'
Diffstat (limited to 'gr-vocoder/include')
-rw-r--r--gr-vocoder/include/gnuradio/vocoder/CMakeLists.txt1
-rw-r--r--gr-vocoder/include/gnuradio/vocoder/codec2.h54
-rw-r--r--gr-vocoder/include/gnuradio/vocoder/codec2_decode_ps.h7
-rw-r--r--gr-vocoder/include/gnuradio/vocoder/codec2_encode_sp.h13
4 files changed, 65 insertions, 10 deletions
diff --git a/gr-vocoder/include/gnuradio/vocoder/CMakeLists.txt b/gr-vocoder/include/gnuradio/vocoder/CMakeLists.txt
index ea0562f36f..1ad2f711fc 100644
--- a/gr-vocoder/include/gnuradio/vocoder/CMakeLists.txt
+++ b/gr-vocoder/include/gnuradio/vocoder/CMakeLists.txt
@@ -24,6 +24,7 @@ install(FILES
api.h
alaw_decode_bs.h
alaw_encode_sb.h
+ codec2.h
codec2_decode_ps.h
codec2_encode_sp.h
cvsd_decode_bs.h
diff --git a/gr-vocoder/include/gnuradio/vocoder/codec2.h b/gr-vocoder/include/gnuradio/vocoder/codec2.h
new file mode 100644
index 0000000000..ca09e4dfc0
--- /dev/null
+++ b/gr-vocoder/include/gnuradio/vocoder/codec2.h
@@ -0,0 +1,54 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2014 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef _VOCODER_CODEC2_H_
+#define _VOCODER_CODEC2_H_
+
+#include <gnuradio/vocoder/api.h>
+
+extern "C" {
+#include "../lib/codec2/codec2.h"
+}
+
+namespace gr {
+ namespace vocoder {
+
+ class VOCODER_API codec2 {
+ public:
+
+ enum bit_rate {
+ MODE_3200 = CODEC2_MODE_3200,
+ MODE_2400 = CODEC2_MODE_2400,
+ MODE_1600 = CODEC2_MODE_1600,
+ MODE_1400 = CODEC2_MODE_1400,
+ MODE_1300 = CODEC2_MODE_1300,
+ MODE_1200 = CODEC2_MODE_1200,
+ };
+
+ private:
+
+ };
+
+ } /* namespace vocoder */
+} /* namespace gr */
+
+#endif /* _VOCODER_CODEC2_H_ */
diff --git a/gr-vocoder/include/gnuradio/vocoder/codec2_decode_ps.h b/gr-vocoder/include/gnuradio/vocoder/codec2_decode_ps.h
index 041877174b..49add0f9ee 100644
--- a/gr-vocoder/include/gnuradio/vocoder/codec2_decode_ps.h
+++ b/gr-vocoder/include/gnuradio/vocoder/codec2_decode_ps.h
@@ -24,6 +24,7 @@
#define INCLUDED_VOCODER_CODEC2_DECODE_PS_H
#include <gnuradio/vocoder/api.h>
+#include <gnuradio/vocoder/codec2.h>
#include <gnuradio/sync_interpolator.h>
namespace gr {
@@ -33,7 +34,7 @@ namespace gr {
* \brief CODEC2 Vocoder Decoder
* \ingroup audio_blk
*
- * Input: A vector of 50 unpacked bits forming a Codec2 frame.
+ * Input: A vector of unpacked bits forming a Codec2 frame.
*
* Output: 16-bit short values of an audio signal with sampling rate 8 kHz.
*
@@ -47,8 +48,10 @@ namespace gr {
/*!
* \brief Make Codec2 decoder block.
+ *
+ * \param mode Encoded bit rate/mode
*/
- static sptr make();
+ static sptr make(int mode=codec2::MODE_2400);
};
} /* namespace vocoder */
diff --git a/gr-vocoder/include/gnuradio/vocoder/codec2_encode_sp.h b/gr-vocoder/include/gnuradio/vocoder/codec2_encode_sp.h
index 12b91b0428..b9b3283dba 100644
--- a/gr-vocoder/include/gnuradio/vocoder/codec2_encode_sp.h
+++ b/gr-vocoder/include/gnuradio/vocoder/codec2_encode_sp.h
@@ -24,6 +24,7 @@
#define INCLUDED_VOCODER_CODEC2_ENCODE_SP_H
#include <gnuradio/vocoder/api.h>
+#include <gnuradio/vocoder/codec2.h>
#include <gnuradio/sync_decimator.h>
namespace gr {
@@ -35,13 +36,7 @@ namespace gr {
*
* Input: Speech (audio) signal as 16-bit shorts, sampling rate 8 kHz.
*
- * Output: Vector of 50 unpacked bits, forming one Codec2 frame, per 160 input samples.
- *
- * Note that the Codec2 library produces 7 bytes with a total of 50 bits
- * per frame. The bits are MSB-first on these 7 bytes, so the first item
- * of the output vector is the MSB of the first byte of the frame.
- * If this block is combined with the gr::vocoder::codec2_decode_ps block,
- * this will work out of the box.
+ * Output: Vector of unpacked bits, forming one Codec2 frame, per 160 input samples.
*
*/
class VOCODER_API codec2_encode_sp : virtual public sync_decimator
@@ -52,8 +47,10 @@ namespace gr {
/*!
* \brief Make Codec2 encoder block.
+ *
+ * \param mode Encoded bit rate/mode
*/
- static sptr make();
+ static sptr make(int mode=codec2::MODE_2400);
};
} /* namespace vocoder */