diff --git a/app/src/main/java/app/myzel394/alibi/db/AppSettings.kt b/app/src/main/java/app/myzel394/alibi/db/AppSettings.kt
index a86ea23..30191f6 100644
--- a/app/src/main/java/app/myzel394/alibi/db/AppSettings.kt
+++ b/app/src/main/java/app/myzel394/alibi/db/AppSettings.kt
@@ -76,7 +76,6 @@ data class RecordingInformation(
val maxDuration: Long,
val intervalDuration: Long,
val fileExtension: String,
- val forceExactMaxDuration: Boolean,
) {
val hasRecordingsAvailable
get() = File(folderPath).listFiles()?.isNotEmpty() ?: false
@@ -88,7 +87,6 @@ data class AudioRecorderSettings(
val maxDuration: Long = 30 * 60 * 1000L,
// 60 seconds
val intervalDuration: Long = 60 * 1000L,
- val forceExactMaxDuration: Boolean = true,
// 320 Kbps
val bitRate: Int = 320000,
val samplingRate: Int? = null,
@@ -238,10 +236,6 @@ data class AudioRecorderSettings(
return copy(maxDuration = duration)
}
- fun setForceExactMaxDuration(forceExactMaxDuration: Boolean): AudioRecorderSettings {
- return copy(forceExactMaxDuration = forceExactMaxDuration)
- }
-
fun setShowAllMicrophones(showAllMicrophones: Boolean): AudioRecorderSettings {
return copy(showAllMicrophones = showAllMicrophones)
}
diff --git a/app/src/main/java/app/myzel394/alibi/helpers/AudioRecorderExporter.kt b/app/src/main/java/app/myzel394/alibi/helpers/AudioRecorderExporter.kt
index 4eefbda..7a30d5c 100644
--- a/app/src/main/java/app/myzel394/alibi/helpers/AudioRecorderExporter.kt
+++ b/app/src/main/java/app/myzel394/alibi/helpers/AudioRecorderExporter.kt
@@ -17,12 +17,11 @@ data class AudioRecorderExporter(
val recording: RecordingInformation,
) {
suspend fun concatenateFiles(
- context: Context,
batchesFolder: BatchesFolder,
outputFilePath: String,
forceConcatenation: Boolean = false,
) {
- val filePaths = batchesFolder.getBatchesForFFmpeg().joinToString("|")
+ val filePaths = batchesFolder.getBatchesForFFmpeg()
if (batchesFolder.checkIfOutputAlreadyExists(
recording.recordingStart,
@@ -32,12 +31,13 @@ data class AudioRecorderExporter(
return
}
+ val filePathsConcatenated = filePaths.joinToString("|")
val command =
"-protocol_whitelist saf,concat,content,file,subfile" +
- " -i 'concat:${filePaths}' -y" +
+ " -i 'concat:$filePathsConcatenated' -y" +
" -acodec copy" +
" -metadata date='${recording.recordingStart.format(DateTimeFormatter.ISO_DATE_TIME)}'" +
- " -metadata batch_count='${filePaths.length}'" +
+ " -metadata batch_count='${filePaths.size}'" +
" -metadata batch_duration='${recording.intervalDuration}'" +
" -metadata max_duration='${recording.maxDuration}'" +
" $outputFilePath"
@@ -57,9 +57,6 @@ data class AudioRecorderExporter(
throw Exception("Failed to concatenate audios")
}
-
- val minRequiredForPossibleInExactMaxDuration =
- recording.maxDuration / recording.intervalDuration
}
companion object {
diff --git a/app/src/main/java/app/myzel394/alibi/services/IntervalRecorderService.kt b/app/src/main/java/app/myzel394/alibi/services/IntervalRecorderService.kt
index c947ede..cc6ac55 100644
--- a/app/src/main/java/app/myzel394/alibi/services/IntervalRecorderService.kt
+++ b/app/src/main/java/app/myzel394/alibi/services/IntervalRecorderService.kt
@@ -40,7 +40,6 @@ abstract class IntervalRecorderService : ExtraRecorderInformationService() {
maxDuration = settings.maxDuration,
fileExtension = settings.fileExtension,
intervalDuration = settings.intervalDuration,
- forceExactMaxDuration = settings.forceExactMaxDuration,
)
// Make overrideable
@@ -106,7 +105,6 @@ abstract class IntervalRecorderService : ExtraRecorderInformationService() {
data class Settings(
val maxDuration: Long,
val intervalDuration: Long,
- val forceExactMaxDuration: Boolean,
val bitRate: Int,
val samplingRate: Int,
val outputFormat: Int,
@@ -135,7 +133,6 @@ abstract class IntervalRecorderService : ExtraRecorderInformationService() {
outputFormat = audioRecorderSettings.getOutputFormat(),
encoder = audioRecorderSettings.getEncoder(),
maxDuration = audioRecorderSettings.maxDuration,
- forceExactMaxDuration = audioRecorderSettings.forceExactMaxDuration,
)
}
}
diff --git a/app/src/main/java/app/myzel394/alibi/ui/components/SettingsScreen/atoms/ForceExactMaxDurationTile.kt b/app/src/main/java/app/myzel394/alibi/ui/components/SettingsScreen/atoms/ForceExactMaxDurationTile.kt
deleted file mode 100644
index 5baea8c..0000000
--- a/app/src/main/java/app/myzel394/alibi/ui/components/SettingsScreen/atoms/ForceExactMaxDurationTile.kt
+++ /dev/null
@@ -1,54 +0,0 @@
-package app.myzel394.alibi.ui.components.SettingsScreen.atoms
-
-import androidx.compose.material.icons.Icons
-import androidx.compose.material.icons.filled.GraphicEq
-import androidx.compose.material3.Icon
-import androidx.compose.material3.Switch
-import androidx.compose.runtime.Composable
-import androidx.compose.runtime.collectAsState
-import androidx.compose.runtime.rememberCoroutineScope
-import androidx.compose.ui.platform.LocalContext
-import androidx.compose.ui.res.stringResource
-import app.myzel394.alibi.R
-import app.myzel394.alibi.dataStore
-import app.myzel394.alibi.db.AppSettings
-import app.myzel394.alibi.ui.components.atoms.SettingsTile
-import com.maxkeppeker.sheets.core.models.base.rememberUseCaseState
-import kotlinx.coroutines.launch
-
-
-@Composable
-fun ForceExactMaxDurationTile(
- settings: AppSettings,
-) {
- val scope = rememberCoroutineScope()
- val dataStore = LocalContext.current.dataStore
-
- fun updateValue(forceExactMaxDuration: Boolean) {
- scope.launch {
- dataStore.updateData {
- it.setAudioRecorderSettings(
- it.audioRecorderSettings.setForceExactMaxDuration(forceExactMaxDuration)
- )
- }
- }
- }
-
-
- SettingsTile(
- title = stringResource(R.string.ui_settings_option_forceExactDuration_title),
- description = stringResource(R.string.ui_settings_option_forceExactDuration_description),
- leading = {
- Icon(
- Icons.Default.GraphicEq,
- contentDescription = null,
- )
- },
- trailing = {
- Switch(
- checked = settings.audioRecorderSettings.forceExactMaxDuration,
- onCheckedChange = ::updateValue,
- )
- },
- )
-}
\ No newline at end of file
diff --git a/app/src/main/java/app/myzel394/alibi/ui/screens/AudioRecorderScreen.kt b/app/src/main/java/app/myzel394/alibi/ui/screens/AudioRecorderScreen.kt
index fd7ef17..db6a049 100644
--- a/app/src/main/java/app/myzel394/alibi/ui/screens/AudioRecorderScreen.kt
+++ b/app/src/main/java/app/myzel394/alibi/ui/screens/AudioRecorderScreen.kt
@@ -136,7 +136,6 @@ fun AudioRecorderScreen(
)
AudioRecorderExporter(recording).concatenateFiles(
- context,
audioRecorder.recorderService!!.batchesFolder,
outputFile,
)
diff --git a/app/src/main/java/app/myzel394/alibi/ui/screens/SettingsScreen.kt b/app/src/main/java/app/myzel394/alibi/ui/screens/SettingsScreen.kt
index b4f5247..cdad664 100644
--- a/app/src/main/java/app/myzel394/alibi/ui/screens/SettingsScreen.kt
+++ b/app/src/main/java/app/myzel394/alibi/ui/screens/SettingsScreen.kt
@@ -37,14 +37,12 @@ import androidx.compose.ui.unit.dp
import androidx.navigation.NavController
import app.myzel394.alibi.R
import app.myzel394.alibi.dataStore
-import app.myzel394.alibi.db.AppSettings
import app.myzel394.alibi.ui.SUPPORTS_DARK_MODE_NATIVELY
import app.myzel394.alibi.ui.components.SettingsScreen.atoms.AboutTile
import app.myzel394.alibi.ui.components.SettingsScreen.atoms.BitrateTile
import app.myzel394.alibi.ui.components.SettingsScreen.atoms.CustomNotificationTile
import app.myzel394.alibi.ui.components.SettingsScreen.atoms.DeleteRecordingsImmediatelyTile
import app.myzel394.alibi.ui.components.SettingsScreen.atoms.EncoderTile
-import app.myzel394.alibi.ui.components.SettingsScreen.atoms.ForceExactMaxDurationTile
import app.myzel394.alibi.ui.components.SettingsScreen.atoms.ImportExport
import app.myzel394.alibi.ui.components.SettingsScreen.atoms.InAppLanguagePicker
import app.myzel394.alibi.ui.components.SettingsScreen.atoms.IntervalDurationTile
@@ -146,7 +144,6 @@ fun SettingsScreen(
)
MaxDurationTile(settings = settings)
IntervalDurationTile(settings = settings)
- ForceExactMaxDurationTile(settings = settings)
InAppLanguagePicker()
DeleteRecordingsImmediatelyTile(settings = settings)
CustomNotificationTile(navController = navController, settings = settings)
diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml
index 73e0687..fabc9a6 100644
--- a/app/src/main/res/values-es/strings.xml
+++ b/app/src/main/res/values-es/strings.xml
@@ -39,8 +39,6 @@
Set the maximum duration of the recording
Batch duration
Record a single batch for this duration. Alibi records multiple batches and deletes the oldest one. When exporting the audio, all batches will be merged together
- Force exact duration
- Force to strip the output file to be the exactly specified duration. If this is disabled, the output file may be a bit longer due to batches of audio samples being encoded together.
Bitrate
A higher bitrate means better quality but also larger file size
Set the bitrate for the audio recording