예제 #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)));
 }