public int BytesToSamples(AudioFormat format, int bytes) { return(bytes / (format.Size >> 3)); }
public int SamplesToBytes(AudioFormat format, int samples) { return(samples * (format.Size >> 3)); }
public int BytesToFrames(AudioFormat format, int bytes) { return(bytes / (format.Components.Length * format.Size >> 3)); }
public int FramesToBytes(AudioFormat format, int samples) { return(samples * (format.Components.Length * format.Size >> 3)); }
/// <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) { }
public static int CalculateFrameSize(AudioFormat format) { return(format.Size >> 3 * format.Components.Length); }
/// <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) { }
/// <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) { }
public static AudioFormat SemiPlanar(AudioFormat other) { return(new AudioFormat(Codec.MediaFormat.SemiPlanar(other))); //return new ImageFormat(other.ByteOrder, Codec.DataLayout.SemiPlanar, other.Components); }
public static AudioFormat Planar(AudioFormat other) { return(new AudioFormat(Codec.MediaFormat.Planar(other))); }
public static AudioFormat Packed(AudioFormat other) { return(new AudioFormat(Codec.MediaFormat.Packed(other))); }