ddnet/src/engine/client/sound.h
def b178c7c74a Make sure headers compile standalone
Not planning to do this automatically, but at least cleaning it up once
provides some benefit. Every header should include what it uses.

$ for i in src/**/*.h; do j=${i#"src/"}; echo $j; echo "#include <$j>\nint main() { return 0; }" | /usr/bin/c++ -DCONF_OPENSSL -DCONF_SQL -DCONF_VIDEORECORDER -DCONF_WAVPACK_CLOSE_FILE -DCONF_WAVPACK_OPEN_FILE_INPUT_EX -DGAME_RELEASE_VERSION=\"15.0.5\" -DGLEW_STATIC -D_FORTIFY_SOURCE=2 -I/usr/include/freetype2 -I/usr/include/opus -I/usr/include/SDL2 -I/usr/include/wavpack -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/libmount -I/usr/include/blkid -Isrc -I/usr/include/mysql -I/home/deen/sys/include/ -O2 -g -DNDEBUG -fdiagnostics-color=always -fstack-protector-all -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Wformat=2 -Wno-nullability-completeness -Wduplicated-cond -Wduplicated-branches -Wlogical-op -Wrestrict -std=gnu++11 -o /dev/null -x c++ -; done

Ignored: tuning.h, variables.h, config_common.h, mapitems_ex_types.h, mapbugs_list.h, protocol7.h, teehistorian_ex_chunks.h, protocol_ex_msgs.h, config.h, config_variables.h, external, keynames.h
2020-09-26 21:50:27 +02:00

63 lines
2.1 KiB
C++

/* (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. */
#ifndef ENGINE_CLIENT_SOUND_H
#define ENGINE_CLIENT_SOUND_H
#include <engine/graphics.h>
#include <engine/sound.h>
#include <engine/storage.h>
#include "SDL.h"
class CSound : public IEngineSound
{
int m_SoundEnabled;
SDL_AudioDeviceID m_Device;
public:
IEngineGraphics *m_pGraphics;
IStorage *m_pStorage;
virtual int Init();
int Update();
int Shutdown();
int AllocID();
static void RateConvert(int SampleID);
// TODO: Refactor: clean this mess up
static int DecodeWV(int SampleID, const void *pData, unsigned DataSize);
static int DecodeOpus(int SampleID, const void *pData, unsigned DataSize);
virtual bool IsSoundEnabled() { return m_SoundEnabled != 0; }
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);
virtual void UnloadSample(int SampleID);
virtual float GetSampleDuration(int SampleID); // in s
virtual void SetListenerPos(float x, float y);
virtual void SetChannel(int ChannelID, float Vol, float Pan);
virtual void SetVoiceVolume(CVoiceHandle Voice, float Volume);
virtual void SetVoiceFalloff(CVoiceHandle Voice, float Falloff);
virtual void SetVoiceLocation(CVoiceHandle Voice, float x, float y);
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);
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);
virtual void StopAll();
virtual void StopVoice(CVoiceHandle Voice);
};
#endif