• 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 #ifndef NOMINMAX
00009 #define NOMINMAX
00010 #endif
00011 #include <windows.h>
00012 #endif
00013 #include <Gosu/Fwd.hpp>
00014 #include <Gosu/IO.hpp>
00015 #include <Gosu/Platform.hpp>
00016 #include <boost/scoped_ptr.hpp>
00017 #include <boost/shared_ptr.hpp>
00018 #include <string>
00019 
00020 namespace Gosu
00021 {
00022     // Deprecated.
00023     class Audio;
00024 
00030     class SampleInstance
00031     {
00032         int handle, extra;
00033         bool alive() const;     
00034 
00035     public:
00037         SampleInstance(int handle, int extra);
00038 
00039         bool playing() const;
00040         bool paused() const;
00042         void pause();
00043         void resume();
00046         void stop();
00047 
00050         void changeVolume(double volume);
00052         void changePan(double pan);
00056         void changeSpeed(double speed);
00057     };
00058 
00062     class Sample
00063     {
00064         struct SampleData;
00065         boost::shared_ptr<SampleData> data;
00066     
00067     public:
00070         explicit Sample(const std::wstring& filename);
00071         
00074         explicit Sample(Reader reader);
00075         
00082         SampleInstance play(double volume = 1, double speed = 1,
00083             bool looping = false) const;
00084 
00094         SampleInstance playPan(double pan, double volume = 1, double speed = 1,
00095             bool looping = false) const;
00096 
00097 
00098         // Deprecated.
00099         #ifndef SWIG
00100         GOSU_DEPRECATED Sample(Audio& audio, const std::wstring& filename);
00101         GOSU_DEPRECATED Sample(Audio& audio, Reader reader);
00102         #endif
00103     };
00104 
00107     class Song
00108     {
00109         class BaseData;
00110         class ModuleData;
00111         class StreamData;
00112         boost::scoped_ptr<BaseData> data;
00113     
00114     public:
00118         explicit Song(const std::wstring& filename);
00119         
00122         explicit Song(Reader reader);
00123         
00124         ~Song();
00125         
00129         static Song* currentSong();
00130         
00133         void play(bool looping = false);
00136         void pause();
00139         bool paused() const;
00142         void stop();
00144         bool playing() const;
00146         double volume() const;
00148         void changeVolume(double volume);
00149         
00151         static void update();
00152 
00153         // Deprecated.
00154         #ifndef SWIG
00157         enum Type
00158         {
00159             stStream,
00160             stModule
00161         };
00162 
00163         GOSU_DEPRECATED Song(Audio&, const std::wstring& filename);
00164         GOSU_DEPRECATED Song(Audio&, Type type, Reader reader);
00165         #endif
00166     };
00167 }
00168 
00169 #endif

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