more audio codes

This commit is contained in:
minjaesong
2024-04-14 23:45:34 +09:00
parent 4fba0f70c9
commit 9762f38868
7 changed files with 206 additions and 54 deletions

View File

@@ -14,6 +14,9 @@ import java.io.File
*/
object AudioHelper {
/**
* The audio must be in stereo (two channels)
*/
fun getIR(module: String, path: String): Array<ComplexArray> {
val id = "convolution$$module.$path"
@@ -66,6 +69,9 @@ object AudioHelper {
return Array(2) { FFT.fft(conv[it]) }
}
/**
* The audio must be in stereo
*/
fun getAudioInSamples(module: String, path: String): Array<FloatArray> {
val id = "audiosamplesf32$$module.$path"

View File

@@ -1,41 +0,0 @@
package net.torvald.terrarum.audio.audiobank
import com.badlogic.gdx.utils.Queue
import net.torvald.terrarum.INGAME
import net.torvald.terrarum.audio.AudioBank
/**
* Created by minjaesong on 2024-04-12.
*/
class AudioBankMusicBox(override var songFinishedHook: (AudioBank) -> Unit = {}) : AudioBank() {
override val name = "spieluhr"
override val samplingRate = 48000
override val channels = 1
override val totalSizeInSamples = Long.MAX_VALUE // TODO length of lowest-pitch note
private val messageQueue = Queue<Pair<Long, Long>>() // pair of: absolute tick count, notes (61 notes polyphony)
override fun currentPositionInSamples(): Long {
TODO("Not yet implemented")
}
override fun readSamples(bufferL: FloatArray, bufferR: FloatArray): Int {
val tickCount = INGAME.WORLD_UPDATE_TIMER
TODO("Not yet implemented")
}
override fun reset() {
TODO("Not yet implemented")
}
override fun makeCopy(): AudioBank {
TODO("Not yet implemented")
}
override fun dispose() {
TODO("Not yet implemented")
}
}