• Main Page
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

Audio.hpp

Go to the documentation of this file.
00001 
00002 
00003 
00004 #ifndef GOSU_AUDIO_HPP
00005 #define GOSU_AUDIO_HPP
00006 
00007 #ifdef WIN32
00008 #define NOMINMAX
00009 #include <windows.h>
00010 #endif
00011 #include <Gosu/Fwd.hpp>
00012 #include <Gosu/IO.hpp>
00013 #include <Gosu/Platform.hpp>
00014 #include <boost/scoped_ptr.hpp>
00015 #include <string>
00016 
00017 namespace Gosu
00018 {
00019     // Deprecated.
00020     class Audio;
00021 
00027     class SampleInstance
00028     {
00029         int handle, extra;
00030         bool alive() const;     
00031 
00032     public:
00034         SampleInstance(int handle, int extra);
00035 
00036         bool playing() const;
00037         bool paused() const;
00039         void pause();
00040         void resume();
00043         void stop();
00044 
00047         void changeVolume(double volume);
00049         void changePan(double pan);
00053         void changeSpeed(double speed);
00054     };
00055 
00059     class Sample
00060     {
00061         struct SampleData;
00062         boost::scoped_ptr<SampleData> data;
00063 
00064     public:
00067         explicit Sample(const std::wstring& filename);
00068         
00071         explicit Sample(Reader reader);
00072         
00073         ~Sample();
00074 
00081         SampleInstance play(double volume = 1, double speed = 1,
00082             bool looping = false) const;
00083 
00093         SampleInstance playPan(double pan, double volume = 1, double speed = 1,
00094             bool looping = false) const;
00095 
00096 
00097         // Deprecated.
00098         Sample(Audio& audio, const std::wstring& filename);
00099         Sample(Audio& audio, Reader reader);
00100     };
00101 
00104     class Song
00105     {
00106         class BaseData;
00107         class ModuleData;
00108         class StreamData;
00109         boost::scoped_ptr<BaseData> data;
00110     public:
00113         enum Type
00114         {
00115             stStream,
00116             stModule
00117         };
00118 
00122         explicit Song(const std::wstring& filename);
00123         
00126         Song(Type type, Reader reader);
00127         
00128         ~Song();
00129         
00133         static Song* currentSong();
00134         
00137         void play(bool looping = false);
00140         void pause();
00143         bool paused() const;
00146         void stop();
00148         bool playing() const;
00150         double volume() const;
00152         void changeVolume(double volume);
00153         
00155         static void update();
00156 
00157         // Deprecated.
00158         Song(Audio&, const std::wstring& filename);
00159         Song(Audio&, Type type, Reader reader);
00160     };
00161 }
00162 
00163 #endif

Documentation not clear enough? Please go to one of the places listed on http://www.libgosu.org/ and leave feedback. Thanks!