mirror of
https://github.com/celisej567/mcpe.git
synced 2026-01-06 22:10:04 +03:00
54 lines
1.0 KiB
C++
54 lines
1.0 KiB
C++
#pragma once
|
|
|
|
#ifdef USE_OPENAL
|
|
|
|
#ifdef _WIN32
|
|
#include <al.h>
|
|
#include <alc.h>
|
|
#pragma comment( lib, "OpenAl32.lib" )
|
|
#elif defined(__APPLE__)
|
|
#include <OpenAL/al.h>
|
|
#include <OpenAL/alc.h>
|
|
#else
|
|
#include <al.h>
|
|
#include <alc.h>
|
|
#endif
|
|
|
|
#include <string>
|
|
#include <vector>
|
|
#include <map>
|
|
|
|
#include "client/sound/SoundSystem.hpp"
|
|
#include "world/phys/Vec3.hpp"
|
|
|
|
#define MAX_IDLE_SOURCES 50
|
|
#define MAX_DISTANCE 16.0f
|
|
|
|
class SoundSystemAL : public SoundSystem
|
|
{
|
|
public:
|
|
SoundSystemAL();
|
|
~SoundSystemAL();
|
|
virtual bool isAvailable();
|
|
void update();
|
|
virtual void playAt(const SoundDesc& sound, float x, float y, float z, float volume, float pitch);
|
|
|
|
virtual void setListenerPos(float x, float y, float z);
|
|
virtual void setListenerAngle(float yaw, float pitch);
|
|
private:
|
|
void delete_sources();
|
|
void delete_buffers();
|
|
ALuint get_buffer(const SoundDesc& sound);
|
|
|
|
ALCdevice *device;
|
|
ALCcontext *context;
|
|
bool loaded;
|
|
std::vector<ALuint> sources;
|
|
std::vector<ALuint> idle_sources;
|
|
std::map<void *, ALuint> buffers;
|
|
|
|
Vec3 lastListenerPos;
|
|
};
|
|
|
|
#endif
|