summaryrefslogtreecommitdiff
path: root/gr-audio/lib/jack
diff options
context:
space:
mode:
authorTom Rondeau <tom@trondeau.com>2014-08-13 16:06:19 -0400
committerTom Rondeau <tom@trondeau.com>2014-08-13 17:06:15 -0400
commit2fc6293932564fd9f84a31898aa11c0b9a3b44cc (patch)
tree08ab00c8881968bcb86dfae04682ddbbf6cab8ac /gr-audio/lib/jack
parentf1c8ab4aff39340da87b82758263c11b4c9a6754 (diff)
audio: modified the audio registration system.
Instead of static functions and macros, this just uses simple ifdefs in the code to register new audio components if cmake found them. The code is more complicated for the developer, if we ever add a new audio machine. But this allows us to use gr-audio in statically linked cases.
Diffstat (limited to 'gr-audio/lib/jack')
-rw-r--r--gr-audio/lib/jack/jack_sink.cc22
-rw-r--r--gr-audio/lib/jack/jack_source.cc22
2 files changed, 22 insertions, 22 deletions
diff --git a/gr-audio/lib/jack/jack_sink.cc b/gr-audio/lib/jack/jack_sink.cc
index 0da074290f..6261545028 100644
--- a/gr-audio/lib/jack/jack_sink.cc
+++ b/gr-audio/lib/jack/jack_sink.cc
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2005-2011,2013 Free Software Foundation, Inc.
+ * Copyright 2005-2011,2013-2014 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -40,9 +40,10 @@
namespace gr {
namespace audio {
- AUDIO_REGISTER_SINK(REG_PRIO_MED, jack)(int sampling_rate,
- const std::string &device_name,
- bool ok_to_block)
+ sink::sptr
+ jack_sink_fcn(int sampling_rate,
+ const std::string &device_name,
+ bool ok_to_block)
{
return sink::sptr
(new jack_sink(sampling_rate, device_name, ok_to_block));
@@ -125,8 +126,8 @@ namespace gr {
if((d_jack_client = jack_client_open(d_device_name.c_str(),
options, &status,
server_name)) == NULL) {
- fprintf(stderr, "audio_jack_sink[%s]: jack server not running?\n",
- d_device_name.c_str());
+ GR_LOG_ERROR(d_logger, boost::format("[%1%]: jack server not running?") \
+ % d_device_name);
throw std::runtime_error("audio_jack_sink");
}
@@ -153,9 +154,8 @@ namespace gr {
jack_nframes_t sample_rate = jack_get_sample_rate(d_jack_client);
if((jack_nframes_t)sampling_rate != sample_rate) {
- fprintf(stderr, "audio_jack_sink[%s]: unable to support sampling rate %d\n",
- d_device_name.c_str(), sampling_rate);
- fprintf(stderr, " card requested %d instead.\n", sample_rate);
+ GR_LOG_INFO(d_logger, boost::format("[%1%]: unable to support sampling rate %2%\n\tCard requested %3% instead.") \
+ % d_device_name % sampling_rate % d_sampling_rate);
}
}
@@ -251,8 +251,8 @@ namespace gr {
void
jack_sink::output_error_msg(const char *msg, int err)
{
- fprintf(stderr, "audio_jack_sink[%s]: %s: %d\n",
- d_device_name.c_str(), msg, err);
+ GR_LOG_ERROR(d_logger, boost::format("[%1%]: %2%: %3%") \
+ % d_device_name % msg % err);
}
void
diff --git a/gr-audio/lib/jack/jack_source.cc b/gr-audio/lib/jack/jack_source.cc
index 9223cbb588..ced1d47d2e 100644
--- a/gr-audio/lib/jack/jack_source.cc
+++ b/gr-audio/lib/jack/jack_source.cc
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2005,2006,2010,2013 Free Software Foundation, Inc.
+ * Copyright 2005,2006,2010,2013-2014 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -40,9 +40,10 @@
namespace gr {
namespace audio {
- AUDIO_REGISTER_SOURCE(REG_PRIO_MED, jack)(int sampling_rate,
- const std::string &device_name,
- bool ok_to_block)
+ source::sptr
+ jack_source_fcn(int sampling_rate,
+ const std::string &device_name,
+ bool ok_to_block)
{
return source::sptr
(new jack_source(sampling_rate, device_name, ok_to_block));
@@ -125,8 +126,8 @@ namespace gr {
if((d_jack_client = jack_client_open(d_device_name.c_str(),
options, &status,
server_name)) == NULL) {
- fprintf(stderr, "audio_jack_source[%s]: jack server not running?\n",
- d_device_name.c_str());
+ GR_LOG_ERROR(d_logger, boost::format("[%1%]: jack server not running?") \
+ % d_device_name);
throw std::runtime_error("audio_jack_source");
}
@@ -150,9 +151,8 @@ namespace gr {
jack_nframes_t sample_rate = jack_get_sample_rate(d_jack_client);
if((jack_nframes_t)sampling_rate != sample_rate) {
- fprintf(stderr, "audio_jack_source[%s]: unable to support sampling rate %d\n",
- d_device_name.c_str(), sampling_rate);
- fprintf(stderr, " card requested %d instead.\n", sample_rate);
+ GR_LOG_INFO(d_logger, boost::format("[%1%]: unable to support sampling rate %2%\n\tCard requested %3% instead.") \
+ % d_device_name % sampling_rate % d_sampling_rate);
}
}
@@ -251,8 +251,8 @@ namespace gr {
void
jack_source::output_error_msg(const char *msg, int err)
{
- fprintf(stderr, "audio_jack_source[%s]: %s: %d\n",
- d_device_name.c_str(), msg, err);
+ GR_LOG_ERROR(d_logger, boost::format("[%1%]: %2%: %3%") \
+ % d_device_name % msg % err);
}
void