SoundPlayer 构造函数
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
初始化 SoundPlayer 类的新实例。
重载
| 名称 | 说明 |
|---|---|
| SoundPlayer() |
初始化 SoundPlayer 类的新实例。 |
| SoundPlayer(Stream) |
初始化类的新实例 SoundPlayer ,并在指定的 Stream文件中附加.wav文件。 |
| SoundPlayer(String) |
初始化类的新实例 SoundPlayer ,并附加指定的.wav文件。 |
| SoundPlayer(SerializationInfo, StreamingContext) |
已过时.
初始化 SoundPlayer 类的新实例。 |
SoundPlayer()
- Source:
- SoundPlayer.cs
- Source:
- SoundPlayer.cs
- Source:
- SoundPlayer.cs
- Source:
- SoundPlayer.cs
- Source:
- SoundPlayer.cs
- Source:
- SoundPlayer.cs
- Source:
- SoundPlayer.cs
初始化 SoundPlayer 类的新实例。
public:
SoundPlayer();
public SoundPlayer();
Public Sub New ()
注解
此构造函数初始化 SoundPlayer 没有音频源。 在配置音频源路径之前,调用其中一种播放方法时, SoundPlayer 将播放蜂鸣声。
另请参阅
适用于
SoundPlayer(Stream)
- Source:
- SoundPlayer.cs
- Source:
- SoundPlayer.cs
- Source:
- SoundPlayer.cs
- Source:
- SoundPlayer.cs
- Source:
- SoundPlayer.cs
- Source:
- SoundPlayer.cs
- Source:
- SoundPlayer.cs
初始化类的新实例 SoundPlayer ,并在指定的 Stream文件中附加.wav文件。
public:
SoundPlayer(System::IO::Stream ^ stream);
public SoundPlayer(System.IO.Stream? stream);
public SoundPlayer(System.IO.Stream stream);
new System.Media.SoundPlayer : System.IO.Stream -> System.Media.SoundPlayer
Public Sub New (stream As Stream)
参数
注解
Stream传递给stream参数的应是包含Stream.wav文件。 方法ReadStream返回的数据应为.wav文件中的数据。
另请参阅
适用于
SoundPlayer(String)
- Source:
- SoundPlayer.cs
- Source:
- SoundPlayer.cs
- Source:
- SoundPlayer.cs
- Source:
- SoundPlayer.cs
- Source:
- SoundPlayer.cs
- Source:
- SoundPlayer.cs
- Source:
- SoundPlayer.cs
初始化类的新实例 SoundPlayer ,并附加指定的.wav文件。
public:
SoundPlayer(System::String ^ soundLocation);
public SoundPlayer(string soundLocation);
new System.Media.SoundPlayer : string -> System.Media.SoundPlayer
Public Sub New (soundLocation As String)
参数
- soundLocation
- String
要加载.wav文件的位置。
例外
无法解析由其 soundLocation 指定的 URL 值。
注解
传递给参数的 soundLocation 字符串可以是文件路径,也可以是指向.wav文件的 URL。 如果路径或 URL 无效,仍将构造路径 SoundPlayer 或 URL,但对加载或播放方法的后续调用将失败。
另请参阅
适用于
SoundPlayer(SerializationInfo, StreamingContext)
- Source:
- SoundPlayer.cs
- Source:
- SoundPlayer.cs
- Source:
- SoundPlayer.cs
- Source:
- SoundPlayer.cs
- Source:
- SoundPlayer.cs
- Source:
- SoundPlayer.cs
- Source:
- SoundPlayer.cs
注意
This API supports obsolete formatter-based serialization. It should not be called or extended by application code.
初始化 SoundPlayer 类的新实例。
protected:
SoundPlayer(System::Runtime::Serialization::SerializationInfo ^ serializationInfo, System::Runtime::Serialization::StreamingContext context);
[System.Obsolete("This API supports obsolete formatter-based serialization. It should not be called or extended by application code.", DiagnosticId="SYSLIB0051", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
protected SoundPlayer(System.Runtime.Serialization.SerializationInfo serializationInfo, System.Runtime.Serialization.StreamingContext context);
protected SoundPlayer(System.Runtime.Serialization.SerializationInfo serializationInfo, System.Runtime.Serialization.StreamingContext context);
[<System.Obsolete("This API supports obsolete formatter-based serialization. It should not be called or extended by application code.", DiagnosticId="SYSLIB0051", UrlFormat="https://aka.ms/dotnet-warnings/{0}")>]
new System.Media.SoundPlayer : System.Runtime.Serialization.SerializationInfo * System.Runtime.Serialization.StreamingContext -> System.Media.SoundPlayer
new System.Media.SoundPlayer : System.Runtime.Serialization.SerializationInfo * System.Runtime.Serialization.StreamingContext -> System.Media.SoundPlayer
Protected Sub New (serializationInfo As SerializationInfo, context As StreamingContext)
参数
- serializationInfo
- SerializationInfo
SerializationInfo用于反序列化。
- context
- StreamingContext
要用于反序列化的目标。
- 特性
例外
SoundLocation无法解析指定的 inserializationInfo。