Compare commits
3 commits
9472859308
...
d4174635c4
| Author | SHA1 | Date | |
|---|---|---|---|
| d4174635c4 | |||
| 15d5674dfa | |||
| df5e8567cd |
1 changed files with 64 additions and 18 deletions
|
|
@ -59,6 +59,8 @@ actual class FMediaPlayer actual constructor(
|
|||
val hairPinEndGrid: Int = -1,
|
||||
val hairPinFromFactor: Float = 1.0f,
|
||||
val hairPinToFactor: Float = 1.0f,
|
||||
val isFin: Boolean = false, // Farany D.C.
|
||||
var finActive: Boolean =false,
|
||||
)
|
||||
private val navigationSteps = mutableListOf<NavigationStep>()
|
||||
|
||||
|
|
@ -84,9 +86,13 @@ actual class FMediaPlayer actual constructor(
|
|||
applyVoiceStates()
|
||||
sequencer?.addMetaEventListener { meta ->
|
||||
if(meta.type == 47){
|
||||
val totalGrids = (sequencer!!.sequence.tickLength / sequencer!!.sequence.resolution).toInt()
|
||||
val currentGrid = (sequencer!!.tickPosition / sequencer!!.sequence.resolution).toInt()
|
||||
val pendingDc = getPendingDcStep()
|
||||
|
||||
if (pendingDc != null) {
|
||||
val isDcNearEnd = pendingDc != null && (totalGrids - pendingDc.gridIndex) <= 2
|
||||
|
||||
if (isDcNearEnd && pendingDc != null) {
|
||||
println("onFinished : DC pending → saut direct vers ${pendingDc.targetGrid}")
|
||||
pendingDc.alreadyDone = true
|
||||
seekToGrid(pendingDc.targetGrid)
|
||||
|
|
@ -281,6 +287,26 @@ actual class FMediaPlayer actual constructor(
|
|||
println("Lien DC créé : $marker à $indx vers le début")
|
||||
}
|
||||
|
||||
// Farany
|
||||
marker.trim().equals("Farany_GROUP_PART", ignoreCase = true) -> {
|
||||
val hasDcAfter = metadataList.any { (_, gi, _, _, mk, _, _, _) ->
|
||||
(gi ?: 0) > currentIndex &&
|
||||
(dcGPattern.matches(mk.trim()) ||
|
||||
dcRegex.matches(mk.trim()))
|
||||
}
|
||||
if (hasDcAfter) {
|
||||
navigationSteps.add(
|
||||
NavigationStep(
|
||||
marker = marker,
|
||||
gridIndex = currentIndex,
|
||||
targetGrid = last_grid,
|
||||
isFin = true,
|
||||
finActive = false
|
||||
)
|
||||
)
|
||||
println("Farany mémorisé à la grille $currentIndex")
|
||||
}
|
||||
}
|
||||
// velocité
|
||||
extractDynamic(marker) != null && marker.trim() != "=" -> {
|
||||
val dyn = extractDynamic(marker) ?: return@forEach
|
||||
|
|
@ -362,6 +388,7 @@ actual class FMediaPlayer actual constructor(
|
|||
step.hairPin == null &&
|
||||
step.dynamic == null &&
|
||||
!step.isHold
|
||||
&& !step.isFin
|
||||
}
|
||||
}
|
||||
private fun startNavigationMonitor(sharedScreenModel: SharedScreenModel) {
|
||||
|
|
@ -389,6 +416,19 @@ actual class FMediaPlayer actual constructor(
|
|||
|
||||
if (step != null) {
|
||||
when {
|
||||
step.isFin -> {
|
||||
if(step.finActive) {
|
||||
step.alreadyDone = true
|
||||
// println("Farany passage → FIN à grille $currentIndex")
|
||||
sequencer?.stop()
|
||||
sequencer?.tempoFactor = 1f
|
||||
synthetizer?.channels?.forEach {
|
||||
it?.controlChange(64, 0)
|
||||
it?.controlChange(123, 0)
|
||||
}
|
||||
onFinished()
|
||||
}
|
||||
}
|
||||
// Point d'orgue
|
||||
step.isHold -> {
|
||||
val currentBpm = sequencer?.tempoInBPM ?: targetBpm
|
||||
|
|
@ -443,6 +483,12 @@ actual class FMediaPlayer actual constructor(
|
|||
seekToGrid(step.targetGrid)
|
||||
synthetizer?.channels?.forEach { it?.controlChange(64, 0) }
|
||||
sequencer?.tempoFactor = 1f
|
||||
|
||||
navigationSteps.filter { it.isFin && step.gridIndex > it.gridIndex }
|
||||
.forEach {
|
||||
it.finActive = true
|
||||
it.alreadyDone = false
|
||||
}
|
||||
if (sequencer?.isRunning == false) {
|
||||
sequencer?.tempoInBPM = targetBpm
|
||||
sequencer?.start()
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue