commit 24/11/2025

This commit is contained in:
2025-11-24 08:39:40 +07:00
parent 421ed661ad
commit 7ab56e32c1
2 changed files with 19 additions and 2 deletions

View File

@@ -34,6 +34,7 @@ class Mp3Encoder(val samplingrate: Int=44100, val channels: Int=1) {
if (sourcehandle == push_handle) { if (sourcehandle == push_handle) {
val data = ByteArray(length) val data = ByteArray(length)
buffer.read(0, data, 0, length) buffer.read(0, data, 0, length)
callback?.accept(data) callback?.accept(data)
} else Logger.error { "MP3 Encoder callback called with unknown source handle: $sourcehandle" } } else Logger.error { "MP3 Encoder callback called with unknown source handle: $sourcehandle" }
} else Logger.error { "MP3 Encoder callback called with unknown encoder handle: $enchandle" } } else Logger.error { "MP3 Encoder callback called with unknown encoder handle: $enchandle" }
@@ -57,7 +58,7 @@ class Mp3Encoder(val samplingrate: Int=44100, val channels: Int=1) {
callback = cb callback = cb
CoroutineScope(Dispatchers.Default).launch { CoroutineScope(Dispatchers.Default).launch {
val readsize = 4*1024 // 4 K buffer val readsize = 32*1024 // 32 K buffer
Logger.info{"MP3 Encoder started successfully." } Logger.info{"MP3 Encoder started successfully." }
while(isActive && push_handle!=0){ while(isActive && push_handle!=0){
val p = Memory(readsize.toLong()) val p = Memory(readsize.toLong())
@@ -68,7 +69,9 @@ class Mp3Encoder(val samplingrate: Int=44100, val channels: Int=1) {
Logger.error{"Failed to read data from MP3 Encoder stream. BASS error code: $err" } Logger.error{"Failed to read data from MP3 Encoder stream. BASS error code: $err" }
break break
} }
delay(2)
delay(100)
} }
Logger.info{"MP3 Encoder finished successfully." } Logger.info{"MP3 Encoder finished successfully." }
} }

14
src/google/GoogleTTS.kt Normal file
View File

@@ -0,0 +1,14 @@
package google
class GoogleTTS {
// project : Gtc-Cloud-AAS
// project ID : gtc-cloud-aas
// project number : 247742838587
// location : indonesia-southeast1
// name : API key 1
// creation date : 21 Nov 2025
// read : https://docs.cloud.google.com/vertex-ai/generative-ai/docs/reference/libraries#client-libraries-usage-java
private val BoundAccount = "vertex-express@gtc-cloud-aas.iam.gserviceaccount.com"
private val API_KEYS = "AQ.Ab8RN6K2ZF6wykKVJcuHsfm0po9IXn3alBpO5cfZzPb4lq35Yw"
}