private static void CheckOpenParameters(SfFormat format, [AssertionCondition(AssertionConditionType.IS_TRUE)] SfMode mode) { if (format == SfFormat.Empty && mode != SfMode.Read) { throw new ArgumentNullException(nameof(format)); } }
public bool Equals(SfFormat other) { return(Major == other.Major && Subtype == other.Subtype && Endian == other.Endian && Channels == other.Channels && SampleRate == other.SampleRate); }
public static SndFile OpenWrite([NotNull] string path, SfFormat format) { if (path == null) { throw new ArgumentNullException(nameof(path)); } return(Open__(path, format, SfMode.Write)); }
private static unsafe SndFile Open__( SfVirtual @virtual, SfMode mode, IntPtr userData, SfFormat format) { if (@virtual == SfVirtual.Empty) { throw new ArgumentNullException(nameof(@virtual)); } CheckOpenParameters(format, mode); var info = format.ToInfo(); var sndFile = sf_open_virtual(ref @virtual, mode, ref info, userData); return(sndFile == null ? null : new SndFile(sndFile, info)); }
private static unsafe SndFile Open__( [NotNull] string path, SfFormat format, SfMode mode) { if (path == null) { throw new ArgumentNullException(nameof(path)); } CheckOpenParameters(format, mode); var info = format.ToInfo(); var sndFile = sf_wchar_open(path, mode, ref info); return(sndFile == null ? null : new SndFile(sndFile, info)); }
public static bool FormatCheck(SfFormat format) { var info = (SfInfo)format; return(sf_format_check(ref info)); }
public static SndFile OpenWrite(SfVirtual @virtual, SfFormat format, IntPtr userData = default) { return(Open__(@virtual, SfMode.Write, userData, format)); }