API reference
API reference
Select your platform
No SDKs available
No versions available

MpegFile Class

Extends IDisposable

Constructors

MpegFile ( fileName )
Construct Mpeg file representation from filename.
Signature
Meta.Audio.NLayer.MpegFile.MpegFile(string fileName)
Parameters
fileName: string  The file which contains Mpeg data.
MpegFile ( stream )
Construct Mpeg file representation from stream.
Signature
Meta.Audio.NLayer.MpegFile.MpegFile(System.IO.Stream stream)
Parameters
stream: System.IO.Stream  The input stream which contains Mpeg data.

Properties

CanSeek : bool
[Get]
Whether the Mpeg stream supports seek operation.
Signature
bool Meta.Audio.NLayer.MpegFile.CanSeek
Channels : int
[Get]
Channel count of source Mpeg.
Signature
int Meta.Audio.NLayer.MpegFile.Channels
Duration : TimeSpan
[Get]
Media duration of the Mpeg file.
Signature
TimeSpan Meta.Audio.NLayer.MpegFile.Duration
Length : long
[Get]
Data length of decoded data, in PCM.
Signature
long Meta.Audio.NLayer.MpegFile.Length
Position : long
[Get][Set]
Current decode position, in number of sample. Calling the setter will result in a seeking operation.
Signature
long Meta.Audio.NLayer.MpegFile.Position
SampleRate : int
[Get]
Sample rate of source Mpeg, in Hertz.
Signature
int Meta.Audio.NLayer.MpegFile.SampleRate
StereoMode : StereoMode
[Get][Set]
Stereo mode used in decoding.
Signature
StereoMode Meta.Audio.NLayer.MpegFile.StereoMode
Time : TimeSpan
[Get][Set]
Current decode position, represented by time. Calling the setter will result in a seeking operation.
Signature
TimeSpan Meta.Audio.NLayer.MpegFile.Time

Methods

Dispose ()
Implements IDisposable.Dispose.
Signature
void Meta.Audio.NLayer.MpegFile.Dispose()
Returns
void
ReadSamples ( buffer , index , count )
Read specified samples into provided buffer. Do exactly the same as ReadSamples(float[], int, int) except that the data is written in type of byte, while still representing single-precision float (in local endian).
Signature
int Meta.Audio.NLayer.MpegFile.ReadSamples(byte[] buffer, int index, int count)
Parameters
buffer: byte []  Buffer to write. Floating point data will be actually written into this byte array.
index: int  Writing offset on the destination buffer.
count: int  Length of samples to be read, in bytes.
Returns
int  Sample size actually reads, in bytes.
ReadSamples ( buffer , index , count )
Read specified samples into provided buffer, as PCM format. Result varies with diffirent StereoMode:
  • For NLayer.StereoMode.Both, sample data on both two channels will occur in turn (left first).
  • For NLayer.StereoMode.LeftOnly and NLayer.StereoMode.RightOnly, only data on specified channel will occur.
  • For NLayer.StereoMode.DownmixToMono, two channels will be down-mixed into single channel.
Signature
int Meta.Audio.NLayer.MpegFile.ReadSamples(float[] buffer, int index, int count)
Parameters
buffer: float []  Buffer to write.
index: int  Writing offset on the destination buffer.
count: int  Count of samples to be read.
Returns
int  Sample count actually reads.
ReadSamplesInt16 ( buffer , index , count )
Signature
int Meta.Audio.NLayer.MpegFile.ReadSamplesInt16(byte[] buffer, int index, int count)
Parameters
buffer: byte []
index: int
count: int
Returns
int
ReadSamplesInt8 ( buffer , index , count )
Signature
int Meta.Audio.NLayer.MpegFile.ReadSamplesInt8(byte[] buffer, int index, int count)
Parameters
buffer: byte []
index: int
count: int
Returns
int
SetEQ ( eq )
Set the equalizer.
Signature
void Meta.Audio.NLayer.MpegFile.SetEQ(float[] eq)
Parameters
eq: float []  The equalizer, represented by an array of 32 adjustments in dB.
Returns
void