Skip to content

Commit

Permalink
commenting out some audio editor stuff, it is way too huge
Browse files Browse the repository at this point in the history
  • Loading branch information
tibbi committed Oct 9, 2023
1 parent 387b9e6 commit 8e41897
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -88,7 +83,7 @@ class EditRecordingActivity : SimpleActivity() {
}

private fun updateVisualization() {
Amplituda(this).apply {
/*Amplituda(this).apply {
try {
val uri = Uri.parse(currentRecording.path)
Expand Down Expand Up @@ -121,7 +116,7 @@ class EditRecordingActivity : SimpleActivity() {
showErrorToast(e)
return
}
}
}*/
}

private fun setupColors() {
Expand Down Expand Up @@ -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
Expand All @@ -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()
Expand All @@ -215,7 +219,7 @@ class EditRecordingActivity : SimpleActivity() {
.cutAudio(endFormatted, realEndFormatted) {
rightPart = it
merge()
}
}*/
}
// R.id.save -> {
// binding.recordingVisualizer.clearEditing()
Expand All @@ -227,13 +231,15 @@ class EditRecordingActivity : SimpleActivity() {
binding.recordingVisualizer.clearEditing()
playRecording(currentRecording.path, currentRecording.id, currentRecording.title, currentRecording.duration, true)
}

R.id.reset -> {
progressStart = 0f
binding.recordingVisualizer.clearEditing()
currentRecording = recording
updateVisualization()
playRecording(currentRecording.path, currentRecording.id, currentRecording.title, currentRecording.duration, true)
}

else -> return@setOnMenuItemClickListener false
}
return@setOnMenuItemClickListener true
Expand Down Expand Up @@ -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 {
Expand Down
32 changes: 16 additions & 16 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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" }
Expand Down

0 comments on commit 8e41897

Please sign in to comment.