1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-08-10 22:11:50 +02:00

Android: Fix voice typing fails to start on certain devices (#12351)

This commit is contained in:
Henry Heino
2025-05-28 01:48:23 -07:00
committed by GitHub
parent 700ddf269a
commit f8200efffc

View File

@@ -18,6 +18,7 @@ class AudioRecorder(context: Context) : Closeable {
// Don't allow the unprocessed audio buffer to grow indefinitely -- discard
// data if longer than this:
private val maxLengthSeconds = 120
private val maxRecorderBufferLengthSeconds = 20
private val maxBufferSize = sampleRate * maxLengthSeconds
private val buffer = FloatArray(maxBufferSize)
private var bufferWriteOffset = 0
@@ -45,7 +46,7 @@ class AudioRecorder(context: Context) : Closeable {
.setChannelMask(AudioFormat.CHANNEL_IN_MONO)
.build()
)
.setBufferSizeInBytes(maxBufferSize * Float.SIZE_BYTES)
.setBufferSizeInBytes(maxRecorderBufferLengthSeconds * sampleRate * Float.SIZE_BYTES)
.build()
// Discards the first [samples] samples from the start of the buffer. Conceptually, this