Re: [Discuss-gnuradio] initial gr-audio-portaudio

2006-03-13 Thread Robert McGwier


Ok.  This is closer.  I get a few buffers,  almost 1 second and then it 
goes off the deep end but that is better than before when all I could 
get was segmentation fault!


I will look at the callback interface, etc.  to see if I see anything.  
I already know this pa works because I am using it with wsjt.


Bob


Stephane Fillod wrote:

On Mon, Mar 13, 2006 at 03:52:25PM +0100, Martin Dvh wrote:
[..]
  

The code should be portable. I was missing the native Win32 call for
mutex_trylock, so someone will have to find it, and define
OMNI_MUTEX_TRYLOCK_IMPLEMENTATION in src/lib/omnithread/ot_nt.h,
with appropriate semantic (return value).
  

I think you can do this with TryEnterCriticalSection



It does fit indeed. It has just been checked in.

Bob, Thomas, please cvs update gnuradio-core AND gr-audio-portaudio at
same time since I changed the logic of omni_mutex::trylock (returns true
if it grabbed the lock), in order to comply with comment in omnithread.h.

  

You could also use the omni_semaphore class defined in 
gnuradio-core/src/lib/omnithread/nt.cc
This latter one uses CreateSemaphore and WaitForSingleObject with some wrapper 
code.
(you probably have to change all defines if you change to using omni_semaphore)



The gr-audio-portaudio code is using omni::mutex and omni::cond calls. 
Actually, they are not used for mutual exclusion, but simply as a

notification mean (there's more room/there's more data in the ringbuffer).


Good Lu*k Martin for your presentation. We can wait next week to see whether
James Brown sounds even better with gr-audio-portaudio under Windows ;-) 

  



--
AMSAT VP Engineering. Member: ARRL, AMSAT-DL, TAPR, Packrats,
NJQRP/AMQRP, QRP ARCI, QCWA, FRC. ARRL SDR Wrk Grp Chairman
Laziness is the number one inspiration for ingenuity.  Guilty as charged!



___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
http://lists.gnu.org/mailman/listinfo/discuss-gnuradio


Re: [Discuss-gnuradio] initial gr-audio-portaudio

2006-03-13 Thread Stephane Fillod
On Mon, Mar 13, 2006 at 03:52:25PM +0100, Martin Dvh wrote:
[..]
> > The code should be portable. I was missing the native Win32 call for
> > mutex_trylock, so someone will have to find it, and define
> > OMNI_MUTEX_TRYLOCK_IMPLEMENTATION in src/lib/omnithread/ot_nt.h,
> > with appropriate semantic (return value).
> I think you can do this with TryEnterCriticalSection

It does fit indeed. It has just been checked in.

Bob, Thomas, please cvs update gnuradio-core AND gr-audio-portaudio at
same time since I changed the logic of omni_mutex::trylock (returns true
if it grabbed the lock), in order to comply with comment in omnithread.h.

> You could also use the omni_semaphore class defined in 
> gnuradio-core/src/lib/omnithread/nt.cc
> This latter one uses CreateSemaphore and WaitForSingleObject with some 
> wrapper code.
> (you probably have to change all defines if you change to using 
> omni_semaphore)

The gr-audio-portaudio code is using omni::mutex and omni::cond calls. 
Actually, they are not used for mutual exclusion, but simply as a
notification mean (there's more room/there's more data in the ringbuffer).


Good Lu*k Martin for your presentation. We can wait next week to see whether
James Brown sounds even better with gr-audio-portaudio under Windows ;-) 

-- 
Stephane


___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
http://lists.gnu.org/mailman/listinfo/discuss-gnuradio


Re: [Discuss-gnuradio] initial gr-audio-portaudio

