/// <summary> /// Creates a new instance of <see cref="Record"/>. /// </summary> public Record(RecordDevice Device, int Frequency, int Channels, Resolution Resolution = Resolution.Short) { Bass.Init(0); Device.Init(); Bass.CurrentRecordingDevice = Device.Index; _handle = Bass.RecordStart(Frequency, Channels, BassFlags.RecordPause | Resolution.ToBassFlag(), Processing); AudioFormat = WaveFormat.FromChannel(_handle); }
/// <summary> /// Get Device by Index. /// </summary> public static RecordDevice GetByIndex(int Device) { if (Singleton.ContainsKey(Device)) return Singleton[Device]; DeviceInfo info; if (!Bass.RecordGetDeviceInfo(Device, out info)) throw new ArgumentException("Invalid RecordingDevice Index"); var dev = new RecordDevice(Device); Singleton.Add(Device, dev); return dev; }
/// <summary> /// Creates a new instance of <see cref="Record"/> with the Default Format. /// </summary> /// <param name="Device">The <see cref="RecordDevice"/> to use.</param> public Record(RecordDevice Device) : this(Device, 44100, 2) { }
void Ensure() => Current = this;