Music.h
Go to the documentation of this file.00001 00010 #ifndef __Music_H__ 00011 #define __Music_H__ 00012 00013 // Includes 00014 00015 // Forward declares 00016 class Asset; 00017 class Platform_Sound_SoundStream; 00018 class AudioFormat; 00019 00020 00021 // Music 00022 class Music 00023 { 00024 public: 00028 Music( 00029 const Asset& asset 00030 ); 00031 00035 ~Music(); 00036 00042 void SetLooping(bool looping); 00043 00047 void Play(); 00048 00052 void Stop(); 00053 00057 void Pause(); 00058 00059 00064 bool IsPlaying(); 00065 00069 float GetLength(); 00070 00074 float GetPosition(); 00075 00079 void SetPosition(float position); 00080 00084 float GetVolume(); 00085 00089 void SetVolume(float level); 00090 00091 private: 00092 friend class Audio; 00093 void Update(); 00094 void CopySoundChunk(int bufferOffset,int maxBytes); 00095 00096 int PositionFromTime(float time); 00097 float TimeFromPosition(int position); 00098 00099 private: 00100 bool looping_; 00101 float storedPosition_; 00102 bool playing_; 00103 00104 00105 Platform_Sound_SoundStream* soundStream_; 00106 AudioFormat* format_; 00107 unsigned char* streamBuffer_; 00108 bool nextCopyToStart_; 00109 int lastCopySourceStart_; 00110 int lastCopyDestinationStart_; 00111 int lastCopyByteCount_; 00112 bool lastCopyReachedEnd_; 00113 }; 00114 00115 #endif /* __Music_H__ */
Reproduction/republishing of any material on this site without permission is strictly prohibited.
