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