2006-03-13 Thread Eric Blossom
On Sun, Mar 12, 2006 at 10:20:16PM +0100, Stephane Fillod wrote:
> On Sun, Mar 12, 2006 at 02:36:21PM -0500, Robert McGwier wrote:
> > That is why I put the message out.  It will be good to have a working 
> > starting point.
> 
> Okay, there it is. Just checked in to gr-audio-portaudio repository.
> It's somewhat working, but there's still some static in the audio 
> output (tested with ALSA playback, mono and stereo). Some more work
> is needed.
> 
> You will need the attached patchs:

Stephane,

Please go ahead and apply the patches.

Thanks,
Eric


___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
http://lists.gnu.org/mailman/listinfo/discuss-gnuradio


Re: [Discuss-gnuradio] initial gr-audio-portaudio

2006-03-13 Thread Thomas Schmid
With help of the examples, I was able to get a little bit further. The
portaudio_sink now gets initialized, but it shortly after fails with
an abort trap. The cause is line 167 in audio_portaudio_sink.cc where
d_portaudio_buffer_size is 0. It looks like if
Pa_GetStreamInfo(d_stream)->outputLatency is already 0. Any ideas why
this happens?

Thomas

On 3/12/06, Stephane Fillod <[EMAIL PROTECTED]> wrote:
> On Sun, Mar 12, 2006 at 07:14:15PM -0800, Thomas Schmid wrote:
> > I tried your code on Mac OS X 10.4 and I get pretty far (everything
> > compiles and isntalls after some hacking), but when I execute an audio
> > example, I get this error:
> >
> > 19:04 [EMAIL PROTECTED]:~/gnuradio/gr-build/gnuradio-examples/python/audio$
> > ./dial_tone.py
> > Traceback (most recent call last):
> >   File "./dial_tone.py", line 55, in ?
> > my_graph().run()
> >   File "./dial_tone.py", line 48, in __init__
> > dst = audio.sink (sample_rate, options.audio_output)
> >   File 
> > "/Users/thomas/gnuradio/gr/lib/python2.4/site-packages/gnuradio/audio_portaudio.py",
> > line 235, in sink
> > return _audio_portaudio.sink(*args)
> > NotImplementedError: No matching function for overloaded 'sink'
> >
> > Now I am stuck. Any idea why this happens or what could be wrong?
>
> Most likely the arguments are not what is expected.
> Looking at gr-audio-portaudio/src/audio_portaudio.i, they should be:
>
> audio_portaudio_sink (int sampling_freq,
>int ok_to_block,
>const std::string device_name
>)
>
> device_name defaults to "", and ok_to_block defaults to 1.
>
> Eric, the argument order may be tweaked.
>
>
> > Here is what I did, if anyone wants to repeat it:
> >
> > - install xcode 2.2
> > - install coreaudio sdk 1.4.3
> > - downloaded portaudio V19 and applied patch
> > - fixed small -framework error on line 144 of configure.in (remove
> > double -framework)
> > - fixed also -framework error in Makefile.in
>
> We should definitely add automake/libtool support to portaudio.
>
> > - removed the portaudio.pc directives which were added from the patch
> > (no portaudio.pc target in the makefile, will do it manually later on.
> > i think it is missing.)
>
> Look at my other mail. This should not be necessary if built from
> scratch.
>
> --
> Stephane
>


___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
http://lists.gnu.org/mailman/listinfo/discuss-gnuradio


Re: [Discuss-gnuradio] initial gr-audio-portaudio

