Browse Source

Make sure that every highest peak value is drawn

As process is usually called more often than
update_cb, we should store the highest peak
value until it is consumed by update_cb.
tags/non-daw-v1.2.0
Roy Vegard Ovesen 12 years ago
parent
commit
ec8bfcba63
2 changed files with 9 additions and 2 deletions
  1. +4
    -1
      mixer/src/Meter_Indicator_Module.C
  2. +5
    -1
      mixer/src/Meter_Module.C

+ 4
- 1
mixer/src/Meter_Indicator_Module.C View File

@@ -183,6 +183,7 @@ Meter_Indicator_Module::update_cb ( void )
for ( int i = 0; i < dpm_pack->children(); ++i )
{
((DPM*)dpm_pack->child( i ))->value( control_value[i] );
control_value[i] = -70.0f;
}
}
}
@@ -275,7 +276,9 @@ Meter_Indicator_Module::process ( nframes_t )

for ( int i = 0; i < p->hints.dimensions; ++i )
{
control_value[i] = ((float*)control_input[0].buffer())[i];
float dB = ((float*)control_input[0].buffer())[i];
if ( dB > control_value[i])
control_value[i] = dB;
}
}
}

+ 5
- 1
mixer/src/Meter_Module.C View File

@@ -89,7 +89,10 @@ Meter_Module::update_cb ( void )
Fl::repeat_timeout( METER_UPDATE_FREQ, update_cb, this );

for ( int i = dpm_pack->children(); i--; )
{
((DPM*)dpm_pack->child( i ))->value( control_value[i] );
control_value[i] = -70.0f;
}
}

bool
@@ -212,7 +215,8 @@ Meter_Module::process ( nframes_t nframes )
float dB = 20 * log10( get_peak_sample( (float*)audio_input[i].buffer(), nframes ) );

((float*)control_output[0].buffer())[i] = dB;
control_value[i] = dB;
if (dB > control_value[i])
control_value[i] = dB;
}
}
}

Loading…
Cancel
Save