From 8e418971a8056919606d009e2fe5603970e62a46 Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 9 Oct 2023 11:14:05 +0200 Subject: [PATCH] commenting out some audio editor stuff, it is way too huge --- .../activities/EditRecordingActivity.kt | 40 +++++++++++-------- gradle/libs.versions.toml | 32 +++++++-------- 2 files changed, 39 insertions(+), 33 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/voicerecorder/activities/EditRecordingActivity.kt b/app/src/main/kotlin/com/simplemobiletools/voicerecorder/activities/EditRecordingActivity.kt index f022fe3..0ed44fb 100644 --- a/app/src/main/kotlin/com/simplemobiletools/voicerecorder/activities/EditRecordingActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/voicerecorder/activities/EditRecordingActivity.kt @@ -15,14 +15,9 @@ import com.simplemobiletools.commons.extensions.* import com.simplemobiletools.commons.helpers.ensureBackgroundThread import com.simplemobiletools.voicerecorder.R import com.simplemobiletools.voicerecorder.databinding.ActivityEditRecordingBinding -import com.simplemobiletools.voicerecorder.extensions.deleteRecordings import com.simplemobiletools.voicerecorder.extensions.getAllRecordings import com.simplemobiletools.voicerecorder.helpers.getAudioFileContentUri import com.simplemobiletools.voicerecorder.models.Recording -import linc.com.amplituda.Amplituda -import linc.com.amplituda.AmplitudaResult -import linc.com.amplituda.callback.AmplitudaSuccessListener -import linc.com.library.AudioTool import java.io.File import java.util.Timer import java.util.TimerTask @@ -88,7 +83,7 @@ class EditRecordingActivity : SimpleActivity() { } private fun updateVisualization() { - Amplituda(this).apply { + /*Amplituda(this).apply { try { val uri = Uri.parse(currentRecording.path) @@ -121,7 +116,7 @@ class EditRecordingActivity : SimpleActivity() { showErrorToast(e) return } - } + }*/ } private fun setupColors() { @@ -165,14 +160,15 @@ class EditRecordingActivity : SimpleActivity() { val durationMillisPart = String.format("%.3f", durationMillis - durationMillis.toInt()).replace("0.", "") val startFormatted = (startMillis.toInt()).getFormattedDuration(true) + ".$startMillisPart" val durationFormatted = (durationMillis.toInt()).getFormattedDuration(true) + ".$durationMillisPart" - modifyAudioFile(currentRecording) + /*modifyAudioFile(currentRecording) .cutAudio(startFormatted, durationFormatted) { progressStart = binding.recordingVisualizer.startPosition playRecording(it.path, null, it.name, durationMillis.toInt(), true) } - .release() + .release()*/ // playRecording() } + R.id.cut -> { val start = binding.recordingVisualizer.startPosition val end = binding.recordingVisualizer.endPosition @@ -193,20 +189,28 @@ class EditRecordingActivity : SimpleActivity() { fun merge() { if (leftPart != null && rightPart != null) { ensureBackgroundThread { - val tempFile = File.createTempFile("${currentRecording.title}.edit.", ".${currentRecording.title.getFilenameExtension()}", cacheDir) - AudioTool.getInstance(this) + val tempFile = + File.createTempFile("${currentRecording.title}.edit.", ".${currentRecording.title.getFilenameExtension()}", cacheDir) + /*AudioTool.getInstance(this) .joinAudios(arrayOf(leftPart, rightPart), tempFile.path) { runOnUiThread { - currentRecording = Recording(-1, it.name, it.path, it.lastModified().toInt(), (startMillis + realEnd).toInt(), it.getProperSize(false).toInt()) + currentRecording = Recording( + -1, + it.name, + it.path, + it.lastModified().toInt(), + (startMillis + realEnd).toInt(), + it.getProperSize(false).toInt() + ) updateVisualization() playRecording(currentRecording.path, currentRecording.id, currentRecording.title, currentRecording.duration, true) } - } + }*/ } } } - modifyAudioFile(currentRecording) + /*modifyAudioFile(currentRecording) .cutAudio("00:00:00", startFormatted) { leftPart = it merge() @@ -215,7 +219,7 @@ class EditRecordingActivity : SimpleActivity() { .cutAudio(endFormatted, realEndFormatted) { rightPart = it merge() - } + }*/ } // R.id.save -> { // binding.recordingVisualizer.clearEditing() @@ -227,6 +231,7 @@ class EditRecordingActivity : SimpleActivity() { binding.recordingVisualizer.clearEditing() playRecording(currentRecording.path, currentRecording.id, currentRecording.title, currentRecording.duration, true) } + R.id.reset -> { progressStart = 0f binding.recordingVisualizer.clearEditing() @@ -234,6 +239,7 @@ class EditRecordingActivity : SimpleActivity() { updateVisualization() playRecording(currentRecording.path, currentRecording.id, currentRecording.title, currentRecording.duration, true) } + else -> return@setOnMenuItemClickListener false } return@setOnMenuItemClickListener true @@ -388,10 +394,10 @@ class EditRecordingActivity : SimpleActivity() { super.onPause() } - private fun modifyAudioFile(recording: Recording): AudioTool { + /*private fun modifyAudioFile(recording: Recording): AudioTool { return AudioTool.getInstance(this) .withAudio(copyToTempFile(recording)) - } + }*/ private fun copyToTempFile(recording: Recording): File { try { diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 96c3f67..e2f28cd 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -16,10 +16,10 @@ simple-commons = "8e7dd4508e" #AudioRecordView audiorecordview = "1.0.4" #AudioTool -audiotool = "1.2.1" -amplituda = "2.2.2" -waveformseekbar = "5.0.1" -mobileffmpeg = "4.4" +#audiotool = "1.2.1" +#amplituda = "2.2.2" +#waveformseekbar = "5.0.1" +#mobileffmpeg = "4.4" #TAndroidLame tandroidlame = "1.1" #AutofitTextView @@ -52,10 +52,10 @@ eventbus = { module = "org.greenrobot:eventbus", version.ref = "eventbus" } #AudioRecordView audiorecordview = { module = "com.github.Armen101:AudioRecordView", version.ref = "audiorecordview" } #AudioTool -audiotool = { module = "com.github.lincollincol:AudioTool", version.ref = "audiotool" } -amplituda = { module = "com.github.lincollincol:amplituda", version.ref = "amplituda" } -mobileffmpeg = { module = "com.arthenica:mobile-ffmpeg-full", version.ref = "mobileffmpeg" } -waveformseekbar = { module = "com.github.massoudss:waveformSeekBar", version.ref = "waveformseekbar" } +#audiotool = { module = "com.github.lincollincol:AudioTool", version.ref = "audiotool" } +#amplituda = { module = "com.github.lincollincol:amplituda", version.ref = "amplituda" } +#mobileffmpeg = { module = "com.arthenica:mobile-ffmpeg-full", version.ref = "mobileffmpeg" } +#waveformseekbar = { module = "com.github.massoudss:waveformSeekBar", version.ref = "waveformseekbar" } #TAndroidLame tandroidlame = { module = "com.github.naman14:TAndroidLame", version.ref = "tandroidlame" } #AutofitTextView @@ -65,14 +65,14 @@ room = [ "androidx-room-ktx", "androidx-room-runtime", ] -audiotool = [ - "audiotool", - "mobileffmpeg", -] -amplituda = [ - "amplituda", - "waveformseekbar", -] +#audiotool = [ +# "audiotool", +# "mobileffmpeg", +#] +#amplituda = [ +# "amplituda", +# "waveformseekbar", +#] [plugins] android = { id = "com.android.application", version.ref = "gradlePlugins-agp" } kotlinAndroid = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }