audioEngine.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. #pragma once
  2. namespace AudioEngine
  3. {
  4. void init();
  5. void loadAllMusic();
  6. void startPlayingMusicAtIndex(int index);
  7. void update();
  8. void playRandomNightMusic();
  9. void playTitleMusic();
  10. void stopAllMusicAndSounds();
  11. void playSound(int sound, float level);
  12. void playHitSound();
  13. void playHurtSound();
  14. float &getMasterVolume();
  15. float &getMusicVolume();
  16. float &getUIVolume();
  17. float &getSoundsVolume();
  18. void loadSettingsOrSetToDefaultIfFail();
  19. void saveSettings();
  20. bool isMusicPlaying();
  21. enum sounds
  22. {
  23. none = 0,
  24. grass,
  25. dirt,
  26. stone,
  27. sand,
  28. wood,
  29. glassBreak,
  30. glassStep,
  31. leaves,
  32. snow,
  33. metal,
  34. wool,
  35. clay,
  36. sandStone,
  37. bricks,
  38. gravel,
  39. ice,
  40. iceBreak,
  41. volcanicRockActive,
  42. volcanicRockInActive,
  43. toolBreakingWood,
  44. toolBreakingStone,
  45. toolBreakingIron,
  46. crackStone,
  47. hit,
  48. fallLow,
  49. fallMedium,
  50. fallHigh,
  51. hurt,
  52. uiButtonPress,
  53. uiButtonBack,
  54. uiOn,
  55. uiOff,
  56. uiSlider,
  57. LAST_SOUND
  58. };
  59. };
  60. int getSoundForBlockBreaking(unsigned int blockType);
  61. int getSoundForBlockStepping(unsigned int blockType);
  62. constexpr static float MINING_BLOCK_SOUND_VOLUME = 0.8;
  63. constexpr static float PLACED_BLOCK_SOUND_VOLUME = 0.9;
  64. constexpr static float BREAKED_BLOCK_SOUND_VOLUME = 1.0;
  65. constexpr static float STEPPING_SOUND_VOLUME = 0.75;
  66. constexpr static float HIT_SOUND_VOLUME = 0.8;
  67. constexpr static float FALL_SOUND_VOLUME = 0.65;
  68. constexpr static float UI_SOUND_VOLUME = 0.9;