Vegastrike 0.5.1 rc1  1.0
Original sources for Vegastrike Evolved
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SimpleSound.h
Go to the documentation of this file.
1 //
2 // C++ Interface: Audio::SimpleSound
3 //
4 #ifndef __AUDIO_SIMPLESOUND_H__INCLUDED__
5 #define __AUDIO_SIMPLESOUND_H__INCLUDED__
6 
7 #include "Exceptions.h"
8 #include "Types.h"
9 #include "Format.h"
10 #include "Sound.h"
11 #include "SoundBuffer.h"
12 
13 #include "vsfilesystem.h"
14 
15 namespace Audio {
16 
17  // Forward definitions
18  class Stream;
19 
35  class SimpleSound : public Sound
36  {
37  private:
38  SharedPtr<Stream> stream;
40 
41  protected:
43  SimpleSound(const std::string& name, VSFileSystem::VSFileType type = VSFileSystem::UnknownFile, bool streaming = false) throw();
44 
45  public:
46  virtual ~SimpleSound();
47 
49  VSFileSystem::VSFileType getType() const { return type; }
50 
51  // The following section contains supporting methods for accessing the stream.
52  // Subclasses need not bother with actual stream management, they need only worry
53  // about sending the samples to where they're needed.
54  protected:
55 
57  bool isStreamLoaded() const { return stream.get() != 0; }
58 
63  void loadStream() throw(Exception);
64 
70 
75  SharedPtr<Stream> getStream() const throw(ResourceNotLoadedException);
76 
81  void readBuffer(SoundBuffer &buffer) throw(Exception);
82 
83  // The following section contains basic Sound interface implementation
84  // functions provided by SimpleSound.
85  protected:
87  virtual void abortLoad() throw();
88 
89  };
90 
91 };
92 
93 #endif//__AUDIO_SIMPLESOUND_H__INCLUDED__