""" sfx.sfx - pygame.mixer initialization and sound effects handling """ import pygame class Sfx: """ Sound Effects and Music? """ def __init__(self): self.initialized = False try: pygame.mixer.pre_init(channels=2, buffer=512, frequency=48000) except pygame.error: pass def init(self, base_path): """ To be called after pygame is initialized. Actual mixer init and sample loading happens here """ try: pygame.mixer.init() self.initialized = True except pygame.error: pass # Initialize only one time try: # pylint: disable = used-before-assignment # This is intented behaviour sfx except NameError: sfx = Sfx()