include/vamos/geometry/Sample.h

Go to the documentation of this file.
00001 //  Sample.h - an audio sample class.
00002 //
00003 //      Vamos Automotive Simulator
00004 //  Copyright (C) 2003 Sam Varner
00005 //
00006 //  This program is free software; you can redistribute it and/or modify
00007 //  it under the terms of the GNU General Public License as published by
00008 //  the Free Software Foundation; either version 2 of the License, or
00009 //  (at your option) any later version.
00010 //
00011 //  This program is distributed in the hope that it will be useful,
00012 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014 //  GNU General Public License for more details.
00015 //
00016 //  You should have received a copy of the GNU General Public License
00017 //  along with this program; if not, write to the Free Software
00018 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00019 
00020 #ifndef _SAMPLE_H_
00021 #define _SAMPLE_H_
00022 
00023 #include <string>
00024 
00025 namespace Vamos_Geometry
00026 {
00027   class Missing_Sound_File
00028   {
00029   private:
00030         std::string m_file;
00031   public:
00032         Missing_Sound_File (std::string file) : m_file (file) {};
00033         std::string message () { return "Can't find the sound file \"" 
00034                                                            + m_file + '\"'; }
00035   };
00036   
00037   class slScheduler
00038   {
00039           public:
00040                   int dummyvar;
00041   };
00042 
00043   //class Sample : public slSample
00044   class Sample
00045   {
00046         /*double m_base_volume;
00047         double m_base_pitch;
00048 
00049         bool m_loop;
00050 
00051         slEnvelope* mp_volume_envelope;
00052         slEnvelope* mp_pitch_envelope;
00053 
00054         slScheduler* mp_scheduler;*/
00055 
00056   public:
00057         Sample (std::string file, double base_volume, double base_pitch,
00058                         bool volume_envelope = false, bool pitch_envelope = false);
00059 
00060         ~Sample ();
00061 
00062         void schedule (slScheduler* scheduler, 
00063                                    bool loop = false, 
00064                                    int priority = 0);
00065         
00066         // Set the sample's volume as volume_factor * m_base_volume.
00067         void volume (double volume_factor);
00068         // Set the sample's pitch as pitch_factor * m_base_pitch.
00069         void pitch (double pitch_factor);
00070 
00071         void play ();
00072         void pause ();
00073         void stop ();
00074   };
00075 }
00076 
00077 #endif // not _SAMPLE_H_

Generated on Thu Oct 19 04:05:48 2006 by  doxygen 1.4.6