LegacySoundFontCollection

public final class LegacySoundFontCollection : Codable
extension LegacySoundFontCollection: CustomStringConvertible

Collection of SoundFont entities. The collection maintains a mapping between a SoundFont.Key (UUID) and a SoundFont instance. It also maintains an array of SoundFont.Key values that are ordered by SoundFont.name values.

  • Undocumented

    Declaration

    Swift

    public typealias Element = LegacySoundFont
  • Undocumented

    Declaration

    Swift

    public typealias CatalogMap = [LegacySoundFont.Key : LegacySoundFont]
  • Undocumented

    Declaration

    Swift

    public typealias SortedKeyArray = [LegacySoundFont.Key]
  • Undocumented

    Declaration

    Swift

    public var isEmpty: Bool { get }
  • Obtain the number of SoundFont instances in the collection

    Declaration

    Swift

    public var count: Int { get }
  • Obtain the first preset of the first sound font if one exists.

    Declaration

    Swift

    public var defaultPreset: SoundFontAndPatch? { get }
  • Create a new collection.

    Declaration

    Swift

    public init(soundFonts: [LegacySoundFont])

    Parameters

    soundFonts

    array of SoundFont instances

  • Undocumented

    Declaration

    Swift

    public var soundFonts: [LegacySoundFont] { get }
  • Obtain the index of the given SoundFont.Key value.

    Declaration

    Swift

    public func firstIndex(of key: LegacySoundFont.Key) -> Int?

    Parameters

    key

    the key to look for

    Return Value

    index value if found, else nil

  • Obtain the index of a SoundFont with the given URL.

    Declaration

    Swift

    public func index(of url: URL) -> Int?

    Parameters

    url

    the URL to look for

    Return Value

    index value if found, else nil

  • Obtain a SoundFont by its (sorted) index value

    Declaration

    Swift

    public func getBy(index: Int) -> LegacySoundFont

    Parameters

    index

    the SoundFont.Key to look for

    Return Value

    the SoundFont value found

  • Obtain a SoundFont by its UUID value

    Declaration

    Swift

    public func getBy(key: LegacySoundFont.Key) -> LegacySoundFont?

    Parameters

    key

    the UUID to look for

    Return Value

    the SoundFont instance found, else nil

  • Add a new SoundFont definition to the collection.

    Declaration

    Swift

    public func add(_ soundFont: LegacySoundFont) -> Int

    Parameters

    soundFont

    the SoundFont to add

    Return Value

    index of the SoundFont in the collection

  • Remove a SoundFont from the collection.

    Declaration

    Swift

    public func remove(_ index: Int) -> LegacySoundFont?

    Parameters

    index

    the index of the SoundFont to remove.

    Return Value

    the removed SoundFont instance, nil if not found.

  • Rename an existing SoundFont.

    Declaration

    Swift

    public func rename(_ index: Int, name: String) -> (Int, LegacySoundFont)

    Parameters

    index

    the index of the SoundFont to change

    name

    the new name for the SoundFont

    Return Value

    2-tuple containing the new index of the SoundFont due to name reordering, and the SoundFont itself

  • Declaration

    Swift

    public var description: String { get }