Sorry, now with example
Hi all,
if I use a qt-gui sink in a flowgraph I get a segmentation fault on the
tb.stop() call.
That is a problem as I use this together with a wavfile-sink.
Due to the segfault the wav file header is not written and I have to
use a hexeditor to correct the header data to be able to read the
samples in a wavfile source.
The segfault even happens if I remove the wavfile-sink.
A small example is attached.
I'm using gnuradio from git together with gentoo 64 bit linux.
Thanks in advance
Volker
#!/usr/bin/env python
##################################################
# Gnuradio Python Flow Graph
# Title: Wavsinktest
# Generated: Mon Mar 18 14:38:35 2013
##################################################
from PyQt4 import Qt
from gnuradio import analog
from gnuradio import eng_notation
from gnuradio import gr
from gnuradio.eng_option import eng_option
from gnuradio.gr import firdes
from gnuradio.qtgui import qtgui
from optparse import OptionParser
import sip
import sys
class WavSinkTest(gr.top_block, Qt.QWidget):
def __init__(self):
gr.top_block.__init__(self, "Wavsinktest")
Qt.QWidget.__init__(self)
self.setWindowTitle("Wavsinktest")
self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc'))
self.top_scroll_layout = Qt.QVBoxLayout()
self.setLayout(self.top_scroll_layout)
self.top_scroll = Qt.QScrollArea()
self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame)
self.top_scroll_layout.addWidget(self.top_scroll)
self.top_scroll.setWidgetResizable(True)
self.top_widget = Qt.QWidget()
self.top_scroll.setWidget(self.top_widget)
self.top_layout = Qt.QVBoxLayout(self.top_widget)
self.top_grid_layout = Qt.QGridLayout()
self.top_layout.addLayout(self.top_grid_layout)
##################################################
# Variables
##################################################
self.samp_rate = samp_rate = 32000
##################################################
# Blocks
##################################################
self.qtgui_sink_x_0 = qtgui.sink_c(
1024, #fftsize
firdes.WIN_BLACKMAN_hARRIS, #wintype
0, #fc
samp_rate, #bw
"QT GUI Plot", #name
True, #plotfreq
True, #plotwaterfall
True, #plottime
True, #plotconst
)
self.qtgui_sink_x_0.set_update_time(1.0 / 10)
self._qtgui_sink_x_0_win = sip.wrapinstance(self.qtgui_sink_x_0.pyqwidget(), Qt.QWidget)
self.top_layout.addWidget(self._qtgui_sink_x_0_win)
self.gr_throttle_0 = gr.throttle(gr.sizeof_gr_complex*1, samp_rate*10)
self.analog_sig_source_x_0 = analog.sig_source_c(samp_rate, analog.GR_COS_WAVE, 1000, 1, 0)
##################################################
# Connections
##################################################
self.connect((self.analog_sig_source_x_0, 0), (self.gr_throttle_0, 0))
self.connect((self.gr_throttle_0, 0), (self.qtgui_sink_x_0, 0))
def get_samp_rate(self):
return self.samp_rate
def set_samp_rate(self, samp_rate):
self.samp_rate = samp_rate
self.analog_sig_source_x_0.set_sampling_freq(self.samp_rate)
self.gr_throttle_0.set_sample_rate(self.samp_rate*10)
self.qtgui_sink_x_0.set_frequency_range(0, self.samp_rate)
if __name__ == '__main__':
parser = OptionParser(option_class=eng_option, usage="%prog: [options]")
(options, args) = parser.parse_args()
qapp = Qt.QApplication(sys.argv)
tb = WavSinkTest()
tb.start()
tb.show()
qapp.exec_()
tb.stop()
_______________________________________________
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio