forked from teamnwah/openmw-tes3coop
Added Stream input method to sound interfaces (not implemented, NOT TESTED YET)
This commit is contained in:
parent
bbb44e07bf
commit
721f3b139b
9 changed files with 56 additions and 14 deletions
|
@ -27,6 +27,7 @@ AudiereManager::AudiereManager()
|
||||||
canRepeatStream = true;
|
canRepeatStream = true;
|
||||||
canLoadFile = true;
|
canLoadFile = true;
|
||||||
canLoadSource = false;
|
canLoadSource = false;
|
||||||
|
canLoadStream = false;
|
||||||
|
|
||||||
device = OpenDevice("");
|
device = OpenDevice("");
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,10 @@ class AudiereManager : public Manager
|
||||||
|
|
||||||
virtual Sound *load(const std::string &file, bool stream=false);
|
virtual Sound *load(const std::string &file, bool stream=false);
|
||||||
|
|
||||||
|
/// not implemented yet
|
||||||
|
virtual Sound *load(Stream::InputStream *input, bool stream=false)
|
||||||
|
{ assert(0); }
|
||||||
|
|
||||||
/// disabled
|
/// disabled
|
||||||
virtual Sound *load(InputSource *input, bool stream=false)
|
virtual Sound *load(InputSource *input, bool stream=false)
|
||||||
{ assert(0); }
|
{ assert(0); }
|
||||||
|
|
|
@ -32,6 +32,8 @@ FFM_InputManager::FFM_InputManager()
|
||||||
av_log_set_level(AV_LOG_ERROR);
|
av_log_set_level(AV_LOG_ERROR);
|
||||||
init = true;
|
init = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
canLoadStream = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
InputSource *FFM_InputManager::load(const std::string &file)
|
InputSource *FFM_InputManager::load(const std::string &file)
|
||||||
|
|
|
@ -34,6 +34,9 @@ class FFM_InputManager : public InputManager
|
||||||
public:
|
public:
|
||||||
FFM_InputManager();
|
FFM_InputManager();
|
||||||
virtual InputSource *load(const std::string &file);
|
virtual InputSource *load(const std::string &file);
|
||||||
|
|
||||||
|
/// not supported
|
||||||
|
virtual InputSource *load(Stream::InputStream *input) { assert(0); }
|
||||||
};
|
};
|
||||||
|
|
||||||
/// FFMpeg implementation of InputSource
|
/// FFMpeg implementation of InputSource
|
||||||
|
|
|
@ -47,9 +47,11 @@ class InputFilter : public Manager
|
||||||
inp = _inp;
|
inp = _inp;
|
||||||
snd = _snd;
|
snd = _snd;
|
||||||
|
|
||||||
|
// Set capabilities
|
||||||
needsUpdate = snd->needsUpdate;
|
needsUpdate = snd->needsUpdate;
|
||||||
has3D = snd->has3D;
|
has3D = snd->has3D;
|
||||||
canRepeatStream = snd->canRepeatStream;
|
canRepeatStream = snd->canRepeatStream;
|
||||||
|
canLoadStream = inp->canLoadStream;
|
||||||
|
|
||||||
// Both these should be true, or the use of this class is pretty
|
// Both these should be true, or the use of this class is pretty
|
||||||
// pointless
|
// pointless
|
||||||
|
@ -61,6 +63,9 @@ class InputFilter : public Manager
|
||||||
virtual Sound *load(const std::string &file, bool stream=false)
|
virtual Sound *load(const std::string &file, bool stream=false)
|
||||||
{ return load(inp->load(file), stream); }
|
{ return load(inp->load(file), stream); }
|
||||||
|
|
||||||
|
virtual Sound *load(Stream::InputStream *input, bool stream=false)
|
||||||
|
{ return load(inp->load(input), stream); }
|
||||||
|
|
||||||
virtual Sound *load(InputSource *input, bool stream=false)
|
virtual Sound *load(InputSource *input, bool stream=false)
|
||||||
{ return snd->load(input, stream); }
|
{ return snd->load(input, stream); }
|
||||||
|
|
||||||
|
|
|
@ -97,6 +97,9 @@ OpenAL_Manager::~OpenAL_Manager()
|
||||||
Sound *OpenAL_Manager::load(const std::string &file, bool stream)
|
Sound *OpenAL_Manager::load(const std::string &file, bool stream)
|
||||||
{ assert(0 && "OpenAL cannot decode files"); }
|
{ assert(0 && "OpenAL cannot decode files"); }
|
||||||
|
|
||||||
|
Sound *OpenAL_Manager::load(Stream::InputStream*,bool)
|
||||||
|
{ assert(0 && "OpenAL cannot decode streams"); }
|
||||||
|
|
||||||
Sound *OpenAL_Manager::load(InputSource *source, bool stream)
|
Sound *OpenAL_Manager::load(InputSource *source, bool stream)
|
||||||
{ return new OpenAL_Sound(source, this, stream); }
|
{ return new OpenAL_Sound(source, this, stream); }
|
||||||
|
|
||||||
|
|
|
@ -26,6 +26,7 @@ public:
|
||||||
void remove_stream(LST::iterator);
|
void remove_stream(LST::iterator);
|
||||||
|
|
||||||
virtual Sound *load(const std::string &file, bool stream=false);
|
virtual Sound *load(const std::string &file, bool stream=false);
|
||||||
|
virtual Sound *load(Stream::InputStream *input, bool stream=false);
|
||||||
virtual Sound *load(InputSource* input, bool stream=false);
|
virtual Sound *load(InputSource* input, bool stream=false);
|
||||||
virtual void update();
|
virtual void update();
|
||||||
virtual void setListenerPos(float x, float y, float z,
|
virtual void setListenerPos(float x, float y, float z,
|
||||||
|
|
|
@ -4,6 +4,8 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#include "../stream/input.h"
|
||||||
|
|
||||||
namespace Mangle {
|
namespace Mangle {
|
||||||
namespace Sound {
|
namespace Sound {
|
||||||
|
|
||||||
|
@ -64,9 +66,15 @@ class InputSource
|
||||||
class InputManager
|
class InputManager
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
/// If true, the stream version of load() works
|
||||||
|
bool canLoadStream;
|
||||||
|
|
||||||
/// Load a sound input source from file
|
/// Load a sound input source from file
|
||||||
virtual InputSource *load(const std::string &file) = 0;
|
virtual InputSource *load(const std::string &file) = 0;
|
||||||
|
|
||||||
|
/// Load a sound input source from stream (if canLoadStream is true)
|
||||||
|
virtual InputSource *load(Stream::InputStream *input) = 0;
|
||||||
|
|
||||||
/// Virtual destructor
|
/// Virtual destructor
|
||||||
virtual ~InputManager() {}
|
virtual ~InputManager() {}
|
||||||
};
|
};
|
||||||
|
|
|
@ -4,6 +4,8 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
#include "input.h"
|
#include "input.h"
|
||||||
|
|
||||||
|
#include "../stream/input.h"
|
||||||
|
|
||||||
namespace Mangle {
|
namespace Mangle {
|
||||||
namespace Sound {
|
namespace Sound {
|
||||||
|
|
||||||
|
@ -115,6 +117,9 @@ class Manager
|
||||||
/// true if we can load sounds from an InputSource
|
/// true if we can load sounds from an InputSource
|
||||||
bool canLoadSource;
|
bool canLoadSource;
|
||||||
|
|
||||||
|
/// If true, we can lound sound files from a Stream
|
||||||
|
bool canLoadStream;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@brief Load a sound from an input source. Only valid if
|
@brief Load a sound from an input source. Only valid if
|
||||||
canLoadSource is true.
|
canLoadSource is true.
|
||||||
|
@ -132,6 +137,16 @@ class Manager
|
||||||
*/
|
*/
|
||||||
virtual Sound *load(InputSource *input, bool stream=false) = 0;
|
virtual Sound *load(InputSource *input, bool stream=false) = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
@brief Load a sound directly from file. Only valid if canLoadStream
|
||||||
|
is true.
|
||||||
|
|
||||||
|
@param input audio file stream
|
||||||
|
@param stream true if the file should be streamed
|
||||||
|
@see load(InputSource*,bool)
|
||||||
|
*/
|
||||||
|
virtual Sound *load(Stream::InputStream *input, bool stream=false) = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@brief Load a sound directly from file. Only valid if canLoadFile
|
@brief Load a sound directly from file. Only valid if canLoadFile
|
||||||
is true.
|
is true.
|
||||||
|
|
Loading…
Reference in a new issue