1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-31 21:45:33 +00:00

Add a skeleton decoder class using mpg123 and libsndfile

This commit is contained in:
Chris Robinson 2012-03-16 23:18:15 -07:00
parent 45b612ab3b
commit 10037e79e7
6 changed files with 81 additions and 2 deletions

View file

@ -38,7 +38,7 @@ add_openmw_dir (mwscript
)
add_openmw_dir (mwsound
soundmanager openal_output
soundmanager openal_output mpgsnd_decoder
)
add_openmw_dir (mwworld

View file

@ -0,0 +1,29 @@
#include "mpgsnd_decoder.hpp"
namespace MWSound
{
bool MpgSnd_Decoder::Open(const std::string &fname)
{
return false;
}
void MpgSnd_Decoder::Close()
{
}
MpgSnd_Decoder::MpgSnd_Decoder()
{
static bool initdone = false;
if(!initdone)
mpg123_init();
initdone = true;
}
MpgSnd_Decoder::~MpgSnd_Decoder()
{
}
}

View file

@ -0,0 +1,29 @@
#ifndef GAME_SOUND_MPGSND_DECODER_H
#define GAME_SOUND_MPGSND_DECODER_H
#include <string>
#include "mpg123.h"
#include "sndfile.h"
#include "sound_decoder.hpp"
namespace MWSound
{
class MpgSnd_Decoder : public Sound_Decoder
{
virtual bool Open(const std::string &fname);
virtual void Close();
MpgSnd_Decoder();
virtual ~MpgSnd_Decoder();
friend class SoundManager;
};
#ifndef DEFAULT_DECODER
#define DEFAULT_DECODER (::MWSound::MpgSnd_Decoder)
#endif
};
#endif

View file

@ -0,0 +1,19 @@
#ifndef GAME_SOUND_SOUND_DECODER_H
#define GAME_SOUND_SOUND_DECODER_H
namespace MWSound
{
class Sound_Decoder
{
public:
virtual bool Open(const std::string &fname) = 0;
virtual void Close() = 0;
virtual ~Sound_Decoder() { }
friend class OpenAL_Output;
friend class SoundManager;
};
}
#endif

View file

@ -12,6 +12,7 @@
#include "../mwworld/world.hpp"
#include "../mwworld/player.hpp"
#include "sound_decoder.hpp"
#include "openal_output.hpp"
#define SOUND_OUT "OpenAL"
@ -28,6 +29,7 @@
#endif
#ifdef OPENMW_USE_MPG123
#include "mpgsnd_decoder.hpp"
#define SOUND_IN "mpg123,sndfile"
#endif

View file

@ -22,6 +22,7 @@ namespace MWWorld
namespace MWSound
{
class Sound_Output;
class Sound_Decoder;
class SoundManager
{
@ -131,7 +132,6 @@ namespace MWSound
virtual void Deinitialize() = 0;
Sound_Output(SoundManager &mgr) : mgr(mgr) { }
public:
virtual ~Sound_Output() { }