2006-03-13 Thread Martin Dvh
Stephane Fillod wrote:
> On Sun, Mar 12, 2006 at 02:36:21PM -0500, Robert McGwier wrote:
> 
>>That is why I put the message out.  It will be good to have a working 
>>starting point.
> 
> 
> Okay, there it is. Just checked in to gr-audio-portaudio repository.
> It's somewhat working, but there's still some static in the audio 
> output (tested with ALSA playback, mono and stereo). Some more work
> is needed.
> 
> You will need the attached patchs:
> 
> - against gnuradio-core: ot_gri_ringbuffer.patch
>   * src/lib/omnithread/omnithread.h: add omni_mutex::trylock
>   * src/lib/general/gri_ringbuffer.{cc,h},
> src/lib/general/Makefile.am: new lockless ringbuffer (single
>   reader/single writer) taken from JACK software (GPL).
> 
> - against portaudio-V19(CVS): portaudio-pkg-config.patch
>   * pkg-config .pc file with proper THREAD_FLAGS
> 
> The code should be portable. I was missing the native Win32 call for
> mutex_trylock, so someone will have to find it, and define
> OMNI_MUTEX_TRYLOCK_IMPLEMENTATION in src/lib/omnithread/ot_nt.h,
> with appropriate semantic (return value).
I think you can do this with TryEnterCriticalSection
You could also use the omni_semaphore class defined in 
gnuradio-core/src/lib/omnithread/nt.cc
This latter one uses CreateSemaphore and WaitForSingleObject with some wrapper 
code.
(you probably have to change all defines if you change to using omni_semaphore)

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/tryentercriticalsection.asp
http://msdn.microsoft.com/library/en-us/dllproc/base/createsemaphore.asp?frame=true
http://msdn.microsoft.com/library/en-us/dllproc/base/waitforsingleobject.asp?frame=true

Another example of how it can be used (very much like our omni_semaphore class)
http://users.pandora.be/robert.deblier/beecrypt/mutex_8h-source.html

I don't have time to implement and test right now.
(I am working hard on finishing my gnuradio presentation for wednessday in 
Limburg)
If nobody implements it this week I will have a look next week.

greetings,
Martin
> The gri_pa_find_device_by_name() function will have to be made more
> smart, like accepting which HostApi (ALSA, JACK, ..) is to be chosen,
> and which device from this API. A syntax will have to be agreed upon,
> like "ALSA:hw:0" or "OSS:/dev/dsp1".
> 
> Have fun,



___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
http://lists.gnu.org/mailman/listinfo/discuss-gnuradio


Re: [Discuss-gnuradio] initial gr-audio-portaudio

2006-03-12 Thread Stephane Fillod
On Sun, Mar 12, 2006 at 07:14:15PM -0800, Thomas Schmid wrote:
> I tried your code on Mac OS X 10.4 and I get pretty far (everything
> compiles and isntalls after some hacking), but when I execute an audio
> example, I get this error:
> 
> 19:04 [EMAIL PROTECTED]:~/gnuradio/gr-build/gnuradio-examples/python/audio$
> ./dial_tone.py
> Traceback (most recent call last):
>   File "./dial_tone.py", line 55, in ?
> my_graph().run()
>   File "./dial_tone.py", line 48, in __init__
> dst = audio.sink (sample_rate, options.audio_output)
>   File 
> "/Users/thomas/gnuradio/gr/lib/python2.4/site-packages/gnuradio/audio_portaudio.py",
> line 235, in sink
> return _audio_portaudio.sink(*args)
> NotImplementedError: No matching function for overloaded 'sink'
> 
> Now I am stuck. Any idea why this happens or what could be wrong?

Most likely the arguments are not what is expected.
Looking at gr-audio-portaudio/src/audio_portaudio.i, they should be:

audio_portaudio_sink (int sampling_freq,
   int ok_to_block,
   const std::string device_name
   )

device_name defaults to "", and ok_to_block defaults to 1.

Eric, the argument order may be tweaked.


> Here is what I did, if anyone wants to repeat it:
> 
> - install xcode 2.2
> - install coreaudio sdk 1.4.3
> - downloaded portaudio V19 and applied patch
> - fixed small -framework error on line 144 of configure.in (remove
> double -framework)
> - fixed also -framework error in Makefile.in

We should definitely add automake/libtool support to portaudio.

> - removed the portaudio.pc directives which were added from the patch
> (no portaudio.pc target in the makefile, will do it manually later on.
> i think it is missing.)

