Module MusistrataRenderer.SoundFontsDataController

Controller for Soundfont-based instrument settings.

Expand source code
"""
    Controller for Soundfont-based instrument settings. 

"""

from typing import Dict

from SoundFontsData import SOUNDFONT_FILES, SOUNDFONT_INSTRUMENTS, SOUNDFONT_INSTRUMENTS_SETTINGS, SOUNDFONT_SETTINGS

class SoundFontsDataController(object):
    def __init__(self):
        pass
    
    @classmethod
    def GetSettingsInstrument(cls, nameInstrument: str) -> Dict:
        """
            Handle settings reading of SoundFont-based instruments.
        """
        if nameInstrument not in SOUNDFONT_INSTRUMENTS_SETTINGS.keys():
            return {
                "File": SOUNDFONT_FILES[SOUNDFONT_SETTINGS[nameInstrument]["File"]],
                "SoundFontSettings": SOUNDFONT_SETTINGS[nameInstrument],
                "InstrumentSettings": SOUNDFONT_INSTRUMENTS_SETTINGS["Default"]
            }
        else:
            return {
                "File": SOUNDFONT_FILES[SOUNDFONT_SETTINGS[nameInstrument]["File"]],
                "SoundFontSettings": SOUNDFONT_SETTINGS[nameInstrument],
                "InstrumentSettings": SOUNDFONT_INSTRUMENTS_SETTINGS[nameInstrument]
            }

Classes

class SoundFontsDataController
Expand source code
class SoundFontsDataController(object):
    def __init__(self):
        pass
    
    @classmethod
    def GetSettingsInstrument(cls, nameInstrument: str) -> Dict:
        """
            Handle settings reading of SoundFont-based instruments.
        """
        if nameInstrument not in SOUNDFONT_INSTRUMENTS_SETTINGS.keys():
            return {
                "File": SOUNDFONT_FILES[SOUNDFONT_SETTINGS[nameInstrument]["File"]],
                "SoundFontSettings": SOUNDFONT_SETTINGS[nameInstrument],
                "InstrumentSettings": SOUNDFONT_INSTRUMENTS_SETTINGS["Default"]
            }
        else:
            return {
                "File": SOUNDFONT_FILES[SOUNDFONT_SETTINGS[nameInstrument]["File"]],
                "SoundFontSettings": SOUNDFONT_SETTINGS[nameInstrument],
                "InstrumentSettings": SOUNDFONT_INSTRUMENTS_SETTINGS[nameInstrument]
            }

Static methods

def GetSettingsInstrument(nameInstrument: str) ‑> Dict

Handle settings reading of SoundFont-based instruments.

Expand source code
@classmethod
def GetSettingsInstrument(cls, nameInstrument: str) -> Dict:
    """
        Handle settings reading of SoundFont-based instruments.
    """
    if nameInstrument not in SOUNDFONT_INSTRUMENTS_SETTINGS.keys():
        return {
            "File": SOUNDFONT_FILES[SOUNDFONT_SETTINGS[nameInstrument]["File"]],
            "SoundFontSettings": SOUNDFONT_SETTINGS[nameInstrument],
            "InstrumentSettings": SOUNDFONT_INSTRUMENTS_SETTINGS["Default"]
        }
    else:
        return {
            "File": SOUNDFONT_FILES[SOUNDFONT_SETTINGS[nameInstrument]["File"]],
            "SoundFontSettings": SOUNDFONT_SETTINGS[nameInstrument],
            "InstrumentSettings": SOUNDFONT_INSTRUMENTS_SETTINGS[nameInstrument]
        }