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 <Gosu/TR1.hpp>
00017 #include <memory>
00018 #include <string>
00019
00020 namespace Gosu
00021 {
00022
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 std::tr1::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 Song(const Song&);
00113 Song& operator=(const Song&);
00114 std::auto_ptr<BaseData> data;
00115
00116 public:
00120 explicit Song(const std::wstring& filename);
00121
00124 explicit Song(Reader reader);
00125
00126 ~Song();
00127
00131 static Song* currentSong();
00132
00135 void play(bool looping = false);
00138 void pause();
00141 bool paused() const;
00144 void stop();
00146 bool playing() const;
00148 double volume() const;
00150 void changeVolume(double volume);
00151
00153 static void update();
00154
00155 #ifndef SWIG
00156 enum Type { stStream, stModule };
00157 GOSU_DEPRECATED Song(Audio&, const std::wstring& filename);
00158 GOSU_DEPRECATED Song(Audio&, Type type, Reader reader);
00159 #endif
00160 };
00161 }
00162
00163 #endif