Panda3D
|
00001 // Filename: audioLoadRequest.I 00002 // Created by: drose (29Aug06) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) Carnegie Mellon University. All rights reserved. 00008 // 00009 // All use of this software is subject to the terms of the revised BSD 00010 // license. You should have received a copy of this license along 00011 // with this source code in a file named "LICENSE." 00012 // 00013 //////////////////////////////////////////////////////////////////// 00014 00015 00016 //////////////////////////////////////////////////////////////////// 00017 // Function: AudioLoadRequest::Constructor 00018 // Access: Published 00019 // Description: Create a new AudioLoadRequest, and add it to the loader 00020 // via load_async(), to begin an asynchronous load. 00021 //////////////////////////////////////////////////////////////////// 00022 INLINE AudioLoadRequest:: 00023 AudioLoadRequest(AudioManager *audio_manager, const string &filename, 00024 bool positional) : 00025 _audio_manager(audio_manager), 00026 _filename(filename), 00027 _positional(positional), 00028 _is_ready(false) 00029 { 00030 } 00031 00032 //////////////////////////////////////////////////////////////////// 00033 // Function: AudioLoadRequest::get_audio_manager 00034 // Access: Published 00035 // Description: Returns the AudioManager that will serve this 00036 // asynchronous AudioLoadRequest. 00037 //////////////////////////////////////////////////////////////////// 00038 INLINE AudioManager *AudioLoadRequest:: 00039 get_audio_manager() const { 00040 return _audio_manager; 00041 } 00042 00043 //////////////////////////////////////////////////////////////////// 00044 // Function: AudioLoadRequest::get_filename 00045 // Access: Published 00046 // Description: Returns the filename associated with this 00047 // asynchronous AudioLoadRequest. 00048 //////////////////////////////////////////////////////////////////// 00049 INLINE const string &AudioLoadRequest:: 00050 get_filename() const { 00051 return _filename; 00052 } 00053 00054 //////////////////////////////////////////////////////////////////// 00055 // Function: AudioLoadRequest::get_positional 00056 // Access: Published 00057 // Description: Returns the positional flag associated with this 00058 // asynchronous AudioLoadRequest. 00059 //////////////////////////////////////////////////////////////////// 00060 INLINE bool AudioLoadRequest:: 00061 get_positional() const { 00062 return _positional; 00063 } 00064 00065 //////////////////////////////////////////////////////////////////// 00066 // Function: AudioLoadRequest::is_ready 00067 // Access: Published 00068 // Description: Returns true if this request has completed, false if 00069 // it is still pending. When this returns true, you may 00070 // retrieve the sound loaded by calling get_sound(). 00071 //////////////////////////////////////////////////////////////////// 00072 INLINE bool AudioLoadRequest:: 00073 is_ready() const { 00074 return _is_ready; 00075 } 00076 00077 //////////////////////////////////////////////////////////////////// 00078 // Function: AudioLoadRequest::get_sound 00079 // Access: Published 00080 // Description: Returns the sound that was loaded asynchronously, if 00081 // any, or NULL if there was an error. It is an error 00082 // to call this unless is_ready() returns true. 00083 //////////////////////////////////////////////////////////////////// 00084 INLINE AudioSound *AudioLoadRequest:: 00085 get_sound() const { 00086 nassertr(_is_ready, NULL); 00087 return _sound; 00088 }