# Path: e3d/sound_management/SoundClass.py
# class Sound(HS, Attachable):
#     def __init__(self, parent, manager, filePath, isStream, bufferSize, maxBufferNumber):
#         """
# 
#         @type buffer: audio.SoundData
#         """
#         HS.__init__(self, manager, filePath, isStream, bufferSize, maxBufferNumber)
#         Attachable.__init__(self, parent)
# 
#     # looped = property(fget=_get_looped, fset=_set_looped)
# 
#     # channelCount = property(fget=_get_ChannelCount)
# 
#     # minDistance = property(_getMinDistance, _setMinDistance)
# 
#     # maxDistance = property(_getMaxDistance, _setMaxDistance)


from hissing import Manager
from cycgkit.cgtypes import vec3
from .SoundClass import Sound



class SoundsManager(Manager):
    def __init__(self):
        """
        Keeps references to sounds in use.
        @rtype : SoundsManager
        """
        super(SoundsManager, self).__init__()
        self._soundIDs = {}
        self._lastListenerPosition = vec3(0)
        self._lastListenerOrientation = [0, 0, 1, 0, 1, 0]
        self._used = {}
        # al.alDistanceModel(al.AL_LINEAR_DISTANCE_CLAMPED)
        # al.alDistanceModel(al.AL_LINEAR_DISTANCE)
        # al.alDistanceModel(al.AL_INVERSE_DISTANCE_CLAMPED)
        # al.alDistanceModel(al.AL_EXPONENT_DISTANCE)  # << realistic
        # al.alDistanceModel(al.AL_EXPONENT_DISTANCE_CLAMPED)

    def idExists(self, ID):
        return ID in self._soundIDs

    def load(self, ID, filePath, parent=None, isStream=False, bufferSize=48000, maxBufferNumber=3):
        if self.idExists(ID):
            raise RuntimeError('the ID is in use.')

# Path: e3d/sound_management/SoundClass.py
# class Sound(HS, Attachable):
#     def __init__(self, parent, manager, filePath, isStream, bufferSize, maxBufferNumber):
#         """
# 
#         @type buffer: audio.SoundData
#         """
#         HS.__init__(self, manager, filePath, isStream, bufferSize, maxBufferNumber)
#         Attachable.__init__(self, parent)
# 
#     # looped = property(fget=_get_looped, fset=_set_looped)
# 
#     # channelCount = property(fget=_get_ChannelCount)
# 
#     # minDistance = property(_getMinDistance, _setMinDistance)
# 
#     # maxDistance = property(_getMaxDistance, _setMaxDistance)


# Path: e3d/sound_management/SoundsManagerClass.py
from hissing import Manager
from cycgkit.cgtypes import vec3
from .SoundClass import Sound




class SoundsManager(Manager):
    def __init__(self):
        """
        Keeps references to sounds in use.
        @rtype : SoundsManager
        """
        super(SoundsManager, self).__init__()
        self._soundIDs = {}
        self._lastListenerPosition = vec3(0)
        self._lastListenerOrientation = [0, 0, 1, 0, 1, 0]
        self._used = {}
        # al.alDistanceModel(al.AL_LINEAR_DISTANCE_CLAMPED)
        # al.alDistanceModel(al.AL_LINEAR_DISTANCE)
        # al.alDistanceModel(al.AL_INVERSE_DISTANCE_CLAMPED)
        # al.alDistanceModel(al.AL_EXPONENT_DISTANCE)  # << realistic
        # al.alDistanceModel(al.AL_EXPONENT_DISTANCE_CLAMPED)

    def idExists(self, ID):
        return ID in self._soundIDs

    def load(self, ID, filePath, parent=None, isStream=False, bufferSize=48000, maxBufferNumber=3):
        if self.idExists(ID):
            raise RuntimeError('the ID is in use.')

        sound = Sound(parent, self, filePath, isStream, bufferSize, maxBufferNumber)