Hello All:
(Cross posted to the wxperl-users mailing list)
Awhile back I was working on some wxPerl code to simulate an o-scope display screen. While the original requirement that started me down that path went away, I did get a proof of concept working that displayed several waveforms and a four channel logic analyser(animated). I have also been playing with the Gqrx software defined radio package and developed a wxPerl based Gqrx scanner application plug-in. A request was made on the Gqrx google group for a method to display the raw audio waveform. It sounded like a good challenge. Gqrx outputs one channel of 16-bit, 48KHz audio to a UDP port. I have this working with a scrolling audio waveform on the o-scope screen. I wonder, and it's hard to tell, if the display is keeping up with the 48KHz data stream. Am I dropping packets? Can I speed up the display process using a memory file rather than writing to a disk file? Will Wx support this? This is the current display and refresh code.
Can this code be modified to use a memory file? Syntax? I am also considering moving the socket code into it's own thread to isolate the reading and decoding of the UDP packets from the updating of the display. Thanks in advance,# Create the Display(bmp & sbm) and Drawing(image) Objects # Uses GD calls to draw the screen background and waveform on t +he image object $self->{bmp} = Wx::Bitmap->new("rawaudio.png", wxBITMAP_TYPE_PNG); $self->{sbm} = Wx::StaticBitmap->new($self, wxID_ANY, $self->{bmp} +, wxDefaultPosition, [600,600]); $oscope->{image} = GD::Image->new($oscope->{maxw}, $oscope->{maxh} +) || die; # Read the updated image and refresh the display $self->{bmp} = Wx::Bitmap->new("rawaudio.png", wxBITMAP_TYPE_PNG); + # Reload the screen image $self->{sbm}->SetBitmap($self->{bmp}); # Refresh sc +reen # Save the Drawing Object to a disk file my $png_data = $oscope->{image}->png; # Write image + to a file open OUTFILE, ">", "rawaudio.png" || die; binmode OUTFILE; print OUTFILE $png_data; close OUTFILE;
Update:
I now have a fairly functional raw audio display script. I still don't know if I am dropping any packets. I am considering developing a UDP server script to feed controlled waveform packets to my script to help to resolve this question. See jmlynesjr for a snapshot of the screen. I will post the code to CUFP later as another wxPerl example. It was a good learning experience for using and decoding/unpacking UDP packets, writing to memory files, and for reusing my simulated o-scope code. Dereferencing lists and arrays inside hashes gave me trouble and I may post a follow-up question after a little more reading on the topic.
James
There's never enough time to do it right, but always enough time to do it over...
In reply to Memory File and wxPerl by jmlynesjr
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |