Panda3D

Loading...
Searching...
No Matches
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
34PUBLISHED:
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.
AudioLoadRequest::AudioLoadRequest
AudioLoadRequest(AudioManager *audio_manager, const std::string &filename, bool positional)
Create a new AudioLoadRequest, and add it to the loader via load_async(), to begin an asynchronous lo...
Definition audioLoadRequest.I:19
AudioLoadRequest::is_ready
bool is_ready() const
Returns true if this request has completed, false if it is still pending.
Definition audioLoadRequest.I:61
AudioLoadRequest::get_audio_manager
AudioManager * get_audio_manager() const
Returns the AudioManager that will serve this asynchronous AudioLoadRequest.
Definition audioLoadRequest.I:32
AudioLoadRequest::get_filename
const std::string & get_filename() const
Returns the filename associated with this asynchronous AudioLoadRequest.
Definition audioLoadRequest.I:40
AudioLoadRequest::get_positional
bool get_positional() const
Returns the positional flag associated with this asynchronous AudioLoadRequest.
Definition audioLoadRequest.I:49
AudioLoadRequest::get_sound
AudioSound * get_sound() const
Returns the sound that was loaded asynchronously, if any, or nullptr if there was an error.
Definition audioLoadRequest.I:72
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