コード例 #1
0
ファイル: Audio.cs プロジェクト: KiruyaMomochi/RediveExtract
        public static void HcaToWav(Stream input, Stream output, DecodeParams decodeParams)
        {
            if (input == null)
            {
                throw new ArgumentNullException(nameof(input));
            }
            if (output == null)
            {
                throw new ArgumentNullException(nameof(output));
            }

            using var hcaStream = new OneWayHcaAudioStream(input, decodeParams, true);
            hcaStream.CopyTo(output);
        }
コード例 #2
0
        private static void DecodeHca(Stream hcaDataStream, Stream waveStream, DecodeParams decodeParams)
        {
            using (var hcaStream = new OneWayHcaAudioStream(hcaDataStream, decodeParams, true)) {
                var buffer = new byte[10240];
                var read   = 1;

                while (read > 0)
                {
                    read = hcaStream.Read(buffer, 0, buffer.Length);

                    if (read > 0)
                    {
                        waveStream.Write(buffer, 0, read);
                    }
                }
            }
        }