summaryrefslogtreecommitdiff
path: root/gr-audio/lib/jack/audio_jack_source.h
diff options
context:
space:
mode:
authorTom Rondeau <trondeau@vt.edu>2013-02-11 22:57:58 -0500
committerTom Rondeau <trondeau@vt.edu>2013-02-11 22:57:58 -0500
commit0c8763a943dde47b4bbebf526c442509a9cf8bd4 (patch)
treefe1b7e6b77d8ca931e9b818ee7a792aef207d7fa /gr-audio/lib/jack/audio_jack_source.h
parent354c1219a22e13422b14d9bc14645e1296776d24 (diff)
analog: wip: oss and jack converted and compiling.
C++ dial_tone example working.
Diffstat (limited to 'gr-audio/lib/jack/audio_jack_source.h')
-rw-r--r--gr-audio/lib/jack/audio_jack_source.h82
1 files changed, 44 insertions, 38 deletions
diff --git a/gr-audio/lib/jack/audio_jack_source.h b/gr-audio/lib/jack/audio_jack_source.h
index 5b893a3d34..f096220b26 100644
--- a/gr-audio/lib/jack/audio_jack_source.h
+++ b/gr-audio/lib/jack/audio_jack_source.h
@@ -23,58 +23,64 @@
#define INCLUDED_AUDIO_JACK_SOURCE_H
#include <audio/source.h>
-#include <string>
#include <jack/jack.h>
#include <jack/ringbuffer.h>
+#include <string>
#include <stdexcept>
-int jack_source_process (jack_nframes_t nframes, void *arg);
-
-/*!
- * \brief audio source using JACK
- * \ingroup audio_blk
- *
- * The source has one input stream of floats.
- *
- * Output samples will be in the range [-1,1].
- */
-class audio_jack_source : public audio_source {
+namespace gr {
+ namespace audio {
- friend int jack_source_process (jack_nframes_t nframes, void *arg);
+ int jack_source_process(jack_nframes_t nframes, void *arg);
- // typedef for pointer to class work method
- typedef int (audio_jack_source::*work_t)(int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items);
+ /*!
+ * \brief audio source using JACK
+ * \ingroup audio_blk
+ *
+ * The source has one input stream of floats.
+ *
+ * Output samples will be in the range [-1,1].
+ */
+ class jack_source : public source
+ {
+ friend int jack_source_process(jack_nframes_t nframes, void *arg);
- unsigned int d_sampling_rate;
- std::string d_device_name;
- bool d_ok_to_block;
+ // typedef for pointer to class work method
+ typedef int(jack_source::*work_t)(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
- jack_client_t *d_jack_client;
- jack_port_t *d_jack_input_port;
- jack_ringbuffer_t *d_ringbuffer;
- jack_nframes_t d_jack_buffer_size;
- pthread_cond_t d_ringbuffer_ready;
- pthread_mutex_t d_jack_process_lock;
+ unsigned int d_sampling_rate;
+ std::string d_device_name;
+ bool d_ok_to_block;
- // random stats
- int d_noverruns; // count of overruns
+ jack_client_t *d_jack_client;
+ jack_port_t *d_jack_input_port;
+ jack_ringbuffer_t *d_ringbuffer;
+ jack_nframes_t d_jack_buffer_size;
+ pthread_cond_t d_ringbuffer_ready;
+ pthread_mutex_t d_jack_process_lock;
- void output_error_msg (const char *msg, int err);
- void bail (const char *msg, int err) throw (std::runtime_error);
+ // random stats
+ int d_noverruns; // count of overruns
+ void output_error_msg(const char *msg, int err);
+ void bail(const char *msg, int err) throw (std::runtime_error);
-public:
- audio_jack_source (int sampling_rate, const std::string device_name, bool ok_to_block);
+ public:
+ jack_source(int sampling_rate,
+ const std::string device_name,
+ bool ok_to_block);
+ ~jack_source();
- ~audio_jack_source ();
+ bool check_topology(int ninputs, int noutputs);
- 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);
+ };
- int work (int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items);
-};
+ } /* namespace audio */
+} /* namespace gr */
#endif /* INCLUDED_AUDIO_JACK_SOURCE_H */