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
|
|
|
|
2024-06-03 21:55:09 -03:00
|
|
|
#include "../../audio/soundeffect.hpp"
|
|
|
|
#include "../../csharp/timespan.hpp"
|
|
|
|
#include "../../csharp/type.hpp"
|
|
|
|
#include "../manager.hpp"
|
|
|
|
#include "../reader.hpp"
|
2024-05-27 21:12:46 -03:00
|
|
|
|
|
|
|
namespace xna {
|
|
|
|
class SoundEffectReader : public ContentTypeReaderT<PSoundEffect> {
|
|
|
|
public:
|
2024-05-31 22:30:45 -03:00
|
|
|
SoundEffectReader() : ContentTypeReaderT(typeof<PSoundEffect>()) {
|
|
|
|
ContentTypeReader::TargetIsValueType = false;
|
|
|
|
}
|
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();
|
2024-06-03 21:20:18 -03:00
|
|
|
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();
|
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
|