mirror of
https://gitea.sffempire.ru/Kolyah35/minecraft-pe-0.6.1.git
synced 2026-03-20 06:53:30 +00:00
80 lines
1.9 KiB
C++
Executable File
80 lines
1.9 KiB
C++
Executable File
#ifndef SoundSystemAL_H__
|
|
#define SoundSystemAL_H__
|
|
|
|
#include "SoundSystem.h"
|
|
|
|
// If audio breaks for other platforms, this is probably why. Here, I'm just calling where Apple's OpenAL headers live (they arent in just "AL"
|
|
#if defined(__APPLE__)
|
|
#include <OpenAL/al.h>
|
|
#include <OpenAL/alc.h>
|
|
#else
|
|
#include <AL/al.h>
|
|
#include <AL/alc.h>
|
|
#endif
|
|
|
|
#include <vector>
|
|
#include <list>
|
|
|
|
//
|
|
// NOTE: This class is only the core OpenAL part of the sound engine.
|
|
// Some audio setup code can still be managed from respective app
|
|
// setup code (e.g. the main app delegate for iOS).
|
|
//
|
|
|
|
class SoundSystemAL: public SoundSystem
|
|
{
|
|
//typedef std::list<SLObjectItf> SoundList;
|
|
public:
|
|
SoundSystemAL();
|
|
~SoundSystemAL();
|
|
|
|
virtual void init();
|
|
virtual void destroy();
|
|
|
|
virtual void enable(bool status);
|
|
|
|
virtual void setListenerPos(float x, float y, float z);
|
|
virtual void setListenerAngle(float deg);
|
|
|
|
virtual void load(const std::string& name){}
|
|
virtual void play(const std::string& name){}
|
|
virtual void pause(const std::string& name){}
|
|
virtual void stop(const std::string& name){}
|
|
virtual void playAt(const SoundDesc& sound, float x, float y, float z, float volume, float pitch);
|
|
|
|
private:
|
|
class Buffer {
|
|
public:
|
|
Buffer()
|
|
: inited(false)
|
|
{}
|
|
bool inited;
|
|
ALuint bufferID;
|
|
char* framePtr;
|
|
};
|
|
|
|
void removeStoppedSounds();
|
|
|
|
static const int MaxNumSources = 12;
|
|
|
|
//SoundList playingBuffers;
|
|
|
|
Vec3 _listenerPos;
|
|
float _rotation;
|
|
|
|
bool available;
|
|
|
|
ALCcontext* context;
|
|
ALCdevice* device;
|
|
|
|
ALuint _sources[MaxNumSources];
|
|
std::vector<Buffer> _buffers;
|
|
|
|
bool getFreeSourceIndex(int* src);
|
|
bool getBufferId(const SoundDesc& sound, ALuint* buf);
|
|
|
|
public:
|
|
};
|
|
|
|
#endif /*SoundSystemAL_H__ */
|