2021-10-19 10:27:59 -04:00
|
|
|
#ifndef AUDIO_H__
|
|
|
|
#define AUDIO_H__
|
|
|
|
|
2023-10-04 15:01:48 -04:00
|
|
|
#ifdef _WIN32
|
2021-12-08 16:29:36 -05:00
|
|
|
#include <irrKlang.h>
|
|
|
|
#include <ik_ISoundSource.h>
|
2023-10-04 15:01:48 -04:00
|
|
|
#else
|
|
|
|
#include "./external/irrKlang-64bit-1.6.0/include/irrKlang.h"
|
|
|
|
#include "./external/irrKlang-64bit-1.6.0/include/ik_ISoundSource.h"
|
|
|
|
#endif
|
|
|
|
|
2023-09-25 17:17:17 -04:00
|
|
|
#include "../SQCSim-common/vector3.h"
|
2023-09-30 14:46:54 -04:00
|
|
|
#include "define.h"
|
2021-10-19 10:27:59 -04:00
|
|
|
|
|
|
|
class Audio {
|
|
|
|
private:
|
2021-10-25 10:50:08 -04:00
|
|
|
irrklang::ISound* m_music;
|
2023-12-13 10:55:58 -05:00
|
|
|
irrklang::ISound* m_menumusic;
|
2023-12-14 00:08:07 -05:00
|
|
|
float m_mainvolume;
|
|
|
|
float m_sfxvolume;
|
2023-12-13 10:55:58 -05:00
|
|
|
bool m_music_on = true;
|
2023-12-14 14:02:29 -05:00
|
|
|
std::vector<irrklang::ISound*> m_sfxes;
|
2021-10-25 10:50:08 -04:00
|
|
|
|
2021-10-19 10:27:59 -04:00
|
|
|
public:
|
|
|
|
Audio();
|
2023-12-13 10:55:58 -05:00
|
|
|
Audio(const char* music, const char* menumusic);
|
2021-10-19 10:27:59 -04:00
|
|
|
~Audio();
|
2023-10-16 12:02:37 -04:00
|
|
|
irrklang::ISoundEngine* m_engine;
|
2021-10-19 10:27:59 -04:00
|
|
|
|
2021-10-26 17:28:37 -04:00
|
|
|
void Update3DAudio(Vector3f pos, Vector3f dir, Vector3f speed);
|
2021-10-25 10:50:08 -04:00
|
|
|
|
2023-12-14 00:08:07 -05:00
|
|
|
|
2023-10-16 12:02:37 -04:00
|
|
|
irrklang::ISound* Create3DAudioObj(irrklang::ISound* sound, const char* name, Vector3f pos, Vector3f vel, bool is_looped, float volume);
|
2021-10-25 10:50:08 -04:00
|
|
|
|
2021-10-26 17:28:37 -04:00
|
|
|
void Render3DAudioObj(irrklang::ISound* sound, Vector3f& pos, Vector3f& vel, float volume);
|
2021-10-19 10:27:59 -04:00
|
|
|
|
2023-09-15 11:24:43 -04:00
|
|
|
//void PlaySong(const char* music);
|
2021-11-16 20:48:52 -05:00
|
|
|
|
2023-12-14 14:02:29 -05:00
|
|
|
void CleanupSFX();
|
|
|
|
|
2023-12-13 10:55:58 -05:00
|
|
|
void ToggleMusicState(GameState state);
|
|
|
|
|
2023-12-14 14:02:29 -05:00
|
|
|
void playSound(const char* sound, float volume);
|
2023-12-13 10:55:58 -05:00
|
|
|
|
|
|
|
void SetMusic(bool ison, GameState state);
|
|
|
|
bool GetMusic();
|
2021-10-19 10:27:59 -04:00
|
|
|
|
2021-10-25 10:50:08 -04:00
|
|
|
void PauseEngine();
|
2023-11-27 16:03:06 -05:00
|
|
|
|
2023-12-14 00:08:07 -05:00
|
|
|
float GetMainVolume() const;
|
|
|
|
void SetMainVolume(float volume);
|
|
|
|
|
2023-11-27 16:03:06 -05:00
|
|
|
float GetMusicVolume() const;
|
2023-12-13 19:59:01 -05:00
|
|
|
void SetMusicVolume(float volume);
|
2023-12-14 00:08:07 -05:00
|
|
|
|
|
|
|
float GetSfxVolume() const;
|
|
|
|
void SetSfxVolume(float volume);
|
2021-10-19 10:27:59 -04:00
|
|
|
};
|
|
|
|
|
2023-10-04 15:01:48 -04:00
|
|
|
#endif // AUDIO_H__
|