HSoundUtils.h
1.19 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
//
// HSoundUtils.hpp
// SteveMaggieCpp
//
// Created by Katarzyna Kalinowska-Górska on 10.05.2017.
//
//
#ifndef HSoundUtils_h
#define HSoundUtils_h
#include <stdio.h>
#include <string>
#include <vector>
#include "audio/include/AudioEngine.h"
class HSoundUtils {
public:
static unsigned int playRandomSound(std::string soundFolderPath = "", std::vector< std::string> soundNames = std::vector< std::string>(), bool stopEffects = true);
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 pauseAllSounds();
static void resumeAllSounds();
static void preloadSoundEffect(std::string soundPath);
protected:
static int currentMusicSoundId;
static std::string currentMusicFilePath;
};
#endif /* HSoundUtils_hpp */