Wire legal idle variants and validate dance media offline
This commit is contained in:
@@ -12,6 +12,7 @@ fun main() {
|
||||
conversationPackageCheck()
|
||||
actualMediaViewCheck()
|
||||
mediaBoundaryCheck()
|
||||
idleVariantCheck()
|
||||
checkContinuous()
|
||||
checkEngineering()
|
||||
checkSafeDriver()
|
||||
|
||||
@@ -0,0 +1,75 @@
|
||||
import com.gorios.lanvoice.avatar.*
|
||||
import com.gorios.lanvoice.dialogue.RoleEmotion
|
||||
|
||||
/** Actual driver callbacks, synthetic bodies; no naturalness or device claim. */
|
||||
fun idleVariantCheck() {
|
||||
var checks=0
|
||||
class Port: CompositeMediaPort {
|
||||
lateinit var pack: ContinuousAvatarPack
|
||||
lateinit var frame: (BodyFrameKey,Boolean)->Unit
|
||||
lateinit var ended: ()->Unit
|
||||
var talking=false;var closed=false;var loop=false
|
||||
override fun prepare(pack: ContinuousAvatarPack,entryFrame: Int,mouth: Boolean,loop: Boolean,
|
||||
frame: (BodyFrameKey,Boolean)->Unit,ended: ()->Unit,failed: ()->Unit) {
|
||||
this.pack=pack;this.frame=frame;this.ended=ended;this.loop=loop
|
||||
}
|
||||
override fun advance() {}
|
||||
override fun mouth(talk: Boolean,generation: Long,revision: Long) { talking=talk }
|
||||
override fun close(released: ()->Unit) { closed=true;released() }
|
||||
fun emit(i: Int,ordinal: Long=0) { frame(BodyFrameKey(i,ordinal,pack.body.ptsUs[i]),!talking) }
|
||||
}
|
||||
val base=mediaFixtureIndex()
|
||||
val index=base.copy(actionPack=null,visuals=base.visuals.map {
|
||||
if(it.id=="neutral") it else it.copy(emotion=RoleEmotion.NEUTRAL)
|
||||
})
|
||||
val music=object: MusicMediaPort {
|
||||
override fun prepare(media: ActionMedia,ready: ()->Unit,firstFrame: ()->Unit,ended: ()->Unit,failed: ()->Unit) { error("No music") }
|
||||
override fun start() { error("No music") }
|
||||
override fun close(released: ()->Unit) { released() }
|
||||
}
|
||||
val ports=mutableListOf<Port>();val trace=mutableListOf<String>()
|
||||
val driver=ConversationMediaDriver(index,{ Port().also(ports::add) },music,{}, { phase,_->trace.add(phase) },chooseIdle={0})
|
||||
driver.beginTurn(7);driver.start();val fallback=ports.single()
|
||||
(0..95).forEach { fallback.emit(it) }
|
||||
check(ports.size==1);checks++ // No arbitrary phase departure.
|
||||
fallback.emit(96);check(ports.size==3 && trace.contains("idle_variant_queued"));checks++
|
||||
fun bridgeTo(target: Port,bridge: Port) {
|
||||
target.emit(0);bridge.emit(0)
|
||||
check(trace.last()=="bridge" && !bridge.loop);checks++
|
||||
(1 until bridge.pack.body.frameCount).forEach { bridge.emit(it) };bridge.ended()
|
||||
check(bridge.closed && driver.currentPackageId!=null);checks++
|
||||
}
|
||||
val idle1=ports[1];bridgeTo(idle1,ports[2])
|
||||
check(driver.currentPackageId=="happy" && driver.visualStatus=="neutral_idle_variant");checks++
|
||||
(1 until idle1.pack.body.frameCount).forEach { idle1.emit(it) }
|
||||
check(trace.contains("idle_variant_return_queued") && ports.size==5);checks++
|
||||
val returned=ports[3];bridgeTo(returned,ports[4])
|
||||
(1..96).forEach { returned.emit(it) }
|
||||
val idle2=ports[5];bridgeTo(idle2,ports[6])
|
||||
check(driver.currentPackageId=="sad");checks++ // Pick0 still excludes previous idle1.
|
||||
driver.intent(mediaReply(RoleEmotion.NEUTRAL),true)
|
||||
check(idle2.talking && ports.size==9);checks++ // Audio continues on current own body while returning.
|
||||
(1 until idle2.pack.body.frameCount).forEach { idle2.emit(it) }
|
||||
val speakingFallback=ports[7];bridgeTo(speakingFallback,ports[8])
|
||||
check(speakingFallback.talking);checks++
|
||||
(1..96).forEach { speakingFallback.emit(it) }
|
||||
check(ports.size==9);checks++ // No variation during active TALK.
|
||||
driver.stop {};val count=trace.size
|
||||
idle2.emit(0);ports[8].ended();check(trace.size==count && ports.all { it.closed });checks++
|
||||
|
||||
// Missing bridge mouth prevents idle activation even with valid own body layers.
|
||||
val noMouth=index.copy(edges=index.edges.map { if(it.nativeLoop) it else it.copy(mouthRuntime=null) })
|
||||
val guarded=mutableListOf<Port>()
|
||||
val other=ConversationMediaDriver(noMouth,{ Port().also(guarded::add) },music,{},chooseIdle={0})
|
||||
other.beginTurn(7);other.start();(0..96).forEach { guarded[0].emit(it) }
|
||||
check(guarded.size==1);checks++;other.stop {}
|
||||
// A retained happy/sad expression must not turn neutral when speech ends.
|
||||
val expressive=mutableListOf<Port>()
|
||||
val retained=ConversationMediaDriver(base,{ Port().also(expressive::add) },music,{},chooseIdle={0})
|
||||
retained.beginTurn(7);retained.start();retained.intent(mediaReply(RoleEmotion.HAPPY),false)
|
||||
(0..96).forEach { expressive[0].emit(it) };expressive[1].emit(0);expressive[2].emit(0)
|
||||
expressive[2].emit(1);expressive[2].emit(2);expressive[2].ended()
|
||||
(1..48).forEach { expressive[1].emit(it) }
|
||||
check(retained.currentPackageId=="happy" && expressive.size==3);checks++;retained.stop {}
|
||||
println("PASS: $checks idle variant driver assertions: complete cycle/legal own-mouth bridges, different N/fps, no consecutive repeat, TALK priority, release/late callbacks, expression retention; fixtures only")
|
||||
}
|
||||
@@ -138,6 +138,25 @@ fun actualMediaViewCheck() {
|
||||
check(statuses.size==before);cases++
|
||||
actionView.dispose();TestScheduler.advanceBy(100)
|
||||
}
|
||||
// New idle rows use the actual view/renderer/codec path and reviewed graph.
|
||||
reset()
|
||||
val idleIndex=mediaFixtureIndex().let { it.copy(actionPack=null,visuals=it.visuals.map { p->p.copy(emotion=RoleEmotion.NEUTRAL) }) }
|
||||
val (idleView,idleBinding,idleTrace)=rig(idleIndex)
|
||||
TestScheduler.advanceBy(3000)
|
||||
check(idleTrace.all { it.actual=="body_neutral" });cases++
|
||||
TestScheduler.until { idleBinding.currentPackageId in setOf("happy","sad") }
|
||||
val firstIdle=idleBinding.currentPackageId
|
||||
check(idleTrace.any { it.actual=="bridge" } && idleBinding.visualStatus=="neutral_idle_variant");cases++
|
||||
TestScheduler.until { idleBinding.currentPackageId=="neutral" }
|
||||
TestScheduler.until { idleBinding.currentPackageId in setOf("happy","sad") }
|
||||
check(idleBinding.currentPackageId!=firstIdle && idleTrace.none { it.actual=="media_failed" });cases++
|
||||
idleBinding.intent(mediaReply(RoleEmotion.NEUTRAL),true)
|
||||
TestScheduler.until { idleBinding.currentPackageId=="neutral" }
|
||||
val speechStart=idleTrace.size;TestScheduler.advanceBy(9000)
|
||||
check(idleTrace.drop(speechStart).all { it.actual=="body_neutral" });cases++
|
||||
val beforeDispose=idleTrace.size;idleView.dispose();TestScheduler.advanceBy(1000)
|
||||
check(idleTrace.size==beforeDispose && driverField.get(idleView)==null && CodecFixture.releases>=7);cases++
|
||||
|
||||
// Real renderer path over a25-frame own-mouth bridge, no loop or endpoint patches.
|
||||
reset()
|
||||
val ownBridge=dynamicPack(25,24,"f".repeat(64)).copy(root="bridge25/")
|
||||
|
||||
Reference in New Issue
Block a user