Look at my other mail. This should not be necessary if built from
scratch.

-- 
Stephane


___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
http://lists.gnu.org/mailman/listinfo/discuss-gnuradio


Re: [Discuss-gnuradio] initial gr-audio-portaudio

2006-03-12 Thread Stephane Fillod
Hi Thomas,

On Sun, Mar 12, 2006 at 06:30:19PM -0800, Thomas Schmid wrote:
> Hi Stephane,
> 
> Is it possible that the portaudio patch of yours is missing the
> portauido.pc target? I get errors if I want to install it, i.e., it
> tells me that there is no portaudio.pc target.

Have you run "aclocal ; autoconf" before running again the configure script
of portaudio? This should take care of making to appear the portaudio.pc
file.

-- 
Stephane


___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
http://lists.gnu.org/mailman/listinfo/discuss-gnuradio


Re: [Discuss-gnuradio] initial gr-audio-portaudio

2006-03-12 Thread Thomas Schmid
I tried your code on Mac OS X 10.4 and I get pretty far (everything
compiles and isntalls after some hacking), but when I execute an audio
example, I get this error:

19:04 [EMAIL PROTECTED]:~/gnuradio/gr-build/gnuradio-examples/python/audio$
./dial_tone.py
Traceback (most recent call last):
  File "./dial_tone.py", line 55, in ?
my_graph().run()
  File "./dial_tone.py", line 48, in __init__
dst = audio.sink (sample_rate, options.audio_output)
  File 
"/Users/thomas/gnuradio/gr/lib/python2.4/site-packages/gnuradio/audio_portaudio.py",
line 235, in sink
return _audio_portaudio.sink(*args)
NotImplementedError: No matching function for overloaded 'sink'

Now I am stuck. Any idea why this happens or what could be wrong?

Here is what I did, if anyone wants to repeat it:

- install xcode 2.2
- install coreaudio sdk 1.4.3
- downloaded portaudio V19 and applied patch
- fixed small -framework error on line 144 of configure.in (remove
double -framework)
- fixed also -framework error in Makefile.in
- removed the portaudio.pc directives which were added from the patch
(no portaudio.pc target in the makefile, will do it manually later on.
i think it is missing.)
- make; make install

- applied patch to gnuradio-core
- add gr-portaudio to audio.py in src/python/gnuradio (or replace the
audio_osx one, as you wish)
- make; make install

- produce my own portaudio.pc file
- remove the -mthreads library from that file
- make gr-portaudio

that's it...

Thomas

On 3/12/06, Stephane Fillod <[EMAIL PROTECTED]> wrote:
> On Sun, Mar 12, 2006 at 02:36:21PM -0500, Robert McGwier wrote:
> > That is why I put the message out.  It will be good to have a working
> > starting point.
>
> Okay, there it is. Just checked in to gr-audio-portaudio repository.
> It's somewhat working, but there's still some static in the audio
> output (tested with ALSA playback, mono and stereo). Some more work
> is needed.
>
> You will need the attached patchs:
>
> - against gnuradio-core: ot_gri_ringbuffer.patch
> * src/lib/omnithread/omnithread.h: add omni_mutex::trylock
> * src/lib/general/gri_ringbuffer.{cc,h},
>   src/lib/general/Makefile.am: new lockless ringbuffer (single
>   reader/single writer) taken from JACK software (GPL).
>
> - against portaudio-V19(CVS): portaudio-pkg-config.patch
> * pkg-config .pc file with proper THREAD_FLAGS
>
> The code should be portable. I was missing the native Win32 call for
> mutex_trylock, so someone will have to find it, and define
> OMNI_MUTEX_TRYLOCK_IMPLEMENTATION in src/lib/omnithread/ot_nt.h,
> with appropriate semantic (return value).
>
> The gri_pa_find_device_by_name() function will have to be made more
> smart, like accepting which HostApi (ALSA, JACK, ..) is to be chosen,
> and which device from this API. A syntax will have to be agreed upon,
> like "ALSA:hw:0" or "OSS:/dev/dsp1".
>
> Have fun,
> --
> Stephane
>
>
> ___
> Discuss-gnuradio mailing list
> Discuss-gnuradio@gnu.org
> http://lists.gnu.org/mailman/listinfo/discuss-gnuradio
>
>
>
>


