AniSoundsRepo.h
2.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
//
//  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 */
