SDL++
C++wrapperfortheSDLlibrary.

audio/Wav.h

Go to the documentation of this file.
00001 
00021 #ifndef SDL_AUDIO_WAV_H
00022 #define SDL_AUDIO_WAV_H
00023 
00024 #include <string>
00025 #include <stdexcept>
00026 
00027 #include <SDL.h>
00028 
00029 namespace sdl {
00030 namespace audio {
00031     using namespace std;
00032 
00037     class Wav {
00038         public:
00046             Wav (const string& fileName)
00047               : name_ (fileName),
00048                 audioBuf_ (0),
00049                 audioLen_ (0),
00050                 spec_ () {
00051                 if (SDL_LoadWAV (name_.c_str (), &spec_, &audioBuf_, &audioLen_) == NULL)
00052                     throw runtime_error (SDL_GetError ());
00053             };
00054 
00058             ~Wav () { SDL_FreeWAV (audioBuf_); };
00059 
00063             std::string name_;
00064 
00068             unsigned char* audioBuf_;
00069 
00073             unsigned int audioLen_;
00074 
00078             SDL_AudioSpec spec_;
00079 
00080         private:
00086             Wav (const Wav& rhs);
00087 
00095             Wav& operator= (const Wav& rhs);
00096     }; //Wav
00097 }; //audio
00098 }; //sdl
00099 
00100 #endif //SDL_AUDIO_WAV_H
00101 
 All Classes Namespaces Files Functions Variables Typedefs