___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
http://lists.gnu.org/mailman/listinfo/discuss-gnuradio


Re: [Discuss-gnuradio] initial gr-audio-portaudio

2006-03-12 Thread Robert McGwier
Yes. This is an error.  To get started I just manually constructed 
portaudio.pc and started work on gr-audio-portaudio.  After we get the 
appropriate fix to Makefile.in in the portaudio build,  we should open 
gr-audio-portaudio.  It is ready for us all to beat on it and find the 
problems.


Bob


Thomas Schmid wrote:

Hi Stephane,

Is it possible that the portaudio patch of yours is missing the
portauido.pc target? I get errors if I want to install it, i.e., it
tells me that there is no portaudio.pc target.

Thomas


On 3/12/06, Stephane Fillod <[EMAIL PROTECTED]> wrote:
  

On Sun, Mar 12, 2006 at 02:36:21PM -0500, Robert McGwier wrote:


That is why I put the message out.  It will be good to have a working
starting point.
  

Okay, there it is. Just checked in to gr-audio-portaudio repository.
It's somewhat working, but there's still some static in the audio
output (tested with ALSA playback, mono and stereo). Some more work
is needed.

You will need the attached patchs:

- against gnuradio-core: ot_gri_ringbuffer.patch
* src/lib/omnithread/omnithread.h: add omni_mutex::trylock
* src/lib/general/gri_ringbuffer.{cc,h},
  src/lib/general/Makefile.am: new lockless ringbuffer (single
  reader/single writer) taken from JACK software (GPL).

- against portaudio-V19(CVS): portaudio-pkg-config.patch
* pkg-config .pc file with proper THREAD_FLAGS

The code should be portable. I was missing the native Win32 call for
mutex_trylock, so someone will have to find it, and define
OMNI_MUTEX_TRYLOCK_IMPLEMENTATION in src/lib/omnithread/ot_nt.h,
with appropriate semantic (return value).

The gri_pa_find_device_by_name() function will have to be made more
smart, like accepting which HostApi (ALSA, JACK, ..) is to be chosen,
and which device from this API. A syntax will have to be agreed upon,
like "ALSA:hw:0" or "OSS:/dev/dsp1".

Have fun,
--
Stephane


___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
http://lists.gnu.org/mailman/listinfo/discuss-gnuradio







  



--
AMSAT VP Engineering. Member: ARRL, AMSAT-DL, TAPR, Packrats,
NJQRP/AMQRP, QRP ARCI, QCWA, FRC. ARRL SDR Wrk Grp Chairman
Laziness is the number one inspiration for ingenuity.  Guilty as charged!



___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
http://lists.gnu.org/mailman/listinfo/discuss-gnuradio


Re: [Discuss-gnuradio] initial gr-audio-portaudio

2006-03-12 Thread Thomas Schmid
Hi Stephane,

Is it possible that the portaudio patch of yours is missing the
portauido.pc target? I get errors if I want to install it, i.e., it
tells me that there is no portaudio.pc target.

Thomas


