|
|
@ -25,6 +25,8 @@ import logging; logger = logging.getLogger(__name__); logger.info("import") |
|
|
|
|
|
|
|
#Python Standard Lib |
|
|
|
import os.path |
|
|
|
from os import PathLike |
|
|
|
from typing import List, Dict, Union |
|
|
|
|
|
|
|
#Third Party |
|
|
|
from calfbox import cbox |
|
|
@ -48,9 +50,9 @@ class Sampler_sf2(Data): |
|
|
|
def __init__(self, parentSession, filePath, activePatches, ignoreProgramChanges, mixer:bool, defaultSoundfont=None): |
|
|
|
super().__init__(parentSession) |
|
|
|
|
|
|
|
self._unlinkOnSave = [] |
|
|
|
self._unlinkOnSave:List[Union[str, PathLike]] = [] #old sf2 files no longer in use. |
|
|
|
self.filePath = filePath |
|
|
|
self.patchlist = {} #bank:{program:name} |
|
|
|
self.patchlist:Dict[int,Dict[int, str]] = {} #bank:{program:name} |
|
|
|
self.buffer_ignoreProgramChanges = ignoreProgramChanges |
|
|
|
|
|
|
|
self.midiInput = MidiInput(session=parentSession, portName="all") |
|
|
@ -166,7 +168,7 @@ class Sampler_sf2(Data): |
|
|
|
def _convertPatches(self, dictionary:dict): |
|
|
|
"""Returns a dict of dicts: |
|
|
|
bank:{program:name}""" |
|
|
|
result = {} |
|
|
|
result:Dict[int,Dict[int, str]] = {} #same as self.patchlist |
|
|
|
for value, name in dictionary.items(): |
|
|
|
program = value & 127 |
|
|
|
bank = value >> 7 |
|
|
|