generated from rnentjes/kotlin-server-web-empty
Refactor project structure and update dependencies
Removed old database-related implementations (`Database`, `Migrations`, and `Main`) and replaced them with a new focus on MIDI message handling. Updated project metadata, introduced multiplatform `MidiMessage` classes, and added publication/CI setup for Maven compatibility.
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
package nl.astraeus.midi.message
|
||||
|
||||
import nl.astraeus.tba.DataType
|
||||
import nl.astraeus.tba.MutableByteArrayHandler
|
||||
import nl.astraeus.tba.SlicedByteArray
|
||||
import nl.astraeus.tba.Type
|
||||
import nl.astraeus.tba.TypedByteArray
|
||||
import nl.astraeus.tba.blob
|
||||
import nl.astraeus.tba.double
|
||||
import nl.astraeus.tba.long
|
||||
|
||||
class MidiMessage() : TypedByteArray(
|
||||
Type("type", DataType.LONG),
|
||||
Type("generated", DataType.DOUBLE),
|
||||
Type("playTime", DataType.DOUBLE),
|
||||
Type("midi", DataType.BLOB, 240),
|
||||
) {
|
||||
var type by long("type")
|
||||
var generated by double("generated")
|
||||
var playTime by double("playTime")
|
||||
var midi by blob("data")
|
||||
|
||||
init {
|
||||
this.type = MidiMessageTypes.MIDI_DATA.typeId
|
||||
}
|
||||
|
||||
|
||||
constructor(data: ByteArray): this() {
|
||||
check(data.size == definition.size) {
|
||||
"Invalid data size: ${data.size} != ${definition.size}"
|
||||
}
|
||||
|
||||
this.data = MutableByteArrayHandler(data)
|
||||
}
|
||||
|
||||
constructor(playTime: Double, midi: ByteArray): this() {
|
||||
this.generated = getCurrentTime()
|
||||
this.playTime = playTime
|
||||
this.midi = SlicedByteArray(midi)
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user