fix: RAM music should loop as they should now

This commit is contained in:
minjaesong
2024-04-06 00:22:03 +09:00
parent 7416f15def
commit 3ef3f3f653
11 changed files with 180 additions and 51 deletions

View File

@@ -0,0 +1,32 @@
package net.torvald.terrarum.audio
import com.badlogic.gdx.utils.Disposable
import java.io.File
/**
* Created by minjaesong on 2024-04-05.
*/
abstract class AudioBank : Disposable {
companion object {
fun fromMusic(name: String, file: File, looping: Boolean = false, toRAM: Boolean = false, songFinishedHook: (AudioBank) -> Unit = {}): AudioBank {
return MusicContainer(name, file, looping, toRAM, songFinishedHook)
}
}
protected val hash = System.nanoTime()
abstract fun makeCopy(): AudioBank
abstract val name: String
abstract val samplingRate: Int
abstract val channels: Int
abstract val totalSizeInSamples: Long
abstract fun currentPositionInSamples(): Long
abstract fun readBytes(buffer: ByteArray): Int
abstract fun reset()
abstract val songFinishedHook: (AudioBank) -> Unit
}