aboutsummaryrefslogtreecommitdiff
path: root/src/audio/oal/channel.h
blob: 872646c86cd2138242e428cfd980e6a33f657c31 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#pragma once

#ifdef AUDIO_OAL
#include "oal/oal_utils.h"
#include <AL/al.h>
#include <AL/alext.h>
#include <AL/efx.h>


class CChannel
{
	uint32 id;
	float  Pitch, Gain;
	float  Mix;
	void  *Data;
	size_t DataSize;
	int32  Frequency;
	float  Position[3];
	float  Distances[2];
	int32  LoopCount;
	ALint  LoopPoints[2];
	ALint  LastProcessedOffset;
	bool   bIs2D;
public:
	static int32 channelsThatNeedService;

	static void InitChannels();
	static void DestroyChannels();

	CChannel();
	void SetDefault();
	void Reset();
	void Init(uint32 _id, bool Is2D = false);
	void Term();
	void Start();
	void Stop();
	bool HasSource();
	bool IsUsed();
	void SetPitch(float pitch);
	void SetGain(float gain);
	void SetVolume(int32 vol);
	void SetSampleData(void *_data, size_t _DataSize, int32 freq);
	void SetCurrentFreq(uint32 freq);
	void SetLoopCount(int32 count);
	void SetLoopPoints(ALint start, ALint end);
	void SetPosition(float x, float y, float z);
	void SetDistances(float max, float min);
	void SetPan(int32 pan);
	void ClearBuffer();
	void SetReverbMix(ALuint slot, float mix);
	void UpdateReverb(ALuint slot);
	bool Update();
};

#endif