ISoundPlayer.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. /*
  2. * ISoundPlayer.h, part of VCMI engine
  3. *
  4. * Authors: listed in file AUTHORS in main folder
  5. *
  6. * License: GNU General Public License v2.0 or later
  7. * Full text of license available in license.txt file, in main folder
  8. *
  9. */
  10. #pragma once
  11. #include "../lib/CSoundBase.h"
  12. #include "../lib/filesystem/ResourcePath.h"
  13. class ISoundPlayer
  14. {
  15. public:
  16. virtual ~ISoundPlayer() = default;
  17. virtual int playSound(soundBase::soundID soundID, int repeats = 0) = 0;
  18. virtual int playSound(const AudioPath & sound, int repeats = 0, bool cache = false) = 0;
  19. virtual int playSound(std::pair<std::unique_ptr<ui8[]>, si64> & data, int repeats = 0, bool cache = false) = 0;
  20. virtual int playSoundFromSet(std::vector<soundBase::soundID> & sound_vec) = 0;
  21. virtual void stopSound(int handler) = 0;
  22. virtual void pauseSound(int handler) = 0;
  23. virtual void resumeSound(int handler) = 0;
  24. virtual ui32 getVolume() const = 0;
  25. virtual void setVolume(ui32 percent) = 0;
  26. virtual uint32_t getSoundDurationMilliseconds(const AudioPath & sound) = 0;
  27. virtual void setCallback(int channel, std::function<void()> function) = 0;
  28. virtual void resetCallback(int channel) = 0;
  29. virtual void soundFinishedCallback(int channel) = 0;
  30. virtual void ambientUpdateChannels(std::map<AudioPath, int> currentSounds) = 0;
  31. virtual void ambientStopAllChannels() = 0;
  32. virtual int ambientGetRange() const = 0;
  33. };