示例#1
0
 public int BytesToSamples(AudioFormat format, int bytes)
 {
     return(bytes / (format.Size >> 3));
 }
示例#2
0
 public int SamplesToBytes(AudioFormat format, int samples)
 {
     return(samples * (format.Size >> 3));
 }
示例#3
0
 public int BytesToFrames(AudioFormat format, int bytes)
 {
     return(bytes / (format.Components.Length * format.Size >> 3));
 }
示例#4
0
 public int FramesToBytes(AudioFormat format, int samples)
 {
     return(samples * (format.Components.Length * format.Size >> 3));
 }
示例#5
0
 /// <summary>
 /// Constructs a new AudioFormat which is a derivative of the given AudioFormat with a different byte order.
 /// </summary>
 /// <param name="format">The existing AudioFormat</param>
 /// <param name="newByteOrder">The new byte order</param>
 public AudioFormat(AudioFormat format, Common.Binary.ByteOrder newByteOrder)
     : this(format.SampleRate, format.IsSigned, format.ByteOrder, format.DataLayout)
 {
 }
示例#6
0
 public static int CalculateFrameSize(AudioFormat format)
 {
     return(format.Size >> 3 * format.Components.Length);
 }
示例#7
0
 /// <summary>
 /// Constructs a new AudioFormat which is a derivative of the given AudioFormat with a different sample rate.
 /// </summary>
 /// <param name="format">The existing AudioFormat</param>
 /// <param name="newSampleRate">The new sampleRate</param>
 public AudioFormat(AudioFormat format, int newSampleRate)
     : this(newSampleRate, format.IsSigned, format.ByteOrder, format.DataLayout)
 {
 }
示例#8
0
 /// <summary>
 /// Clones an AudioFormat
 /// </summary>
 /// <param name="format">The AudioFormat to clone</param>
 internal protected AudioFormat(AudioFormat format)
     : this(format.SampleRate, format.IsSigned, format.ByteOrder, format.DataLayout)
 {
 }
示例#9
0
 public static AudioFormat SemiPlanar(AudioFormat other)
 {
     return(new AudioFormat(Codec.MediaFormat.SemiPlanar(other)));
     //return new ImageFormat(other.ByteOrder, Codec.DataLayout.SemiPlanar, other.Components);
 }
示例#10
0
 public static AudioFormat Planar(AudioFormat other)
 {
     return(new AudioFormat(Codec.MediaFormat.Planar(other)));
 }
示例#11
0
 public static AudioFormat Packed(AudioFormat other)
 {
     return(new AudioFormat(Codec.MediaFormat.Packed(other)));
 }