Skip to content

Commit

Permalink
V2.7
Browse files Browse the repository at this point in the history
new options for peak hold
fixes #24
  • Loading branch information
woheller69 committed Oct 3, 2024
1 parent 27409c0 commit a38a96c
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 8 deletions.
4 changes: 2 additions & 2 deletions audioSpectrumAnalyzer/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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;
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions audioSpectrumAnalyzer/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -125,4 +125,7 @@
<string name="screenshot">Screenshot stored in\u0020</string>
<string name="permission_storage_denied">Permission to write to storage denied.</string>
<string name="permission_microphone_denied">Permission for microphone denied.</string>
<string name="preference_peakHoldTime_1">in seconds</string>
<string name="preference_peakHoldTime_2">Peak Hold time</string>
<string name="preference_peakDropSpeed">Peak decay rate</string>
</resources>
20 changes: 19 additions & 1 deletion audioSpectrumAnalyzer/src/main/res/xml/preferences.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" >
<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">

<PreferenceCategory
android:key="generalSettingsBar"
Expand Down Expand Up @@ -49,6 +51,22 @@
android:key="spectrumRange"
android:summary="@string/preference_spectrumRange_1"
android:title="@string/preference_spectrumRange_2" />

<SeekBarPreference
android:title="@string/preference_peakHoldTime_2"
android:summary="@string/preference_peakHoldTime_1"
android:max="60"
android:defaultValue="2"
android:key="prefPeakHold"
app:showSeekBarValue="true" />

<SeekBarPreference
android:title="@string/preference_peakDropSpeed"
android:max="100"
android:defaultValue="20"
android:key="prefPeakDropSpeed"
app:showSeekBarValue="true" />

</PreferenceCategory>

<PreferenceCategory
Expand Down
1 change: 1 addition & 0 deletions fastlane/metadata/android/de-DE/changelogs/270.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Neue Einstellmöglichkeiten für Peak Hold
1 change: 1 addition & 0 deletions fastlane/metadata/android/en-US/changelogs/270.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
New options for peak hold

0 comments on commit a38a96c

Please sign in to comment.