summaryrefslogtreecommitdiff
path: root/gr-vocoder/lib/vocoder_ulaw_encode_sb.cc
diff options
context:
space:
mode:
authorTom Rondeau2011-07-20 20:41:29 -0400
committerTom Rondeau2011-07-20 20:41:29 -0400
commit1b7ad9d18f777d2efe50fc67d1613d5de7b2ffee (patch)
tree0ed298ede352affd386b994a333455c3f05b7793 /gr-vocoder/lib/vocoder_ulaw_encode_sb.cc
parent1f10b8eeb2be3eef7adfaba3aa407ab362088792 (diff)
parentc0580462f19d99a97b7955b9215bd08eab24cd5b (diff)
downloadgnuradio-1b7ad9d18f777d2efe50fc67d1613d5de7b2ffee.tar.gz
gnuradio-1b7ad9d18f777d2efe50fc67d1613d5de7b2ffee.tar.bz2
gnuradio-1b7ad9d18f777d2efe50fc67d1613d5de7b2ffee.zip
Merge branch 'next' of gnuradio.org:gnuradio into next
Diffstat (limited to 'gr-vocoder/lib/vocoder_ulaw_encode_sb.cc')
-rw-r--r--gr-vocoder/lib/vocoder_ulaw_encode_sb.cc63
1 files changed, 63 insertions, 0 deletions
diff --git a/gr-vocoder/lib/vocoder_ulaw_encode_sb.cc b/gr-vocoder/lib/vocoder_ulaw_encode_sb.cc
new file mode 100644
index 000000000..19c53d72c
--- /dev/null
+++ b/gr-vocoder/lib/vocoder_ulaw_encode_sb.cc
@@ -0,0 +1,63 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2011 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <vocoder_ulaw_encode_sb.h>
+#include <gr_io_signature.h>
+#include <limits.h>
+
+extern "C" {
+#include "g7xx/g72x.h"
+}
+
+vocoder_ulaw_encode_sb_sptr vocoder_make_ulaw_encode_sb()
+{
+ return gnuradio::get_initial_sptr(new vocoder_ulaw_encode_sb());
+}
+
+vocoder_ulaw_encode_sb::vocoder_ulaw_encode_sb()
+ : gr_sync_block("vocoder_ulaw_encode_sb",
+ gr_make_io_signature (1, 1, sizeof(short)),
+ gr_make_io_signature (1, 1, sizeof(unsigned char)))
+{
+}
+
+vocoder_ulaw_encode_sb::~vocoder_ulaw_encode_sb()
+{
+}
+
+int
+vocoder_ulaw_encode_sb::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ const short *in = (const short *)input_items[0];
+ unsigned char *out = (unsigned char *)output_items[0];
+
+ for(int i = 0; i < noutput_items; i++)
+ out[i] = linear2ulaw(in[i]);
+
+ return noutput_items;
+}