forked from mirror/openmw-tes3mp
Make a skeleton Sound class
This commit is contained in:
parent
246b0266fb
commit
637617056b
3 changed files with 33 additions and 6 deletions
22
apps/openmw/mwsound/sound.hpp
Normal file
22
apps/openmw/mwsound/sound.hpp
Normal file
|
@ -0,0 +1,22 @@
|
|||
#ifndef GAME_SOUND_SOUND_H
|
||||
#define GAME_SOUND_SOUND_H
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace MWSound
|
||||
{
|
||||
class Sound
|
||||
{
|
||||
virtual bool Play() = 0;
|
||||
virtual void Stop() = 0;
|
||||
virtual bool isPlaying() = 0;
|
||||
|
||||
public:
|
||||
virtual ~Sound() { }
|
||||
|
||||
friend class OpenAL_Output;
|
||||
friend class SoundManager;
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
|
@ -14,6 +14,7 @@
|
|||
|
||||
#include "sound_output.hpp"
|
||||
#include "sound_decoder.hpp"
|
||||
#include "sound.hpp"
|
||||
|
||||
#include "openal_output.hpp"
|
||||
#define SOUND_OUT "OpenAL"
|
||||
|
@ -143,15 +144,18 @@ namespace MWSound
|
|||
|
||||
void SoundManager::stopMusic()
|
||||
{
|
||||
if(mMusic)
|
||||
mMusic->Stop();
|
||||
setPlaylist();
|
||||
}
|
||||
|
||||
|
||||
void SoundManager::streamMusicFull(const std::string& filename)
|
||||
{
|
||||
// Play the sound and tell it to stream, if possible. TODO:
|
||||
// Store the reference, the jukebox will need to check status,
|
||||
// control volume etc.
|
||||
if(mMusic)
|
||||
mMusic->Stop();
|
||||
std::auto_ptr<Sound_Decoder> decoder(new DEFAULT_DECODER);
|
||||
//mMusic.reset(Output->StreamSound(filename, decoder));
|
||||
}
|
||||
|
||||
void SoundManager::streamMusic(const std::string& filename)
|
||||
|
@ -186,9 +190,7 @@ namespace MWSound
|
|||
|
||||
bool SoundManager::isMusicPlaying()
|
||||
{
|
||||
// HACK: Return true to prevent the engine from trying to keep playing
|
||||
// music and tanking the framerate.
|
||||
return true;
|
||||
return mMusic && mMusic->isPlaying();
|
||||
}
|
||||
|
||||
bool SoundManager::setPlaylist(std::string playlist)
|
||||
|
|
|
@ -23,6 +23,7 @@ namespace MWSound
|
|||
{
|
||||
class Sound_Output;
|
||||
class Sound_Decoder;
|
||||
class Sound;
|
||||
|
||||
class SoundManager
|
||||
{
|
||||
|
@ -36,6 +37,8 @@ namespace MWSound
|
|||
|
||||
std::auto_ptr<Sound_Output> Output;
|
||||
|
||||
boost::shared_ptr<Sound> mMusic;
|
||||
|
||||
void streamMusicFull(const std::string& filename);
|
||||
///< Play a soundifle
|
||||
/// \param absolute filename
|
||||
|
|
Loading…
Reference in a new issue