diff options
author | Tom Rondeau | 2011-07-20 20:41:29 -0400 |
---|---|---|
committer | Tom Rondeau | 2011-07-20 20:41:29 -0400 |
commit | 1b7ad9d18f777d2efe50fc67d1613d5de7b2ffee (patch) | |
tree | 0ed298ede352affd386b994a333455c3f05b7793 | |
parent | 1f10b8eeb2be3eef7adfaba3aa407ab362088792 (diff) | |
parent | c0580462f19d99a97b7955b9215bd08eab24cd5b (diff) | |
download | gnuradio-1b7ad9d18f777d2efe50fc67d1613d5de7b2ffee.tar.gz gnuradio-1b7ad9d18f777d2efe50fc67d1613d5de7b2ffee.tar.bz2 gnuradio-1b7ad9d18f777d2efe50fc67d1613d5de7b2ffee.zip |
Merge branch 'next' of gnuradio.org:gnuradio into next
39 files changed, 823 insertions, 16 deletions
diff --git a/config/grc_gnuradio_core.m4 b/config/grc_gnuradio_core.m4 index 4d6780737..a35629e2e 100644 --- a/config/grc_gnuradio_core.m4 +++ b/config/grc_gnuradio_core.m4 @@ -86,7 +86,6 @@ AC_DEFUN([GRC_GNURADIO_CORE],[ gnuradio-core/src/guile/gr-run-waveform-script \ gnuradio-core/src/lib/Makefile \ gnuradio-core/src/lib/filter/Makefile \ - gnuradio-core/src/lib/g72x/Makefile \ gnuradio-core/src/lib/general/Makefile \ gnuradio-core/src/lib/general/gr_constants.cc \ gnuradio-core/src/lib/gengen/Makefile \ diff --git a/config/grc_gr_vocoder.m4 b/config/grc_gr_vocoder.m4 index fa620ad05..df75656fe 100644 --- a/config/grc_gr_vocoder.m4 +++ b/config/grc_gr_vocoder.m4 @@ -33,6 +33,7 @@ AC_DEFUN([GRC_GR_VOCODER],[ gr-vocoder/include/Makefile \ gr-vocoder/lib/Makefile \ gr-vocoder/lib/codec2/Makefile \ + gr-vocoder/lib/g7xx/Makefile \ gr-vocoder/lib/gsm/Makefile \ gr-vocoder/python/Makefile \ gr-vocoder/python/run_tests \ diff --git a/gnuradio-core/src/lib/Makefile.am b/gnuradio-core/src/lib/Makefile.am index 4db2ff167..979ac7f91 100644 --- a/gnuradio-core/src/lib/Makefile.am +++ b/gnuradio-core/src/lib/Makefile.am @@ -24,7 +24,7 @@ include $(top_srcdir)/Makefile.common ## Process this file with automake to produce Makefile.in # We've got to build . before swig -SUBDIRS = missing runtime filter viterbi general gengen g72x reed-solomon io hier . swig +SUBDIRS = missing runtime filter viterbi general gengen reed-solomon io hier . swig AM_CPPFLAGS = $(STD_DEFINES_AND_INCLUDES) $(CPPUNIT_INCLUDES) $(WITH_INCLUDES) @@ -43,7 +43,6 @@ libgnuradio_core_qa_la_LDFLAGS = $(NO_UNDEFINED) -version-info 0:0:0 \ libgnuradio_core_la_LIBADD = \ filter/libfilter.la \ - g72x/libccitt.la \ viterbi/libviterbi.la \ general/libgeneral.la \ gengen/libgengen.la \ diff --git a/gr-audio/lib/alsa/audio_alsa_source.cc b/gr-audio/lib/alsa/audio_alsa_source.cc index 4f0042b22..2f4506f71 100644 --- a/gr-audio/lib/alsa/audio_alsa_source.cc +++ b/gr-audio/lib/alsa/audio_alsa_source.cc @@ -217,8 +217,14 @@ audio_alsa_source::check_topology (int ninputs, int noutputs) unsigned int nchan = noutputs; int err; - // FIXME check_topology may be called more than once. + // Check the state of the stream // Ensure that the pcm is in a state where we can still mess with the hw_params + snd_pcm_state_t state; + state=snd_pcm_state(d_pcm_handle); + if ( state== SND_PCM_STATE_RUNNING) + return true; // If stream is running, don't change any parameters + else if(state == SND_PCM_STATE_XRUN ) + snd_pcm_prepare ( d_pcm_handle ); // Prepare stream on underrun, and we can set parameters; bool special_case = nchan == 1 && d_special_case_stereo_to_mono; if (special_case) diff --git a/gr-qtgui/lib/spectrumUpdateEvents.h b/gr-qtgui/lib/spectrumUpdateEvents.h index 5a17657b7..760619f88 100644 --- a/gr-qtgui/lib/spectrumUpdateEvents.h +++ b/gr-qtgui/lib/spectrumUpdateEvents.h @@ -101,7 +101,6 @@ public: int which() const; const std::vector<double*> getTimeDomainPoints() const; uint64_t getNumTimeDomainDataPoints() const; - timespec getDataTimestamp() const; bool getRepeatDataFlag() const; protected: diff --git a/gr-vocoder/examples/Makefile.am b/gr-vocoder/examples/Makefile.am index 69aa05e26..6d881e1a6 100644 --- a/gr-vocoder/examples/Makefile.am +++ b/gr-vocoder/examples/Makefile.am @@ -24,6 +24,8 @@ include $(top_srcdir)/Makefile.common ourdatadir = $(exampledir)/vocoder dist_ourdata_SCRIPTS = \ + alaw_audio_loopback.py \ codec2_audio_loopback.py \ cvsd_audio_loopback.py \ - gsm_audio_loopback.py + gsm_audio_loopback.py \ + ulaw_audio_loopback.py diff --git a/gr-vocoder/examples/alaw_audio_loopback.py b/gr-vocoder/examples/alaw_audio_loopback.py new file mode 100755 index 000000000..8fdd64d44 --- /dev/null +++ b/gr-vocoder/examples/alaw_audio_loopback.py @@ -0,0 +1,45 @@ +#!/usr/bin/env python +# +# 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. +# + +from gnuradio import gr +from gnuradio import audio +from gnuradio import vocoder + +def build_graph(): + tb = gr.top_block() + src = audio.source(8000) + src_scale = gr.multiply_const_ff(32767) + f2s = gr.float_to_short () + enc = vocoder.alaw_encode_sb() + dec = vocoder.alaw_decode_bs() + s2f = gr.short_to_float () + sink_scale = gr.multiply_const_ff(1.0/32767.) + sink = audio.sink(8000) + tb.connect(src, src_scale, f2s, enc, dec, s2f, sink_scale, sink) + return tb + +if __name__ == '__main__': + tb = build_graph() + tb.start() + raw_input ('Press Enter to exit: ') + tb.stop() + tb.wait() diff --git a/gr-vocoder/examples/ulaw_audio_loopback.py b/gr-vocoder/examples/ulaw_audio_loopback.py new file mode 100755 index 000000000..afe0921fa --- /dev/null +++ b/gr-vocoder/examples/ulaw_audio_loopback.py @@ -0,0 +1,45 @@ +#!/usr/bin/env python +# +# 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. +# + +from gnuradio import gr +from gnuradio import audio +from gnuradio import vocoder + +def build_graph(): + tb = gr.top_block() + src = audio.source(8000) + src_scale = gr.multiply_const_ff(32767) + f2s = gr.float_to_short () + enc = vocoder.ulaw_encode_sb() + dec = vocoder.ulaw_decode_bs() + s2f = gr.short_to_float () + sink_scale = gr.multiply_const_ff(1.0/32767.) + sink = audio.sink(8000) + tb.connect(src, src_scale, f2s, enc, dec, s2f, sink_scale, sink) + return tb + +if __name__ == '__main__': + tb = build_graph() + tb.start() + raw_input ('Press Enter to exit: ') + tb.stop() + tb.wait() diff --git a/gr-vocoder/include/Makefile.am b/gr-vocoder/include/Makefile.am index 472dd4f3c..06c649680 100644 --- a/gr-vocoder/include/Makefile.am +++ b/gr-vocoder/include/Makefile.am @@ -23,9 +23,13 @@ include $(top_srcdir)/Makefile.common # C/C++ headers get installed in ${prefix}/include/gnuradio grinclude_HEADERS = \ + vocoder_alaw_decode_bs.h \ + vocoder_alaw_encode_sb.h \ vocoder_codec2_decode_ps.h \ vocoder_codec2_encode_sp.h \ vocoder_cvsd_decode_bs.h \ vocoder_cvsd_encode_sb.h \ vocoder_gsm_fr_decode_ps.h \ - vocoder_gsm_fr_encode_sp.h + vocoder_gsm_fr_encode_sp.h \ + vocoder_ulaw_decode_bs.h \ + vocoder_ulaw_encode_sb.h diff --git a/gr-vocoder/include/vocoder_alaw_decode_bs.h b/gr-vocoder/include/vocoder_alaw_decode_bs.h new file mode 100644 index 000000000..b71569439 --- /dev/null +++ b/gr-vocoder/include/vocoder_alaw_decode_bs.h @@ -0,0 +1,55 @@ +/* -*- 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. + */ + +#ifndef INCLUDED_VOCODER_ALAW_DECODE_BS_H +#define INCLUDED_VOCODER_ALAW_DECODE_BS_H + +#include <gr_sync_block.h> + +class vocoder_alaw_decode_bs; + +typedef boost::shared_ptr<vocoder_alaw_decode_bs> vocoder_alaw_decode_bs_sptr; + +vocoder_alaw_decode_bs_sptr vocoder_make_alaw_decode_bs(); + +/*! + * \brief This block performs alaw audio decoding. + * + * \ingroup vocoder_blk + */ + +class vocoder_alaw_decode_bs : public gr_sync_block +{ +private: + friend vocoder_alaw_decode_bs_sptr vocoder_make_alaw_decode_bs(); + + vocoder_alaw_decode_bs(); + + public: + ~vocoder_alaw_decode_bs(); + + int work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); +}; + +#endif /* INCLUDED_VOCODER_ALAW_DECODE_BS_H */ diff --git a/gr-vocoder/include/vocoder_alaw_encode_sb.h b/gr-vocoder/include/vocoder_alaw_encode_sb.h new file mode 100644 index 000000000..d1858d048 --- /dev/null +++ b/gr-vocoder/include/vocoder_alaw_encode_sb.h @@ -0,0 +1,54 @@ +/* -*- 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. + */ + +#ifndef INCLUDED_VOCODER_ALAW_ENCODER_SB_H +#define INCLUDED_VOCODER_ALAW_ENCODER_SB_H + +#include <gr_sync_block.h> + +class vocoder_alaw_encode_sb; + +typedef boost::shared_ptr<vocoder_alaw_encode_sb> vocoder_alaw_encode_sb_sptr; + +vocoder_alaw_encode_sb_sptr vocoder_make_alaw_encode_sb(); + +/*! + * \brief This block performs g.711 alaw audio encoding. + * + * \ingroup vocoder_blk + */ +class vocoder_alaw_encode_sb : public gr_sync_block +{ +private: + friend vocoder_alaw_encode_sb_sptr vocoder_make_alaw_encode_sb(); + + vocoder_alaw_encode_sb(); + + public: + ~vocoder_alaw_encode_sb(); + + int work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); +}; + +#endif /* INCLUDED_VOCODER_ALAW_ENCODE_SB_H */ diff --git a/gr-vocoder/include/vocoder_ulaw_decode_bs.h b/gr-vocoder/include/vocoder_ulaw_decode_bs.h new file mode 100644 index 000000000..1126c6cb3 --- /dev/null +++ b/gr-vocoder/include/vocoder_ulaw_decode_bs.h @@ -0,0 +1,55 @@ +/* -*- 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. + */ + +#ifndef INCLUDED_VOCODER_ULAW_DECODE_BS_H +#define INCLUDED_VOCODER_ULAW_DECODE_BS_H + +#include <gr_sync_block.h> + +class vocoder_ulaw_decode_bs; + +typedef boost::shared_ptr<vocoder_ulaw_decode_bs> vocoder_ulaw_decode_bs_sptr; + +vocoder_ulaw_decode_bs_sptr vocoder_make_ulaw_decode_bs(); + +/*! + * \brief This block performs ulaw audio decoding. + * + * \ingroup vocoder_blk + */ + +class vocoder_ulaw_decode_bs : public gr_sync_block +{ +private: + friend vocoder_ulaw_decode_bs_sptr vocoder_make_ulaw_decode_bs(); + + vocoder_ulaw_decode_bs(); + + public: + ~vocoder_ulaw_decode_bs(); + + int work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); +}; + +#endif /* INCLUDED_VOCODER_ULAW_DECODE_BS_H */ diff --git a/gr-vocoder/include/vocoder_ulaw_encode_sb.h b/gr-vocoder/include/vocoder_ulaw_encode_sb.h new file mode 100644 index 000000000..eddc4f4e5 --- /dev/null +++ b/gr-vocoder/include/vocoder_ulaw_encode_sb.h @@ -0,0 +1,54 @@ +/* -*- 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. + */ + +#ifndef INCLUDED_VOCODER_ULAW_ENCODER_SB_H +#define INCLUDED_VOCODER_ULAW_ENCODER_SB_H + +#include <gr_sync_block.h> + +class vocoder_ulaw_encode_sb; + +typedef boost::shared_ptr<vocoder_ulaw_encode_sb> vocoder_ulaw_encode_sb_sptr; + +vocoder_ulaw_encode_sb_sptr vocoder_make_ulaw_encode_sb(); + +/*! + * \brief This block performs g.711 ulaw audio encoding. + * + * \ingroup vocoder_blk + */ +class vocoder_ulaw_encode_sb : public gr_sync_block +{ +private: + friend vocoder_ulaw_encode_sb_sptr vocoder_make_ulaw_encode_sb(); + + vocoder_ulaw_encode_sb(); + + public: + ~vocoder_ulaw_encode_sb(); + + int work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); +}; + +#endif /* INCLUDED_VOCODER_ULAW_ENCODE_SB_H */ diff --git a/gr-vocoder/lib/Makefile.am b/gr-vocoder/lib/Makefile.am index 198371f47..e05d61f3c 100644 --- a/gr-vocoder/lib/Makefile.am +++ b/gr-vocoder/lib/Makefile.am @@ -21,7 +21,7 @@ include $(top_srcdir)/Makefile.common -SUBDIRS = codec2 gsm . +SUBDIRS = codec2 g7xx gsm . AM_CPPFLAGS = $(STD_DEFINES_AND_INCLUDES) $(PYTHON_CPPFLAGS) $(WITH_INCLUDES) \ -I$(top_srcdir)/gr-vocoder/include @@ -29,16 +29,21 @@ AM_CPPFLAGS = $(STD_DEFINES_AND_INCLUDES) $(PYTHON_CPPFLAGS) $(WITH_INCLUDES) \ lib_LTLIBRARIES = libgnuradio-vocoder.la libgnuradio_vocoder_la_SOURCES = \ + vocoder_alaw_decode_bs.cc \ + vocoder_alaw_encode_sb.cc \ vocoder_codec2_decode_ps.cc \ vocoder_codec2_encode_sp.cc \ vocoder_cvsd_encode_sb.cc \ vocoder_cvsd_decode_bs.cc \ vocoder_gsm_fr_decode_ps.cc \ - vocoder_gsm_fr_encode_sp.cc + vocoder_gsm_fr_encode_sp.cc \ + vocoder_ulaw_decode_bs.cc \ + vocoder_ulaw_encode_sb.cc libgnuradio_vocoder_la_LIBADD = \ $(GNURADIO_CORE_LA) \ codec2/libcodec2.la \ + g7xx/libg7xx.la \ gsm/libgsm.la libgnuradio_vocoder_la_LDFLAGS = $(NO_UNDEFINED) $(LTVERSIONFLAGS) diff --git a/gnuradio-core/src/lib/g72x/.gitignore b/gr-vocoder/lib/g7xx/.gitignore index a02b6ff73..a02b6ff73 100644 --- a/gnuradio-core/src/lib/g72x/.gitignore +++ b/gr-vocoder/lib/g7xx/.gitignore diff --git a/gnuradio-core/src/lib/g72x/Makefile.am b/gr-vocoder/lib/g7xx/Makefile.am index d2700376f..929fd23ba 100644 --- a/gnuradio-core/src/lib/g72x/Makefile.am +++ b/gr-vocoder/lib/g7xx/Makefile.am @@ -1,5 +1,5 @@ # -# Copyright 2001 Free Software Foundation, Inc. +# Copyright 2001,2011 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -21,7 +21,7 @@ include $(top_srcdir)/Makefile.common -noinst_LTLIBRARIES = libccitt.la -libccitt_la_SOURCES = g711.c g72x.c g721.c g723_24.c g723_40.c g72x.h +noinst_LTLIBRARIES = libg7xx.la +libg7xx_la_SOURCES = g711.c g72x.c g721.c g723_24.c g723_40.c g72x.h EXTRA_DIST += encode.c decode.c diff --git a/gnuradio-core/src/lib/g72x/README b/gr-vocoder/lib/g7xx/README index 23b0e7dd5..23b0e7dd5 100644 --- a/gnuradio-core/src/lib/g72x/README +++ b/gr-vocoder/lib/g7xx/README diff --git a/gnuradio-core/src/lib/g72x/decode.c b/gr-vocoder/lib/g7xx/decode.c index cf8c739c5..cf8c739c5 100644 --- a/gnuradio-core/src/lib/g72x/decode.c +++ b/gr-vocoder/lib/g7xx/decode.c diff --git a/gnuradio-core/src/lib/g72x/encode.c b/gr-vocoder/lib/g7xx/encode.c index e74482869..e74482869 100644 --- a/gnuradio-core/src/lib/g72x/encode.c +++ b/gr-vocoder/lib/g7xx/encode.c diff --git a/gnuradio-core/src/lib/g72x/g711.c b/gr-vocoder/lib/g7xx/g711.c index d4d60a5c2..d4d60a5c2 100644 --- a/gnuradio-core/src/lib/g72x/g711.c +++ b/gr-vocoder/lib/g7xx/g711.c diff --git a/gnuradio-core/src/lib/g72x/g721.c b/gr-vocoder/lib/g7xx/g721.c index 445f177e8..445f177e8 100644 --- a/gnuradio-core/src/lib/g72x/g721.c +++ b/gr-vocoder/lib/g7xx/g721.c diff --git a/gnuradio-core/src/lib/g72x/g723_24.c b/gr-vocoder/lib/g7xx/g723_24.c index 452f4daeb..452f4daeb 100644 --- a/gnuradio-core/src/lib/g72x/g723_24.c +++ b/gr-vocoder/lib/g7xx/g723_24.c diff --git a/gnuradio-core/src/lib/g72x/g723_40.c b/gr-vocoder/lib/g7xx/g723_40.c index 4858baf40..4858baf40 100644 --- a/gnuradio-core/src/lib/g72x/g723_40.c +++ b/gr-vocoder/lib/g7xx/g723_40.c diff --git a/gnuradio-core/src/lib/g72x/g72x.c b/gr-vocoder/lib/g7xx/g72x.c index 9a823c755..9a823c755 100644 --- a/gnuradio-core/src/lib/g72x/g72x.c +++ b/gr-vocoder/lib/g7xx/g72x.c diff --git a/gnuradio-core/src/lib/g72x/g72x.h b/gr-vocoder/lib/g7xx/g72x.h index 33807171a..33807171a 100644 --- a/gnuradio-core/src/lib/g72x/g72x.h +++ b/gr-vocoder/lib/g7xx/g72x.h diff --git a/gr-vocoder/lib/vocoder_alaw_decode_bs.cc b/gr-vocoder/lib/vocoder_alaw_decode_bs.cc new file mode 100644 index 000000000..7ffdddd81 --- /dev/null +++ b/gr-vocoder/lib/vocoder_alaw_decode_bs.cc @@ -0,0 +1,65 @@ +/* -*- 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_alaw_decode_bs.h> +#include <gr_io_signature.h> +#include <limits.h> + +extern "C" { +#include "g7xx/g72x.h" +} + +vocoder_alaw_decode_bs_sptr vocoder_make_alaw_decode_bs() +{ + return gnuradio::get_initial_sptr(new vocoder_alaw_decode_bs()); +} + +vocoder_alaw_decode_bs::vocoder_alaw_decode_bs() + : gr_sync_block("vocoder_alaw_decode_bs", + gr_make_io_signature (1, 1, sizeof (unsigned char)), + gr_make_io_signature (1, 1, sizeof (short))) +{ +} + +vocoder_alaw_decode_bs::~vocoder_alaw_decode_bs() +{ +} + + + +int +vocoder_alaw_decode_bs::work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items) +{ + const unsigned char *in = (const unsigned char *)input_items[0]; + short *out = (short *)output_items[0]; + + for(int i = 0; i < noutput_items; i++) + out[i] = alaw2linear(in[i]); + + return noutput_items; +} diff --git a/gr-vocoder/lib/vocoder_alaw_encode_sb.cc b/gr-vocoder/lib/vocoder_alaw_encode_sb.cc new file mode 100644 index 000000000..e4d975271 --- /dev/null +++ b/gr-vocoder/lib/vocoder_alaw_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_alaw_encode_sb.h> +#include <gr_io_signature.h> +#include <limits.h> + +extern "C" { +#include "g7xx/g72x.h" +} + +vocoder_alaw_encode_sb_sptr vocoder_make_alaw_encode_sb() +{ + return gnuradio::get_initial_sptr(new vocoder_alaw_encode_sb()); +} + +vocoder_alaw_encode_sb::vocoder_alaw_encode_sb() + : gr_sync_block("vocoder_alaw_encode_sb", + gr_make_io_signature (1, 1, sizeof(short)), + gr_make_io_signature (1, 1, sizeof(unsigned char))) +{ +} + +vocoder_alaw_encode_sb::~vocoder_alaw_encode_sb() +{ +} + +int +vocoder_alaw_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] = linear2alaw(in[i]); + + return noutput_items; +} diff --git a/gr-vocoder/lib/vocoder_ulaw_decode_bs.cc b/gr-vocoder/lib/vocoder_ulaw_decode_bs.cc new file mode 100644 index 000000000..3ade9d3f0 --- /dev/null +++ b/gr-vocoder/lib/vocoder_ulaw_decode_bs.cc @@ -0,0 +1,65 @@ +/* -*- 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_decode_bs.h> +#include <gr_io_signature.h> +#include <limits.h> + +extern "C" { +#include "g7xx/g72x.h" +} + +vocoder_ulaw_decode_bs_sptr vocoder_make_ulaw_decode_bs() +{ + return gnuradio::get_initial_sptr(new vocoder_ulaw_decode_bs()); +} + +vocoder_ulaw_decode_bs::vocoder_ulaw_decode_bs() + : gr_sync_block("vocoder_ulaw_decode_bs", + gr_make_io_signature (1, 1, sizeof (unsigned char)), + gr_make_io_signature (1, 1, sizeof (short))) +{ +} + +vocoder_ulaw_decode_bs::~vocoder_ulaw_decode_bs() +{ +} + + + +int +vocoder_ulaw_decode_bs::work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items) +{ + const unsigned char *in = (const unsigned char *)input_items[0]; + short *out = (short *)output_items[0]; + + for(int i = 0; i < noutput_items; i++) + out[i] = ulaw2linear(in[i]); + + return noutput_items; +} 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; +} diff --git a/gr-vocoder/python/Makefile.am b/gr-vocoder/python/Makefile.am index 1afbc9232..256b46005 100644 --- a/gr-vocoder/python/Makefile.am +++ b/gr-vocoder/python/Makefile.am @@ -26,9 +26,11 @@ vocoderdir = $(grpythondir)/vocoder TESTS = run_tests noinst_PYTHON = \ + qa_alaw_vocoder.py \ qa_codec2_vocoder.py \ qa_cvsd_vocoder.py \ - qa_gsm_full_rate.py + qa_gsm_full_rate.py \ + qa_ulaw_vocoder.py vocoder_PYTHON = \ __init__.py \ diff --git a/gr-vocoder/python/qa_alaw_vocoder.py b/gr-vocoder/python/qa_alaw_vocoder.py new file mode 100755 index 000000000..b7b937138 --- /dev/null +++ b/gr-vocoder/python/qa_alaw_vocoder.py @@ -0,0 +1,39 @@ +#!/usr/bin/env python +# +# 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. +# + +from gnuradio import gr, gr_unittest +from vocoder_swig import * + +class test_alaw_vocoder (gr_unittest.TestCase): + + def setUp (self): + self.tb = gr.top_block() + + def tearDown (self): + self.tb = None + + def test001_module_load (self): + enc = alaw_encode_sb(); + dec = alaw_decode_bs(); + +if __name__ == '__main__': + gr_unittest.run(test_alaw_vocoder, "test_alaw_vocoder.xml") diff --git a/gr-vocoder/python/qa_ulaw_vocoder.py b/gr-vocoder/python/qa_ulaw_vocoder.py new file mode 100755 index 000000000..0e201638c --- /dev/null +++ b/gr-vocoder/python/qa_ulaw_vocoder.py @@ -0,0 +1,39 @@ +#!/usr/bin/env python +# +# 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. +# + +from gnuradio import gr, gr_unittest +from vocoder_swig import * + +class test_ulaw_vocoder (gr_unittest.TestCase): + + def setUp (self): + self.tb = gr.top_block() + + def tearDown (self): + self.tb = None + + def test001_module_load (self): + enc = ulaw_encode_sb(); + dec = ulaw_decode_bs(); + +if __name__ == '__main__': + gr_unittest.run(test_ulaw_vocoder, "test_ulaw_vocoder.xml") diff --git a/gr-vocoder/swig/Makefile.am b/gr-vocoder/swig/Makefile.am index fbfd18c7c..b2a331394 100644 --- a/gr-vocoder/swig/Makefile.am +++ b/gr-vocoder/swig/Makefile.am @@ -57,12 +57,16 @@ vocoder_swig_la_swig_libadd = \ # additional SWIG files to be installed vocoder_swig_swiginclude_headers = \ + vocoder_alaw_decode_bs.i \ + vocoder_alaw_encode_sb.i \ vocoder_codec2_decode_ps.i \ vocoder_codec2_encode_sp.i \ vocoder_cvsd_decode_bs.i \ vocoder_cvsd_encode_sb.i \ vocoder_gsm_fr_encode_sp.i \ - vocoder_gsm_fr_decode_ps.i + vocoder_gsm_fr_decode_ps.i \ + vocoder_ulaw_decode_bs.i \ + vocoder_ulaw_encode_sb.i vocoder_swig_swig_args = \ -I$(abs_top_builddir)/gr-vocoder/lib diff --git a/gr-vocoder/swig/vocoder_alaw_decode_bs.i b/gr-vocoder/swig/vocoder_alaw_decode_bs.i new file mode 100644 index 000000000..f789c454f --- /dev/null +++ b/gr-vocoder/swig/vocoder_alaw_decode_bs.i @@ -0,0 +1,35 @@ +/* -*- 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. + */ + +%{ +#include "vocoder_alaw_decode_bs.h" +%} + +GR_SWIG_BLOCK_MAGIC(vocoder,alaw_decode_bs); + +vocoder_alaw_decode_bs_sptr vocoder_make_alaw_decode_bs(); + +class vocoder_alaw_decode_bs : public gr_sync_block +{ +private: + vocoder_alaw_decode_bs(); +}; diff --git a/gr-vocoder/swig/vocoder_alaw_encode_sb.i b/gr-vocoder/swig/vocoder_alaw_encode_sb.i new file mode 100644 index 000000000..9fe537d55 --- /dev/null +++ b/gr-vocoder/swig/vocoder_alaw_encode_sb.i @@ -0,0 +1,35 @@ +/* -*- 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. + */ + +%{ +#include "vocoder_alaw_encode_sb.h" +%} + +GR_SWIG_BLOCK_MAGIC(vocoder,alaw_encode_sb); + +vocoder_alaw_encode_sb_sptr vocoder_make_alaw_encode_sb(); + +class vocoder_alaw_encode_sb : public gr_sync_block +{ +private: + vocoder_alaw_encode_sb(); +}; diff --git a/gr-vocoder/swig/vocoder_swig.i b/gr-vocoder/swig/vocoder_swig.i index 9edb0dc0c..b339cc7a4 100644 --- a/gr-vocoder/swig/vocoder_swig.i +++ b/gr-vocoder/swig/vocoder_swig.i @@ -22,12 +22,16 @@ %include "gnuradio.i" +%include "vocoder_alaw_decode_bs.i" +%include "vocoder_alaw_encode_sb.i" %include "vocoder_codec2_encode_sp.i" %include "vocoder_codec2_decode_ps.i" %include "vocoder_cvsd_decode_bs.i" %include "vocoder_cvsd_encode_sb.i" %include "vocoder_gsm_fr_encode_sp.i" %include "vocoder_gsm_fr_decode_ps.i" +%include "vocoder_ulaw_decode_bs.i" +%include "vocoder_ulaw_encode_sb.i" #if SWIGGUILE %scheme %{ diff --git a/gr-vocoder/swig/vocoder_ulaw_decode_bs.i b/gr-vocoder/swig/vocoder_ulaw_decode_bs.i new file mode 100644 index 000000000..5e8e8c9ae --- /dev/null +++ b/gr-vocoder/swig/vocoder_ulaw_decode_bs.i @@ -0,0 +1,35 @@ +/* -*- 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. + */ + +%{ +#include "vocoder_ulaw_decode_bs.h" +%} + +GR_SWIG_BLOCK_MAGIC(vocoder,ulaw_decode_bs); + +vocoder_ulaw_decode_bs_sptr vocoder_make_ulaw_decode_bs(); + +class vocoder_ulaw_decode_bs : public gr_sync_block +{ +private: + vocoder_ulaw_decode_bs(); +}; diff --git a/gr-vocoder/swig/vocoder_ulaw_encode_sb.i b/gr-vocoder/swig/vocoder_ulaw_encode_sb.i new file mode 100644 index 000000000..1665df480 --- /dev/null +++ b/gr-vocoder/swig/vocoder_ulaw_encode_sb.i @@ -0,0 +1,35 @@ +/* -*- 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. + */ + +%{ +#include "vocoder_ulaw_encode_sb.h" +%} + +GR_SWIG_BLOCK_MAGIC(vocoder,ulaw_encode_sb); + +vocoder_ulaw_encode_sb_sptr vocoder_make_ulaw_encode_sb(); + +class vocoder_ulaw_encode_sb : public gr_sync_block +{ +private: + vocoder_ulaw_encode_sb(); +}; diff --git a/volk/gen/make_makefile_am.py b/volk/gen/make_makefile_am.py index d700626bb..f843b4413 100644 --- a/volk/gen/make_makefile_am.py +++ b/volk/gen/make_makefile_am.py @@ -77,9 +77,9 @@ noinst_LTLIBRARIES = if archflags_dict[arch] != "none": tempstring += "-" + archflags_dict[arch] + " " - tempstring += "\nnoinst_LTLIBRARIES += libvolk_" + machine_name + ".la " + tempstring += "\nnoinst_LTLIBRARIES += libvolk_" + machine_name + ".la " tempstring += "\nlibvolk_la_LIBADD += libvolk_" + machine_name + ".la\n" - tempstring += "libvolk_la_CPPFLAGS += -DLV_MACHINE_" + machine_name.swapcase() + " \n" + tempstring += "libvolk_la_CPPFLAGS += -DLV_MACHINE_" + machine_name.swapcase() + " \n" tempstring += "endif\n" |