Merge branch 'patches/marcus/stripchart'
[debian/gnuradio] / gr-audio-portaudio / src / audio_portaudio_sink.h
index 2069f7c8bcb643b040f4a68e107419400139c3b4..71cbfcf9f011d0c72dbcb67ddf13b0abaad4ca78 100644 (file)
@@ -6,7 +6,7 @@
  * 
  * 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 2, or (at your option)
+ * 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,
  * 
  * 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
  */
 #ifndef INCLUDED_AUDIO_PORTAUDIO_SINK_H
 #define INCLUDED_AUDIO_PORTAUDIO_SINK_H
 
 #include <gr_sync_block.h>
 #include <gr_buffer.h>
-#include <omnithread.h>
+#include <gruel/thread.h>
 #include <string>
 #include <portaudio.h>
 #include <stdexcept>
-#include <gri_logger.h>
+//#include <gri_logger.h>
 
 class audio_portaudio_sink;
 typedef boost::shared_ptr<audio_portaudio_sink> audio_portaudio_sink_sptr;
 
 /*!
- * \PORTAUDIO audio sink.
+ * \brief PORTAUDIO audio sink.
+ *
  * \param sampling_rate        sampling rate in Hz
- * \param dev PORTAUDIO device name, e.g., "pa:"
+ * \param device_name PORTAUDIO device name, e.g., "pa:"
  * \param ok_to_block  true if it's ok for us to block
  */
 audio_portaudio_sink_sptr
 audio_portaudio_make_sink (int sampling_rate,
-                          const std::string dev = "",
+                          const std::string device_name = "",
                           bool ok_to_block = true);
 
 PaStreamCallback portaudio_sink_callback;
@@ -73,12 +74,14 @@ class audio_portaudio_sink : public gr_sync_block {
 
   gr_buffer_sptr       d_writer;               // buffer used between work and callback
   gr_buffer_reader_sptr        d_reader;
-  omni_semaphore       d_ringbuffer_ready;     // binary semaphore
 
+  gruel::mutex          d_ringbuffer_mutex;
+  gruel::condition_variable d_ringbuffer_cond;
+  bool                  d_ringbuffer_ready;
 
   // random stats
   int                  d_nunderuns;            // count of underruns
-  gri_logger_sptr      d_log;                  // handle to non-blocking logging instance
+  //gri_logger_sptr    d_log;                  // handle to non-blocking logging instance
 
   void output_error_msg (const char *msg, int err);
   void bail (const char *msg, int err) throw (std::runtime_error);