Change note's duration type from int to Fraction and enable + operator support for note and int
This commit is contained in:
@@ -5,6 +5,7 @@ import io.smnp.callable.function.FunctionDefinitionTool
|
||||
import io.smnp.callable.signature.Signature.Companion.simple
|
||||
import io.smnp.data.entity.Note
|
||||
import io.smnp.data.enumeration.Pitch
|
||||
import io.smnp.math.Fraction
|
||||
import io.smnp.type.enumeration.DataType.*
|
||||
import io.smnp.type.matcher.Matcher.Companion.ofType
|
||||
import io.smnp.type.model.Value
|
||||
@@ -18,7 +19,7 @@ class NoteConstructor : Function("Note") {
|
||||
ofType(BOOL)
|
||||
) body { _, (pitchString, octave, duration, dot) ->
|
||||
val pitch = Pitch.parse((pitchString.value as String).toLowerCase())
|
||||
val note = Note(pitch, octave.value as Int, duration.value as Int, dot.value as Boolean)
|
||||
val note = Note(pitch, octave.value as Int, Fraction(1, duration.value as Int), dot.value as Boolean)
|
||||
Value.note(note)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user