"""
sounds.py - Handles all sound effects
"""

import common
import os
import pygame.mixer

class Sound:

    def __init__(self):
        if not common.nosound:
            pygame.mixer.init()
            pygame.mixer.music.load("sounds%sbgmusic.wav"%os.sep)
            self.snd_loading   = pygame.mixer.Sound("sounds%sloading.wav"%os.sep)
            self.snd_explosion = pygame.mixer.Sound("sounds%sexplosion.wav"%os.sep)
            self.snd_big_expl  = pygame.mixer.Sound("sounds%sbig_explosion.wav"%os.sep)
            self.snd_ready     = pygame.mixer.Sound("sounds%sready.wav"%os.sep)
            self.snd_menu      = pygame.mixer.Sound("sounds%smenu.wav"%os.sep)
            self.snd_loading.play()

    def ready(self):
        if not common.nosound:
            self.snd_ready.play()

    def startbgmusic(self):
        if not common.nosound:
            pygame.mixer.music.play(-1)

    def stopbgmusic(self):
        if not common.nosound:
            pygame.mixer.music.stop()

    def explode(self):
        if not common.nosound:
            self.snd_explosion.play()

    def big_explode(self):
        if not common.nosound:
            self.snd_big_expl.play()

    def menu(self):
        if not common.nosound:
            self.snd_menu.play()
