CtlAudioMgr.h 744 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #ifndef RUCtlAudioMgr_h
  2. #define RUCtlAudioMgr_h
  3. #include "cocos2d.h"
  4. #include "SimpleAudioEngine.h"
  5. #include "AudioEngine.h"
  6. #include "RUDefine.h"
  7. USING_NS_CC;
  8. using namespace std;
  9. NS_RU_BEGIN
  10. class CtlAudioMgr {
  11. public:
  12. static CtlAudioMgr* getInstance();
  13. bool getSoundEnabled();
  14. bool getMusicEnabled();
  15. void setMusicEnabled(bool flag);
  16. void setSoundEnabled(bool flag);
  17. //
  18. void playEffect(const string& effect);
  19. //
  20. void playMusic(const string& music);
  21. //
  22. void stopMusic();
  23. private:
  24. CtlAudioMgr();
  25. ~CtlAudioMgr();
  26. private:
  27. std::string _lastMusic;
  28. bool _musicEnabled = true;
  29. bool _soundEnabled = true;
  30. };
  31. NS_RU_END
  32. #endif /* RUCtlAudioMgr_h */