Skip to content

Commit

Permalink
Add amplitudes to RecordingUpdate to be passed back to caller
Browse files Browse the repository at this point in the history
  • Loading branch information
zwarm committed Jun 9, 2024
1 parent d8f6f5f commit 9b97d8b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -150,10 +150,12 @@ class AudioRecorder(
delay(RECORDING_UPDATE_INTERVAL)
elapsedTimeInSeconds += (RECORDING_UPDATE_INTERVAL / 1000).toInt()
val fileSize = File(filePath).length()
val amplitude = recorder?.maxAmplitude?.toFloat() ?: 0f
_recordingUpdates.value = RecordingUpdate(
elapsedTime = elapsedTimeInSeconds,
fileSize = fileSize,
fileSizeLimitExceeded = fileSize >= recordingStrategy.maxFileSize,
amplitudes = listOf(amplitude)
)

if ( maxFileSizeExceeded(fileSize) || maxDurationExceeded(elapsedTimeInSeconds) ) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@ package org.wordpress.android.util.audio
data class RecordingUpdate(
val elapsedTime: Int = 0, // in seconds
val fileSize: Long = 0L, // in bytes
val fileSizeLimitExceeded: Boolean = false
val fileSizeLimitExceeded: Boolean = false,
val amplitudes: List<Float> = emptyList()
)

0 comments on commit 9b97d8b

Please sign in to comment.