Panda3D
milesAudioSequence.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 milesAudioSequence.h
10  * @author drose
11  * @date 2007-07-31
12  */
13 
14 #ifndef MILESAUDIOSEQUENCE_H
15 #define MILESAUDIOSEQUENCE_H
16 
17 #include "pandabase.h"
18 #ifdef HAVE_RAD_MSS //[
19 
20 #include "milesAudioSound.h"
21 #include "milesAudioManager.h"
22 
23 #include <mss.h>
24 
25 /**
26  * A MIDI file, preloaded and played from a memory buffer. MIDI files cannot
27  * be streamed.
28  */
29 class EXPCL_MILES_AUDIO MilesAudioSequence : public MilesAudioSound {
30 private:
31  MilesAudioSequence(MilesAudioManager *manager,
32  MilesAudioManager::SoundData *sd,
33  const std::string &file_name);
34 
35 public:
36  virtual ~MilesAudioSequence();
37 
38  virtual void play();
39  virtual void stop();
40 
41  virtual PN_stdfloat get_time() const;
42 
43  virtual void set_volume(PN_stdfloat volume=1.0f);
44  virtual void set_balance(PN_stdfloat balance_right=0.0f);
45  virtual void set_play_rate(PN_stdfloat play_rate=1.0f);
46 
47  virtual PN_stdfloat length() const;
48 
49  virtual AudioSound::SoundStatus status() const;
50 
51  virtual void cleanup();
52 
53 private:
54  void internal_stop();
55  static void AILCALLBACK finish_callback(HSEQUENCE sequence);
56  void do_set_time(PN_stdfloat time);
57  void determine_length();
58 
59  PT(MilesAudioManager::SoundData) _sd;
60  HSEQUENCE _sequence;
61  size_t _sequence_index;
62 
63 public:
64  static TypeHandle get_class_type() {
65  return _type_handle;
66  }
67  static void init_type() {
68  MilesAudioSound::init_type();
69  register_type(_type_handle, "MilesAudioSequence",
70  MilesAudioSound::get_class_type());
71  }
72  virtual TypeHandle get_type() const {
73  return get_class_type();
74  }
75  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
76 
77 private:
78  static TypeHandle _type_handle;
79 
80  friend class GlobalMilesManager;
81  friend class MilesAudioManager;
82 };
83 
84 #include "milesAudioSequence.I"
85 
86 #endif //]
87 
88 #endif /* MILESAUDIOSEQUENCE_H */
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
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:81
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.