Hey Guys, I am building a compose app, which allow...
# multiplatform
p
Hey Guys, I am building a compose app, which allows you to test your breath control in seconds it uses a platform specific library by expect/actual mechanism to take audio input data I am using a kotlin class as a controller for this compose screen which can pass events and data states using state flow to the ui layer in this video we can see, that when i start to test my breath, it doesn't start instantly takes a little time, and when i stop, it is still running and stops after some time, So there is a lag, I am using a while loop with
Copy code
coroutineContext.isActive
for the computation block, with a scheduled delay of 10ms for every iteration and this is how i pass data to the state flow
Copy code
_currentBreathMonitorData.value = BreathMonitor(
    audioFeatures.rms * 100, stopwatchTimer.timeInSeconds.value
)
this stateflow is collected as state in ui layer to show the time and the radius Any idea why i observe a lag here, what can be done to resolve this lag? let me know if you need any extra info on this