Files
LifeProject/LifeSound/src/StreamedSound.h
T

41 lines
854 B
C++
Raw Normal View History

2025-05-13 02:46:21 +03:00
#ifndef StreamedSound_h__
#define StreamedSound_h__
#include "OggStream.h"
#include <math/LifeMath.h>
#include <vector>
#include "ISound.h"
namespace Sound
{
#define BUFFERS_COUNT 2
#define BUFFER_SIZE (4096 * 16)
class StreamedSound : public ISound
{
public:
StreamedSound(OggStream* stm, bool looped);
~StreamedSound();
void Play();
void Stop();
void Update();
void Move(const LifeMath::Vec3f& pos);
bool IsPlaying();
size_t GetPlaybackPosition();
size_t GetByteLength();
void SetPlaybackPosition(float pos);
double GetTimeLength();
void SeekTime(double position);
double GetTimePosition();
private:
ALuint source;
LifeMath::Vec3f position;
LifeMath::Vec3f velocity;
OggStream* data;
char tempBuffer[BUFFER_SIZE];
ALuint buffers[BUFFERS_COUNT];
bool loop;
bool stopped;
};
}
#endif // StreamedSound_h__