On Wednesday 27 February 2013 18:51:34 Patrick Shirkey wrote:
On Thu, February 28, 2013 8:14 am, drew Roberts
wrote:
Ignorant here. Trying to scrounge around and make
something work for a
demo
purpose.
In python I am trying to build this pipeline:
pipeline_txt = (
'jackaudiosrc ! '
'level name=level interval=1000000000 !'
'jackaudiosink')
pipeline = gst.parse_launch(pipeline_txt)
I have been trying that a number of ways.
So, I basically watch the bus for level info.
In a subroutine, I can print the peak info to the terminal.
I can't seem to figure out how to pass this info back to the rest of the
program so that I can hook it up to a graphical meter.
Add a call to the callback for the meter to set the meter value from the
subroutine?
Cna anyone point me to some simple code doing
something like this? Give
me some clues that might help someone who seems to be being very dense
for days
now?
Sounds like you just need to connect the meter to the subroutine but it's
a bit had to say without a bit more code to demonstrate how you are
setting up the meter.
A few questions...
Is the meter a class of it's own or just a widget in a draw routine?
Do you have a "set_meter_value" type of function or are you just calling
directly to the meter widget's value?
What UI toolkit is the meter using?
Right now, I have not even tried to make a meter, I just want to get the peak
value out of the subroutine and print it from outside. I can print it from
the inside but can't even figure out how to get it out.
One sample I started working with (there are others but this is one) can be
found here:
http://stackoverflow.com/questions/9344888/getting-max-amplitude-for-an-aud…
In the def show_peak(bus, message):
there is:
peaks.append(message.structure['peak'][0])
but this is more of a "batch" type setup rather than an interactive one.
So let's say I do something like this instead:
#peaks.append(message.structure['peak'][0])
zpeak = message.structure['peak'][0]
#print "message.structure: "
print zpeak
return zpeak
along with making a jack source and sink instead of a file source and fake
sink.
I can get the peaks printed in there via the print zpeak.
But I am going around in circles (actually, circles is too clean a shape) in
my head trying to figure out how to get that info out as it comes in.
Once I ge that, then I have to figure out how to hook it up to a meter widget.
One possibility I have looked at basing this on is this:
http://zetcode.com/gui/pygtk/customwidget/
--
Patrick Shirkey
Boost Hardware Ltd
all the best,
drew