mirror of
https://github.com/glest/glest-source.git
synced 2025-08-11 10:54:01 +02:00
Fixed the god-awful indentation
This commit is contained in:
@@ -19,102 +19,140 @@
|
||||
using namespace std;
|
||||
using namespace Shared::Platform;
|
||||
|
||||
namespace Shared{ namespace Sound{
|
||||
namespace Shared {
|
||||
namespace Sound {
|
||||
|
||||
// =====================================================
|
||||
// class SoundInfo
|
||||
// =====================================================
|
||||
// =====================================================
|
||||
// class SoundInfo
|
||||
// =====================================================
|
||||
|
||||
class SoundInfo{
|
||||
private:
|
||||
uint32 channels;
|
||||
uint32 samplesPerSecond;
|
||||
uint32 bitsPerSample;
|
||||
uint32 size;
|
||||
uint32 bitRate;
|
||||
class SoundInfo {
|
||||
private:
|
||||
uint32 channels;
|
||||
uint32 samplesPerSecond;
|
||||
uint32 bitsPerSample;
|
||||
uint32 size;
|
||||
uint32 bitRate;
|
||||
|
||||
public:
|
||||
SoundInfo();
|
||||
virtual ~SoundInfo(){};
|
||||
public:
|
||||
SoundInfo();
|
||||
virtual ~SoundInfo() {
|
||||
};
|
||||
|
||||
uint32 getChannels() const {return channels;}
|
||||
uint32 getSamplesPerSecond() const {return samplesPerSecond;}
|
||||
uint32 getBitsPerSample() const {return bitsPerSample;}
|
||||
uint32 getSize() const {return size;}
|
||||
uint32 getBitRate() const {return bitRate;}
|
||||
uint32 getChannels() const {
|
||||
return channels;
|
||||
}
|
||||
uint32 getSamplesPerSecond() const {
|
||||
return samplesPerSecond;
|
||||
}
|
||||
uint32 getBitsPerSample() const {
|
||||
return bitsPerSample;
|
||||
}
|
||||
uint32 getSize() const {
|
||||
return size;
|
||||
}
|
||||
uint32 getBitRate() const {
|
||||
return bitRate;
|
||||
}
|
||||
|
||||
void setChannels(uint32 channels) {this->channels= channels;}
|
||||
void setsamplesPerSecond(uint32 samplesPerSecond) {this->samplesPerSecond= samplesPerSecond;}
|
||||
void setBitsPerSample(uint32 bitsPerSample) {this->bitsPerSample= bitsPerSample;}
|
||||
void setSize(uint32 size) {this->size= size;}
|
||||
void setBitRate(uint32 value) {this->bitRate = value;}
|
||||
};
|
||||
void setChannels(uint32 channels) {
|
||||
this->channels = channels;
|
||||
}
|
||||
void setsamplesPerSecond(uint32 samplesPerSecond) {
|
||||
this->samplesPerSecond = samplesPerSecond;
|
||||
}
|
||||
void setBitsPerSample(uint32 bitsPerSample) {
|
||||
this->bitsPerSample = bitsPerSample;
|
||||
}
|
||||
void setSize(uint32 size) {
|
||||
this->size = size;
|
||||
}
|
||||
void setBitRate(uint32 value) {
|
||||
this->bitRate = value;
|
||||
}
|
||||
};
|
||||
|
||||
// =====================================================
|
||||
// class Sound
|
||||
// =====================================================
|
||||
// =====================================================
|
||||
// class Sound
|
||||
// =====================================================
|
||||
|
||||
class Sound {
|
||||
protected:
|
||||
SoundFileLoader *soundFileLoader;
|
||||
SoundInfo info;
|
||||
float volume;
|
||||
string fileName;
|
||||
|
||||
//static bool masterserverMode;
|
||||
class Sound {
|
||||
protected:
|
||||
SoundFileLoader *soundFileLoader;
|
||||
SoundInfo info;
|
||||
float volume;
|
||||
string fileName;
|
||||
|
||||
public:
|
||||
Sound();
|
||||
virtual ~Sound(){};
|
||||
//static bool masterserverMode;
|
||||
|
||||
//static void setMasterserverMode(bool value) { masterserverMode=value; }
|
||||
public:
|
||||
Sound();
|
||||
virtual ~Sound() {
|
||||
};
|
||||
|
||||
const SoundInfo *getInfo() const {return &info;}
|
||||
float getVolume() const {return volume;}
|
||||
|
||||
void setVolume(float volume) {this->volume= volume;}
|
||||
string getFileName() {return fileName; }
|
||||
};
|
||||
//static void setMasterserverMode(bool value) { masterserverMode=value; }
|
||||
|
||||
// =====================================================
|
||||
// class StaticSound
|
||||
// =====================================================
|
||||
const SoundInfo *getInfo() const {
|
||||
return &info;
|
||||
}
|
||||
float getVolume() const {
|
||||
return volume;
|
||||
}
|
||||
|
||||
class StaticSound: public Sound{
|
||||
private:
|
||||
int8 * samples;
|
||||
void setVolume(float volume) {
|
||||
this->volume = volume;
|
||||
}
|
||||
string getFileName() {
|
||||
return fileName;
|
||||
}
|
||||
};
|
||||
|
||||
public:
|
||||
StaticSound();
|
||||
virtual ~StaticSound();
|
||||
// =====================================================
|
||||
// class StaticSound
|
||||
// =====================================================
|
||||
|
||||
int8 *getSamples() const {return samples;}
|
||||
|
||||
void load(const string &path);
|
||||
void close();
|
||||
};
|
||||
class StaticSound : public Sound {
|
||||
private:
|
||||
int8 * samples;
|
||||
|
||||
// =====================================================
|
||||
// class StrSound
|
||||
// =====================================================
|
||||
public:
|
||||
StaticSound();
|
||||
virtual ~StaticSound();
|
||||
|
||||
class StrSound: public Sound{
|
||||
private:
|
||||
StrSound *next;
|
||||
int8 *getSamples() const {
|
||||
return samples;
|
||||
}
|
||||
|
||||
public:
|
||||
StrSound();
|
||||
virtual ~StrSound();
|
||||
void load(const string &path);
|
||||
void close();
|
||||
};
|
||||
|
||||
StrSound *getNext() const {return next;}
|
||||
void setNext(StrSound *next) {this->next= next;}
|
||||
// =====================================================
|
||||
// class StrSound
|
||||
// =====================================================
|
||||
|
||||
void open(const string &path);
|
||||
uint32 read(int8 *samples, uint32 size);
|
||||
void close();
|
||||
void restart();
|
||||
};
|
||||
class StrSound : public Sound {
|
||||
private:
|
||||
StrSound *next;
|
||||
|
||||
}}//end namespace
|
||||
public:
|
||||
StrSound();
|
||||
virtual ~StrSound();
|
||||
|
||||
StrSound *getNext() const {
|
||||
return next;
|
||||
}
|
||||
void setNext(StrSound *next) {
|
||||
this->next = next;
|
||||
}
|
||||
|
||||
void open(const string &path);
|
||||
uint32 read(int8 *samples, uint32 size);
|
||||
void close();
|
||||
void restart();
|
||||
};
|
||||
|
||||
}
|
||||
}//end namespace
|
||||
|
||||
#endif
|
||||
|
@@ -15,18 +15,23 @@
|
||||
#include "sound_player.h"
|
||||
#include "leak_dumper.h"
|
||||
|
||||
namespace Shared{ namespace Sound{
|
||||
namespace Shared {
|
||||
namespace Sound {
|
||||
|
||||
// =====================================================
|
||||
// class SoundFactory
|
||||
// =====================================================
|
||||
// =====================================================
|
||||
// class SoundFactory
|
||||
// =====================================================
|
||||
|
||||
class SoundFactory{
|
||||
public:
|
||||
virtual ~SoundFactory(){}
|
||||
virtual SoundPlayer *newSoundPlayer() {return NULL;}
|
||||
};
|
||||
class SoundFactory {
|
||||
public:
|
||||
virtual ~SoundFactory() {
|
||||
}
|
||||
virtual SoundPlayer *newSoundPlayer() {
|
||||
return NULL;
|
||||
}
|
||||
};
|
||||
|
||||
}}//end namespace
|
||||
}
|
||||
}//end namespace
|
||||
|
||||
#endif
|
||||
|
@@ -12,17 +12,21 @@
|
||||
#include "sound_factory.h"
|
||||
#include "leak_dumper.h"
|
||||
|
||||
namespace Shared{ namespace Sound{
|
||||
namespace Shared {
|
||||
namespace Sound {
|
||||
|
||||
// ===============================
|
||||
// class SoundFactoryOpenAL
|
||||
// ===============================
|
||||
// ===============================
|
||||
// class SoundFactoryOpenAL
|
||||
// ===============================
|
||||
|
||||
class SoundFactoryNone : public SoundFactory{
|
||||
public:
|
||||
virtual SoundPlayer* newSoundPlayer() {return NULL;}
|
||||
};
|
||||
class SoundFactoryNone : public SoundFactory {
|
||||
public:
|
||||
virtual SoundPlayer* newSoundPlayer() {
|
||||
return NULL;
|
||||
}
|
||||
};
|
||||
|
||||
}}//end namespace
|
||||
}
|
||||
}//end namespace
|
||||
|
||||
#endif
|
||||
|
@@ -23,87 +23,94 @@ struct OggVorbis_File;
|
||||
using std::string;
|
||||
using std::ifstream;
|
||||
|
||||
namespace Shared{ namespace Sound{
|
||||
namespace Shared {
|
||||
namespace Sound {
|
||||
|
||||
using Platform::uint32;
|
||||
using Platform::int8;
|
||||
using Util::MultiFactory;
|
||||
using Platform::uint32;
|
||||
using Platform::int8;
|
||||
using Util::MultiFactory;
|
||||
|
||||
class SoundInfo;
|
||||
class SoundInfo;
|
||||
|
||||
// =====================================================
|
||||
// class SoundFileLoader
|
||||
//
|
||||
/// Interface that all SoundFileLoaders will implement
|
||||
// =====================================================
|
||||
// =====================================================
|
||||
// class SoundFileLoader
|
||||
//
|
||||
/// Interface that all SoundFileLoaders will implement
|
||||
// =====================================================
|
||||
|
||||
class SoundFileLoader{
|
||||
public:
|
||||
virtual ~SoundFileLoader(){}
|
||||
class SoundFileLoader {
|
||||
public:
|
||||
virtual ~SoundFileLoader() {
|
||||
}
|
||||
|
||||
virtual void open(const string &path, SoundInfo *soundInfo)= 0;
|
||||
virtual uint32 read(int8 *samples, uint32 size)= 0;
|
||||
virtual void close()= 0;
|
||||
virtual void restart()= 0;
|
||||
virtual string getFileName() = 0;
|
||||
};
|
||||
virtual void open(const string &path, SoundInfo *soundInfo) = 0;
|
||||
virtual uint32 read(int8 *samples, uint32 size) = 0;
|
||||
virtual void close() = 0;
|
||||
virtual void restart() = 0;
|
||||
virtual string getFileName() = 0;
|
||||
};
|
||||
|
||||
// =====================================================
|
||||
// class WavSoundFileLoader
|
||||
//
|
||||
/// Wave file loader
|
||||
// =====================================================
|
||||
// =====================================================
|
||||
// class WavSoundFileLoader
|
||||
//
|
||||
/// Wave file loader
|
||||
// =====================================================
|
||||
|
||||
class WavSoundFileLoader: public SoundFileLoader{
|
||||
private:
|
||||
static const int maxDataRetryCount= 10;
|
||||
string fileName;
|
||||
private:
|
||||
uint32 dataOffset;
|
||||
uint32 dataSize;
|
||||
uint32 bytesPerSecond;
|
||||
ifstream f;
|
||||
class WavSoundFileLoader : public SoundFileLoader {
|
||||
private:
|
||||
static const int maxDataRetryCount = 10;
|
||||
string fileName;
|
||||
private:
|
||||
uint32 dataOffset;
|
||||
uint32 dataSize;
|
||||
uint32 bytesPerSecond;
|
||||
ifstream f;
|
||||
|
||||
public:
|
||||
virtual void open(const string &path, SoundInfo *soundInfo);
|
||||
virtual uint32 read(int8 *samples, uint32 size);
|
||||
virtual void close();
|
||||
virtual void restart();
|
||||
virtual string getFileName() { return fileName; }
|
||||
};
|
||||
public:
|
||||
virtual void open(const string &path, SoundInfo *soundInfo);
|
||||
virtual uint32 read(int8 *samples, uint32 size);
|
||||
virtual void close();
|
||||
virtual void restart();
|
||||
virtual string getFileName() {
|
||||
return fileName;
|
||||
}
|
||||
};
|
||||
|
||||
// =====================================================
|
||||
// class OggSoundFileLoader
|
||||
//
|
||||
/// OGG sound file loader, uses ogg-vorbis library
|
||||
// =====================================================
|
||||
// =====================================================
|
||||
// class OggSoundFileLoader
|
||||
//
|
||||
/// OGG sound file loader, uses ogg-vorbis library
|
||||
// =====================================================
|
||||
|
||||
class OggSoundFileLoader: public SoundFileLoader{
|
||||
private:
|
||||
OggVorbis_File *vf;
|
||||
FILE *f;
|
||||
string fileName;
|
||||
class OggSoundFileLoader : public SoundFileLoader {
|
||||
private:
|
||||
OggVorbis_File *vf;
|
||||
FILE *f;
|
||||
string fileName;
|
||||
|
||||
public:
|
||||
OggSoundFileLoader();
|
||||
virtual void open(const string &path, SoundInfo *soundInfo);
|
||||
virtual uint32 read(int8 *samples, uint32 size);
|
||||
virtual void close();
|
||||
virtual void restart();
|
||||
virtual string getFileName() { return fileName; }
|
||||
};
|
||||
public:
|
||||
OggSoundFileLoader();
|
||||
virtual void open(const string &path, SoundInfo *soundInfo);
|
||||
virtual uint32 read(int8 *samples, uint32 size);
|
||||
virtual void close();
|
||||
virtual void restart();
|
||||
virtual string getFileName() {
|
||||
return fileName;
|
||||
}
|
||||
};
|
||||
|
||||
// =====================================================
|
||||
// class SoundFileLoaderFactory
|
||||
// =====================================================
|
||||
// =====================================================
|
||||
// class SoundFileLoaderFactory
|
||||
// =====================================================
|
||||
|
||||
class SoundFileLoaderFactory: public MultiFactory<SoundFileLoader>{
|
||||
private:
|
||||
SoundFileLoaderFactory();
|
||||
public:
|
||||
static SoundFileLoaderFactory * getInstance();
|
||||
};
|
||||
class SoundFileLoaderFactory : public MultiFactory<SoundFileLoader> {
|
||||
private:
|
||||
SoundFileLoaderFactory();
|
||||
public:
|
||||
static SoundFileLoaderFactory * getInstance();
|
||||
};
|
||||
|
||||
}}//end namespace
|
||||
}
|
||||
}//end namespace
|
||||
|
||||
#endif
|
||||
|
@@ -15,31 +15,33 @@
|
||||
#include "sound_factory.h"
|
||||
#include "leak_dumper.h"
|
||||
|
||||
namespace Shared{ namespace Sound{
|
||||
namespace Shared {
|
||||
namespace Sound {
|
||||
|
||||
// =====================================================
|
||||
// class SoundInterface
|
||||
// =====================================================
|
||||
// =====================================================
|
||||
// class SoundInterface
|
||||
// =====================================================
|
||||
|
||||
class SoundInterface{
|
||||
private:
|
||||
SoundFactory *soundFactory;
|
||||
class SoundInterface {
|
||||
private:
|
||||
SoundFactory *soundFactory;
|
||||
|
||||
private:
|
||||
SoundInterface() {
|
||||
soundFactory = 0;
|
||||
}
|
||||
SoundInterface(SoundInterface &);
|
||||
void operator=(SoundInterface &);
|
||||
|
||||
public:
|
||||
static SoundInterface &getInstance();
|
||||
|
||||
void setFactory(SoundFactory *soundFactory);
|
||||
|
||||
SoundPlayer *newSoundPlayer();
|
||||
};
|
||||
|
||||
private:
|
||||
SoundInterface() {
|
||||
soundFactory = 0;
|
||||
}
|
||||
SoundInterface(SoundInterface &);
|
||||
void operator=(SoundInterface &);
|
||||
|
||||
public:
|
||||
static SoundInterface &getInstance();
|
||||
|
||||
void setFactory(SoundFactory *soundFactory);
|
||||
|
||||
SoundPlayer *newSoundPlayer();
|
||||
};
|
||||
|
||||
}}//end namespace
|
||||
}//end namespace
|
||||
|
||||
#endif
|
||||
|
@@ -18,47 +18,50 @@
|
||||
|
||||
using Shared::Platform::uint32;
|
||||
|
||||
namespace Shared{ namespace Sound{
|
||||
namespace Shared {
|
||||
namespace Sound {
|
||||
|
||||
// =====================================================
|
||||
// class SoundPlayerParams
|
||||
// =====================================================
|
||||
// =====================================================
|
||||
// class SoundPlayerParams
|
||||
// =====================================================
|
||||
|
||||
class SoundPlayerParams{
|
||||
public:
|
||||
uint32 strBufferSize;
|
||||
uint32 strBufferCount;
|
||||
uint32 staticBufferCount;
|
||||
class SoundPlayerParams {
|
||||
public:
|
||||
uint32 strBufferSize;
|
||||
uint32 strBufferCount;
|
||||
uint32 staticBufferCount;
|
||||
|
||||
SoundPlayerParams();
|
||||
};
|
||||
SoundPlayerParams();
|
||||
};
|
||||
|
||||
// =====================================================
|
||||
// class SoundPlayer
|
||||
//
|
||||
// Interface that every SoundPlayer will implement
|
||||
// =====================================================
|
||||
// =====================================================
|
||||
// class SoundPlayer
|
||||
//
|
||||
// Interface that every SoundPlayer will implement
|
||||
// =====================================================
|
||||
|
||||
class SoundPlayer{
|
||||
protected:
|
||||
class SoundPlayer {
|
||||
protected:
|
||||
|
||||
bool initOk;
|
||||
bool initOk;
|
||||
|
||||
public:
|
||||
virtual ~SoundPlayer()
|
||||
{
|
||||
initOk = false;
|
||||
};
|
||||
virtual bool init(const SoundPlayerParams *params)= 0;
|
||||
virtual void end()= 0;
|
||||
virtual void play(StaticSound *staticSound, bool force=false)= 0;
|
||||
virtual void play(StrSound *strSound, int64 fadeOn=0)= 0; //delay and fade in miliseconds
|
||||
virtual void stop(StrSound *strSound, int64 fadeOff=0)= 0;
|
||||
virtual void stopAllSounds(int64 fadeOff=0)= 0;
|
||||
virtual void updateStreams()= 0;
|
||||
virtual bool wasInitOk() const { return initOk; }
|
||||
};
|
||||
public:
|
||||
virtual ~SoundPlayer() {
|
||||
initOk = false;
|
||||
};
|
||||
virtual bool init(const SoundPlayerParams *params) = 0;
|
||||
virtual void end() = 0;
|
||||
virtual void play(StaticSound *staticSound, bool force = false) = 0;
|
||||
virtual void play(StrSound *strSound, int64 fadeOn = 0) = 0; //delay and fade in miliseconds
|
||||
virtual void stop(StrSound *strSound, int64 fadeOff = 0) = 0;
|
||||
virtual void stopAllSounds(int64 fadeOff = 0) = 0;
|
||||
virtual void updateStreams() = 0;
|
||||
virtual bool wasInitOk() const {
|
||||
return initOk;
|
||||
}
|
||||
};
|
||||
|
||||
}}//end namespace
|
||||
}
|
||||
}//end namespace
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user