MCPcopy Create free account
hub / github.com/audacity/audacity / CalcPower

Method CalcPower

src/import/SpecPowerMeter.cpp:39–59  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

37}
38
39float SpecPowerCalculation::CalcPower(float* sig, float fc, float bw)
40{
41 float pwr;
42 int loBin, hiBin;
43
44 // Given the bandwidth bw, get the boundary bin numbers
45 loBin = Freq2Bin(fc - (bw / 2.0f));
46 hiBin = Freq2Bin(fc + (bw / 2.0f));
47 if (loBin == hiBin)
48 {
49 hiBin = loBin + 1;
50 }
51
52 // Calc the FFT
53 FFT(mSigLen, 0, sig, mSigI.get(), mSigFR.get(), mSigFI.get());
54
55 // Calc the in-band power
56 pwr = CalcBinPower(mSigFR.get(), mSigFI.get(), loBin, hiBin);
57
58 return pwr;
59}
60
61float SpecPowerCalculation::CalcBinPower(float* sig_f_r, float* sig_f_i, int loBin, int hiBin)
62{

Callers 1

RunMethod · 0.80

Calls 2

FFTFunction · 0.50
getMethod · 0.45

Tested by

no test coverage detected