commenting out some audio editor stuff, it is way too huge

This commit is contained in:
tibbi 2023-10-09 11:14:05 +02:00
parent 387b9e6b00
commit 8e418971a8
2 changed files with 39 additions and 33 deletions

View file

@ -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 {

View file

@ -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" }