public void Process() { int blocksize = s.DSPBlockSize; if (!Strobe()) { return; } // Re-ordered by George Byrkit, K9TRV, so that the inst and avg calcs are done regardless, // but events are only fired if anyone is subscribed. That way, one can use non-event-based // processing for a more deferred handling of updating an S-Meter float temp_metervalue = 0f; for (int i = 0; i < blocksize; i++) { temp_metervalue += d.GetPower(i); } this.meter_inst_value = (float)(10.0 * Math.Log10(temp_metervalue + 1e-20)); this.meter_average_value = (this.meter_average_value * 0.9f) + (this.meter_inst_value * 0.1f); if (metering_event != null) { metering_event(this, new SignalMeterEvent(this.meter_inst_value, this.meter_average_value)); } }
public void Process() { int blocksize = s.DSPBlockSize; this.num = (int)(blocksize * blocksize / s.DSPSampleRate); if (this.sqflag) { float temp = 0F; this.power = 0F; for (int i = 0; i < blocksize; i++) { this.power += d.GetPower(i); } temp = (float)(10.0 * Math.Log10(this.power) + this.sqoffset_meter + this.sqoffset_attenuation + this.sqoffset_gain); if (this.sqthreshold > temp) { if (this.running == false) { for (int i = 0; i < this.num; i++) { d.cpx[i].real *= 1.0F - (float)(i / this.num); d.cpx[i].imaginary *= 1.0F - (float)(i / this.num); } for (int i = this.num; i < blocksize; i++) { d.cpx[i].real = 0F; d.cpx[i].imaginary = 0F; } this.running = true; } else { for (int i = 0; i < blocksize; i++) { d.cpx[i].real = 0F; d.cpx[i].imaginary = 0F; } } } } else { if (this.running) { for (int i = 0; i < this.num; i++) { d.cpx[i].real *= 1.0F - (float)(i / this.num); d.cpx[i].imaginary *= 1.0F - (float)(i / this.num); } this.running = false; } } }