Add support for velocity command to smnp.audio.synth module

This commit is contained in:
2020-04-06 14:06:20 +02:00
parent fbf559d6bd
commit 5dbaed2edf
3 changed files with 4 additions and 2 deletions

View File

@@ -59,7 +59,7 @@ abstract class SequenceCompiler {
command["velocity"]?.let {
val value = it as? Float ?: throw CustomException("Invalid parameter type: 'velocity' is supposed to be of float type")
velocity = (127.0 * value).toInt()
velocity = (127.0 * value.coerceIn(0.0F, 1.0F)).toInt()
}
noteOnTick