Skip to content

Commit 28267aa

Browse files
committed
- Fix common crash when detecting low frequencies.
- Increasing margins a bit for temperament button.
1 parent 25e8611 commit 28267aa

File tree

6 files changed

+29
-8
lines changed

6 files changed

+29
-8
lines changed

app/build.gradle.kts

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ android {
1616
applicationId = "de.moekadu.tuner"
1717
minSdk = 23
1818
targetSdk = 35
19-
versionCode = 40
20-
versionName = "7.1.0"
19+
versionCode = 41
20+
versionName = "7.1.1"
2121
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
2222
vectorDrawables.useSupportLibrary = true
2323
resourceConfigurations += listOf("cs", "de", "en", "fr", "zh-rCN")

app/src/main/java/de/moekadu/tuner/MainActivity.kt

+2-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,8 @@ class MainActivity : ComponentActivity() {
8686
enableEdgeToEdge()
8787
super.onCreate(savedInstanceState)
8888
// Log.v("Tuner", "MainActivity2.onCreate: savedInstanceState = $savedInstanceState")
89-
89+
// if (Build.VERSION.SDK_INT >= 27)
90+
// setShowWhenLocked(true)
9091
runBlocking {
9192
migrateFromV6(this@MainActivity, pref, temperaments, instruments)
9293
}

app/src/main/java/de/moekadu/tuner/notedetection/TargetNoteAutoDetection.kt

+3-1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
*/
1919
package de.moekadu.tuner.notedetection
2020

21+
import android.util.Log
2122
import de.moekadu.tuner.instruments.Instrument
2223
import de.moekadu.tuner.instruments.InstrumentIcon
2324
import de.moekadu.tuner.temperaments.MusicalNote
@@ -128,8 +129,9 @@ class TargetNoteAutoDetection(
128129
return floatArrayOf(Float.POSITIVE_INFINITY, Float.NEGATIVE_INFINITY)
129130
}
130131
instrument.isChromatic -> {
131-
// Log.v("Tuner", "TargetNoteAutoDetection: instrument.isChrmoatic")
132+
// Log.v("Tuner", "TargetNoteAutoDetection: instrument.isChromatic")
132133
val noteIndex = musicalScale.getNoteIndex(note)
134+
// Log.v("Tuner", "TargetNoteAutoDetection.getFrequencyRangeWithinWhichWeReturnTheInputNote: note=$note, noteIndex=$noteIndex")
133135
return setFrequencyRangeForChromaticTarget(noteIndex)
134136
}
135137
numDifferentNotes <= 1 -> { // always return the input note

app/src/main/java/de/moekadu/tuner/temperaments/MusicalScaleFrequencies.kt

+3-2
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,11 @@ class MusicalScaleFrequencies(
4343

4444
/** Obtain frequency of given index.
4545
* @param index Note index (indexStart <= index < indexEnd)
46-
* @return Frequency at given index.
46+
* @return Frequency at given index. If index is out of bounds, we return the index of the
47+
* the lower/upper bound.
4748
*/
4849
operator fun get(index: Int): Float {
49-
return frequencies[index + indexOfReferenceNote]
50+
return frequencies[(index + indexOfReferenceNote).coerceIn(0, frequencies.size-1)]
5051
}
5152

5253
/** Obtain frequency by float index.

app/src/main/java/de/moekadu/tuner/ui/temperaments/TemperamentDialog.kt

+7-2
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ fun TemperamentDialog(
136136
id = R.string.temperament),
137137
modifier = Modifier
138138
.padding(horizontal = 16.dp)
139-
.padding(top = 8.dp),
139+
.padding(top = 16.dp),
140140
style = MaterialTheme.typography.labelSmall
141141
)
142142
Text(
@@ -146,7 +146,12 @@ fun TemperamentDialog(
146146
)
147147
Text(
148148
state.temperament.value.description.value(context),
149-
modifier = Modifier.padding(horizontal = 16.dp, vertical = 8.dp),
149+
modifier = Modifier.padding(
150+
start = 16.dp,
151+
end = 16.dp,
152+
top = 8.dp,
153+
bottom = 16.dp
154+
),
150155
style = MaterialTheme.typography.labelMedium
151156
)
152157
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
v7.0.0:
2+
- New UI backend (jetpack compose).
3+
- (Hopefully) improved note detection for some edge cases.
4+
- User defined temperaments.
5+
6+
v7.1.0:
7+
- Fix displaying preferences correctly on Android 15.
8+
- Enable edge-to-edge mode (meaning that e.g. lists are displayed
9+
down to the bottom behind navigation bar).
10+
11+
v7.1.1:
12+
- Fix common crash when detecting low frequencies.

0 commit comments

Comments
 (0)