2024-05-30 17:37:40 -03:00
|
|
|
#ifndef XNA_CONTENT_READERS_AUDIO_HPP
|
|
|
|
#define XNA_CONTENT_READERS_AUDIO_HPP
|
2024-05-27 21:12:46 -03:00
|
|
|
|
|
|
|
#include "content/manager.hpp"
|
|
|
|
#include "content/reader.hpp"
|
|
|
|
#include "csharp/type.hpp"
|
|
|
|
#include "audio/soundeffect.hpp"
|
2024-05-29 15:58:37 -03:00
|
|
|
#include "csharp/timespan.hpp"
|
2024-05-27 21:12:46 -03:00
|
|
|
|
|
|
|
namespace xna {
|
|
|
|
class SoundEffectReader : public ContentTypeReaderT<PSoundEffect> {
|
|
|
|
public:
|
2024-05-30 17:37:40 -03:00
|
|
|
SoundEffectReader() : ContentTypeReaderT(typeof<PSoundEffect>()) {}
|
2024-05-27 21:12:46 -03:00
|
|
|
|
|
|
|
PSoundEffect Read(ContentReader& input, PSoundEffect& existingInstance) override {
|
2024-05-28 09:06:10 -03:00
|
|
|
const auto count1 = input.ReadInt32();
|
|
|
|
auto format = input.ReadBytes(count1);
|
|
|
|
auto count2 = input.ReadInt32();
|
|
|
|
auto data = input.ReadBytes(count2);
|
|
|
|
auto loopStart = input.ReadInt32();
|
|
|
|
auto loopLength = input.ReadInt32();
|
|
|
|
auto num = input.ReadInt32();
|
2024-05-29 15:58:37 -03:00
|
|
|
|
|
|
|
auto sf = snew<SoundEffect>(format, data, loopStart, loopLength, TimeSpan::FromMilliseconds((double)num));
|
|
|
|
return sf;
|
2024-05-27 21:12:46 -03:00
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|