Example #1
0
        public static bool IsLoopedHcaStream(Stream stream)
        {
            var  position = stream.Position;
            bool result;

            try {
                // The cipher keys do nothing to validating HCA files.
                var decoder = new HcaDecoder(stream, DecodeParams.Default);
                result = decoder.HcaInfo.LoopFlag;
            } catch (HcaException) {
                result = false;
            }
            stream.Seek(position, SeekOrigin.Begin);
            return(result);
        }
Example #2
0
        public HcaAudioStream(Stream baseStream, DecodeParams decodeParams, AudioParams audioParams)
            : base(baseStream, decodeParams)
        {
            var decoder = new HcaDecoder(baseStream, decodeParams);

            _decoder     = decoder;
            _audioParams = audioParams;
            var buffer = new byte[GetTotalAfterDecodingWaveDataSize()];

            _memoryCache   = new MemoryStream(buffer, true);
            _decodedBlocks = new Dictionary <long, long>();
            _decodeBuffer  = new byte[decoder.GetMinWaveDataBufferSize()];
            _hasLoop       = decoder.HcaInfo.LoopFlag;

            PrepareDecoding();
        }