commit 21/11/2025

This commit is contained in:
2025-11-21 13:33:37 +07:00
parent 46be98363a
commit 421ed661ad
7 changed files with 165 additions and 133 deletions

View File

@@ -48,9 +48,10 @@ class Mp3Encoder(val samplingrate: Int=44100, val channels: Int=1) {
push_handle = bass.BASS_StreamCreate(samplingrate, channels, Bass.BASS_STREAM_DECODE, Pointer(-1), null)
if (push_handle!=0){
Logger.info{"MP3 Encoder initialized with sampling rate $samplingrate Hz and $channels channel(s)" }
//val options = "lame -b 128 --cbr --write-xing 0 --nohist --noid3v2 - -"
val flag = BassEnc.BASS_ENCODE_AUTOFREE or BassEnc.BASS_ENCODE_NOHEAD
mp3_handle = bassencmp3.BASS_Encode_MP3_Start(push_handle, null, flag,proc, null)
val options = "lame -b 128 --cbr --write-xing 0 --nohist --noid3v2 - -"
//val flag = BassEnc.BASS_ENCODE_AUTOFREE or BassEnc.BASS_ENCODE_NOHEAD
val flag = BassEnc.BASS_ENCODE_AUTOFREE
mp3_handle = bassencmp3.BASS_Encode_MP3_Start(push_handle, options, flag,proc, null)
if (mp3_handle!=0){
callback = cb
@@ -100,7 +101,6 @@ class Mp3Encoder(val samplingrate: Int=44100, val channels: Int=1) {
Logger.error{"Failed to push data to MP3 Encoder. BASS error code: $err" }
return 0
}
//println("MP3 Encoder: Pushed $written bytes of PCM data.")
return written
}
@@ -122,6 +122,5 @@ class Mp3Encoder(val samplingrate: Int=44100, val channels: Int=1) {
// auto close by BASS_ENCODE_AUTOFREE
mp3_handle = 0
callback = null
println("MP3 Encoder: Stopped.")
}
}