This commit is contained in:
Wiesław Šoltés 2016-09-03 23:32:15 +02:00
Родитель 0749716533
Коммит 530e651f4f
4 изменённых файлов: 203 добавлений и 4 удалений

Просмотреть файл

@ -12,15 +12,32 @@ namespace WavFile
private readonly string _shortName;
private readonly WavChannelMask _mask;
/// <summary>
///
/// </summary>
public string LongName { get { return _longName; } }
/// <summary>
///
/// </summary>
public string ShortName { get { return _shortName; } }
/// <summary>
///
/// </summary>
public WavChannelMask Mask { get { return _mask; } }
/// <summary>
///
/// </summary>
/// <param name="longName"></param>
/// <param name="shortName"></param>
/// <param name="mask"></param>
public WavChannel(string longName, string shortName, WavChannelMask mask)
{
_longName = longName;
_shortName = shortName;
_mask = mask;
}
public string LongName { get { return _longName; } }
public string ShortName { get { return _shortName; } }
public WavChannelMask Mask { get { return _mask; } }
}
}

Просмотреть файл

@ -8,23 +8,94 @@ namespace WavFile
/// </summary>
public enum WavChannelMask
{
/// <summary>
///
/// </summary>
SPEAKER_FRONT_LEFT = 0x1,
/// <summary>
///
/// </summary>
SPEAKER_FRONT_RIGHT = 0x2,
/// <summary>
///
/// </summary>
SPEAKER_FRONT_CENTER = 0x4,
/// <summary>
///
/// </summary>
SPEAKER_LOW_FREQUENCY = 0x8,
/// <summary>
///
/// </summary>
SPEAKER_BACK_LEFT = 0x10,
/// <summary>
///
/// </summary>
SPEAKER_BACK_RIGHT = 0x20,
/// <summary>
///
/// </summary>
SPEAKER_FRONT_LEFT_OF_CENTER = 0x40,
/// <summary>
///
/// </summary>
SPEAKER_FRONT_RIGHT_OF_CENTER = 0x80,
/// <summary>
///
/// </summary>
SPEAKER_BACK_CENTER = 0x100,
/// <summary>
///
/// </summary>
SPEAKER_SIDE_LEFT = 0x200,
/// <summary>
///
/// </summary>
SPEAKER_SIDE_RIGHT = 0x400,
/// <summary>
///
/// </summary>
SPEAKER_TOP_CENTER = 0x800,
/// <summary>
///
/// </summary>
SPEAKER_TOP_FRONT_LEFT = 0x1000,
/// <summary>
///
/// </summary>
SPEAKER_TOP_FRONT_CENTER = 0x2000,
/// <summary>
///
/// </summary>
SPEAKER_TOP_FRONT_RIGHT = 0x4000,
/// <summary>
///
/// </summary>
SPEAKER_TOP_BACK_LEFT = 0x8000,
/// <summary>
///
/// </summary>
SPEAKER_TOP_BACK_CENTER = 0x10000,
/// <summary>
///
/// </summary>
SPEAKER_TOP_BACK_RIGHT = 0x20000
}
}

Просмотреть файл

@ -23,6 +23,7 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
<DocumentationFile>bin\Debug\WavFile.XML</DocumentationFile>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
@ -32,6 +33,7 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
<DocumentationFile>bin\Release\WavFile.XML</DocumentationFile>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />

Просмотреть файл

@ -16,46 +16,139 @@ namespace WavFile
//
// WAVE bytes=12
//
/// <summary>
///
/// </summary>
public UInt32 ChunkID; // bytes=4
/// <summary>
///
/// </summary>
public UInt32 ChunkSize; // bytes=4
/// <summary>
///
/// </summary>
public UInt32 Format; // bytes=4
//
// fmt bytes=24
//
/// <summary>
///
/// </summary>
public UInt32 Subchunk1ID; // bytes=4
/// <summary>
///
/// </summary>
public UInt32 Subchunk1Size; // bytes=4
/// <summary>
///
/// </summary>
public UInt16 AudioFormat; // bytes=2
/// <summary>
///
/// </summary>
public UInt16 NumChannels; // bytes=2
/// <summary>
///
/// </summary>
public UInt32 SampleRate; // bytes=4
/// <summary>
///
/// </summary>
public UInt32 ByteRate; // bytes=4
/// <summary>
///
/// </summary>
public UInt16 BlockAlign; // bytes=2
/// <summary>
///
/// </summary>
public UInt16 BitsPerSample; // bytes=2
//
// extra bytes=2
// if h.Subchunk1Size > 16
//
/// <summary>
///
/// </summary>
public UInt16 ExtraParamSize; // bytes=2
//
// extensible bytes=22
//
/// <summary>
///
/// </summary>
public UInt16 Samples; // bytes=2
/// <summary>
///
/// </summary>
public UInt32 ChannelMask; // bytes=4
/// <summary>
///
/// </summary>
public Guid GuidSubFormat; // bytes=16
//
// data bytes=8
//
/// <summary>
///
/// </summary>
public UInt32 Subchunk2ID; // bytes=4
/// <summary>
///
/// </summary>
public UInt32 Subchunk2Size; // bytes=4
//
// info
//
/// <summary>
///
/// </summary>
public bool IsExtensible;
/// <summary>
///
/// </summary>
public int HeaderSize; // normal WAV = 44 bytes, extensible WAV = 44 + 24 = 68 bytes (without extra chunks)
/// <summary>
///
/// </summary>
public double Duration; // duration in seconds
/// <summary>
///
/// </summary>
public long TotalSamples;
//
// channel types
//
/// <summary>
///
/// </summary>
public static readonly IList<WavChannel> WavChannelTypes = new ReadOnlyCollection<WavChannel>(
new[]
{
@ -67,6 +160,10 @@ namespace WavFile
//
// multi-channel types
//
/// <summary>
///
/// </summary>
public static readonly IList<WavChannel> WavMultiChannelTypes = new ReadOnlyCollection<WavChannel>(
new[]
{
@ -91,9 +188,21 @@ namespace WavFile
});
// WAVEFORMATEXTENSIBLE sub-formats
/// <summary>
///
/// </summary>
public static readonly Guid subTypePCM = new Guid("00000001-0000-0010-8000-00aa00389b71");
/// <summary>
///
/// </summary>
public static readonly Guid subTypeIEEE_FLOAT = new Guid("00000003-0000-0010-8000-00aa00389b71");
/// <summary>
///
/// </summary>
/// <returns></returns>
public override string ToString()
{
return String.Format(