00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef FIFE_SOUNDCLIP_H_
00023 #define FIFE_SOUNDCLIP_H_
00024
00025
00026 #include <vector>
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036 #include "util/base/resourceclass.h"
00037
00038 #include "sounddecoder.h"
00039
00040 namespace FIFE {
00041
00044 enum SoundPositionType {
00045 SD_SAMPLE_POS,
00046 SD_TIME_POS,
00047 SD_BYTE_POS
00048 };
00049
00050 struct SoundBufferEntry {
00051 ALuint buffers[BUFFER_NUM];
00052 unsigned int usedbufs;
00053 unsigned long deccursor;
00054 };
00055
00058 class SoundClip : public ResourceClass {
00059 public:
00060
00061 SoundClip(SoundDecoder* decptr, bool deletedecoder = true);
00062
00063 ~SoundClip();
00064
00069 bool isStream() const {
00070 return m_isstream;
00071 }
00072
00078 unsigned int countBuffers() const {
00079 return m_buffervec.at(0)->usedbufs;
00080 }
00081
00085 ALuint* getBuffers(unsigned int streamid = 0) const {
00086 return m_buffervec.at(streamid)->buffers;
00087 }
00088
00092 unsigned int beginStreaming();
00093
00098 void acquireStream(unsigned int streamid);
00099
00103 bool setStreamPos(unsigned int streamid, SoundPositionType type, float value);
00104
00107 float getStreamPos(unsigned int streamid, SoundPositionType type) const;
00108
00114 bool getStream(unsigned int streamid, ALuint buffer);
00115
00118 void quitStreaming(unsigned int streamid);
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00132 SoundDecoder* getDecoder() const {
00133 return m_decoder;
00134 }
00135
00136 private:
00137
00138 bool m_isstream;
00139 SoundDecoder* m_decoder;
00140 bool m_deletedecoder;
00141 std::vector<SoundBufferEntry*> m_buffervec;
00142 };
00143 }
00144
00145 #endif