Panda3D
nullAudioSound.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 nullAudioSound.h
10  * @author skyler
11  * @date 2001-06-06
12  * Prior system by: cary
13  */
14 
15 #ifndef __NULL_AUDIO_SOUND_H__
16 #define __NULL_AUDIO_SOUND_H__
17 
18 #include "audioSound.h"
19 
20 
21 // This class intentionally does next to nothing. It's used as a placeholder
22 // when you don't want a sound system.
23 class EXPCL_PANDA_AUDIO NullAudioSound : public AudioSound {
24  // All of these methods are stubbed out to some degree. If you're looking
25  // for a starting place for a new AudioManager, please consider looking at
26  // the milesAudioManager.
27 
28 public:
29  ~NullAudioSound();
30 
31  void play();
32  void stop();
33 
34  void set_loop(bool);
35  bool get_loop() const;
36 
37  void set_loop_count(unsigned long);
38  unsigned long get_loop_count() const;
39 
40  void set_time(PN_stdfloat);
41  PN_stdfloat get_time() const;
42 
43  void set_volume(PN_stdfloat);
44  PN_stdfloat get_volume() const;
45 
46  void set_balance(PN_stdfloat);
47  PN_stdfloat get_balance() const;
48 
49  void set_play_rate(PN_stdfloat);
50  PN_stdfloat get_play_rate() const;
51 
52  void set_active(bool);
53  bool get_active() const;
54 
55  void set_finished_event(const std::string& event);
56  const std::string& get_finished_event() const;
57 
58  const std::string& get_name() const;
59 
60  PN_stdfloat length() const;
61 
62  void set_3d_attributes(PN_stdfloat px, PN_stdfloat py, PN_stdfloat pz, PN_stdfloat vx, PN_stdfloat vy, PN_stdfloat vz);
63  void get_3d_attributes(PN_stdfloat *px, PN_stdfloat *py, PN_stdfloat *pz, PN_stdfloat *vx, PN_stdfloat *vy, PN_stdfloat *vz);
64  void set_3d_min_distance(PN_stdfloat dist);
65  PN_stdfloat get_3d_min_distance() const;
66  void set_3d_max_distance(PN_stdfloat dist);
67  PN_stdfloat get_3d_max_distance() const;
68 
69  AudioSound::SoundStatus status() const;
70 
71 // why protect the constructor?!? protected:
73 
74 public:
75  static TypeHandle get_class_type() {
76  return _type_handle;
77  }
78  static void init_type() {
79  AudioSound::init_type();
80  register_type(_type_handle, "NullAudioSound",
81  AudioSound::get_class_type());
82  }
83  virtual TypeHandle get_type() const {
84  return get_class_type();
85  }
86  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
87 
88 private:
89  static TypeHandle _type_handle;
90 
91  friend class NullAudioManager;
92 };
93 
94 #endif /* __NULL_AUDIO_SOUND_H__ */
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:81