On 3/12/06, Stephane Fillod <[EMAIL PROTECTED]> wrote:
> On Sun, Mar 12, 2006 at 02:36:21PM -0500, Robert McGwier wrote:
> > That is why I put the message out.  It will be good to have a working
> > starting point.
>
> Okay, there it is. Just checked in to gr-audio-portaudio repository.
> It's somewhat working, but there's still some static in the audio
> output (tested with ALSA playback, mono and stereo). Some more work
> is needed.
>
> You will need the attached patchs:
>
> - against gnuradio-core: ot_gri_ringbuffer.patch
> * src/lib/omnithread/omnithread.h: add omni_mutex::trylock
> * src/lib/general/gri_ringbuffer.{cc,h},
>   src/lib/general/Makefile.am: new lockless ringbuffer (single
>   reader/single writer) taken from JACK software (GPL).
>
> - against portaudio-V19(CVS): portaudio-pkg-config.patch
> * pkg-config .pc file with proper THREAD_FLAGS
>
> The code should be portable. I was missing the native Win32 call for
> mutex_trylock, so someone will have to find it, and define
> OMNI_MUTEX_TRYLOCK_IMPLEMENTATION in src/lib/omnithread/ot_nt.h,
> with appropriate semantic (return value).
>
> The gri_pa_find_device_by_name() function will have to be made more
> smart, like accepting which HostApi (ALSA, JACK, ..) is to be chosen,
> and which device from this API. A syntax will have to be agreed upon,
> like "ALSA:hw:0" or "OSS:/dev/dsp1".
>
> Have fun,
> --
> Stephane
>
>
> ___
> Discuss-gnuradio mailing list
> Discuss-gnuradio@gnu.org
> http://lists.gnu.org/mailman/listinfo/discuss-gnuradio
>
>
>
>


___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
http://lists.gnu.org/mailman/listinfo/discuss-gnuradio


Re: [Discuss-gnuradio] initial gr-audio-portaudio

2006-03-12 Thread Robert McGwier

Stephane Fillod wrote:

On Sun, Mar 12, 2006 at 02:36:21PM -0500, Robert McGwier wrote:
  
That is why I put the message out.  It will be good to have a working 
starting point.



Okay, there it is. Just checked in to gr-audio-portaudio repository.
It's somewhat working, but there's still some static in the audio 
output (tested with ALSA playback, mono and stereo). Some more work

is needed.

You will need the attached patchs:

  


Awesome.

--
AMSAT VP Engineering. Member: ARRL, AMSAT-DL, TAPR, Packrats,
NJQRP/AMQRP, QRP ARCI, QCWA, FRC. ARRL SDR Wrk Grp Chairman
Laziness is the number one inspiration for ingenuity.  Guilty as charged!



___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
http://lists.gnu.org/mailman/listinfo/discuss-gnuradio


Re: [Discuss-gnuradio] initial gr-audio-portaudio

2006-03-12 Thread Stephane Fillod
On Sun, Mar 12, 2006 at 02:36:21PM -0500, Robert McGwier wrote:
> That is why I put the message out.  It will be good to have a working 
> starting point.

Okay, there it is. Just checked in to gr-audio-portaudio repository.
It's somewhat working, but there's still some static in the audio 
output (tested with ALSA playback, mono and stereo). Some more work
is needed.

You will need the attached patchs:

- against gnuradio-core: ot_gri_ringbuffer.patch
* src/lib/omnithread/omnithread.h: add omni_mutex::trylock
* src/lib/general/gri_ringbuffer.{cc,h},
  src/lib/general/Makefile.am: new lockless ringbuffer (single
  reader/single writer) taken from JACK software (GPL).

- against portaudio-V19(CVS): portaudio-pkg-config.patch
* pkg-config .pc file with proper THREAD_FLAGS

The code should be portable. I was missing the native Win32 call for
mutex_trylock, so someone will have to find it, and define
OMNI_MUTEX_TRYLOCK_IMPLEMENTATION in src/lib/omnithread/ot_nt.h,
with appropriate semantic (return value).

The gri_pa_find_device_by_name() function will have to be made more
smart, like accepting which HostApi (ALSA, JACK, ..) is to be chosen,
and which device from this API. A syntax will have to be agreed upon,
like "ALSA:hw:0" or "OSS:/dev/dsp1".

