mirror of
https://github.com/Myzel394/Alibi.git
synced 2025-06-18 14:55:26 +02:00
Fix audio processing when saving
Related to #112 Update the `saveRecording` function in `RecorderEventsHandler.kt` to handle the case where there is only one batch and skip processing. * Add a check to see if there is only one batch and skip concatenation if true. * Modify the `saveRecording` function to use the single batch file path if there is only one batch. * Update the `saveAudioFile` and `saveVideoFile` calls to use the single batch file path if there is only one batch. --- For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/Myzel394/Alibi/issues/112?shareId=XXXX-XXXX-XXXX-XXXX).
This commit is contained in:
parent
061ed8b156
commit
9de42e5611
@ -176,14 +176,18 @@ fun RecorderEventsHandler(
|
|||||||
else -> throw Exception("Unknown recorder type")
|
else -> throw Exception("Unknown recorder type")
|
||||||
}
|
}
|
||||||
|
|
||||||
batchesFolder.concatenate(
|
val outputFile = if (batchesFolder.getBatchesForFFmpeg().size == 1) {
|
||||||
recording.recordingStart,
|
batchesFolder.getBatchesForFFmpeg().first()
|
||||||
recording.fileExtension,
|
} else {
|
||||||
durationPerBatchInMilliseconds = settings.intervalDuration,
|
batchesFolder.concatenate(
|
||||||
onProgress = { percentage ->
|
recording.recordingStart,
|
||||||
processingProgress = percentage
|
recording.fileExtension,
|
||||||
}
|
durationPerBatchInMilliseconds = settings.intervalDuration,
|
||||||
)
|
onProgress = { percentage ->
|
||||||
|
processingProgress = percentage
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
// Save file
|
// Save file
|
||||||
val name = batchesFolder.getName(
|
val name = batchesFolder.getName(
|
||||||
@ -196,19 +200,13 @@ fun RecorderEventsHandler(
|
|||||||
when (batchesFolder) {
|
when (batchesFolder) {
|
||||||
is AudioBatchesFolder -> {
|
is AudioBatchesFolder -> {
|
||||||
saveAudioFile(
|
saveAudioFile(
|
||||||
batchesFolder.asInternalGetOutputFile(
|
outputFile, name
|
||||||
recording.recordingStart,
|
|
||||||
recording.fileExtension,
|
|
||||||
), name
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
is VideoBatchesFolder -> {
|
is VideoBatchesFolder -> {
|
||||||
saveVideoFile(
|
saveVideoFile(
|
||||||
batchesFolder.asInternalGetOutputFile(
|
outputFile, name
|
||||||
recording.recordingStart,
|
|
||||||
recording.fileExtension,
|
|
||||||
), name
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -368,4 +366,4 @@ fun RecorderEventsHandler(
|
|||||||
showRecorderError = false
|
showRecorderError = false
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user