-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathWriterConfig.cs
More file actions
97 lines (83 loc) · 2.5 KB
/
WriterConfig.cs
File metadata and controls
97 lines (83 loc) · 2.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
//
//
// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
// KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
// PURPOSE. IT CAN BE DISTRIBUTED FREE OF CHARGE AS LONG AS THIS HEADER
// REMAINS UNCHANGED.
//
// Email: yetiicb@hotmail.com
//
// Copyright (C) 2002-2003 Idael Cardoso.
//
using System;
using System.Runtime.Serialization;
using System.Windows.Forms;
using WaveLib;
namespace Yeti.MMedia
{
/// <summary>
///
/// </summary>
[Serializable]
public class AudioWriterConfig : ISerializable
{
protected WaveFormat m_Format;
/// <summary>
/// A constructor with this signature must be implemented by descendants.
/// <see cref="System.Runtime.Serialization.ISerializable"/> for more information
/// </summary>
/// <param name="info">The <see cref="System.Runtime.Serialization.SerializationInfo"/> where is the serialized data.</param>
/// <param name="context">The source (see <see cref="System.Runtime.Serialization.StreamingContext"/>) for this serialization.</param>
protected AudioWriterConfig(SerializationInfo info, StreamingContext context)
{
int rate = info.GetInt32("Format.Rate");
int bits = info.GetInt32("Format.Bits");
int channels = info.GetInt32("Format.Channels");
m_Format = new WaveFormat(rate, bits, channels);
}
public AudioWriterConfig(WaveFormat f)
{
m_Format = new WaveFormat(f.nSamplesPerSec, f.wBitsPerSample, f.nChannels);
}
public AudioWriterConfig()
:this(new WaveFormat(44100, 16, 2))
{
}
public WaveFormat Format
{
get
{
return m_Format;
}
set
{
m_Format = value;
}
}
#region ISerializable Members
public virtual void GetObjectData(SerializationInfo info, StreamingContext context)
{
info.AddValue("Format.Rate", m_Format.nSamplesPerSec);
info.AddValue("Format.Bits", m_Format.wBitsPerSample);
info.AddValue("Format.Channels", m_Format.nChannels);
}
#endregion
}
public interface IConfigControl
{
void DoApply();
void DoSetInitialValues();
Control ConfigControl { get; }
string ControlName { get; }
event EventHandler ConfigChange;
}
public interface IEditAudioWriterConfig : IConfigControl
{
AudioWriterConfig Config { get; set; }
}
public interface IEditFormat : IConfigControl
{
WaveFormat Format { get; set; }
}
}