Have fun,
-- 
Stephane
Index: src/lib/general/Makefile.am
===
RCS file: /sources/gnuradio/gnuradio-core/src/lib/general/Makefile.am,v
retrieving revision 1.83
diff -u -b -B -w -p -r1.83 Makefile.am
--- src/lib/general/Makefile.am 23 Feb 2006 21:26:29 -  1.83
+++ src/lib/general/Makefile.am 12 Mar 2006 20:55:14 -
@@ -187,6 +187,7 @@ libgeneral_la_SOURCES = \
gri_char_to_float.cc\
gri_uchar_to_float.cc   \
gri_interleaved_short_to_complex.cc \
+   gri_ringbuffer.cc   \
malloc16.c  
 
 libgeneral_qa_la_SOURCES = \
@@ -302,6 +303,7 @@ grinclude_HEADERS = \
gri_lfsr_32k.h  \
gri_short_to_float.h\
gri_char_to_float.h \
+   gri_ringbuffer.h\
gri_uchar_to_float.h\
random.h
 
Index: src/lib/omnithread/omnithread.h
===
RCS file: /sources/gnuradio/gnuradio-core/src/lib/omnithread/omnithread.h,v
retrieving revision 1.1.1.1
diff -u -b -B -w -p -r1.1.1.1 omnithread.h
--- src/lib/omnithread/omnithread.h 10 Apr 2004 18:00:52 -  1.1.1.1
+++ src/lib/omnithread/omnithread.h 12 Mar 2006 20:55:19 -
@@ -145,6 +145,7 @@ class omni_thread;
 
 #if (!defined(OMNI_MUTEX_IMPLEMENTATION)|| \
  !defined(OMNI_MUTEX_LOCK_IMPLEMENTATION)   || \
+ !defined(OMNI_MUTEX_TRYLOCK_IMPLEMENTATION)|| \
  !defined(OMNI_MUTEX_UNLOCK_IMPLEMENTATION) || \
  !defined(OMNI_CONDITION_IMPLEMENTATION)|| \
  !defined(OMNI_SEMAPHORE_IMPLEMENTATION)|| \
@@ -186,6 +187,10 @@ public:
 
 inline void lock(void){ OMNI_MUTEX_LOCK_IMPLEMENTATION   }
 inline void unlock(void)  { OMNI_MUTEX_UNLOCK_IMPLEMENTATION }
+inline int trylock(void)  { return OMNI_MUTEX_TRYLOCK_IMPLEMENTATION }
+   // if mutex is unlocked, lock it and return 1 (true).
+   // If it's already locked then return 0 (false).
+
 inline void acquire(void) { lock(); }
 inline void release(void) { unlock(); }
// the names lock and unlock are preferred over acquire and release
Index: src/lib/omnithread/ot_posix.h
===
RCS file: /sources/gnuradio/gnuradio-core/src/lib/omnithread/ot_posix.h,v
retrieving revision 1.1.1.1
diff -u -b -B -w -p -r1.1.1.1 ot_posix.h
--- src/lib/omnithread/ot_posix.h   10 Apr 2004 18:00:52 -  1.1.1.1
+++ src/lib/omnithread/ot_posix.h   12 Mar 2006 20:55:19 -
@@ -57,6 +57,9 @@ extern "C" void* omni_thread_wrapper(voi
 #define OMNI_MUTEX_LOCK_IMPLEMENTATION  \
 pthread_mutex_lock(&posix_mutex);
 
+#define OMNI_MUTEX_TRYLOCK_IMPLEMENTATION   \
+pthread_mutex_trylock(&posix_mutex);
+
 #define OMNI_MUTEX_UNLOCK_IMPLEMENTATION\
 pthread_mutex_unlock(&posix_mutex);
 
--- /dev/null   2006-03-10 00:02:48.821312048 +0100
+++ src/lib/general/gri_ringbuffer.h2006-03-12 20:05:46.0 +0100
@@ -0,0 +1,203 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 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 2, 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