add live select pannel

This commit is contained in:
CroakFang
2023-01-20 07:13:54 +08:00
parent 3b18268252
commit a4dc2516e3
1543 changed files with 107369 additions and 9227 deletions
@@ -0,0 +1,44 @@
using System;
using System.Linq.Expressions;
namespace DereTore.Exchange.Audio.HCA {
partial class HcaDecoder {
public static string NameOf<T>(Expression<Func<T>> e)
{
return ((MemberExpression)e.Body).Member.Name;
}
internal uint DecodeBlock(byte[] waveDataBuffer, uint blockIndex) {
if (waveDataBuffer == null) {
throw new ArgumentNullException(NameOf(() => waveDataBuffer));
}
var waveBlockSize = GetMinWaveDataBufferSize();
if (waveDataBuffer.Length < waveBlockSize) {
throw new HcaException(ErrorMessages.GetBufferTooSmall(waveBlockSize, waveDataBuffer.Length), ActionResult.BufferTooSmall);
}
TransformWaveDataBlocks(SourceStream, waveDataBuffer, blockIndex, 1, GetProperWaveWriter());
return 1;
}
internal uint DecodeBlocks(byte[] waveDataBuffer, uint startBlockIndex) {
if (waveDataBuffer == null) {
throw new ArgumentNullException(NameOf(() => waveDataBuffer));
}
var waveBlockSize = GetMinWaveDataBufferSize();
if (waveDataBuffer.Length < waveBlockSize) {
throw new HcaException(ErrorMessages.GetBufferTooSmall(waveBlockSize, waveDataBuffer.Length), ActionResult.BufferTooSmall);
}
var hcaInfo = HcaInfo;
var numBlocksToDecode = (uint)(waveDataBuffer.Length / waveBlockSize);
if (startBlockIndex + numBlocksToDecode >= hcaInfo.BlockCount) {
numBlocksToDecode = hcaInfo.BlockCount - startBlockIndex;
}
if (numBlocksToDecode == 0) {
return 0;
}
TransformWaveDataBlocks(SourceStream, waveDataBuffer, startBlockIndex, numBlocksToDecode, GetProperWaveWriter());
return numBlocksToDecode;
}
}
}