Execute DC before finished song
This commit is contained in:
parent
810ebb38e6
commit
ab221a6355
1 changed files with 22 additions and 13 deletions
|
|
@ -84,18 +84,18 @@ actual class FMediaPlayer actual constructor(
|
|||
applyVoiceStates()
|
||||
sequencer?.addMetaEventListener { meta ->
|
||||
if(meta.type == 47){
|
||||
onFinished()
|
||||
}
|
||||
}
|
||||
/*
|
||||
sequencer?.addMetaEventListener { meta ->
|
||||
if (meta.type == 0x51) { // 0x51 "Set Tempo"
|
||||
if (sequencer?.tempoInBPM != targetBpm) {
|
||||
println("Tempo MIDI détecté (120), forçage à $targetBpm")
|
||||
applyBpm()
|
||||
val pendingDc = getPendingDcStep()
|
||||
|
||||
if (pendingDc != null) {
|
||||
println("onFinished : DC pending → saut direct vers ${pendingDc.targetGrid}")
|
||||
pendingDc.alreadyDone = true
|
||||
seekToGrid(pendingDc.targetGrid)
|
||||
play()
|
||||
} else {
|
||||
onFinished()
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
} else {
|
||||
// Créeons une fichier vide au 1er lancement de l'application, après MidiWriterKotlin l'écrasera
|
||||
val f0file = File("${getConfigDirectoryPath()}whawyd3.mid")
|
||||
|
|
@ -253,9 +253,10 @@ actual class FMediaPlayer actual constructor(
|
|||
|
||||
// DC
|
||||
dcGPattern.matches(marker.trim()) -> {
|
||||
var indx = if((last_grid - currentIndex) <= 0) {
|
||||
val indx = if((last_grid - currentIndex) <= 0) {
|
||||
currentIndex - 1
|
||||
} else currentIndex
|
||||
// println("monn index est $indx car dernier est $last_grid et curr $currentIndex")
|
||||
navigationSteps.add(
|
||||
NavigationStep(
|
||||
marker,
|
||||
|
|
@ -355,6 +356,14 @@ actual class FMediaPlayer actual constructor(
|
|||
}
|
||||
}
|
||||
}
|
||||
private fun getPendingDcStep(): NavigationStep? {
|
||||
return navigationSteps.firstOrNull { step ->
|
||||
!step.alreadyDone &&
|
||||
step.hairPin == null &&
|
||||
step.dynamic == null &&
|
||||
!step.isHold
|
||||
}
|
||||
}
|
||||
private fun startNavigationMonitor(sharedScreenModel: SharedScreenModel) {
|
||||
var dcDone = sharedScreenModel.getDcDone()
|
||||
val dsDone = sharedScreenModel.getDsDone()
|
||||
|
|
@ -364,8 +373,8 @@ actual class FMediaPlayer actual constructor(
|
|||
sharedScreenModel.activeIndex.collect { currentIndex ->
|
||||
|
||||
val availableIndices = navigationSteps.map { it.gridIndex }
|
||||
// println("bpm:$targetBpm _ ${sequencer?.tempoInBPM}")
|
||||
// println("MONITOR : Reçu Index $currentIndex | Index en mémoire : $availableIndices ")
|
||||
// println("bpm:$targetBpm _ ${sequencer?.tempoInBPM}| Index en mémoire : $availableIndices")
|
||||
// println("i $currentIndex ")
|
||||
|
||||
if (sequencer?.isRunning == true) {
|
||||
if (Math.abs(sequencer!!.tempoInBPM - targetBpm) > 0.1) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue