ddnet/src/engine/client/sound.h

63 lines
2.1 KiB
C
Raw Normal View History

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 ENGINE_CLIENT_SOUND_H
#define ENGINE_CLIENT_SOUND_H
#include <engine/sound.h>
#include "SDL.h"
2010-05-29 07:25:38 +00:00
class CSound : public IEngineSound
{
int m_SoundEnabled;
SDL_AudioDeviceID m_Device;
2010-05-29 07:25:38 +00:00
public:
IEngineGraphics *m_pGraphics;
IStorage *m_pStorage;
virtual int Init();
int Update();
int Shutdown();
int AllocID();
2010-05-29 07:25:38 +00:00
static void RateConvert(int SampleID);
2010-05-29 07:25:38 +00:00
// TODO: Refactor: clean this mess up
static IOHANDLE ms_File;
static int ReadData(void *pBuffer, int Size);
2014-10-11 12:50:16 +00:00
static int DecodeWV(int SampleID, const void *pData, unsigned DataSize);
static int DecodeOpus(int SampleID, const void *pData, unsigned DataSize);
2010-05-29 07:25:38 +00:00
virtual bool IsSoundEnabled() { return m_SoundEnabled != 0; }
2010-05-29 07:25:38 +00:00
virtual int LoadWV(const char *pFilename);
virtual int LoadWVFromMem(const void *pData, unsigned DataSize, bool FromEditor);
virtual int LoadOpus(const char *pFilename);
virtual int LoadOpusFromMem(const void *pData, unsigned DataSize, bool FromEditor);
2014-10-11 11:38:08 +00:00
virtual void UnloadSample(int SampleID);
2010-05-29 07:25:38 +00:00
virtual float GetSampleDuration(int SampleID); // in s
2010-05-29 07:25:38 +00:00
virtual void SetListenerPos(float x, float y);
virtual void SetChannel(int ChannelID, float Vol, float Pan);
2010-05-29 07:25:38 +00:00
2014-10-12 14:12:13 +00:00
virtual void SetVoiceVolume(CVoiceHandle Voice, float Volume);
virtual void SetVoiceFalloff(CVoiceHandle Voice, float Falloff);
2014-10-12 14:12:13 +00:00
virtual void SetVoiceLocation(CVoiceHandle Voice, float x, float y);
2014-10-18 13:21:13 +00:00
virtual void SetVoiceTimeOffset(CVoiceHandle Voice, float offset); // in s
virtual void SetVoiceCircle(CVoiceHandle Voice, float Radius);
virtual void SetVoiceRectangle(CVoiceHandle Voice, float Width, float Height);
2014-10-12 14:12:13 +00:00
CVoiceHandle Play(int ChannelID, int SampleID, int Flags, float x, float y);
virtual CVoiceHandle PlayAt(int ChannelID, int SampleID, int Flags, float x, float y);
virtual CVoiceHandle Play(int ChannelID, int SampleID, int Flags);
virtual void Stop(int SampleID);
2010-05-29 07:25:38 +00:00
virtual void StopAll();
2014-10-18 13:21:13 +00:00
virtual void StopVoice(CVoiceHandle Voice);
2010-05-29 07:25:38 +00:00
};
#endif