ActivePatchManager
public final class ActivePatchManager : SubscriptionManager<ActivePatchEvent>
Maintains the active SoundFont patch being used for sound generation. There should only ever be one instance of this class, but this is not enforced.
-
The currently active patch (if any)
Declaration
Swift
public private(set) var active: ActivePatchKind { get }
-
The currently active sound font (if any)
Declaration
Swift
public var activeSoundFont: LegacySoundFont? { get }
-
The currently active preset instance (if any)
Declaration
Swift
public var activePatch: LegacyPatch? { get }
-
The currently active preset instance (if any)
Declaration
Swift
public var activeFavorite: LegacyFavorite? { get }
-
The preset configuration for the currently active preset or favorite
Declaration
Swift
public var activePresetConfig: PresetConfig? { get }
-
Obtain the last-saved active patch value
Declaration
Swift
static var restoredActivePatchKind: ActivePatchKind? { get }
-
Construct new manager
Declaration
Swift
public init(soundFonts: SoundFonts, selectedSoundFontManager: SelectedSoundFontManager)
Parameters
soundFont
the sound font manager
selectedSoundFontManager
the manager of the selected sound font
inApp
true if the running inside the app, false if running in the AUv3 extension
-
Obtain the sound font instance that corresponds to the given preset key.
Declaration
Swift
public func resolveToSoundFont(_ soundFontAndPatch: SoundFontAndPatch) -> LegacySoundFont?
Parameters
soundFontAndPatch
the preset key to resolve
Return Value
optional sound font instance that corresponds to the given key
-
Obtain the preset instance that corresponds to the given preset key.
Declaration
Swift
public func resolveToPatch(_ soundFontAndPatch: SoundFontAndPatch) -> LegacyPatch?
Parameters
soundFontAndPatch
the preset key to resolve
Return Value
optional patch instance that corresponds to the given key
-
Set a new active preset.
Declaration
Swift
@discardableResult public func setActive(preset: SoundFontAndPatch, playSample: Bool) -> Bool
Parameters
preset
the preset to make active
playSample
if true, play a note using the new preset
-
Make a favorite the active preset.
Declaration
Swift
@discardableResult public func setActive(favorite: LegacyFavorite, playSample: Bool) -> Bool
Parameters
favorite
the favorite to make active
playSample
if true, play a note using the new preset
-
Set a new active value.
Declaration
Swift
@discardableResult public func setActive(_ kind: ActivePatchKind, playSample: Bool = false) -> Bool
Parameters
kind
wrapped value to set
playSample
if true, play a note using the new preset