Add "p" meta for bpm song metadata
This commit is contained in:
parent
6a0c3e4e0c
commit
057b8b0333
3 changed files with 8 additions and 5 deletions
|
|
@ -132,8 +132,8 @@ actual class FMediaPlayer actual constructor(
|
||||||
@Volatile private var isHolding = false
|
@Volatile private var isHolding = false
|
||||||
private var currentTickPos: Long = 0L
|
private var currentTickPos: Long = 0L
|
||||||
private var lastEventNano: Long = System.nanoTime()
|
private var lastEventNano: Long = System.nanoTime()
|
||||||
private var targetBpm: Float = 120f
|
private var targetBpm: Float = sharedScreenModel.currentBpmFlow.value
|
||||||
private var initialBpm: Float = 120f
|
private var initialBpm: Float = sharedScreenModel.currentBpmFlow.value
|
||||||
|
|
||||||
@Volatile private var currentPlaybackBpm: Float = 120f
|
@Volatile private var currentPlaybackBpm: Float = 120f
|
||||||
@Volatile private var isInTempoChange: Boolean = false
|
@Volatile private var isInTempoChange: Boolean = false
|
||||||
|
|
|
||||||
|
|
@ -242,6 +242,8 @@ class Solfa(val sharedScreenModel: SharedScreenModel, private val fileRepository
|
||||||
parseOneLine(line)
|
parseOneLine(line)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
val songBpm = meta["p"]?.toFloatOrNull() ?: 120f
|
||||||
|
sharedScreenModel.setBpmFlow(songBpm)
|
||||||
unparsedNote.forEach {
|
unparsedNote.forEach {
|
||||||
preloadN(it)
|
preloadN(it)
|
||||||
}
|
}
|
||||||
|
|
@ -278,10 +280,11 @@ class Solfa(val sharedScreenModel: SharedScreenModel, private val fileRepository
|
||||||
)
|
)
|
||||||
val originalKey = sharedScreenModel.songKey.value
|
val originalKey = sharedScreenModel.songKey.value
|
||||||
val transposedKey = Transpose.transposeKey(baseKey = originalKey, interval = transpI)
|
val transposedKey = Transpose.transposeKey(baseKey = originalKey, interval = transpI)
|
||||||
|
val initialSongBpm = meta["p"]?.toFloatOrNull() ?: bpm
|
||||||
midiWriter.process(
|
midiWriter.process(
|
||||||
pitchesSorted,
|
pitchesSorted,
|
||||||
sharedScreenModel.getFullMarkers(),
|
sharedScreenModel.getFullMarkers(),
|
||||||
initialBpm = bpm,
|
initialBpm = initialSongBpm,
|
||||||
instruments,
|
instruments,
|
||||||
initialKey = transposedKey
|
initialKey = transposedKey
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -35,8 +35,8 @@ actual class FMediaPlayer actual constructor(
|
||||||
private var currentDynamicVelocity: Int = Dynamic.MF.velocity
|
private var currentDynamicVelocity: Int = Dynamic.MF.velocity
|
||||||
private var currentDynamicFactor: Float = Dynamic.MF.factor
|
private var currentDynamicFactor: Float = Dynamic.MF.factor
|
||||||
|
|
||||||
private var targetBpm: Float = 120f
|
private var targetBpm: Float = sharedScreenModel.currentBpmFlow.value
|
||||||
private var initialBpm: Float = 120f
|
private var initialBpm: Float = sharedScreenModel.currentBpmFlow.value
|
||||||
private val playerScope = CoroutineScope(Dispatchers.Default + SupervisorJob())
|
private val playerScope = CoroutineScope(Dispatchers.Default + SupervisorJob())
|
||||||
private var abJob: Job? = null
|
private var abJob: Job? = null
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue