mirror of
https://github.com/borgesdan/xn65
synced 2024-12-29 21:54:47 +01:00
32 lines
990 B
C++
32 lines
990 B
C++
#ifndef XNA_CONTENT_READERS_AUDIO_HPP
|
|
#define XNA_CONTENT_READERS_AUDIO_HPP
|
|
|
|
#include "../../audio/soundeffect.hpp"
|
|
#include "../../csharp/timespan.hpp"
|
|
#include "../../csharp/type.hpp"
|
|
#include "../manager.hpp"
|
|
#include "../reader.hpp"
|
|
|
|
namespace xna {
|
|
class SoundEffectReader : public ContentTypeReaderT<PSoundEffect> {
|
|
public:
|
|
SoundEffectReader() : ContentTypeReaderT(typeof<PSoundEffect>()) {
|
|
ContentTypeReader::TargetIsValueType = false;
|
|
}
|
|
|
|
PSoundEffect Read(ContentReader& input, PSoundEffect& existingInstance) override {
|
|
const auto count1 = input.ReadInt32();
|
|
const auto format = input.ReadBytes(count1);
|
|
const auto count2 = input.ReadInt32();
|
|
const auto data = input.ReadBytes(count2);
|
|
const auto loopStart = input.ReadInt32();
|
|
const auto loopLength = input.ReadInt32();
|
|
const auto num = input.ReadInt32();
|
|
|
|
auto sf = snew<SoundEffect>(format, data, loopStart, loopLength, TimeSpan::FromMilliseconds((double)num));
|
|
return sf;
|
|
}
|
|
};
|
|
}
|
|
|
|
#endif |