commonMain.dev.atsushieno.ktmidi.MidiModuleDatabase.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ktmidi-jvm Show documentation
Show all versions of ktmidi-jvm Show documentation
Kotlin Multiplatform library for MIDI 1.0 and MIDI 2.0
The newest version!
package dev.atsushieno.ktmidi
abstract class MidiModuleDatabase {
abstract fun all(): Iterable
abstract fun resolve(moduleName: String): MidiModuleDefinition
}
class MergedMidiModuleDatabase : MidiModuleDatabase {
constructor(sources: Iterable) {
list = sources.toList()
}
val list: List
override fun all(): Iterable {
return list.flatMap { d -> d.all() }
}
override fun resolve(moduleName: String): MidiModuleDefinition {
return list.map { d -> d.resolve(moduleName) }.first()
}
}
class MidiModuleDefinition {
var name: String? = null
var match: String? = null
var instrument = MidiInstrumentDefinition()
}
class MidiInstrumentDefinition {
var maps = arrayListOf()
var drumMaps = arrayListOf()
}
class MidiInstrumentMap {
var name: String? = null
var programs = arrayListOf()
}
class MidiProgramDefinition {
var name: String? = null
var index: Int = 0
var banks = arrayListOf()
}
class MidiBankDefinition {
var name: String? = null
var msb: Int = 0
var lsb: Int = 0
}