Click or drag to resize

Sound Class

Represents a sound for playback from a PDF file.
Inheritance Hierarchy
SystemObject
  Atalasoft.PdfDoc.Generating.MultimediaSound

Namespace:  Atalasoft.PdfDoc.Generating.Multimedia
Assembly:  Atalasoft.PdfDoc (in Atalasoft.PdfDoc.dll) Version: 11.4.0.9.0.377 (.NET 4.5.2, x86)
Syntax
[SerializableAttribute]
public class Sound : IValidatable, ISerializable

The Sound type exposes the following members.

Constructors
  NameDescription
Public methodSound
Initializes a new instance of the Sound class. SamplingRate will default to 22050, Channels to 1, BitsPerSample to 8, EncodingFormat to Raw and a null DataStream.
Protected methodSound(SerializationInfo, StreamingContext)
Initializes a new instance of the Sound class.
Top
Properties
  NameDescription
Public propertyBitsPerSample
Gets or sets the bits per sample. Only 8 is supported.
Public propertyChannels
Gets or sets the number of channels. This should be either 1 or 2.
Public propertyDataStream
Gets or sets the data stream.
Public propertyEncodingFormat
Gets or sets the encoding format.
Public propertySamplingRate
Gets or sets the sampling rate. For maximum compatibility this value is in Hz and should be one of: 8000, 11025, or 22050.
Top
Methods
  NameDescription
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Protected methodFinalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
Public methodStatic memberFromWavReader
Constructs a new Sound from the given IWavReader class.
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodGetObjectData
Populates a SerializationInfo with the data needed to serialize the target object.
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodMakeRepairContext
Makes the repair context for repairing problems in this object. An object implementing IValidatable should at least return an empty RepairContext object.
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Public methodValidate
Validates the specified problems.
Top
Remarks
PDF accepts a wide range of values for sound parameters, but for maximum compatibility, you should limit yourself to with 8kHz, 11.025kHz, or 22.050kHz sampling rates, a multiple of 8 bits of data per sample per channel and either 1 or two channels. Because of these restrictions, it is easier to use pre-existing data that matches that format. WAV is typically the closest and can be handled with the WavReader class.
Examples
Making a sound annotation from an existing file.
FileStream stm = new FileStream("somefile.wav", FileMode.Open);
WavReader reader = new WavReader(stm);
Sound sound = Sound.FromWavReader(reader);
if (sound == null) // returns null if not a widely compatible format.
{
    // incompatible format
    stm.Close();
    throw new Exception("incompatible sound format");
}
See Also