feat: Add save current audio recording without stopping it (wip)

Signed-off-by: Myzel394 <50424412+Myzel394@users.noreply.github.com>
This commit is contained in:
Myzel394 2024-03-17 18:19:38 +01:00
parent fe24f3473f
commit dad8439d3d
No known key found for this signature in database
GPG Key ID: DEC4AAB876F73185
3 changed files with 11 additions and 9 deletions

View File

@ -35,7 +35,7 @@ abstract class IntervalRecorderService<I, B : BatchesFolder> :
// Unlocks and deletes the files that were locked using `lockFiles`. // Unlocks and deletes the files that were locked using `lockFiles`.
fun unlockFiles(cleanupFiles: Boolean = false) { fun unlockFiles(cleanupFiles: Boolean = false) {
if (cleanupFiles) { if (cleanupFiles) {
batchesFolder.deleteRecordings(0..lockedIndex!!) batchesFolder.deleteRecordings(0..<lockedIndex!!)
} }
lockedIndex = null lockedIndex = null

View File

@ -108,9 +108,7 @@ fun RecordingControl(
) { ) {
SaveButton( SaveButton(
onSave = onSaveAndStop, onSave = onSaveAndStop,
onLongClick = { onLongClick = onSaveCurrent,
println("onLongClick")
},
modifier = Modifier.fillMaxWidth(), modifier = Modifier.fillMaxWidth(),
) )
} }
@ -176,9 +174,7 @@ fun RecordingControl(
) { ) {
SaveButton( SaveButton(
onSave = onSaveAndStop, onSave = onSaveAndStop,
onLongClick = { onLongClick = onSaveCurrent,
println("onLongClick")
},
) )
} }
} }

View File

@ -152,13 +152,19 @@ fun _PrimitiveControls(audioRecorder: AudioRecorderModel) {
it.saveLastRecording(audioRecorder as RecorderModel) it.saveLastRecording(audioRecorder as RecorderModel)
} }
audioRecorder.onRecordingSave(false) audioRecorder.onRecordingSave(false).join()
runCatching { runCatching {
audioRecorder.destroyService(context) audioRecorder.destroyService(context)
} }
} }
}, },
onSaveCurrent = {}, onSaveCurrent = {
scope.launch {
audioRecorder.recorderService!!.startNewCycle()
audioRecorder.onRecordingSave(true).join()
}
},
) )
} }