audio: AudioLoadRequest should take Filename or MovieAudio
This commit is contained in:
parent
051268de51
commit
1c8a5cfb48
|
|
@ -16,7 +16,7 @@
|
||||||
* to begin an asynchronous load.
|
* to begin an asynchronous load.
|
||||||
*/
|
*/
|
||||||
INLINE AudioLoadRequest::
|
INLINE AudioLoadRequest::
|
||||||
AudioLoadRequest(AudioManager *audio_manager, const std::string &filename,
|
AudioLoadRequest(AudioManager *audio_manager, const Filename &filename,
|
||||||
bool positional) :
|
bool positional) :
|
||||||
_audio_manager(audio_manager),
|
_audio_manager(audio_manager),
|
||||||
_filename(filename),
|
_filename(filename),
|
||||||
|
|
@ -24,6 +24,19 @@ AudioLoadRequest(AudioManager *audio_manager, const std::string &filename,
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new AudioLoadRequest, and add it to the loader via load_async(),
|
||||||
|
* to begin an asynchronous load.
|
||||||
|
*/
|
||||||
|
INLINE AudioLoadRequest::
|
||||||
|
AudioLoadRequest(AudioManager *audio_manager, MovieAudio *source,
|
||||||
|
bool positional) :
|
||||||
|
_audio_manager(audio_manager),
|
||||||
|
_source(source),
|
||||||
|
_positional(positional)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the AudioManager that will serve this asynchronous
|
* Returns the AudioManager that will serve this asynchronous
|
||||||
* AudioLoadRequest.
|
* AudioLoadRequest.
|
||||||
|
|
@ -36,7 +49,7 @@ get_audio_manager() const {
|
||||||
/**
|
/**
|
||||||
* Returns the filename associated with this asynchronous AudioLoadRequest.
|
* Returns the filename associated with this asynchronous AudioLoadRequest.
|
||||||
*/
|
*/
|
||||||
INLINE const std::string &AudioLoadRequest::
|
INLINE const Filename &AudioLoadRequest::
|
||||||
get_filename() const {
|
get_filename() const {
|
||||||
return _filename;
|
return _filename;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,9 @@ TypeHandle AudioLoadRequest::_type_handle;
|
||||||
*/
|
*/
|
||||||
AsyncTask::DoneStatus AudioLoadRequest::
|
AsyncTask::DoneStatus AudioLoadRequest::
|
||||||
do_task() {
|
do_task() {
|
||||||
set_result(_audio_manager->get_sound(_filename, _positional));
|
set_result(_source != nullptr
|
||||||
|
? _audio_manager->get_sound(_source, _positional)
|
||||||
|
: _audio_manager->get_sound(_filename, _positional));
|
||||||
|
|
||||||
// Don't continue the task; we're done.
|
// Don't continue the task; we're done.
|
||||||
return DS_done;
|
return DS_done;
|
||||||
|
|
|
||||||
|
|
@ -33,11 +33,14 @@ public:
|
||||||
|
|
||||||
PUBLISHED:
|
PUBLISHED:
|
||||||
INLINE explicit AudioLoadRequest(AudioManager *audio_manager,
|
INLINE explicit AudioLoadRequest(AudioManager *audio_manager,
|
||||||
const std::string &filename,
|
const Filename &filename,
|
||||||
|
bool positional);
|
||||||
|
INLINE explicit AudioLoadRequest(AudioManager *audio_manager,
|
||||||
|
MovieAudio *source,
|
||||||
bool positional);
|
bool positional);
|
||||||
|
|
||||||
INLINE AudioManager *get_audio_manager() const;
|
INLINE AudioManager *get_audio_manager() const;
|
||||||
INLINE const std::string &get_filename() const;
|
INLINE const Filename &get_filename() const;
|
||||||
INLINE bool get_positional() const;
|
INLINE bool get_positional() const;
|
||||||
|
|
||||||
INLINE bool is_ready() const;
|
INLINE bool is_ready() const;
|
||||||
|
|
@ -48,7 +51,8 @@ protected:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
PT(AudioManager) _audio_manager;
|
PT(AudioManager) _audio_manager;
|
||||||
std::string _filename;
|
Filename _filename;
|
||||||
|
PT(MovieAudio) _source;
|
||||||
bool _positional;
|
bool _positional;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue