# Path: vulk/exception.py
# class SDL2Error(VulkError):
#     pass
# 
# class SoundError(VulkError):
#     pass


import logging
import sdl2
from sdl2 import sdlmixer as mixer
from sdl2.ext.compat import byteify
from vulk.exception import SDL2Error, SoundError
            raise SoundError(msg)

        mixer.Mix_Volume(channel, int(mixer.MIX_MAX_VOLUME * volume))
        return channel


class Music():
    '''
    For any sound that's longer than a few seconds it is preferable to stream
    it from disk instead of fully loading it into RAM. Vulk provides a Music
    class that lets you do that.

    Music can be stored in various formats. Vulk is based on SDL2 and
    thus supports WAVE, MOD, MIDI, OGG, MP3, FLAC files.

    **Note: You can play only one music at a time**
    '''

    def __init__(self, path):
        '''Load the music file

        *Parameters:*

        - `path`: Path to the music file
        '''
        self.music = mixer.Mix_LoadMUS(byteify(path, "utf-8"))

        if not self.music:
            msg = "Cannot load file %s" % path
            logger.error(msg)

# Path: vulk/exception.py
# class SDL2Error(VulkError):
#     pass
# 
# class SoundError(VulkError):
#     pass


# Path: vulk/audio.py
import logging
import sdl2
from sdl2 import sdlmixer as mixer
from sdl2.ext.compat import byteify
from vulk.exception import SDL2Error, SoundError

            raise SoundError(msg)

        mixer.Mix_Volume(channel, int(mixer.MIX_MAX_VOLUME * volume))
        return channel


class Music():
    '''
    For any sound that's longer than a few seconds it is preferable to stream
    it from disk instead of fully loading it into RAM. Vulk provides a Music
    class that lets you do that.

    Music can be stored in various formats. Vulk is based on SDL2 and
    thus supports WAVE, MOD, MIDI, OGG, MP3, FLAC files.

    **Note: You can play only one music at a time**
    '''

    def __init__(self, path):
        '''Load the music file

        *Parameters:*

        - `path`: Path to the music file
        '''
        self.music = mixer.Mix_LoadMUS(byteify(path, "utf-8"))

        if not self.music:
            msg = "Cannot load file %s" % path
            logger.error(msg)

            raise SoundError(msg)