mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-15 04:54:05 +09:00
Player movement seems like back to working, res→assets
Former-commit-id: f91181caee4dabf4cb2e51d8077441c6b0f83757 Former-commit-id: 8b450303698c5c85dea9145a056b290b95a6a7b0
This commit is contained in:
@@ -1,9 +1,12 @@
|
||||
package net.torvald.terrarum.audio
|
||||
|
||||
import org.lwjgl.BufferUtils
|
||||
import org.lwjgl.openal.AL10
|
||||
import org.newdawn.slick.Music
|
||||
import org.newdawn.slick.openal.Audio
|
||||
import org.newdawn.slick.openal.AudioImpl
|
||||
import org.newdawn.slick.openal.MODSound
|
||||
import org.newdawn.slick.openal.StreamSound
|
||||
import java.util.*
|
||||
|
||||
/**
|
||||
@@ -12,10 +15,10 @@ import java.util.*
|
||||
object AudioMixer {
|
||||
const val TRACK_COUNT = 32
|
||||
|
||||
const val TRACK_AMBIENT_ONE = 0
|
||||
const val TRACK_AMBIENT_ONE_NEXT = 1
|
||||
const val TRACK_AMBIENT_TWO = 2
|
||||
const val TRACK_AMBIENT_TWO_NEXT = 3
|
||||
const val TRACK_AMBIENT_ONE = 0 // music track one
|
||||
const val TRACK_AMBIENT_ONE_NEXT = 1 // music track two
|
||||
const val TRACK_AMBIENT_TWO = 2 // music track three
|
||||
const val TRACK_AMBIENT_TWO_NEXT = 3 // music track four
|
||||
|
||||
const val TRACK_UI_ONE = 8
|
||||
const val TRACK_UI_TWO = 9
|
||||
@@ -23,14 +26,18 @@ object AudioMixer {
|
||||
const val TRACK_SFX_START = 16
|
||||
const val TRACK_SFX_END = 31
|
||||
|
||||
val tracks = ArrayList<MixerTrack>(TRACK_COUNT)
|
||||
val tracks = ArrayList<Int>(TRACK_COUNT) // stores index of ALSource
|
||||
|
||||
init {
|
||||
|
||||
tracks[TRACK_AMBIENT_ONE]
|
||||
}
|
||||
|
||||
fun getAudio(track: Int) = tracks[track]
|
||||
|
||||
fun play(channel: Int) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Queue an SFX to any empty SFX track and play it.
|
||||
*/
|
||||
@@ -38,11 +45,12 @@ object AudioMixer {
|
||||
|
||||
}
|
||||
|
||||
fun update() {
|
||||
fun update(delta: Int) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
class MixerTrack(val audio: Audio, var volume: Float, var pan: Float) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package net.torvald.terrarum.audio
|
||||
|
||||
import org.newdawn.slick.openal.Audio
|
||||
import org.newdawn.slick.openal.AudioLoader
|
||||
import java.io.File
|
||||
import java.io.FileInputStream
|
||||
import java.util.*
|
||||
|
||||
@@ -10,22 +11,25 @@ import java.util.*
|
||||
*/
|
||||
object AudioResourceLibrary {
|
||||
|
||||
// will play as music
|
||||
val ambientsForest = ArrayList<Audio>()
|
||||
val ambientsMeadow = ArrayList<Audio>()
|
||||
val ambientsWindy = ArrayList<Audio>()
|
||||
val ambientsWoods = ArrayList<Audio>()
|
||||
|
||||
// will play as sound effect
|
||||
val crickets = ArrayList<Audio>()
|
||||
|
||||
init {
|
||||
ambientsForest.add(AudioLoader.getAudio("ogg", FileInputStream("./res/sounds/ambient/ambient_forest_01.ogg")))
|
||||
ambientsForest.add(AudioLoader.getStreamingAudio("OGG", File("./assets/sounds/ambient/ambient_forest_01.ogg").toURI().toURL()))
|
||||
|
||||
ambientsMeadow.add(AudioLoader.getAudio("ogg", FileInputStream("./res/sounds/ambient/ambient_meadow_01.ogg")))
|
||||
ambientsMeadow.add(AudioLoader.getStreamingAudio("OGG", File("./assets/sounds/ambient/ambient_meadow_01.ogg").toURI().toURL()))
|
||||
|
||||
ambientsWindy.add(AudioLoader.getAudio("ogg", FileInputStream("./res/sounds/ambient/ambient_windy_01.ogg")))
|
||||
ambientsWindy.add(AudioLoader.getStreamingAudio("OGG", File("./assets/sounds/ambient/ambient_windy_01.ogg").toURI().toURL()))
|
||||
|
||||
ambientsWoods.add(AudioLoader.getAudio("ogg", FileInputStream("./res/sounds/ambient/ambient_woods_01.ogg")))
|
||||
ambientsWoods.add(AudioLoader.getStreamingAudio("OGG", File("./assets/sounds/ambient/ambient_woods_01.ogg").toURI().toURL()))
|
||||
|
||||
crickets.add(AudioLoader.getAudio("ogg", FileInputStream("./res/sounds/ambient/crickets_01.ogg")))
|
||||
crickets.add(AudioLoader.getAudio("ogg", FileInputStream("./res/sounds/ambient/crickets_02.ogg")))
|
||||
crickets.add(AudioLoader.getAudio("OGG", FileInputStream("./assets/sounds/ambient/crickets_01.ogg")))
|
||||
crickets.add(AudioLoader.getAudio("OGG", FileInputStream("./assets/sounds/ambient/crickets_02.ogg")))
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user