Hello All:

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 referesh code.

    # Create the Display(bmp & sbm) and Drawing(image) Objects
    #    Uses GD calls to draw the screen background and waveform on the
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 screen

    # 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;

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,
James

Reply via email to