SoundsRepo.h 2.77 KB
//
//  SoundsRepo.h
//  WattsenglishToyApp
//
//  Created by Katarzyna Kalinowska-Górska on 26/11/2019.
//

#ifndef SoundsRepo_h
#define SoundsRepo_h

#include <map>
#include "audio/include/AudioEngine.h"

class SoundsRepo {

public:
    
    static std::string soundsFolder;
    static std::string musicBgFilePath;
    static std::map<std::string, float> soundDurations;
    
    static int currentMusicSoundId;
    
    struct SoundInfo {
        SoundInfo(std::string fp, float sd){
            filePath = fp;
            soundDuration = sd;
        };
        std::string filePath;
        float soundDuration;
    };

    // shoot game

    static void preloadAllShootGameSounds();

    static const char* SHOOT_GAME_SOUND_INTRO;
    static const char * SHOOT_GAME_SOUND_ALL_IN_TROLLEY;
    static const char* SHOOT_GAME_SOUND_SHOP_CLOSED;
    static const char* SHOOT_GAME_SOUND_WRONG_THREE_TIMES;
    static const char* SHOOT_GAME_SOUND_IN_TROLLEY;
    static const char* SHOOT_GAME_SOUND_NOT_IN_TROLLEY;
    static const char* SHOOT_GAME_SOUND_HIT_STEVE;
    static const char* SHOOT_GAME_SOUND_HIT_MAGGIE;
    static const char* SHOOT_GAME_SOUND_EFFECT_CATAPULT;
    static const char* SHOOT_GAME_SOUND_EFFECT_IN_TROLLEY;
    static const char* SHOOT_GAME_SOUND_EFFECT_SPLAT;
    
    static const char * MAP_GAME_SOUND_INTRO;
    static const char * MAP_GAME_SOUND_ALL_DONE;

    ///
    
    static SoundInfo hooraySound();
    static SoundInfo oopsSound();
    static SoundInfo pureOopsSound();
    static SoundInfo noSound();
    static SoundInfo pickLevelSound();
    static SoundInfo changeLevelSound();
//    static SoundInfo gameFinishedSound();
//    static SoundInfo scoreSound();
    static SoundInfo gameLostSound();
    static SoundInfo gameTNCIntroSound();
    static SoundInfo gameLetsStartIntroSound();
    static SoundInfo typeRequestSound(int game, int itemType);
    static SoundInfo typeConfirmSound(int game, int itemType);
    static SoundInfo typeWrongSound(int game, int itemType);

    static SoundInfo hurryUpSound();
//    static SoundInfo tooSlowSound();
//    static SoundInfo wrongThreeTimesSound();
    
    static int playSound(const std::string soundFilepath, bool stopOtherEffects = true);
    static int playMusic(const std::string musicFilepath);
    static void stopAllSounds();
    static void stopSoundById(int audioId);
    static void stopMusic();
    static void pauseAllSounds();
    static void resumeAllSounds();
    static float soundDuration(const std::string soundFilepath);
    static void preloadSoundEffect(std::string soundPath);
    static void preloadAllLoadedSoundEffects();
    
    static void loadSoundsList();
    static void parseSoundInfoFile(std::string soundFolderPath, std::string filePath, std::map<std::string, float>& mapToFill);
};
    
#endif /* SoundsRepo_h */