diff --git a/audioSpectrumAnalyzer/build.gradle b/audioSpectrumAnalyzer/build.gradle
index e4a0ece..d052691 100644
--- a/audioSpectrumAnalyzer/build.gradle
+++ b/audioSpectrumAnalyzer/build.gradle
@@ -6,8 +6,8 @@ android {
applicationId "org.woheller69.audio_analyzer_for_android"
minSdkVersion 14
targetSdk 34
- versionCode 260
- versionName "2.6"
+ versionCode 270
+ versionName "2.7"
}
buildTypes {
release {
diff --git a/audioSpectrumAnalyzer/src/main/java/org/woheller69/audio_analyzer_for_android/SpectrumPlot.java b/audioSpectrumAnalyzer/src/main/java/org/woheller69/audio_analyzer_for_android/SpectrumPlot.java
index 5998ccd..ad3bc4a 100644
--- a/audioSpectrumAnalyzer/src/main/java/org/woheller69/audio_analyzer_for_android/SpectrumPlot.java
+++ b/audioSpectrumAnalyzer/src/main/java/org/woheller69/audio_analyzer_for_android/SpectrumPlot.java
@@ -16,15 +16,14 @@
package org.woheller69.audio_analyzer_for_android;
import android.content.Context;
+import android.content.SharedPreferences;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Typeface;
import android.os.SystemClock;
import android.util.Log;
-
-import static java.lang.Math.abs;
-import static java.lang.Math.round;
+import androidx.preference.PreferenceManager;
/**
* The spectrum plot part of AnalyzerGraphic
@@ -42,7 +41,7 @@ class SpectrumPlot {
private int canvasHeight=0, canvasWidth=0;
private float DPRatio;
-
+ private AnalyzerUtil.PeakHoldAndFall peakHold;
double cursorFreq, cursorDB; // cursor location
private Plot2D plot2D;
ScreenPhysicalMapping axisX, axisY;
@@ -88,6 +87,11 @@ class SpectrumPlot {
canvasWidth, canvasHeight, DPRatio);
axisX = plot2D.axisX;
axisY = plot2D.axisY;
+
+ SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(_context);
+ int peakHoldTime = sharedPref.getInt("prefPeakHold",2);
+ int peakDropSpeed = sharedPref.getInt("prefPeakDropSpeed", 20);
+ peakHold = new AnalyzerUtil.PeakHoldAndFall((double) peakHoldTime, (double) peakDropSpeed);
}
void setCanvas(int _canvasWidth, int _canvasHeight, double[] axisBounds) {
@@ -120,7 +124,6 @@ void addCalibCurve(double[] y, double[] x, String name) {
}
private double[] db_cache = null;
- private AnalyzerUtil.PeakHoldAndFall peakHold = new AnalyzerUtil.PeakHoldAndFall();
private long timeLastCall;
// Plot the spectrum into the Canvas c
diff --git a/audioSpectrumAnalyzer/src/main/res/values/strings.xml b/audioSpectrumAnalyzer/src/main/res/values/strings.xml
index ad0cc34..acd97a0 100644
--- a/audioSpectrumAnalyzer/src/main/res/values/strings.xml
+++ b/audioSpectrumAnalyzer/src/main/res/values/strings.xml
@@ -125,4 +125,7 @@
Screenshot stored in\u0020
Permission to write to storage denied.
Permission for microphone denied.
+ in seconds
+ Peak Hold time
+ Peak decay rate
diff --git a/audioSpectrumAnalyzer/src/main/res/xml/preferences.xml b/audioSpectrumAnalyzer/src/main/res/xml/preferences.xml
index bb3e62e..8a16210 100644
--- a/audioSpectrumAnalyzer/src/main/res/xml/preferences.xml
+++ b/audioSpectrumAnalyzer/src/main/res/xml/preferences.xml
@@ -1,5 +1,7 @@
-
+
+
+
+
+
+