• 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     #ifndef SWIG
00024     GOSU_DEPRECATED class Audio;
00025     #endif
00026 
00032     class SampleInstance
00033     {
00034         int handle, extra;
00035         bool alive() const;     
00036 
00037     public:
00039         SampleInstance(int handle, int extra);
00040 
00041         bool playing() const;
00042         bool paused() const;
00044         void pause();
00045         void resume();
00048         void stop();
00049 
00052         void changeVolume(double volume);
00054         void changePan(double pan);
00058         void changeSpeed(double speed);
00059     };
00060 
00064     class Sample
00065     {
00066         struct SampleData;
00067         boost::shared_ptr<SampleData> data;
00068     
00069     public:
00072         explicit Sample(const std::wstring& filename);
00073         
00076         explicit Sample(Reader reader);
00077         
00084         SampleInstance play(double volume = 1, double speed = 1,
00085             bool looping = false) const;
00086 
00096         SampleInstance playPan(double pan, double volume = 1, double speed = 1,
00097             bool looping = false) const;
00098 
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         #ifndef SWIG
00154         enum Type { stStream, stModule };
00155         GOSU_DEPRECATED Song(Audio&, const std::wstring& filename);
00156         GOSU_DEPRECATED Song(Audio&, Type type, Reader reader);
00157         #endif
00158     };
00159 }
00160 
00161 #endif

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