All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonMain.dev.atsushieno.ktmidi.MidiModuleDatabase.kt Maven / Gradle / Ivy

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
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy