2010-11-20 10:37:14 +00:00
|
|
|
/* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */
|
|
|
|
/* If you are missing that file, acquire a complete release at teeworlds.com. */
|
2010-05-29 07:25:38 +00:00
|
|
|
#ifndef GAME_CLIENT_COMPONENTS_SOUNDS_H
|
|
|
|
#define GAME_CLIENT_COMPONENTS_SOUNDS_H
|
2014-10-12 14:12:13 +00:00
|
|
|
#include <engine/sound.h>
|
2010-05-29 07:25:38 +00:00
|
|
|
#include <game/client/component.h>
|
|
|
|
|
|
|
|
class CSounds : public CComponent
|
|
|
|
{
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
QUEUE_SIZE = 32,
|
|
|
|
};
|
2011-04-13 18:00:54 +00:00
|
|
|
struct QueueEntry
|
|
|
|
{
|
|
|
|
int m_Channel;
|
|
|
|
int m_SetId;
|
|
|
|
} m_aQueue[QUEUE_SIZE];
|
2010-05-29 07:25:38 +00:00
|
|
|
int m_QueuePos;
|
|
|
|
int64 m_QueueWaitTime;
|
2011-02-27 16:56:03 +00:00
|
|
|
class CJob m_SoundJob;
|
|
|
|
bool m_WaitForSoundJob;
|
2012-01-06 18:38:40 +00:00
|
|
|
|
|
|
|
int GetSampleId(int SetId);
|
2010-05-29 07:25:38 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
// sound channels
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
CHN_GUI=0,
|
|
|
|
CHN_MUSIC,
|
|
|
|
CHN_WORLD,
|
|
|
|
CHN_GLOBAL,
|
2014-10-10 17:10:57 +00:00
|
|
|
CHN_AMBIENT,
|
2010-05-29 07:25:38 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
virtual void OnInit();
|
|
|
|
virtual void OnReset();
|
2011-06-27 21:26:01 +00:00
|
|
|
virtual void OnStateChange(int NewState, int OldState);
|
2010-05-29 07:25:38 +00:00
|
|
|
virtual void OnRender();
|
2011-04-13 18:37:12 +00:00
|
|
|
|
2010-05-29 07:25:38 +00:00
|
|
|
void ClearQueue();
|
2011-04-13 18:00:54 +00:00
|
|
|
void Enqueue(int Channel, int SetId);
|
2012-01-06 18:38:40 +00:00
|
|
|
void Play(int Channel, int SetId, float Vol);
|
|
|
|
void PlayAt(int Channel, int SetId, float Vol, vec2 Pos);
|
2010-05-29 07:25:38 +00:00
|
|
|
void PlayAndRecord(int Channel, int SetId, float Vol, vec2 Pos);
|
2011-04-13 18:00:54 +00:00
|
|
|
void Stop(int SetId);
|
2014-10-10 17:10:57 +00:00
|
|
|
|
2014-10-12 14:12:13 +00:00
|
|
|
ISound::CVoiceHandle PlaySample(int Channel, int SampleId, float Vol, int Flags = 0);
|
|
|
|
ISound::CVoiceHandle PlaySampleAt(int Channel, int SampleId, float Vol, vec2 Pos, int Flags = 0);
|
2010-05-29 07:25:38 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|