Panda3D
 All Classes Functions Variables Enumerations
milesAudioSequence.h
00001 // Filename: milesAudioSequence.h
00002 // Created by:  drose (31Jul07)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) Carnegie Mellon University.  All rights reserved.
00008 //
00009 // All use of this software is subject to the terms of the revised BSD
00010 // license.  You should have received a copy of this license along
00011 // with this source code in a file named "LICENSE."
00012 //
00013 ////////////////////////////////////////////////////////////////////
00014 
00015 #ifndef MILESAUDIOSEQUENCE_H
00016 #define MILESAUDIOSEQUENCE_H
00017 
00018 #include "pandabase.h"
00019 #ifdef HAVE_RAD_MSS //[
00020 
00021 #include "milesAudioSound.h"
00022 #include "milesAudioManager.h"
00023 #include "mss.h"
00024 
00025 ////////////////////////////////////////////////////////////////////
00026 //       Class : MilesAudioSequence
00027 // Description : A MIDI file, preloaded and played from a memory
00028 //               buffer.  MIDI files cannot be streamed.
00029 ////////////////////////////////////////////////////////////////////
00030 class EXPCL_MILES_AUDIO MilesAudioSequence : public MilesAudioSound {
00031 private:
00032   MilesAudioSequence(MilesAudioManager *manager, 
00033                      MilesAudioManager::SoundData *sd,
00034                      const string &file_name);
00035 
00036 public:
00037   virtual ~MilesAudioSequence();
00038   
00039   virtual void play();
00040   virtual void stop();
00041   
00042   virtual PN_stdfloat get_time() const;
00043   
00044   virtual void set_volume(PN_stdfloat volume=1.0f);
00045   virtual void set_balance(PN_stdfloat balance_right=0.0f);
00046   virtual void set_play_rate(PN_stdfloat play_rate=1.0f);
00047   
00048   virtual PN_stdfloat length() const;
00049 
00050   virtual AudioSound::SoundStatus status() const;
00051 
00052   virtual void cleanup();
00053 
00054 private:
00055   void internal_stop();
00056   static void AILCALLBACK finish_callback(HSEQUENCE sequence);
00057   void do_set_time(PN_stdfloat time);
00058   void determine_length();
00059 
00060   PT(MilesAudioManager::SoundData) _sd;
00061   HSEQUENCE _sequence;
00062   size_t _sequence_index;
00063 
00064 public:
00065   static TypeHandle get_class_type() {
00066     return _type_handle;
00067   }
00068   static void init_type() {
00069     MilesAudioSound::init_type();
00070     register_type(_type_handle, "MilesAudioSequence",
00071                   MilesAudioSound::get_class_type());
00072   }
00073   virtual TypeHandle get_type() const {
00074     return get_class_type();
00075   }
00076   virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
00077 
00078 private:
00079   static TypeHandle _type_handle;
00080 
00081   friend class GlobalMilesManager;
00082   friend class MilesAudioManager;
00083 };
00084 
00085 #include "milesAudioSequence.I"
00086 
00087 #endif //]
00088 
00089 #endif  /* MILESAUDIOSEQUENCE_H */
 All Classes Functions Variables Enumerations