Panda3D

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