22 #include "MASoundMemory.hpp" 35 return Data->GetSize() /
sizeof(int16_t);
57 const int Position =
MCBound(0, position, Size-1);
58 int Duration = (Position+count > Size ? Size-Position : count);
64 int16_t* SrcPtr = ((int16_t*)(
void*)
Data->GetData())+Position;
65 int32_t* DestPtr = buffer;
67 for (
int i = 0; i < Duration; ++i)
69 *DestPtr += (int32_t)*SrcPtr;
virtual int GetSize() const
Get the sound data size.
virtual void AddToBuffer(int position, int count, int32_t *buffer)
Add sound data to a buffer.
const T & MCBound(const T &min, const T &value, const T &max)
Check a value bound according to a range.
virtual bool IsCached() const
Check if the sound data is cached.
MASoundMemory(const std::string &display_name, MC::BinaryDataSPtr sound_data)
Class constructor.
MC::BinaryDataSPtr Data
Sound data.
virtual bool IsValid() const
Check if the sound data is valid.