Panda3D
 All Classes Functions Variables Enumerations
audioLoadRequest.h
1 // Filename: audioLoadRequest.h
2 // Created by: drose (29Aug06)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 #ifndef AUDIOLOADREQUEST_H
16 #define AUDIOLOADREQUEST_H
17 
18 #include "pandabase.h"
19 
20 #include "asyncTask.h"
21 #include "audioManager.h"
22 #include "audioSound.h"
23 #include "pointerTo.h"
24 
25 ////////////////////////////////////////////////////////////////////
26 // Class : AudioLoadRequest
27 // Description : A class object that manages a single asynchronous
28 // audio load request. This works in conjunction with
29 // the Loader class defined in pgraph, or really with
30 // any AsyncTaskManager. Create a new AudioLoadRequest,
31 // and add it to the loader via load_async(), to begin
32 // an asynchronous load.
33 ////////////////////////////////////////////////////////////////////
34 class EXPCL_PANDA_AUDIO AudioLoadRequest : public AsyncTask {
35 public:
36  ALLOC_DELETED_CHAIN(AudioLoadRequest);
37 
38 PUBLISHED:
39  INLINE AudioLoadRequest(AudioManager *audio_manager, const string &filename,
40  bool positional);
41 
42  INLINE AudioManager *get_audio_manager() const;
43  INLINE const string &get_filename() const;
44  INLINE bool get_positional() const;
45 
46  INLINE bool is_ready() const;
47  INLINE AudioSound *get_sound() const;
48 
49 protected:
50  virtual DoneStatus do_task();
51 
52 private:
53  PT(AudioManager) _audio_manager;
54  string _filename;
55  bool _positional;
56 
57  bool _is_ready;
58  PT(AudioSound) _sound;
59 
60 public:
61  static TypeHandle get_class_type() {
62  return _type_handle;
63  }
64  static void init_type() {
65  AsyncTask::init_type();
66  register_type(_type_handle, "AudioLoadRequest",
67  AsyncTask::get_class_type());
68  }
69  virtual TypeHandle get_type() const {
70  return get_class_type();
71  }
72  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
73 
74 private:
75  static TypeHandle _type_handle;
76 };
77 
78 #include "audioLoadRequest.I"
79 
80 #endif
81 
A class object that manages a single asynchronous audio load request.
This class represents a concrete task performed by an AsyncManager.
Definition: asyncTask.h:43
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:85