Przeglądaj źródła

Add readPeakToPeak() to AudioAnalyzePeak

dds
PaulStoffregen 9 lat temu
rodzic
commit
32245a94ce
2 zmienionych plików z 21 dodań i 3 usunięć
  1. +16
    -2
      analyze_peak.h
  2. +5
    -1
      gui/index.html

+ 16
- 2
analyze_peak.h Wyświetl plik

@@ -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 Wyświetl plik

@@ -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>

Ładowanie…
Anuluj
Zapisz