LossyWAV support

This commit is contained in:
chudov
2008-11-21 20:06:11 +00:00
parent b7b78afa8a
commit 478f92236d
19 changed files with 4110 additions and 3223 deletions

View File

@@ -322,6 +322,7 @@ namespace WavPackDotNet {
_compressionMode = 1;
_extraMode = 0;
_blockSize = 0;
_bitsPerSample = bitsPerSample;
_channelCount = channelCount;
@@ -385,6 +386,14 @@ namespace WavPackDotNet {
}
}
virtual property Int64 BlockSize
{
void set(Int64 value)
{
_blockSize = value;
}
}
virtual void Write(array<Int32, 2>^ sampleBuffer, UInt32 sampleCount)
{
if (!_initialized)
@@ -467,7 +476,7 @@ namespace WavPackDotNet {
WavpackContext *_wpc;
Int32 _finalSampleCount, _samplesWritten;
Int32 _bitsPerSample, _channelCount, _sampleRate, _blockAlign;
Int32 _compressionMode, _extraMode;
Int32 _compressionMode, _extraMode, _blockSize;
NameValueCollection^ _tags;
String^ _path;
bool _md5Sum;
@@ -500,6 +509,9 @@ namespace WavPackDotNet {
_md5hasher = gcnew MD5CryptoServiceProvider ();
config.flags |= CONFIG_MD5_CHECKSUM;
}
config.block_samples = (int)_blockSize;
if (_blockSize > 0 && _blockSize < 2048)
config.flags |= CONFIG_MERGE_BLOCKS;
if (!WavpackSetConfiguration(_wpc, &config, (_finalSampleCount == 0) ? -1 : _finalSampleCount)) {
throw gcnew Exception("Invalid configuration setting.");