ソースを参照

Add readPeakToPeak() to AudioAnalyzePeak

dds
PaulStoffregen 8年前
コミット
32245a94ce
2個のファイルの変更21行の追加3行の削除
  1. +16
    -2
      analyze_peak.h
  2. +5
    -1
      gui/index.html

+ 16
- 2
analyze_peak.h ファイルの表示

@@ -45,12 +45,26 @@ public:
}
float read(void) {
__disable_irq();
int diff = max_sample - min_sample;
int min = min_sample;
int max = max_sample;
min_sample = 32767;
max_sample = -32768;
__enable_irq();
return diff / 65535.0;
min = abs(min);
max = abs(max);
if (min > max) max = min;
return (float)max / 32767.0f;
}
float readPeakToPeak(void) {
__disable_irq();
int min = min_sample;
int max = max_sample;
min_sample = 32767;
max_sample = -32768;
__enable_irq();
return (float)(max - min) / 32767.0f;
}

virtual void update(void);
private:
audio_block_t *inputQueueArray[1];

+ 5
- 1
gui/index.html ファイルの表示

@@ -2082,9 +2082,13 @@ double s_freq = .0625;</p>
<p class=desc>Returns true each time new peak data is available.
</p>
<p class=func><span class=keyword>read</span>();</p>
<p class=desc>Read the highest peak value since the last read.
<p class=desc>Read the highest peak amplitude value since the last read.
Return is from 0.0 to 1.0.
</p>
<p class=func><span class=keyword>readPeakToPeak</span>();</p>
<p class=desc>Read the highest peak-to-peak amplitude since the last read.
Return is from 0.0 to 2.0.
</p>
<h3>Examples</h3>
<p class=exam>File &gt; Examples &gt; Audio &gt; Analysis &gt; PeakMeterMono
</p>

読み込み中…
キャンセル
保存