Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

panda/src/audiotraits/fmodAudioSound.h

Go to the documentation of this file.
00001 // Filename: fmodAudioSound.h
00002 // Created by:  cort (January 22, 2003)
00003 // Prior system by: cary
00004 //
00005 ////////////////////////////////////////////////////////////////////
00006 //
00007 // PANDA 3D SOFTWARE
00008 // Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
00009 //
00010 // All use of this software is subject to the terms of the Panda 3d
00011 // Software license.  You should have received a copy of this license
00012 // along with this source code; you will also find a current copy of
00013 // the license at http://www.panda3d.org/license.txt .
00014 //
00015 // To contact the maintainers of this program write to
00016 // panda3d@yahoogroups.com .
00017 //
00018 ////////////////////////////////////////////////////////////////////
00019 
00020 #ifndef __FMOD_AUDIO_SOUND_H__
00021 #define __FMOD_AUDIO_SOUND_H__
00022 
00023 #include <pandabase.h>
00024 #ifdef HAVE_FMOD //[
00025 
00026 #include "audioSound.h"
00027 class FmodAudioManager;
00028 #include <fmod.h>
00029 
00030 
00031 class EXPCL_FMOD_AUDIO FmodAudioSound : public AudioSound {
00032 public:
00033   ~FmodAudioSound();
00034   
00035   // For best compatability, set the loop_count, start_time,
00036   // volume, and balance, prior to calling play().  You may
00037   // set them while they're playing, but it's implementation
00038   // specific whether you get the results.
00039   void play();
00040   void stop();
00041   
00042   // loop: false = play once; true = play forever.
00043   // inits to false.
00044   void set_loop(bool loop=true);
00045   bool get_loop() const;
00046   
00047   // loop_count: 0 = forever; 1 = play once; n = play n times.
00048   // inits to 1.
00049   void set_loop_count(unsigned long loop_count=1);
00050   unsigned long get_loop_count() const;
00051   
00052   // 0 = begining; length() = end.
00053   // inits to 0.0.
00054   void set_time(float start_time=0.0);
00055   float get_time() const;
00056   
00057   // 0 = minimum; 1.0 = maximum.
00058   // inits to 1.0.
00059   void set_volume(float volume=1.0);
00060   float get_volume() const;
00061   
00062   // -1.0 is hard left
00063   // 0.0 is centered
00064   // 1.0 is hard right
00065   // inits to 0.0.
00066   void set_balance(float balance_right=0.0);
00067   float get_balance() const;
00068 
00069   // inits to manager's state.
00070   void set_active(bool active=true);
00071   bool get_active() const;
00072   
00073   const string& get_name() const;
00074   
00075   // return: playing time in seconds.
00076   float length() const;
00077 
00078   AudioSound::SoundStatus status() const;
00079 
00080 protected:
00081 
00082 private:
00083   PT(FmodAudioManager) _manager;
00084   FSOUND_STREAM *_audio;
00085   string _file_name;
00086   float _volume; // 0..1.0
00087   float _balance; // -1..1
00088   unsigned long _loop_count;
00089   mutable float _length; // in seconds.
00090   bool _active;
00091   bool _paused;
00092   int _channel;
00093 
00094   FmodAudioSound(FmodAudioManager* manager, FSOUND_STREAM *audio_data,
00095          string file_name, float length=0.0f);
00096 
00097   // forbidden functions!
00098   FmodAudioSound(const FmodAudioSound& rhs) {}
00099   const FmodAudioSound& operator=(const FmodAudioSound& rhs) { return *this; }
00100 
00101   friend class FmodAudioManager;
00102 };
00103 
00104 #include "fmodAudioSound.I"
00105 
00106 #endif //]
00107 
00108 #endif /* __FMOD_AUDIO_SOUND_H__ */

Generated on Fri May 2 00:34:32 2003 for Panda by doxygen1.3