mirror of
https://github.com/eried/portapack-mayhem.git
synced 2025-06-27 16:17:31 -04:00
Added an audio FFT view in Wideband FM receive
Tried speeding up fill_rectangle for clearing the waveform widget
This commit is contained in:
parent
b11c3c94b6
commit
b813b32593
19 changed files with 259 additions and 38 deletions
|
@ -1493,6 +1493,7 @@ Waveform::Waveform(
|
|||
color_ { color }
|
||||
{
|
||||
//set_focusable(false);
|
||||
//previous_data.resize(length_, 0);
|
||||
}
|
||||
|
||||
void Waveform::set_cursor(const uint32_t i, const int16_t position) {
|
||||
|
@ -1522,19 +1523,31 @@ void Waveform::set_length(const uint32_t new_length) {
|
|||
void Waveform::paint(Painter& painter) {
|
||||
size_t n;
|
||||
Coord y, y_offset = screen_rect().location().y();
|
||||
Coord prev_x = screen_rect().location().x(), prev_y;
|
||||
Coord prev_x, prev_y;
|
||||
float x, x_inc;
|
||||
Dim h = screen_rect().size().height();
|
||||
const float y_scale = (float)(h - 1) / 65536.0;
|
||||
int16_t * data_start = data_ + offset_;
|
||||
|
||||
// Clear
|
||||
painter.fill_rectangle(screen_rect(), Color::black());
|
||||
|
||||
if (!length_) return;
|
||||
|
||||
x_inc = (float)screen_rect().size().width() / length_;
|
||||
|
||||
// Clear
|
||||
painter.fill_rectangle_unrolled8(screen_rect(), Color::black());
|
||||
/*prev_x = screen_rect().location().x();
|
||||
prev_y = previous_data[0];
|
||||
x = prev_x + x_inc;
|
||||
for (n = 1; n < length_; n++) {
|
||||
y = previous_data[n];
|
||||
display.draw_line( {prev_x, prev_y}, {(Coord)x, y}, Color::black());
|
||||
|
||||
prev_x = x;
|
||||
prev_y = y;
|
||||
x += x_inc;
|
||||
}*/
|
||||
prev_x = screen_rect().location().x();
|
||||
|
||||
if (digital_) {
|
||||
// Digital waveform: each value is an horizontal line
|
||||
x = 0;
|
||||
|
@ -1557,8 +1570,10 @@ void Waveform::paint(Painter& painter) {
|
|||
x = prev_x + x_inc;
|
||||
h /= 2;
|
||||
prev_y = y_offset + h - (*(data_start++) * y_scale);
|
||||
//previous_data[0] = prev_y;
|
||||
for (n = 1; n < length_; n++) {
|
||||
y = y_offset + h - (*(data_start++) * y_scale);
|
||||
//previous_data[n] = y;
|
||||
display.draw_line( {prev_x, prev_y}, {(Coord)x, y}, color_);
|
||||
|
||||
prev_x = x;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue