Panda3D
 All Classes Functions Variables Enumerations
milesAudioStream.h
1 // Filename: milesAudioStream.h
2 // Created by: drose (26Jul07)
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 MILESAUDIOSTREAM_H
16 #define MILESAUDIOSTREAM_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 : MilesAudioStream
27 // Description : This represents a sound file played by the Miles
28 // Sound System, similar to MilesAudioSample, except
29 // that it is streamed from disk instead of preloaded
30 // into memory.
31 ////////////////////////////////////////////////////////////////////
32 class EXPCL_MILES_AUDIO MilesAudioStream : public MilesAudioSound {
33 private:
34  MilesAudioStream(MilesAudioManager *manager, const string &file_name,
35  const Filename &path);
36 
37 public:
38  virtual ~MilesAudioStream();
39 
40  virtual void play();
41  virtual void stop();
42 
43  virtual PN_stdfloat get_time() const;
44 
45  virtual void set_volume(PN_stdfloat volume=1.0f);
46  virtual void set_balance(PN_stdfloat balance_right=0.0f);
47  virtual void set_play_rate(PN_stdfloat play_rate=1.0f);
48 
49  virtual PN_stdfloat length() const;
50 
51  virtual AudioSound::SoundStatus status() const;
52 
53  virtual void cleanup();
54 
55 private:
56  static void AILCALLBACK finish_callback(HSTREAM stream);
57  void do_set_time(PN_stdfloat time);
58 
59  Filename _path;
60  HSTREAM _stream;
61  S32 _original_playback_rate;
62  mutable PN_stdfloat _length;
63  mutable bool _got_length;
64 
65 public:
66  static TypeHandle get_class_type() {
67  return _type_handle;
68  }
69  static void init_type() {
70  MilesAudioSound::init_type();
71  register_type(_type_handle, "MilesAudioStream",
72  MilesAudioSound::get_class_type());
73  }
74  virtual TypeHandle get_type() const {
75  return get_class_type();
76  }
77  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
78 
79 private:
80  static TypeHandle _type_handle;
81 
82  friend class MilesAudioManager;
83 };
84 
85 #include "milesAudioStream.I"
86 
87 #endif //]
88 
89 #endif
The name of a file, such as a texture file or an Egg file.
Definition: filename.h:44
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:85