[]
        
(Showing Draft Content)

GrapeCity.Documents.Pdf.SoundObject

Class SoundObject

Namespace
GrapeCity.Documents.Pdf
Assembly
GcDocs.Pdf.dll

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
Inheritance
SoundObject
Implements
Inherited Members
Extension Methods

Constructors

SoundObject()

Initializes a new instance of the SoundObject class.

public SoundObject()

Properties

BitsPerSample

Gets or sets the number of bits per sample value per channel.

public int BitsPerSample { get; set; }

Property Value

int

EncodingFormat

Gets or sets the encoding format for the sample data, see SoundEncodingFormat.

public IPdfName EncodingFormat { get; set; }

Property Value

IPdfName

SamplingRate

Gets or sets the sampling rate, in samples per second.

public float SamplingRate { get; set; }

Property Value

float

SoundChannels

Gets or sets the number of sound channels.

public int SoundChannels { get; set; }

Property Value

int

Methods

FromFile(string, AudioFormat)

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)

Parameters

fileName string

The file with the audio.

audioFormat AudioFormat

The audio format.

Returns

SoundObject

The created SoundObject.

FromStream(Stream, AudioFormat)

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)

Parameters

stream Stream

The stream with audio data.

audioFormat AudioFormat

The audio format.

Returns

SoundObject

The created SoundObject.

GetAudioDataStream()

Gets a Stream object containing the audio data.

IMPORTANT: that the stream should be disposed after usage.

public Stream GetAudioDataStream()

Returns

Stream

The Stream containing audio data, should be disposed after usage.

SetAudioDataStream(Stream)

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)

Parameters

stream Stream

The Stream containing audio data.