Skip to content

Commit

Permalink
tuner
Browse files Browse the repository at this point in the history
  • Loading branch information
Shaji Khan committed Oct 18, 2023
1 parent bbddd8a commit c98e85a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ android {
applicationId "com.shajikhan.ladspa.amprack"
minSdk 23
targetSdk 33
versionCode 65
versionName '3.74'
versionCode 66
versionName '3.75'

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
externalNativeBuild {
Expand Down
14 changes: 13 additions & 1 deletion app/src/main/java/com/shajikhan/ladspa/amprack/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -2523,16 +2523,28 @@ public boolean isPluginLV2 (String pluginName) {
return lv2Plugins.contains(pluginName);
}

static ArrayList <Float> tunerBuffer = new ArrayList<>();
static Pitch pitch = new Pitch();
static void setMixerMeter (float inputValue, float outputValue) {
inputMeter.setProgress((int) (inputValue * 100));
outputMeter.setProgress((int) (outputValue * 100));
}

static void setMixerMeterSwitch (float inputValue, boolean isInput) {
if (inputValue < 0.001)
return;
// Log.d(TAG, "setMixerMeterSwitch() called with: inputValue = [" + inputValue + "], isInput = [" + isInput + "]");
if (isInput)
if (isInput) {
inputMeter.setProgress((int) (inputValue * 100));
if (tunerBuffer.size() < 30) {
// Log.d(TAG, "setMixerMeter: " + inputValue);
tunerBuffer.add(inputValue);
} else {
double freq = pitch.computePitchFrequency(tunerBuffer);
Log.d(TAG, "setMixerMeter: detected pitch " + freq);
tunerBuffer.clear();
}
}
else {
outputMeter.setProgress((int) (inputValue * 100));
// Log.d(TAG, "setMixerMeterSwitch: " + inputValue);
Expand Down

0 comments on commit c98e85a

Please sign in to comment.