discuss-gnuradio
[Top][All Lists]
Advanced

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

[Discuss-gnuradio] gr.message_source question


From: W. David Li
Subject: [Discuss-gnuradio] gr.message_source question
Date: Mon, 14 Jan 2008 16:23:13 -0800

Hi,

I got a python class that contains a gr.message_source as in the
following. When UDP packets came in "enqueue_pkt" was called. Packets
were converted into stream and inserted into a gr.msg_queue. Now I tried
to dump the stream to an audio device by connecting the message_source
to an audio sink. I got an error message:

          audio_alsa_sink[hw:0,0]: Device or resource busy

What went wrong here?

- David

---------------- code snipets ---------------

class source(gr.hier_block2):
    
    def __init__(self):
        
        gr.hier_block2.__init__(self,
                                "local_vrf_source",
                                gr.io_signature(0,0,0),
                                gr.io_signature(0,0,0))
        
        self._message_source = gr.message_source(4) #Is this the right
size?
        self._message_queue  = self._message_source.msgq()
        


        
    def enqueue_pkt(self, pkt):
        """This will take UPD pakcets, converts them into stream
gr_messsage
        and enqueue to the message queue
        """ 
        try:
            msg_sptr = gr.message_from_string(pkt) 
            self._message_queue.insert_tail(msg_sptr)
            
            audio_sink = audio.sink(48000)
            self.connect(self._message_source,audio_sink)
            
        except Exception,e:
            print 'source:  exception: ', e

----------------- end of code snipets --------------------------





reply via email to

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