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 string _shortName;
private readonly WavChannelMask _mask; 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) public WavChannel(string longName, string shortName, WavChannelMask mask)
{ {
_longName = longName; _longName = longName;
_shortName = shortName; _shortName = shortName;
_mask = mask; _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> /// </summary>
public enum WavChannelMask public enum WavChannelMask
{ {
/// <summary>
///
/// </summary>
SPEAKER_FRONT_LEFT = 0x1, SPEAKER_FRONT_LEFT = 0x1,
/// <summary>
///
/// </summary>
SPEAKER_FRONT_RIGHT = 0x2, SPEAKER_FRONT_RIGHT = 0x2,
/// <summary>
///
/// </summary>
SPEAKER_FRONT_CENTER = 0x4, SPEAKER_FRONT_CENTER = 0x4,
/// <summary>
///
/// </summary>
SPEAKER_LOW_FREQUENCY = 0x8, SPEAKER_LOW_FREQUENCY = 0x8,
/// <summary>
///
/// </summary>
SPEAKER_BACK_LEFT = 0x10, SPEAKER_BACK_LEFT = 0x10,
/// <summary>
///
/// </summary>
SPEAKER_BACK_RIGHT = 0x20, SPEAKER_BACK_RIGHT = 0x20,
/// <summary>
///
/// </summary>
SPEAKER_FRONT_LEFT_OF_CENTER = 0x40, SPEAKER_FRONT_LEFT_OF_CENTER = 0x40,
/// <summary>
///
/// </summary>
SPEAKER_FRONT_RIGHT_OF_CENTER = 0x80, SPEAKER_FRONT_RIGHT_OF_CENTER = 0x80,
/// <summary>
///
/// </summary>
SPEAKER_BACK_CENTER = 0x100, SPEAKER_BACK_CENTER = 0x100,
/// <summary>
///
/// </summary>
SPEAKER_SIDE_LEFT = 0x200, SPEAKER_SIDE_LEFT = 0x200,
/// <summary>
///
/// </summary>
SPEAKER_SIDE_RIGHT = 0x400, SPEAKER_SIDE_RIGHT = 0x400,
/// <summary>
///
/// </summary>
SPEAKER_TOP_CENTER = 0x800, SPEAKER_TOP_CENTER = 0x800,
/// <summary>
///
/// </summary>
SPEAKER_TOP_FRONT_LEFT = 0x1000, SPEAKER_TOP_FRONT_LEFT = 0x1000,
/// <summary>
///
/// </summary>
SPEAKER_TOP_FRONT_CENTER = 0x2000, SPEAKER_TOP_FRONT_CENTER = 0x2000,
/// <summary>
///
/// </summary>
SPEAKER_TOP_FRONT_RIGHT = 0x4000, SPEAKER_TOP_FRONT_RIGHT = 0x4000,
/// <summary>
///
/// </summary>
SPEAKER_TOP_BACK_LEFT = 0x8000, SPEAKER_TOP_BACK_LEFT = 0x8000,
/// <summary>
///
/// </summary>
SPEAKER_TOP_BACK_CENTER = 0x10000, SPEAKER_TOP_BACK_CENTER = 0x10000,
/// <summary>
///
/// </summary>
SPEAKER_TOP_BACK_RIGHT = 0x20000 SPEAKER_TOP_BACK_RIGHT = 0x20000
} }
} }

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

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

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

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