summaryrefslogtreecommitdiff
path: root/gr-audio-alsa
diff options
context:
space:
mode:
authorTom Rondeau2011-04-08 15:37:29 -0400
committerTom Rondeau2011-04-08 15:37:29 -0400
commit21b64f070a3eb38ab044529a6ddd9cd6b6d0a2cb (patch)
tree4e72909a051b0a4ac428252d15f34b53bcc986b6 /gr-audio-alsa
parentd7093fd06d0ec37f6ba2841d202fe90f4fa3661e (diff)
parent5c358afd00347f5da7a59dd73ea79cd3df26659d (diff)
downloadgnuradio-21b64f070a3eb38ab044529a6ddd9cd6b6d0a2cb.tar.gz
gnuradio-21b64f070a3eb38ab044529a6ddd9cd6b6d0a2cb.tar.bz2
gnuradio-21b64f070a3eb38ab044529a6ddd9cd6b6d0a2cb.zip
Merge branch 'master' into constell_obj
Conflicts: gnuradio-core/src/lib/filter/gr_pfb_clock_sync_ccf.h gr-audio-oss/src/Makefile.swig.gen gr-audio/swig/Makefile.swig.gen
Diffstat (limited to 'gr-audio-alsa')
-rw-r--r--gr-audio-alsa/.gitignore30
-rw-r--r--gr-audio-alsa/Makefile.am30
-rw-r--r--gr-audio-alsa/build-stamp0
-rw-r--r--gr-audio-alsa/gnuradio-audio-alsa.pc.in11
-rw-r--r--gr-audio-alsa/gr-audio-alsa.conf11
-rw-r--r--gr-audio-alsa/src/.gitignore20
-rw-r--r--gr-audio-alsa/src/Makefile.am88
-rw-r--r--gr-audio-alsa/src/Makefile.swig.gen145
-rw-r--r--gr-audio-alsa/src/audio_alsa.i85
-rw-r--r--gr-audio-alsa/src/audio_alsa.test37
-rw-r--r--gr-audio-alsa/src/audio_alsa_sink.cc551
-rw-r--r--gr-audio-alsa/src/audio_alsa_sink.h125
-rw-r--r--gr-audio-alsa/src/audio_alsa_source.cc507
-rw-r--r--gr-audio-alsa/src/audio_alsa_source.h124
-rw-r--r--gr-audio-alsa/src/gri_alsa.cc175
-rw-r--r--gr-audio-alsa/src/gri_alsa.h44
-rwxr-xr-xgr-audio-alsa/src/qa_audio_alsa.py40
-rw-r--r--gr-audio-alsa/src/run_guile_tests.in14
-rw-r--r--gr-audio-alsa/src/run_tests.in10
19 files changed, 0 insertions, 2047 deletions
diff --git a/gr-audio-alsa/.gitignore b/gr-audio-alsa/.gitignore
deleted file mode 100644
index cdcf41b15..000000000
--- a/gr-audio-alsa/.gitignore
+++ /dev/null
@@ -1,30 +0,0 @@
-/*.cache
-/*.la
-/*.lo
-/*.pc
-/.deps
-/.la
-/.libs
-/.lo
-/Makefile
-/Makefile.in
-/aclocal.m4
-/autom4te.cache
-/config.cache
-/config.h
-/config.h.in
-/config.log
-/config.status
-/configure
-/depcomp
-/install-sh
-/libtool
-/ltmain.sh
-/make.log
-/missing
-/missing
-/mkinstalldirs
-/py-compile
-/stamp-h
-/stamp-h.in
-/stamp-h1
diff --git a/gr-audio-alsa/Makefile.am b/gr-audio-alsa/Makefile.am
deleted file mode 100644
index 5bd92b0ff..000000000
--- a/gr-audio-alsa/Makefile.am
+++ /dev/null
@@ -1,30 +0,0 @@
-#
-# Copyright 2004,2006,2009 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 $(top_srcdir)/Makefile.common
-
-SUBDIRS = src
-
-pkgconfigdir = $(libdir)/pkgconfig
-dist_pkgconfig_DATA = gnuradio-audio-alsa.pc
-
-etcdir = $(gr_prefsdir)
-dist_etc_DATA = gr-audio-alsa.conf
diff --git a/gr-audio-alsa/build-stamp b/gr-audio-alsa/build-stamp
deleted file mode 100644
index e69de29bb..000000000
--- a/gr-audio-alsa/build-stamp
+++ /dev/null
diff --git a/gr-audio-alsa/gnuradio-audio-alsa.pc.in b/gr-audio-alsa/gnuradio-audio-alsa.pc.in
deleted file mode 100644
index d5147e6af..000000000
--- a/gr-audio-alsa/gnuradio-audio-alsa.pc.in
+++ /dev/null
@@ -1,11 +0,0 @@
-prefix=@prefix@
-exec_prefix=@exec_prefix@
-libdir=@libdir@
-includedir=@includedir@
-
-Name: gnuradio-audio-alsa
-Description: The GNU Radio block for the ALSA sound system
-Requires: gnuradio-core alsa
-Version: @LIBVER@
-Libs: -L${libdir} -lgnuradio-audio-alsa
-Cflags: -I${includedir}
diff --git a/gr-audio-alsa/gr-audio-alsa.conf b/gr-audio-alsa/gr-audio-alsa.conf
deleted file mode 100644
index 5cec63e7a..000000000
--- a/gr-audio-alsa/gr-audio-alsa.conf
+++ /dev/null
@@ -1,11 +0,0 @@
-# This file contains system wide configuration data for GNU Radio.
-# You may override any setting on a per-user basis by editing
-# ~/.gnuradio/config.conf
-
-[audio_alsa]
-
-default_input_device = hw:0,0
-default_output_device = hw:0,0
-period_time = 0.010 # in seconds
-nperiods = 4 # total buffering = period_time * nperiods
-verbose = false
diff --git a/gr-audio-alsa/src/.gitignore b/gr-audio-alsa/src/.gitignore
deleted file mode 100644
index 8de8fe39c..000000000
--- a/gr-audio-alsa/src/.gitignore
+++ /dev/null
@@ -1,20 +0,0 @@
-/Makefile
-/Makefile.in
-/.la
-/.lo
-/.deps
-/.libs
-/*.la
-/*.lo
-/usrp.py
-/usrp.cc
-/audio_oss.cc
-/audio_oss.py
-/audio_alsa.py
-/audio_alsa.cc
-/run_tests
-/run_guile_tests
-/*.pyc
-/gnuradio
-/guile
-/python
diff --git a/gr-audio-alsa/src/Makefile.am b/gr-audio-alsa/src/Makefile.am
deleted file mode 100644
index 330158aa5..000000000
--- a/gr-audio-alsa/src/Makefile.am
+++ /dev/null
@@ -1,88 +0,0 @@
-#
-# Copyright 2004,2008,2009,2010 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 $(top_srcdir)/Makefile.common
-include $(top_srcdir)/Makefile.swig
-
-TESTS =
-EXTRA_DIST += run_tests.in run_guile_tests.in
-DISTCLEANFILES += run_tests run_guile_tests
-
-# C/C++ headers get installed in ${prefix}/include/gnuradio
-grinclude_HEADERS = \
- audio_alsa_sink.h \
- audio_alsa_source.h
-
-noinst_HEADERS = \
- gri_alsa.h
-
-noinst_PYTHON = \
- qa_audio_alsa.py
-
-noinst_GUILE = \
- audio_alsa.test
-
-
-AM_CPPFLAGS = $(STD_DEFINES_AND_INCLUDES) $(PYTHON_CPPFLAGS) $(WITH_INCLUDES)
-
-# ------------------------------------------------------------------------
-# ALSA C++ library, including OS interface, sink, and source
-
-lib_LTLIBRARIES = libgnuradio-audio-alsa.la
-
-libgnuradio_audio_alsa_la_SOURCES = \
- audio_alsa_sink.cc \
- audio_alsa_source.cc \
- gri_alsa.cc
-
-libgnuradio_audio_alsa_la_LIBADD = \
- $(GNURADIO_CORE_LA) \
- $(ALSA_LIBS)
-
-libgnuradio_audio_alsa_la_LDFLAGS = $(NO_UNDEFINED) $(LTVERSIONFLAGS)
-
-
-# ------------------------------------------------------------------------
-# SWIG generated bindings
-
-TOP_SWIG_IFILES = \
- audio_alsa.i
-
-# Install so that they end up available as:
-# import gnuradio.audio_alsa
-# This ends up at:
-# ${prefix}/lib/python${python_version}/site-packages/gnuradio
-audio_alsa_pythondir_category = \
- gnuradio
-
-# additional libraries for linking with the SWIG-generated library
-audio_alsa_la_swig_libadd = \
- libgnuradio-audio-alsa.la
-
-if PYTHON
-TESTS += run_tests
-endif
-
-if GUILE
-TESTS += run_guile_tests
-endif
-
-
diff --git a/gr-audio-alsa/src/Makefile.swig.gen b/gr-audio-alsa/src/Makefile.swig.gen
deleted file mode 100644
index 785095d96..000000000
--- a/gr-audio-alsa/src/Makefile.swig.gen
+++ /dev/null
@@ -1,145 +0,0 @@
-# -*- Makefile -*-
-#
-# Copyright 2009 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.
-#
-
-# Makefile.swig.gen for audio_alsa.i
-
-## Default install locations for these files:
-##
-## Default location for the Python directory is:
-## ${prefix}/lib/python${python_version}/site-packages/[category]/audio_alsa
-## Default location for the Python exec directory is:
-## ${exec_prefix}/lib/python${python_version}/site-packages/[category]/audio_alsa
-##
-## The following can be overloaded to change the install location, but
-## this has to be done in the including Makefile.am -before-
-## Makefile.swig is included.
-
-audio_alsa_pythondir_category ?= gnuradio/audio_alsa
-audio_alsa_pylibdir_category ?= $(audio_alsa_pythondir_category)
-audio_alsa_pythondir = $(pythondir)/$(audio_alsa_pythondir_category)
-audio_alsa_pylibdir = $(pyexecdir)/$(audio_alsa_pylibdir_category)
-
-# The .so libraries for the guile modules get installed whereever guile
-# is installed, usually /usr/lib/guile/gnuradio/
-# FIXME: determince whether these should be installed with gnuradio.
-audio_alsa_scmlibdir = $(libdir)
-
-# The scm files for the guile modules get installed where ever guile
-# is installed, usually /usr/share/guile/site/audio_alsa
-# FIXME: determince whether these should be installed with gnuradio.
-audio_alsa_scmdir = $(guiledir)
-
-## SWIG headers are always installed into the same directory.
-
-audio_alsa_swigincludedir = $(swigincludedir)
-
-## This is a template file for a "generated" Makefile addition (in
-## this case, "Makefile.swig.gen"). By including the top-level
-## Makefile.swig, this file will be used to generate the SWIG
-## dependencies. Assign the variable TOP_SWIG_FILES to be the list of
-## SWIG .i files to generated wrappings for; there can be more than 1
-## so long as the names are unique (no sorting is done on the
-## TOP_SWIG_FILES list). This file explicitly assumes that a SWIG .i
-## file will generate .cc, .py, and possibly .h files -- meaning that
-## all of these files will have the same base name (that provided for
-## the SWIG .i file).
-##
-## This code is setup to ensure parallel MAKE ("-j" or "-jN") does the
-## right thing. For more info, see <
-## http://sources.redhat.com/automake/automake.html#Multiple-Outputs >
-
-## Other cleaned files: dependency files generated by SWIG or this Makefile
-
-MOSTLYCLEANFILES += $(DEPDIR)/*.S*
-
-## Various SWIG variables. These can be overloaded in the including
-## Makefile.am by setting the variable value there, then including
-## Makefile.swig .
-
-audio_alsa_swiginclude_HEADERS = \
- audio_alsa.i \
- $(audio_alsa_swiginclude_headers)
-
-if PYTHON
-audio_alsa_pylib_LTLIBRARIES = \
- _audio_alsa.la
-
-_audio_alsa_la_SOURCES = \
- python/audio_alsa.cc \
- $(audio_alsa_la_swig_sources)
-
-audio_alsa_python_PYTHON = \
- audio_alsa.py \
- $(audio_alsa_python)
-
-_audio_alsa_la_LIBADD = \
- $(STD_SWIG_LA_LIB_ADD) \
- $(audio_alsa_la_swig_libadd)
-
-_audio_alsa_la_LDFLAGS = \
- $(STD_SWIG_LA_LD_FLAGS) \
- $(audio_alsa_la_swig_ldflags)
-
-_audio_alsa_la_CXXFLAGS = \
- $(STD_SWIG_CXX_FLAGS) \
- -I$(top_builddir) \
- $(audio_alsa_la_swig_cxxflags)
-
-python/audio_alsa.cc: audio_alsa.py
-audio_alsa.py: audio_alsa.i
-
-# Include the python dependencies for this file
--include python/audio_alsa.d
-
-endif # end of if python
-
-if GUILE
-
-audio_alsa_scmlib_LTLIBRARIES = \
- libguile-gnuradio-audio_alsa.la
-libguile_gnuradio_audio_alsa_la_SOURCES = \
- guile/audio_alsa.cc \
- $(audio_alsa_la_swig_sources)
-nobase_audio_alsa_scm_DATA = \
- gnuradio/audio_alsa.scm \
- gnuradio/audio_alsa-primitive.scm
-libguile_gnuradio_audio_alsa_la_LIBADD = \
- $(STD_SWIG_LA_LIB_ADD) \
- $(audio_alsa_la_swig_libadd)
-libguile_gnuradio_audio_alsa_la_LDFLAGS = \
- $(STD_SWIG_LA_LD_FLAGS) \
- $(audio_alsa_la_swig_ldflags)
-libguile_gnuradio_audio_alsa_la_CXXFLAGS = \
- $(STD_SWIG_CXX_FLAGS) \
- -I$(top_builddir) \
- $(audio_alsa_la_swig_cxxflags)
-
-guile/audio_alsa.cc: gnuradio/audio_alsa.scm
-gnuradio/audio_alsa.scm: audio_alsa.i
-gnuradio/audio_alsa-primitive.scm: gnuradio/audio_alsa.scm
-
-# Include the guile dependencies for this file
--include guile/audio_alsa.d
-
-endif # end of GUILE
-
-
diff --git a/gr-audio-alsa/src/audio_alsa.i b/gr-audio-alsa/src/audio_alsa.i
deleted file mode 100644
index 215acf33d..000000000
--- a/gr-audio-alsa/src/audio_alsa.i
+++ /dev/null
@@ -1,85 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2004,2006,2009 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 "gnuradio.i" // the common stuff
-
-%{
-#include "audio_alsa_sink.h"
-#include "audio_alsa_source.h"
-%}
-
-// ----------------------------------------------------------------
-
-GR_SWIG_BLOCK_MAGIC(audio_alsa,source)
-
-audio_alsa_source_sptr
-audio_alsa_make_source (int sampling_rate,
- const std::string dev = "",
- bool ok_to_block = true
- ) throw (std::runtime_error);
-
-class audio_alsa_source : public gr_sync_block {
-
- protected:
- audio_alsa_source (int sampling_rate,
- const std::string device_name,
- bool ok_to_block = true
- ) throw (std::runtime_error);
-
- public:
- ~audio_alsa_source ();
-
- bool start();
- bool stop();
-};
-
-// ----------------------------------------------------------------
-
-GR_SWIG_BLOCK_MAGIC(audio_alsa,sink)
-
-audio_alsa_sink_sptr
-audio_alsa_make_sink (int sampling_rate,
- const std::string dev = "",
- bool ok_to_block = true
- ) throw (std::runtime_error);
-
-class audio_alsa_sink : public gr_sync_block {
-
- protected:
- audio_alsa_sink (int sampling_rate,
- const std::string device_name,
- bool ok_to_block
- ) throw (std::runtime_error);
-
- public:
- ~audio_alsa_sink ();
-};
-
-#if SWIGGUILE
-%scheme %{
-(load-extension-global "libguile-gnuradio-audio_alsa" "scm_init_gnuradio_audio_alsa_module")
-%}
-
-%goops %{
-(use-modules (gnuradio gnuradio_core_runtime))
-%}
-#endif
diff --git a/gr-audio-alsa/src/audio_alsa.test b/gr-audio-alsa/src/audio_alsa.test
deleted file mode 100644
index 7997b9283..000000000
--- a/gr-audio-alsa/src/audio_alsa.test
+++ /dev/null
@@ -1,37 +0,0 @@
-;;; -*- Scheme -*-
-;;;
-;;; Copyright 2010 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 this program. If not, see <http://www.gnu.org/licenses/>.
-;;;
-
-;;; If you're using Emacs's Scheme mode:
-;;; (put 'with-test-prefix 'scheme-indent-function 1)
-
-;;; See the comments in gnuradio/test-suite/lib.scm for info on writing tests.
-;;; See also the very end of the file, where the test-equal, test-eqv
-;;; and test-eq macros are defined.
-
-(define-module (test-module)
- #:use-module (oop goops)
- #:use-module (gnuradio core)
- #:use-module (gnuradio test-suite lib)
- #:duplicates (merge-generics replace check))
-
-;;; Just see if we can import the module...
-;;; They may not have ALSA drivers, etc.
-
-(use-modules (gnuradio audio_alsa))
diff --git a/gr-audio-alsa/src/audio_alsa_sink.cc b/gr-audio-alsa/src/audio_alsa_sink.cc
deleted file mode 100644
index d44a93b3f..000000000
--- a/gr-audio-alsa/src/audio_alsa_sink.cc
+++ /dev/null
@@ -1,551 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2004,2010 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 <audio_alsa_sink.h>
-#include <gr_io_signature.h>
-#include <gr_prefs.h>
-#include <stdio.h>
-#include <iostream>
-#include <stdexcept>
-#include <gri_alsa.h>
-
-
-static bool CHATTY_DEBUG = false;
-
-
-static snd_pcm_format_t acceptable_formats[] = {
- // these are in our preferred order...
- SND_PCM_FORMAT_S32,
- SND_PCM_FORMAT_S16
-};
-
-#define NELEMS(x) (sizeof(x)/sizeof(x[0]))
-
-
-static std::string
-default_device_name ()
-{
- return gr_prefs::singleton()->get_string("audio_alsa", "default_output_device", "hw:0,0");
-}
-
-static double
-default_period_time ()
-{
- return std::max(0.001, gr_prefs::singleton()->get_double("audio_alsa", "period_time", 0.010));
-}
-
-static int
-default_nperiods ()
-{
- return std::max(2L, gr_prefs::singleton()->get_long("audio_alsa", "nperiods", 4));
-}
-
-// ----------------------------------------------------------------
-
-audio_alsa_sink_sptr
-audio_alsa_make_sink (int sampling_rate,
- const std::string dev,
- bool ok_to_block)
-{
- return gnuradio::get_initial_sptr(new audio_alsa_sink (sampling_rate, dev,
- ok_to_block));
-}
-
-audio_alsa_sink::audio_alsa_sink (int sampling_rate,
- const std::string device_name,
- bool ok_to_block)
- : gr_sync_block ("audio_alsa_sink",
- gr_make_io_signature (0, 0, 0),
- gr_make_io_signature (0, 0, 0)),
- d_sampling_rate (sampling_rate),
- d_device_name (device_name.empty() ? default_device_name() : device_name),
- d_pcm_handle (0),
- d_hw_params ((snd_pcm_hw_params_t *)(new char[snd_pcm_hw_params_sizeof()])),
- d_sw_params ((snd_pcm_sw_params_t *)(new char[snd_pcm_sw_params_sizeof()])),
- d_nperiods (default_nperiods()),
- d_period_time_us ((unsigned int) (default_period_time() * 1e6)),
- d_period_size (0),
- d_buffer_size_bytes (0), d_buffer (0),
- d_worker (0), d_special_case_mono_to_stereo (false),
- d_nunderuns (0), d_nsuspends (0), d_ok_to_block(ok_to_block)
-{
- CHATTY_DEBUG = gr_prefs::singleton()->get_bool("audio_alsa", "verbose", false);
-
- int error;
- int dir;
-
- // open the device for playback
- error = snd_pcm_open(&d_pcm_handle, d_device_name.c_str (),
- SND_PCM_STREAM_PLAYBACK, 0);
- if (ok_to_block == false)
- snd_pcm_nonblock(d_pcm_handle, !ok_to_block);
- if (error < 0){
- fprintf (stderr, "audio_alsa_sink[%s]: %s\n",
- d_device_name.c_str(), snd_strerror(error));
- throw std::runtime_error ("audio_alsa_sink");
- }
-
- // Fill params with a full configuration space for a PCM.
- error = snd_pcm_hw_params_any(d_pcm_handle, d_hw_params);
- if (error < 0)
- bail ("broken configuration for playback", error);
-
-
- if (CHATTY_DEBUG)
- gri_alsa_dump_hw_params (d_pcm_handle, d_hw_params, stdout);
-
-
- // now that we know how many channels the h/w can handle, set input signature
- unsigned int umin_chan, umax_chan;
- snd_pcm_hw_params_get_channels_min (d_hw_params, &umin_chan);
- snd_pcm_hw_params_get_channels_max (d_hw_params, &umax_chan);
- int min_chan = std::min (umin_chan, 1000U);
- int max_chan = std::min (umax_chan, 1000U);
-
- // As a special case, if the hw's min_chan is two, we'll accept
- // a single input and handle the duplication ourselves.
-
- if (min_chan == 2){
- min_chan = 1;
- d_special_case_mono_to_stereo = true;
- }
- set_input_signature (gr_make_io_signature (min_chan, max_chan,
- sizeof (float)));
-
- // fill in portions of the d_hw_params that we know now...
-
- // Specify the access methods we implement
- // For now, we only handle RW_INTERLEAVED...
- snd_pcm_access_mask_t *access_mask;
- snd_pcm_access_mask_t **access_mask_ptr = &access_mask; // FIXME: workaround for compiler warning
- snd_pcm_access_mask_alloca (access_mask_ptr);
- snd_pcm_access_mask_none (access_mask);
- snd_pcm_access_mask_set (access_mask, SND_PCM_ACCESS_RW_INTERLEAVED);
- // snd_pcm_access_mask_set (access_mask, SND_PCM_ACCESS_RW_NONINTERLEAVED);
-
- if ((error = snd_pcm_hw_params_set_access_mask (d_pcm_handle,
- d_hw_params, access_mask)) < 0)
- bail ("failed to set access mask", error);
-
-
- // set sample format
- if (!gri_alsa_pick_acceptable_format (d_pcm_handle, d_hw_params,
- acceptable_formats,
- NELEMS (acceptable_formats),
- &d_format,
- "audio_alsa_sink",
- CHATTY_DEBUG))
- throw std::runtime_error ("audio_alsa_sink");
-
-
- // sampling rate
- unsigned int orig_sampling_rate = d_sampling_rate;
- if ((error = snd_pcm_hw_params_set_rate_near (d_pcm_handle, d_hw_params,
- &d_sampling_rate, 0)) < 0)
- bail ("failed to set rate near", error);
-
- if (orig_sampling_rate != d_sampling_rate){
- fprintf (stderr, "audio_alsa_sink[%s]: unable to support sampling rate %d\n",
- snd_pcm_name (d_pcm_handle), orig_sampling_rate);
- fprintf (stderr, " card requested %d instead.\n", d_sampling_rate);
- }
-
- /*
- * ALSA transfers data in units of "periods".
- * We indirectly determine the underlying buffersize by specifying
- * the number of periods we want (typically 4) and the length of each
- * period in units of time (typically 1ms).
- */
- unsigned int min_nperiods, max_nperiods;
- snd_pcm_hw_params_get_periods_min (d_hw_params, &min_nperiods, &dir);
- snd_pcm_hw_params_get_periods_max (d_hw_params, &max_nperiods, &dir);
- //fprintf (stderr, "alsa_sink: min_nperiods = %d, max_nperiods = %d\n",
- // min_nperiods, max_nperiods);
-
- unsigned int orig_nperiods = d_nperiods;
- d_nperiods = std::min (std::max (min_nperiods, d_nperiods), max_nperiods);
-
- // adjust period time so that total buffering remains more-or-less constant
- d_period_time_us = (d_period_time_us * orig_nperiods) / d_nperiods;
-
- error = snd_pcm_hw_params_set_periods (d_pcm_handle, d_hw_params,
- d_nperiods, 0);
- if (error < 0)
- bail ("set_periods failed", error);
-
- dir = 0;
- error = snd_pcm_hw_params_set_period_time_near (d_pcm_handle, d_hw_params,
- &d_period_time_us, &dir);
- if (error < 0)
- bail ("set_period_time_near failed", error);
-
- dir = 0;
- error = snd_pcm_hw_params_get_period_size (d_hw_params,
- &d_period_size, &dir);
- if (error < 0)
- bail ("get_period_size failed", error);
-
- set_output_multiple (d_period_size);
-}
-
-
-bool
-audio_alsa_sink::check_topology (int ninputs, int noutputs)
-{
- // ninputs is how many channels the user has connected.
- // Now we can finish up setting up the hw params...
-
- int nchan = ninputs;
- int err;
-
- // 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_mono_to_stereo;
- if (special_case)
- nchan = 2;
-
- err = snd_pcm_hw_params_set_channels (d_pcm_handle, d_hw_params, nchan);
-
- if (err < 0){
- output_error_msg ("set_channels failed", err);
- return false;
- }
-
- // set the parameters into the driver...
- err = snd_pcm_hw_params(d_pcm_handle, d_hw_params);
- if (err < 0){
- output_error_msg ("snd_pcm_hw_params failed", err);
- return false;
- }
-
- // get current s/w params
- err = snd_pcm_sw_params_current (d_pcm_handle, d_sw_params);
- if (err < 0)
- bail ("snd_pcm_sw_params_current", err);
-
- // Tell the PCM device to wait to start until we've filled
- // it's buffers half way full. This helps avoid audio underruns.
-
- err = snd_pcm_sw_params_set_start_threshold(d_pcm_handle,
- d_sw_params,
- d_nperiods * d_period_size / 2);
- if (err < 0)
- bail ("snd_pcm_sw_params_set_start_threshold", err);
-
- // store the s/w params
- err = snd_pcm_sw_params (d_pcm_handle, d_sw_params);
- if (err < 0)
- bail ("snd_pcm_sw_params", err);
-
- d_buffer_size_bytes =
- d_period_size * nchan * snd_pcm_format_size (d_format, 1);
-
- d_buffer = new char [d_buffer_size_bytes];
-
- if (CHATTY_DEBUG)
- fprintf (stdout, "audio_alsa_sink[%s]: sample resolution = %d bits\n",
- snd_pcm_name (d_pcm_handle),
- snd_pcm_hw_params_get_sbits (d_hw_params));
-
- switch (d_format){
- case SND_PCM_FORMAT_S16:
- if (special_case)
- d_worker = &audio_alsa_sink::work_s16_1x2;
- else
- d_worker = &audio_alsa_sink::work_s16;
- break;
-
- case SND_PCM_FORMAT_S32:
- if (special_case)
- d_worker = &audio_alsa_sink::work_s32_1x2;
- else
- d_worker = &audio_alsa_sink::work_s32;
- break;
-
- default:
- assert (0);
- }
- return true;
-}
-
-audio_alsa_sink::~audio_alsa_sink ()
-{
- if (snd_pcm_state (d_pcm_handle) == SND_PCM_STATE_RUNNING)
- snd_pcm_drop (d_pcm_handle);
-
- snd_pcm_close(d_pcm_handle);
- delete [] ((char *) d_hw_params);
- delete [] ((char *) d_sw_params);
- delete [] d_buffer;
-}
-
-int
-audio_alsa_sink::work (int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items)
-{
- assert ((noutput_items % d_period_size) == 0);
-
- // this is a call through a pointer to a method...
- return (this->*d_worker)(noutput_items, input_items, output_items);
-}
-
-/*
- * Work function that deals with float to S16 conversion
- */
-int
-audio_alsa_sink::work_s16 (int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items)
-{
- typedef gr_int16 sample_t; // the type of samples we're creating
- static const int NBITS = 16; // # of bits in a sample
-
- unsigned int nchan = input_items.size ();
- const float **in = (const float **) &input_items[0];
- sample_t *buf = (sample_t *) d_buffer;
- int bi;
- int n;
-
- unsigned int sizeof_frame = nchan * sizeof (sample_t);
- assert (d_buffer_size_bytes == d_period_size * sizeof_frame);
-
- for (n = 0; n < noutput_items; n += d_period_size){
-
- // process one period of data
- bi = 0;
- for (unsigned int i = 0; i < d_period_size; i++){
- for (unsigned int chan = 0; chan < nchan; chan++){
- buf[bi++] = (sample_t) (in[chan][i] * (float) ((1L << (NBITS-1)) - 1));
- }
- }
-
- // update src pointers
- for (unsigned int chan = 0; chan < nchan; chan++)
- in[chan] += d_period_size;
-
- if (!write_buffer (buf, d_period_size, sizeof_frame))
- return -1; // No fixing this problem. Say we're done.
- }
-
- return n;
-}
-
-
-/*
- * Work function that deals with float to S32 conversion
- */
-int
-audio_alsa_sink::work_s32 (int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items)
-{
- typedef gr_int32 sample_t; // the type of samples we're creating
- static const int NBITS = 32; // # of bits in a sample
-
- unsigned int nchan = input_items.size ();
- const float **in = (const float **) &input_items[0];
- sample_t *buf = (sample_t *) d_buffer;
- int bi;
- int n;
-
- unsigned int sizeof_frame = nchan * sizeof (sample_t);
- assert (d_buffer_size_bytes == d_period_size * sizeof_frame);
-
- for (n = 0; n < noutput_items; n += d_period_size){
-
- // process one period of data
- bi = 0;
- for (unsigned int i = 0; i < d_period_size; i++){
- for (unsigned int chan = 0; chan < nchan; chan++){
- buf[bi++] = (sample_t) (in[chan][i] * (float) ((1L << (NBITS-1)) - 1));
- }
- }
-
- // update src pointers
- for (unsigned int chan = 0; chan < nchan; chan++)
- in[chan] += d_period_size;
-
- if (!write_buffer (buf, d_period_size, sizeof_frame))
- return -1; // No fixing this problem. Say we're done.
- }
-
- return n;
-}
-
-/*
- * Work function that deals with float to S16 conversion and
- * mono to stereo kludge.
- */
-int
-audio_alsa_sink::work_s16_1x2 (int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items)
-{
- typedef gr_int16 sample_t; // the type of samples we're creating
- static const int NBITS = 16; // # of bits in a sample
-
- assert (input_items.size () == 1);
- static const unsigned int nchan = 2;
- const float **in = (const float **) &input_items[0];
- sample_t *buf = (sample_t *) d_buffer;
- int bi;
- int n;
-
- unsigned int sizeof_frame = nchan * sizeof (sample_t);
- assert (d_buffer_size_bytes == d_period_size * sizeof_frame);
-
- for (n = 0; n < noutput_items; n += d_period_size){
-
- // process one period of data
- bi = 0;
- for (unsigned int i = 0; i < d_period_size; i++){
- sample_t t = (sample_t) (in[0][i] * (float) ((1L << (NBITS-1)) - 1));
- buf[bi++] = t;
- buf[bi++] = t;
- }
-
- // update src pointers
- in[0] += d_period_size;
-
- if (!write_buffer (buf, d_period_size, sizeof_frame))
- return -1; // No fixing this problem. Say we're done.
- }
-
- return n;
-}
-
-/*
- * Work function that deals with float to S32 conversion and
- * mono to stereo kludge.
- */
-int
-audio_alsa_sink::work_s32_1x2 (int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items)
-{
- typedef gr_int32 sample_t; // the type of samples we're creating
- static const int NBITS = 32; // # of bits in a sample
-
- assert (input_items.size () == 1);
- static unsigned int nchan = 2;
- const float **in = (const float **) &input_items[0];
- sample_t *buf = (sample_t *) d_buffer;
- int bi;
- int n;
-
- unsigned int sizeof_frame = nchan * sizeof (sample_t);
- assert (d_buffer_size_bytes == d_period_size * sizeof_frame);
-
- for (n = 0; n < noutput_items; n += d_period_size){
-
- // process one period of data
- bi = 0;
- for (unsigned int i = 0; i < d_period_size; i++){
- sample_t t = (sample_t) (in[0][i] * (float) ((1L << (NBITS-1)) - 1));
- buf[bi++] = t;
- buf[bi++] = t;
- }
-
- // update src pointers
- in[0] += d_period_size;
-
- if (!write_buffer (buf, d_period_size, sizeof_frame))
- return -1; // No fixing this problem. Say we're done.
- }
-
- return n;
-}
-
-bool
-audio_alsa_sink::write_buffer (const void *vbuffer,
- unsigned nframes, unsigned sizeof_frame)
-{
- const unsigned char *buffer = (const unsigned char *) vbuffer;
-
- while (nframes > 0){
- int r = snd_pcm_writei (d_pcm_handle, buffer, nframes);
- if (r == -EAGAIN)
- {
- if (d_ok_to_block == true)
- continue; // try again
-
- break;
- }
-
- else if (r == -EPIPE){ // underrun
- d_nunderuns++;
- fputs ("aU", stderr);
- if ((r = snd_pcm_prepare (d_pcm_handle)) < 0){
- output_error_msg ("snd_pcm_prepare failed. Can't recover from underrun", r);
- return false;
- }
- continue; // try again
- }
-
- else if (r == -ESTRPIPE){ // h/w is suspended (whatever that means)
- // This is apparently related to power management
- d_nsuspends++;
- if ((r = snd_pcm_resume (d_pcm_handle)) < 0){
- output_error_msg ("failed to resume from suspend", r);
- return false;
- }
- continue; // try again
- }
-
- else if (r < 0){
- output_error_msg ("snd_pcm_writei failed", r);
- return false;
- }
-
- nframes -= r;
- buffer += r * sizeof_frame;
- }
-
- return true;
-}
-
-
-void
-audio_alsa_sink::output_error_msg (const char *msg, int err)
-{
- fprintf (stderr, "audio_alsa_sink[%s]: %s: %s\n",
- snd_pcm_name (d_pcm_handle), msg, snd_strerror (err));
-}
-
-void
-audio_alsa_sink::bail (const char *msg, int err) throw (std::runtime_error)
-{
- output_error_msg (msg, err);
- throw std::runtime_error ("audio_alsa_sink");
-}
diff --git a/gr-audio-alsa/src/audio_alsa_sink.h b/gr-audio-alsa/src/audio_alsa_sink.h
deleted file mode 100644
index f3007f60f..000000000
--- a/gr-audio-alsa/src/audio_alsa_sink.h
+++ /dev/null
@@ -1,125 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2004 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_AUDIO_ALSA_SINK_H
-#define INCLUDED_AUDIO_ALSA_SINK_H
-
-// use new ALSA API
-#define ALSA_PCM_NEW_HW_PARAMS_API
-#define ALSA_PCM_NEW_SW_PARAMS_API
-
-#include <gr_sync_block.h>
-#include <string>
-#include <alsa/asoundlib.h>
-#include <stdexcept>
-
-
-class audio_alsa_sink;
-typedef boost::shared_ptr<audio_alsa_sink> audio_alsa_sink_sptr;
-
-/*!
- * \brief make an alsa audio sink.
- *
- * \param sampling_rate sampling rate in Hz
- * \param device_name ALSA pcm device name, e.g., "hw:0,0"
- * \param ok_to_block (currently ignored)
- */
-audio_alsa_sink_sptr
-audio_alsa_make_sink (int sampling_rate,
- const std::string device_name = "",
- bool ok_to_block = true);
-
-/*!
- * \brief audio sink using ALSA
- *
- * The sink has N input streams of floats, where N depends
- * on the hardware characteristics of the selected device.
- *
- * Input samples must be in the range [-1,1].
- */
-class audio_alsa_sink : public gr_sync_block {
- friend audio_alsa_sink_sptr
- audio_alsa_make_sink (int sampling_rate, const std::string device_name,
- bool ok_to_block);
-
- // typedef for pointer to class work method
- typedef int (audio_alsa_sink::*work_t)(int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items);
-
- unsigned int d_sampling_rate;
- std::string d_device_name;
- snd_pcm_t *d_pcm_handle;
- snd_pcm_hw_params_t *d_hw_params;
- snd_pcm_sw_params_t *d_sw_params;
- snd_pcm_format_t d_format;
- unsigned int d_nperiods;
- unsigned int d_period_time_us; // microseconds
- snd_pcm_uframes_t d_period_size; // in frames
- unsigned int d_buffer_size_bytes; // sizeof of d_buffer
- char *d_buffer;
- work_t d_worker; // the work method to use
- bool d_special_case_mono_to_stereo;
-
- // random stats
- int d_nunderuns; // count of underruns
- int d_nsuspends; // count of suspends
- bool d_ok_to_block; // defaults to "true", controls blocking/non-block I/O
-
- void output_error_msg (const char *msg, int err);
- void bail (const char *msg, int err) throw (std::runtime_error);
-
- protected:
- audio_alsa_sink (int sampling_rate, const std::string device_name,
- bool ok_to_block);
-
- public:
- ~audio_alsa_sink ();
-
- bool check_topology (int ninputs, int noutputs);
-
- int work (int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items);
-
-
-protected:
- bool write_buffer (const void *buffer, unsigned nframes, unsigned sizeof_frame);
-
- int work_s16 (int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items);
-
- int work_s16_1x2 (int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items);
-
- int work_s32 (int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items);
-
- int work_s32_1x2 (int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items);
-};
-
-#endif /* INCLUDED_AUDIO_ALSA_SINK_H */
diff --git a/gr-audio-alsa/src/audio_alsa_source.cc b/gr-audio-alsa/src/audio_alsa_source.cc
deleted file mode 100644
index 7b3d91b9d..000000000
--- a/gr-audio-alsa/src/audio_alsa_source.cc
+++ /dev/null
@@ -1,507 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2004,2006,2010 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 <audio_alsa_source.h>
-#include <gr_io_signature.h>
-#include <gr_prefs.h>
-#include <stdio.h>
-#include <iostream>
-#include <stdexcept>
-#include <gri_alsa.h>
-
-
-static bool CHATTY_DEBUG = false;
-
-static snd_pcm_format_t acceptable_formats[] = {
- // these are in our preferred order...
- SND_PCM_FORMAT_S32,
- SND_PCM_FORMAT_S16
-};
-
-#define NELEMS(x) (sizeof(x)/sizeof(x[0]))
-
-
-static std::string
-default_device_name ()
-{
- return gr_prefs::singleton()->get_string("audio_alsa", "default_input_device", "hw:0,0");
-}
-
-static double
-default_period_time ()
-{
- return std::max(0.001, gr_prefs::singleton()->get_double("audio_alsa", "period_time", 0.010));
-}
-
-static int
-default_nperiods ()
-{
- return std::max(2L, gr_prefs::singleton()->get_long("audio_alsa", "nperiods", 4));
-}
-
-// ----------------------------------------------------------------
-
-audio_alsa_source_sptr
-audio_alsa_make_source (int sampling_rate, const std::string dev,
- bool ok_to_block)
-{
- return gnuradio::get_initial_sptr(new audio_alsa_source (sampling_rate, dev,
- ok_to_block));
-}
-
-audio_alsa_source::audio_alsa_source (int sampling_rate,
- const std::string device_name,
- bool ok_to_block)
- : gr_sync_block ("audio_alsa_source",
- gr_make_io_signature (0, 0, 0),
- gr_make_io_signature (0, 0, 0)),
- d_sampling_rate (sampling_rate),
- d_device_name (device_name.empty() ? default_device_name() : device_name),
- d_pcm_handle (0),
- d_hw_params ((snd_pcm_hw_params_t *)(new char[snd_pcm_hw_params_sizeof()])),
- d_sw_params ((snd_pcm_sw_params_t *)(new char[snd_pcm_sw_params_sizeof()])),
- d_nperiods (default_nperiods()),
- d_period_time_us ((unsigned int) (default_period_time() * 1e6)),
- d_period_size (0),
- d_buffer_size_bytes (0), d_buffer (0),
- d_worker (0), d_hw_nchan (0),
- d_special_case_stereo_to_mono (false),
- d_noverruns (0), d_nsuspends (0)
-{
-
- CHATTY_DEBUG = gr_prefs::singleton()->get_bool("audio_alsa", "verbose", false);
-
- int error;
- int dir;
-
- // open the device for capture
- error = snd_pcm_open(&d_pcm_handle, d_device_name.c_str (),
- SND_PCM_STREAM_CAPTURE, 0);
- if (error < 0){
- fprintf (stderr, "audio_alsa_source[%s]: %s\n",
- d_device_name.c_str(), snd_strerror(error));
- throw std::runtime_error ("audio_alsa_source");
- }
-
- // Fill params with a full configuration space for a PCM.
- error = snd_pcm_hw_params_any(d_pcm_handle, d_hw_params);
- if (error < 0)
- bail ("broken configuration for playback", error);
-
- if (CHATTY_DEBUG)
- gri_alsa_dump_hw_params (d_pcm_handle, d_hw_params, stdout);
-
- // now that we know how many channels the h/w can handle, set output signature
- unsigned int umax_chan;
- unsigned int umin_chan;
- snd_pcm_hw_params_get_channels_min (d_hw_params, &umin_chan);
- snd_pcm_hw_params_get_channels_max (d_hw_params, &umax_chan);
- int min_chan = std::min (umin_chan, 1000U);
- int max_chan = std::min (umax_chan, 1000U);
-
- // As a special case, if the hw's min_chan is two, we'll accept
- // a single output and handle the demux ourselves.
-
- if (min_chan == 2){
- min_chan = 1;
- d_special_case_stereo_to_mono = true;
- }
-
- set_output_signature (gr_make_io_signature (min_chan, max_chan,
- sizeof (float)));
-
- // fill in portions of the d_hw_params that we know now...
-
- // Specify the access methods we implement
- // For now, we only handle RW_INTERLEAVED...
- snd_pcm_access_mask_t *access_mask;
- snd_pcm_access_mask_t **access_mask_ptr = &access_mask; // FIXME: workaround for compiler warning
- snd_pcm_access_mask_alloca (access_mask_ptr);
- snd_pcm_access_mask_none (access_mask);
- snd_pcm_access_mask_set (access_mask, SND_PCM_ACCESS_RW_INTERLEAVED);
- // snd_pcm_access_mask_set (access_mask, SND_PCM_ACCESS_RW_NONINTERLEAVED);
-
- if ((error = snd_pcm_hw_params_set_access_mask (d_pcm_handle,
- d_hw_params, access_mask)) < 0)
- bail ("failed to set access mask", error);
-
-
- // set sample format
- if (!gri_alsa_pick_acceptable_format (d_pcm_handle, d_hw_params,
- acceptable_formats,
- NELEMS (acceptable_formats),
- &d_format,
- "audio_alsa_source",
- CHATTY_DEBUG))
- throw std::runtime_error ("audio_alsa_source");
-
-
- // sampling rate
- unsigned int orig_sampling_rate = d_sampling_rate;
- if ((error = snd_pcm_hw_params_set_rate_near (d_pcm_handle, d_hw_params,
- &d_sampling_rate, 0)) < 0)
- bail ("failed to set rate near", error);
-
- if (orig_sampling_rate != d_sampling_rate){
- fprintf (stderr, "audio_alsa_source[%s]: unable to support sampling rate %d\n",
- snd_pcm_name (d_pcm_handle), orig_sampling_rate);
- fprintf (stderr, " card requested %d instead.\n", d_sampling_rate);
- }
-
- /*
- * ALSA transfers data in units of "periods".
- * We indirectly determine the underlying buffersize by specifying
- * the number of periods we want (typically 4) and the length of each
- * period in units of time (typically 1ms).
- */
- unsigned int min_nperiods, max_nperiods;
- snd_pcm_hw_params_get_periods_min (d_hw_params, &min_nperiods, &dir);
- snd_pcm_hw_params_get_periods_max (d_hw_params, &max_nperiods, &dir);
- //fprintf (stderr, "alsa_source: min_nperiods = %d, max_nperiods = %d\n",
- // min_nperiods, max_nperiods);
-
-
- unsigned int orig_nperiods = d_nperiods;
- d_nperiods = std::min (std::max (min_nperiods, d_nperiods), max_nperiods);
-
- // adjust period time so that total buffering remains more-or-less constant
- d_period_time_us = (d_period_time_us * orig_nperiods) / d_nperiods;
-
- error = snd_pcm_hw_params_set_periods (d_pcm_handle, d_hw_params,
- d_nperiods, 0);
- if (error < 0)
- bail ("set_periods failed", error);
-
- dir = 0;
- error = snd_pcm_hw_params_set_period_time_near (d_pcm_handle, d_hw_params,
- &d_period_time_us, &dir);
- if (error < 0)
- bail ("set_period_time_near failed", error);
-
- dir = 0;
- error = snd_pcm_hw_params_get_period_size (d_hw_params,
- &d_period_size, &dir);
- if (error < 0)
- bail ("get_period_size failed", error);
-
- set_output_multiple (d_period_size);
-}
-
-bool
-audio_alsa_source::check_topology (int ninputs, int noutputs)
-{
- // noutputs is how many channels the user has connected.
- // Now we can finish up setting up the hw params...
-
- unsigned int nchan = noutputs;
- int err;
-
- // FIXME check_topology may be called more than once.
- // Ensure that the pcm is in a state where we can still mess with the hw_params
-
- bool special_case = nchan == 1 && d_special_case_stereo_to_mono;
- if (special_case)
- nchan = 2;
-
- d_hw_nchan = nchan;
- err = snd_pcm_hw_params_set_channels (d_pcm_handle, d_hw_params, d_hw_nchan);
- if (err < 0){
- output_error_msg ("set_channels failed", err);
- return false;
- }
-
- // set the parameters into the driver...
- err = snd_pcm_hw_params(d_pcm_handle, d_hw_params);
- if (err < 0){
- output_error_msg ("snd_pcm_hw_params failed", err);
- return false;
- }
-
- d_buffer_size_bytes =
- d_period_size * d_hw_nchan * snd_pcm_format_size (d_format, 1);
-
- d_buffer = new char [d_buffer_size_bytes];
-
- if (CHATTY_DEBUG)
- fprintf (stdout, "audio_alsa_source[%s]: sample resolution = %d bits\n",
- snd_pcm_name (d_pcm_handle),
- snd_pcm_hw_params_get_sbits (d_hw_params));
-
- switch (d_format){
- case SND_PCM_FORMAT_S16:
- if (special_case)
- d_worker = &audio_alsa_source::work_s16_2x1;
- else
- d_worker = &audio_alsa_source::work_s16;
- break;
-
- case SND_PCM_FORMAT_S32:
- if (special_case)
- d_worker = &audio_alsa_source::work_s32_2x1;
- else
- d_worker = &audio_alsa_source::work_s32;
- break;
-
- default:
- assert (0);
- }
-
- return true;
-}
-
-audio_alsa_source::~audio_alsa_source ()
-{
- if (snd_pcm_state (d_pcm_handle) == SND_PCM_STATE_RUNNING)
- snd_pcm_drop (d_pcm_handle);
-
- snd_pcm_close(d_pcm_handle);
- delete [] ((char *) d_hw_params);
- delete [] ((char *) d_sw_params);
- delete [] d_buffer;
-}
-
-int
-audio_alsa_source::work (int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items)
-{
- assert ((noutput_items % d_period_size) == 0);
- assert (noutput_items != 0);
-
- // this is a call through a pointer to a method...
- return (this->*d_worker)(noutput_items, input_items, output_items);
-}
-
-/*
- * Work function that deals with float to S16 conversion
- */
-int
-audio_alsa_source::work_s16 (int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items)
-{
- typedef gr_int16 sample_t; // the type of samples we're creating
- static const int NBITS = 16; // # of bits in a sample
-
- unsigned int nchan = output_items.size ();
- float **out = (float **) &output_items[0];
- sample_t *buf = (sample_t *) d_buffer;
- int bi;
-
- unsigned int sizeof_frame = d_hw_nchan * sizeof (sample_t);
- assert (d_buffer_size_bytes == d_period_size * sizeof_frame);
-
- // To minimize latency, return at most a single period's worth of samples.
- // [We could also read the first one in a blocking mode and subsequent
- // ones in non-blocking mode, but we'll leave that for later (or never).]
-
- if (!read_buffer (buf, d_period_size, sizeof_frame))
- return -1; // No fixing this problem. Say we're done.
-
- // process one period of data
- bi = 0;
- for (unsigned int i = 0; i < d_period_size; i++){
- for (unsigned int chan = 0; chan < nchan; chan++){
- out[chan][i] = (float) buf[bi++] * (1.0 / (float) ((1L << (NBITS-1)) - 1));
- }
- }
-
- return d_period_size;
-}
-
-/*
- * Work function that deals with float to S16 conversion
- * and stereo to mono kludge...
- */
-int
-audio_alsa_source::work_s16_2x1 (int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items)
-{
- typedef gr_int16 sample_t; // the type of samples we're creating
- static const int NBITS = 16; // # of bits in a sample
-
- unsigned int nchan = output_items.size ();
- float **out = (float **) &output_items[0];
- sample_t *buf = (sample_t *) d_buffer;
- int bi;
-
- assert (nchan == 1);
-
- unsigned int sizeof_frame = d_hw_nchan * sizeof (sample_t);
- assert (d_buffer_size_bytes == d_period_size * sizeof_frame);
-
- // To minimize latency, return at most a single period's worth of samples.
- // [We could also read the first one in a blocking mode and subsequent
- // ones in non-blocking mode, but we'll leave that for later (or never).]
-
- if (!read_buffer (buf, d_period_size, sizeof_frame))
- return -1; // No fixing this problem. Say we're done.
-
- // process one period of data
- bi = 0;
- for (unsigned int i = 0; i < d_period_size; i++){
- int t = (buf[bi] + buf[bi+1]) / 2;
- bi += 2;
- out[0][i] = (float) t * (1.0 / (float) ((1L << (NBITS-1)) - 1));
- }
-
- return d_period_size;
-}
-
-/*
- * Work function that deals with float to S32 conversion
- */
-int
-audio_alsa_source::work_s32 (int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items)
-{
- typedef gr_int32 sample_t; // the type of samples we're creating
- static const int NBITS = 32; // # of bits in a sample
-
- unsigned int nchan = output_items.size ();
- float **out = (float **) &output_items[0];
- sample_t *buf = (sample_t *) d_buffer;
- int bi;
-
- unsigned int sizeof_frame = d_hw_nchan * sizeof (sample_t);
- assert (d_buffer_size_bytes == d_period_size * sizeof_frame);
-
- // To minimize latency, return at most a single period's worth of samples.
- // [We could also read the first one in a blocking mode and subsequent
- // ones in non-blocking mode, but we'll leave that for later (or never).]
-
- if (!read_buffer (buf, d_period_size, sizeof_frame))
- return -1; // No fixing this problem. Say we're done.
-
- // process one period of data
- bi = 0;
- for (unsigned int i = 0; i < d_period_size; i++){
- for (unsigned int chan = 0; chan < nchan; chan++){
- out[chan][i] = (float) buf[bi++] * (1.0 / (float) ((1L << (NBITS-1)) - 1));
- }
- }
-
- return d_period_size;
-}
-
-/*
- * Work function that deals with float to S32 conversion
- * and stereo to mono kludge...
- */
-int
-audio_alsa_source::work_s32_2x1 (int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items)
-{
- typedef gr_int32 sample_t; // the type of samples we're creating
- static const int NBITS = 32; // # of bits in a sample
-
- unsigned int nchan = output_items.size ();
- float **out = (float **) &output_items[0];
- sample_t *buf = (sample_t *) d_buffer;
- int bi;
-
- assert (nchan == 1);
-
- unsigned int sizeof_frame = d_hw_nchan * sizeof (sample_t);
- assert (d_buffer_size_bytes == d_period_size * sizeof_frame);
-
- // To minimize latency, return at most a single period's worth of samples.
- // [We could also read the first one in a blocking mode and subsequent
- // ones in non-blocking mode, but we'll leave that for later (or never).]
-
- if (!read_buffer (buf, d_period_size, sizeof_frame))
- return -1; // No fixing this problem. Say we're done.
-
- // process one period of data
- bi = 0;
- for (unsigned int i = 0; i < d_period_size; i++){
- int t = (buf[bi] + buf[bi+1]) / 2;
- bi += 2;
- out[0][i] = (float) t * (1.0 / (float) ((1L << (NBITS-1)) - 1));
- }
-
- return d_period_size;
-}
-
-bool
-audio_alsa_source::read_buffer (void *vbuffer, unsigned nframes, unsigned sizeof_frame)
-{
- unsigned char *buffer = (unsigned char *) vbuffer;
-
- while (nframes > 0){
- int r = snd_pcm_readi (d_pcm_handle, buffer, nframes);
- if (r == -EAGAIN)
- continue; // try again
-
- else if (r == -EPIPE){ // overrun
- d_noverruns++;
- fputs ("aO", stderr);
- if ((r = snd_pcm_prepare (d_pcm_handle)) < 0){
- output_error_msg ("snd_pcm_prepare failed. Can't recover from overrun", r);
- return false;
- }
- continue; // try again
- }
-
- else if (r == -ESTRPIPE){ // h/w is suspended (whatever that means)
- // This is apparently related to power management
- d_nsuspends++;
- if ((r = snd_pcm_resume (d_pcm_handle)) < 0){
- output_error_msg ("failed to resume from suspend", r);
- return false;
- }
- continue; // try again
- }
-
- else if (r < 0){
- output_error_msg ("snd_pcm_readi failed", r);
- return false;
- }
-
- nframes -= r;
- buffer += r * sizeof_frame;
- }
-
- return true;
-}
-
-
-void
-audio_alsa_source::output_error_msg (const char *msg, int err)
-{
- fprintf (stderr, "audio_alsa_source[%s]: %s: %s\n",
- snd_pcm_name (d_pcm_handle), msg, snd_strerror (err));
-}
-
-void
-audio_alsa_source::bail (const char *msg, int err) throw (std::runtime_error)
-{
- output_error_msg (msg, err);
- throw std::runtime_error ("audio_alsa_source");
-}
diff --git a/gr-audio-alsa/src/audio_alsa_source.h b/gr-audio-alsa/src/audio_alsa_source.h
deleted file mode 100644
index db6c45683..000000000
--- a/gr-audio-alsa/src/audio_alsa_source.h
+++ /dev/null
@@ -1,124 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2004,2006 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_AUDIO_ALSA_SOURCE_H
-#define INCLUDED_AUDIO_ALSA_SOURCE_H
-
-// use new ALSA API
-#define ALSA_PCM_NEW_HW_PARAMS_API
-#define ALSA_PCM_NEW_SW_PARAMS_API
-
-#include <gr_sync_block.h>
-#include <string>
-#include <alsa/asoundlib.h>
-#include <stdexcept>
-
-class audio_alsa_source;
-typedef boost::shared_ptr<audio_alsa_source> audio_alsa_source_sptr;
-
-/*!
- * \brief Make an ALSA audio source.
- *
- * \param sampling_rate sampling rate
- * \param device_name ALSA pcm device name, e.g., "hw:0,0"
- * \param ok_to_block (currently ignored)
- */
-audio_alsa_source_sptr
-audio_alsa_make_source (int sampling_rate,
- const std::string device_name = "",
- bool ok_to_block = true);
-
-/*!
- * \brief audio source using ALSA
- *
- * The source has between 1 and N input streams of floats, where N is
- * depends on the hardware characteristics of the selected device.
- *
- * Output samples will be in the range [-1,1].
- */
-class audio_alsa_source : public gr_sync_block {
- friend audio_alsa_source_sptr
- audio_alsa_make_source (int sampling_rate,
- const std::string device_name,
- bool ok_to_block);
-
- // typedef for pointer to class work method
- typedef int (audio_alsa_source::*work_t)(int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items);
-
- unsigned int d_sampling_rate;
- std::string d_device_name;
- snd_pcm_t *d_pcm_handle;
- snd_pcm_hw_params_t *d_hw_params;
- snd_pcm_sw_params_t *d_sw_params;
- snd_pcm_format_t d_format;
- unsigned int d_nperiods;
- unsigned int d_period_time_us; // microseconds
- snd_pcm_uframes_t d_period_size; // in frames
- unsigned int d_buffer_size_bytes; // sizeof of d_buffer
- char *d_buffer;
- work_t d_worker; // the work method to use
- unsigned int d_hw_nchan; // # of configured h/w channels
- bool d_special_case_stereo_to_mono;
-
- // random stats
- int d_noverruns; // count of overruns
- int d_nsuspends; // count of suspends
-
- void output_error_msg (const char *msg, int err);
- void bail (const char *msg, int err) throw (std::runtime_error);
-
- protected:
- audio_alsa_source (int sampling_rate, const std::string device_name,
- bool ok_to_block);
-
- public:
- ~audio_alsa_source ();
-
- bool check_topology (int ninputs, int noutputs);
-
- int work (int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items);
-
-protected:
- bool read_buffer (void *buffer, unsigned nframes, unsigned sizeof_frame);
-
- int work_s16 (int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items);
-
- int work_s16_2x1 (int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items);
-
- int work_s32 (int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items);
-
- int work_s32_2x1 (int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items);
-};
-
-#endif /* INCLUDED_AUDIO_ALSA_SOURCE_H */
diff --git a/gr-audio-alsa/src/gri_alsa.cc b/gr-audio-alsa/src/gri_alsa.cc
deleted file mode 100644
index d9fda0f7d..000000000
--- a/gr-audio-alsa/src/gri_alsa.cc
+++ /dev/null
@@ -1,175 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2004 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 <gri_alsa.h>
-#include <algorithm>
-
-static snd_pcm_access_t access_types[] = {
- SND_PCM_ACCESS_MMAP_INTERLEAVED,
- SND_PCM_ACCESS_MMAP_NONINTERLEAVED,
- SND_PCM_ACCESS_MMAP_COMPLEX,
- SND_PCM_ACCESS_RW_INTERLEAVED,
- SND_PCM_ACCESS_RW_NONINTERLEAVED
-};
-
-static snd_pcm_format_t format_types[] = {
- // SND_PCM_FORMAT_UNKNOWN,
- SND_PCM_FORMAT_S8,
- SND_PCM_FORMAT_U8,
- SND_PCM_FORMAT_S16_LE,
- SND_PCM_FORMAT_S16_BE,
- SND_PCM_FORMAT_U16_LE,
- SND_PCM_FORMAT_U16_BE,
- SND_PCM_FORMAT_S24_LE,
- SND_PCM_FORMAT_S24_BE,
- SND_PCM_FORMAT_U24_LE,
- SND_PCM_FORMAT_U24_BE,
- SND_PCM_FORMAT_S32_LE,
- SND_PCM_FORMAT_S32_BE,
- SND_PCM_FORMAT_U32_LE,
- SND_PCM_FORMAT_U32_BE,
- SND_PCM_FORMAT_FLOAT_LE,
- SND_PCM_FORMAT_FLOAT_BE,
- SND_PCM_FORMAT_FLOAT64_LE,
- SND_PCM_FORMAT_FLOAT64_BE,
- SND_PCM_FORMAT_IEC958_SUBFRAME_LE,
- SND_PCM_FORMAT_IEC958_SUBFRAME_BE,
- SND_PCM_FORMAT_MU_LAW,
- SND_PCM_FORMAT_A_LAW,
- SND_PCM_FORMAT_IMA_ADPCM,
- SND_PCM_FORMAT_MPEG,
- SND_PCM_FORMAT_GSM,
- SND_PCM_FORMAT_SPECIAL,
- SND_PCM_FORMAT_S24_3LE,
- SND_PCM_FORMAT_S24_3BE,
- SND_PCM_FORMAT_U24_3LE,
- SND_PCM_FORMAT_U24_3BE,
- SND_PCM_FORMAT_S20_3LE,
- SND_PCM_FORMAT_S20_3BE,
- SND_PCM_FORMAT_U20_3LE,
- SND_PCM_FORMAT_U20_3BE,
- SND_PCM_FORMAT_S18_3LE,
- SND_PCM_FORMAT_S18_3BE,
- SND_PCM_FORMAT_U18_3LE,
- SND_PCM_FORMAT_U18_3BE
-};
-
-static unsigned int test_rates[] = {
- 8000, 16000, 22050, 32000, 44100, 48000, 96000, 192000
-};
-
-#define NELEMS(x) (sizeof(x)/sizeof(x[0]))
-
-void
-gri_alsa_dump_hw_params (snd_pcm_t *pcm, snd_pcm_hw_params_t *hwparams, FILE *fp)
-{
- fprintf (fp, "PCM name: %s\n", snd_pcm_name (pcm));
-
- fprintf (fp, "Access types:\n");
- for (unsigned i = 0; i < NELEMS (access_types); i++){
- snd_pcm_access_t at = access_types[i];
- fprintf (fp, " %-20s %s\n",
- snd_pcm_access_name (at),
- snd_pcm_hw_params_test_access (pcm, hwparams, at) == 0 ? "YES" : "NO");
- }
-
- fprintf (fp, "Formats:\n");
- for (unsigned i = 0; i < NELEMS (format_types); i++){
- snd_pcm_format_t ft = format_types[i];
- if (0)
- fprintf (fp, " %-20s %s\n",
- snd_pcm_format_name (ft),
- snd_pcm_hw_params_test_format (pcm, hwparams, ft) == 0 ? "YES" : "NO");
- else {
- if (snd_pcm_hw_params_test_format (pcm, hwparams, ft) == 0)
- fprintf (fp, " %-20s YES\n", snd_pcm_format_name (ft));
- }
- }
-
- fprintf (fp, "Number of channels\n");
- unsigned int min_chan, max_chan;
- snd_pcm_hw_params_get_channels_min (hwparams, &min_chan);
- snd_pcm_hw_params_get_channels_max (hwparams, &max_chan);
- fprintf (fp, " min channels: %d\n", min_chan);
- fprintf (fp, " max channels: %d\n", max_chan);
- unsigned int chan;
- max_chan = std::min (max_chan, 16U); // truncate display...
- for (chan = min_chan; chan <= max_chan; chan++){
- fprintf (fp, " %d channels\t%s\n", chan,
- snd_pcm_hw_params_test_channels (pcm, hwparams, chan) == 0 ? "YES" : "NO");
- }
-
- fprintf (fp, "Sample Rates:\n");
- unsigned int min_rate, max_rate;
- int min_dir, max_dir;
-
- snd_pcm_hw_params_get_rate_min (hwparams, &min_rate, &min_dir);
- snd_pcm_hw_params_get_rate_max (hwparams, &max_rate, &max_dir);
- fprintf (fp, " min rate: %7d (dir = %d)\n", min_rate, min_dir);
- fprintf (fp, " max rate: %7d (dir = %d)\n", max_rate, max_dir);
- for (unsigned i = 0; i < NELEMS (test_rates); i++){
- unsigned int rate = test_rates[i];
- fprintf (fp, " %6u %s\n", rate,
- snd_pcm_hw_params_test_rate (pcm, hwparams, rate, 0) == 0 ? "YES" : "NO");
- }
-
- fflush (fp);
-}
-
-bool
-gri_alsa_pick_acceptable_format (snd_pcm_t *pcm,
- snd_pcm_hw_params_t *hwparams,
- snd_pcm_format_t acceptable_formats[],
- unsigned nacceptable_formats,
- snd_pcm_format_t *selected_format,
- const char *error_msg_tag,
- bool verbose)
-{
- int err;
-
- // pick a format that we like...
- for (unsigned i = 0; i < nacceptable_formats; i++){
- if (snd_pcm_hw_params_test_format (pcm, hwparams,
- acceptable_formats[i]) == 0){
- err = snd_pcm_hw_params_set_format (pcm, hwparams, acceptable_formats[i]);
- if (err < 0){
- fprintf (stderr, "%s[%s]: failed to set format: %s\n",
- error_msg_tag, snd_pcm_name (pcm), snd_strerror (err));
- return false;
- }
- if (verbose)
- fprintf (stdout, "%s[%s]: using %s\n",
- error_msg_tag, snd_pcm_name (pcm),
- snd_pcm_format_name (acceptable_formats[i]));
- *selected_format = acceptable_formats[i];
- return true;
- }
- }
-
- fprintf (stderr, "%s[%s]: failed to find acceptable format",
- error_msg_tag, snd_pcm_name (pcm));
- return false;
-}
diff --git a/gr-audio-alsa/src/gri_alsa.h b/gr-audio-alsa/src/gri_alsa.h
deleted file mode 100644
index 3d72fd950..000000000
--- a/gr-audio-alsa/src/gri_alsa.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2004 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_GRI_ALSA_H
-#define INCLUDED_GRI_ALSA_H
-
-#include <stdio.h>
-#include <alsa/asoundlib.h>
-
-void
-gri_alsa_dump_hw_params (snd_pcm_t *pcm,
- snd_pcm_hw_params_t *hwparams,
- FILE *fp);
-
-bool
-gri_alsa_pick_acceptable_format (snd_pcm_t *pcm,
- snd_pcm_hw_params_t *hwparams,
- snd_pcm_format_t acceptable_formats[],
- unsigned nacceptable_formats,
- snd_pcm_format_t *selected_format,
- const char *error_msg_tag,
- bool verbose);
-
-
-#endif /* INCLUDED_GRI_ALSA_H */
diff --git a/gr-audio-alsa/src/qa_audio_alsa.py b/gr-audio-alsa/src/qa_audio_alsa.py
deleted file mode 100755
index 52dbfdc7a..000000000
--- a/gr-audio-alsa/src/qa_audio_alsa.py
+++ /dev/null
@@ -1,40 +0,0 @@
-#!/usr/bin/env python
-#
-# Copyright 2005,2007,2010 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
-import audio_alsa
-
-class test_audio_alsa (gr_unittest.TestCase):
-
- def setUp (self):
- self.tb = gr.top_block ()
-
- def tearDown (self):
- self.tb = None
-
- def test_000_nop (self):
- """Just see if we can import the module...
- They may not have ALSA drivers, etc. Don't try to run anything"""
- pass
-
-if __name__ == '__main__':
- gr_unittest.run(test_audio_alsa, "test_audio_alsa.xml")
diff --git a/gr-audio-alsa/src/run_guile_tests.in b/gr-audio-alsa/src/run_guile_tests.in
deleted file mode 100644
index 5d08b0dd5..000000000
--- a/gr-audio-alsa/src/run_guile_tests.in
+++ /dev/null
@@ -1,14 +0,0 @@
-#!/bin/sh
-
-. @top_builddir@/setup_guile_test_env
-
-# 1st argument is absolute path to hand coded guile source directory
-# 2nd argument is absolute path to component C++ shared library build directory
-# 3nd argument is absolute path to component SWIG build directory
-
-add_local_paths \
- @srcdir@ \
- @abs_builddir@ \
- @abs_builddir@
-
-@GUILE@ -e main -c '(use-modules (gnuradio test-suite guile-test))' -t @srcdir@
diff --git a/gr-audio-alsa/src/run_tests.in b/gr-audio-alsa/src/run_tests.in
deleted file mode 100644
index fd3963068..000000000
--- a/gr-audio-alsa/src/run_tests.in
+++ /dev/null
@@ -1,10 +0,0 @@
-#!/bin/sh
-
-# 1st parameter is absolute path to component source directory
-# 2nd parameter is absolute path to component build directory
-# 3rd parameter is path to Python QA directory
-
-@top_builddir@/run_tests.sh \
- @abs_top_srcdir@/gr-audio-alsa \
- @abs_top_builddir@/gr-audio-alsa \
- @srcdir@