commit-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Commit-gnuradio] r4165 - gnuradio/branches/developers/brickle/jack/gr-a


From: brickle
Subject: [Commit-gnuradio] r4165 - gnuradio/branches/developers/brickle/jack/gr-audio-jack/src
Date: Wed, 20 Dec 2006 13:21:12 -0700 (MST)

Author: brickle
Date: 2006-12-20 13:21:11 -0700 (Wed, 20 Dec 2006)
New Revision: 4165

Modified:
   
gnuradio/branches/developers/brickle/jack/gr-audio-jack/src/audio_jack_source.cc
Log:
Further edge-straightening.


Modified: 
gnuradio/branches/developers/brickle/jack/gr-audio-jack/src/audio_jack_source.cc
===================================================================
--- 
gnuradio/branches/developers/brickle/jack/gr-audio-jack/src/audio_jack_source.cc
    2006-12-20 20:17:43 UTC (rev 4164)
+++ 
gnuradio/branches/developers/brickle/jack/gr-audio-jack/src/audio_jack_source.cc
    2006-12-20 20:21:11 UTC (rev 4165)
@@ -93,7 +93,7 @@
 }
 
 int
-audio_portaudio_source::work(int noutput_items,
+audio_jack_source::work(int noutput_items,
                             gr_vector_const_void_star &input_items,
                             gr_vector_void_star &output_items)
 {
@@ -125,56 +125,16 @@
   return k;  // tell how many we actually did
 }
 
-int
-audio_jack_source::work (int noutput_items,
-                        gr_vector_const_void_star &input_items,
-                        gr_vector_void_star &output_items)
-{
-  // read_size and work_size are in bytes
-  unsigned int read_size;
-
-  // Minimize latency
-  noutput_items = std::min (noutput_items, (int)d_jack_buffer_size);
-
-  int work_size = noutput_items*sizeof(sample_t);
-
-  while (work_size > 0) {
-    unsigned int read_space;   // bytes
-
-    // JACK actually requires POSIX
-
-    pthread_mutex_lock (&d_jack_process_lock);
-    while ((read_space=jack_ringbuffer_read_space (d_ringbuffer)) < 
-                   d_jack_buffer_size*sizeof(sample_t)) {
-
-      // wait until jack_source_process() signals more data
-      pthread_cond_wait (&d_ringbuffer_ready, &d_jack_process_lock);
-    }
-    pthread_mutex_unlock (&d_jack_process_lock);
-
-    read_space -= read_space%(d_jack_buffer_size*sizeof(sample_t));
-    read_size = std::min(read_space, (unsigned int)work_size);
-
-    if (jack_ringbuffer_read (d_ringbuffer, (char *) output_items[0],
-                             read_size) < read_size) {
-      bail ("jack_ringbuffer_read failed", 0);
-    }
-    work_size -= read_size;
-  }
-
-  return noutput_items;
-}
-
 void
-audio_jack_source::output_error_msg (const char *msg, int err)
+audio_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);
 }
 
 void
-audio_jack_source::bail (const char *msg, int err) throw (std::runtime_error)
+audio_jack_source::bail(const char *msg, int err) throw (std::runtime_error)
 {
-  output_error_msg (msg, err);
+  output_error_msg(msg, err);
   throw std::runtime_error ("audio_jack_source");
 }





reply via email to

[Prev in Thread] Current Thread [Next in Thread]