00001 00002 00003 00004 // REDESIGN: Rename all changeXXX() member functions to setXXX(). 00005 // REDESIGN: Don't require window argument, is this possible? 00006 00007 #ifndef GOSU_AUDIO_HPP 00008 #define GOSU_AUDIO_HPP 00009 00010 #ifdef WIN32 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/utility.hpp> 00018 #include <string> 00019 00020 namespace Gosu 00021 { 00026 class Audio : boost::noncopyable 00027 { 00028 public: 00029 #ifdef GOSU_IS_WIN 00030 explicit Audio(HWND window); 00031 #else 00032 Audio(); 00033 #endif 00034 ~Audio(); 00035 00036 void update(); 00037 }; 00038 00044 class SampleInstance 00045 { 00046 int handle, extra; 00047 bool alive() const; 00048 00049 public: 00051 SampleInstance(int handle, int extra); 00052 00053 bool playing() const; 00054 bool paused() const; 00056 void pause(); 00057 void resume(); 00060 void stop(); 00061 00064 void changeVolume(double volume); 00066 void changePan(double pan); 00070 void changeSpeed(double speed); 00071 }; 00072 00076 class Sample 00077 { 00078 struct SampleData; 00079 boost::scoped_ptr<SampleData> data; 00080 00081 public: 00084 Sample(Audio& audio, const std::wstring& filename); 00085 00088 Sample(Audio& audio, Reader reader); 00089 00090 ~Sample(); 00091 00098 SampleInstance play(double volume = 1, double speed = 1, 00099 bool looping = false) const; 00100 00110 SampleInstance playPan(double pan, double volume = 1, double speed = 1, 00111 bool looping = false) const; 00112 }; 00113 00116 class Song 00117 { 00118 class BaseData; 00119 class ModuleData; 00120 class StreamData; 00121 boost::scoped_ptr<BaseData> data; 00122 00123 #ifdef GOSU_IS_MAC 00124 void update(); 00125 friend class Audio; 00126 #endif 00127 public: 00130 enum Type 00131 { 00132 stStream, 00133 stModule 00134 }; 00135 00139 Song(Audio&, const std::wstring& filename); 00140 00143 Song(Audio&, Type type, Reader reader); 00144 00145 ~Song(); 00146 00150 static Song* currentSong(); 00151 00154 void play(bool looping = false); 00157 void pause(); 00160 bool paused() const; 00163 void stop(); 00165 bool playing() const; 00167 double volume() const; 00169 void changeVolume(double volume); 00170 }; 00171 } 00172 00173 #endif
Documentation not clear enough? Please go to one of the places listed on http://www.libgosu.org/ and leave feedback. Thanks!