mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-13 20:14:05 +09:00
caching for non-ram music
This commit is contained in:
@@ -8,9 +8,7 @@ class MusicCache(val trackName: String) : Disposable {
|
|||||||
private val cache = HashMap<String, MusicContainer>()
|
private val cache = HashMap<String, MusicContainer>()
|
||||||
|
|
||||||
fun getOrPut(music: MusicContainer?): MusicContainer? {
|
fun getOrPut(music: MusicContainer?): MusicContainer? {
|
||||||
if (music != null && !music.toRAM)
|
if (music != null)
|
||||||
return music
|
|
||||||
if (music != null && music.toRAM) // for now only the on-the-RAM tracks are getting cached
|
|
||||||
return cache.getOrPut(music.name) { music.makeCopy() }
|
return cache.getOrPut(music.name) { music.makeCopy() }
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user