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

#ifndef AniSoundsRepo_h
#define AniSoundsRepo_h

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

class AniSoundsRepo {

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

    // shoot game

    static void preloadAllTutorialGameSounds();
    
    
    static const char * MAP_GAME_SOUND_INTRO;
    static const char * MAP_GAME_SOUND_ALL_DONE;

    ///
    
    static const std::vector<std::string> TUTORIAL_SOUNDS;
    static SoundInfo gameTutorialSound(int phase);
        
    static SoundInfo hooraySound();
    static SoundInfo pickLevelSound();
    static SoundInfo scoreSound();
    static SoundInfo gameLostSound();
    static SoundInfo gameTNCIntroSound();
    static SoundInfo typeRequestSound(int game, int itemType);
    static SoundInfo typeConfirmSound(int game, int itemType);
    static SoundInfo typeWrongSound(int game, int itemType);
    static SoundInfo wrongItemEffectSound();
    static SoundInfo rightItemEffectSound();
    static SoundInfo tooSlowSound();
    
//    static void enablePlayingSoud
    static int playSound(const std::string soundFilepath, bool stopOtherEffects = true);
    static int playMusic(const std::string musicFilepath);
    static void stopAllSounds(bool musicToo = false);
    static void stopSoundById(int audioId);
    static void stopMusic();
    static void pauseMusic();
    static void resumeMusic();
    static bool isMusicPlaying() { return currentMusicSoundId != cocos2d::AudioEngine::INVALID_AUDIO_ID; };
    static bool isPlayingSound(); //other than music
//    static void turnDownMusic();
//    static void turnUpMusic();
    static void pauseAllSounds();
    static void resumeAllSounds();
    static float soundDuration(const std::string soundFilepath);
    static void preloadSoundEffect(std::string soundPath);
    static void preloadMusic(std::string musicFilePath);
    static void preloadAllLoadedSoundEffects();
    
    static void loadSoundsList();
    static void parseSoundInfoFile(std::string soundFolderPath, std::string filePath, std::map<std::string, float>& mapToFill);
};
    
#endif /* AniSoundsRepo_h */