[]
Represents a sound object, which is a stream containing sample values that define a sound to be played through the computer's speakers.
public class SoundObject : PdfDictWrapper, IPdfDict
Initializes a new instance of the SoundObject class.
public SoundObject()
Gets or sets the number of bits per sample value per channel.
public int BitsPerSample { get; set; }
Gets or sets the encoding format for the sample data, see SoundEncodingFormat.
public IPdfName EncodingFormat { get; set; }
Gets or sets the sampling rate, in samples per second.
public float SamplingRate { get; set; }
Gets or sets the number of sound channels.
public int SoundChannels { get; set; }
Creates a SoundObject from a specified file.
Note that only a limited set of audio formats is supported, see AudioFormat for details.
public static SoundObject FromFile(string fileName, AudioFormat audioFormat = AudioFormat.Auto)
fileName
stringThe file with the audio.
audioFormat
AudioFormatThe audio format.
The created SoundObject.
Creates a SoundObject from a specified stream.
Note that only a limited set of audio formats is supported, see AudioFormat for details.
public static SoundObject FromStream(Stream stream, AudioFormat audioFormat = AudioFormat.Auto)
stream
System.IO.StreamThe stream with audio data.
audioFormat
AudioFormatThe audio format.
The created SoundObject.
Gets a System.IO.Stream object containing the audio data.
IMPORTANT: that the stream should be disposed after usage.
public Stream GetAudioDataStream()
The System.IO.Stream containing audio data, should be disposed after usage.
Sets the audio data stream.
IMPORTANT: the stream will be read when the document is saved, so it should be available at that time.
public void SetAudioDataStream(Stream stream)
stream
System.IO.StreamThe System.IO.Stream containing audio data.