/// <summary> /// <para>Sets the significant frequency in Hz for the specified <see cref="Band" />.</para> /// <para>Cutoff if [low/high pass, low/high shelf] <see cref="Filter" />.</para> /// <para>Center if [notch, peaking, band-pass] <see cref="Filter" />.</para> /// <para>Phase transition point if [all-pass] <see cref="Filter" />.</para> /// <para><c>0.0</c> to <c>22000.0</c>. Default = <c>8000.0</c>.</para> /// </summary> /// <param name="band">The band to set frquency of.</param> /// <param name="frequency">The frequency.</param> public void SetFrequency(Band band, float frequency) { var index = (int)band * 4 + 1; var clamped = frequency.Clamp(20.0f, 22000.0f); SetParameterFloat(index, clamped); FrequencyChanged?.Invoke(this, new MultiBandEqEventArgs(index, band, clamped, 20.0f, 22000.0f)); }
private void FireFrequencyChanged() { _inputViaTyping = false; //reset if (FrequencyChanged != null) { FrequencyChanged.Invoke(this, new EventArgs()); } }
private void PollRig() { while (true) { long hz1 = ReadFrequencyFromRig(Vfo.A); if (hz1 != 0) { if (hz1 != 0) { FrequencyChanged?.Invoke(null, new FrequencyEventArgs { Frequency = hz1, Vfo = Vfo.A }); } if (freqHzA != hz1) { freqHzA = hz1; } } long hz2 = ReadFrequencyFromRig(Vfo.B); if (hz2 != 0) { if (hz2 != 0) { FrequencyChanged?.Invoke(null, new FrequencyEventArgs { Frequency = hz2, Vfo = Vfo.B }); } if (freqHzB != hz2) { freqHzB = hz2; } } rigStatusCallback?.Invoke(new RigStatus { VfoA = new VfoStatus { Frequency = hz1 }, VfoB = new VfoStatus { Frequency = hz2 }, }); Thread.Sleep(rigPollInterval); } }
private void OnFrequencyChanged() { numFrequency.Value = _frequency; if (_form != null) { _form.Frequency = _frequency; } if (!_fireEvent) { return; } if (FrequencyChanged != null) { FrequencyChanged.Invoke(this, null); } }
void SetupConnection(eConnType type, IPAddress addr, int port) { CloseConnection(); switch (type) { case eConnType.UdpClient: Endpoint = new IPEndPoint(addr, port); ReceiveSocket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp); ReceiveSocket.Bind(Endpoint); ReceiveSocket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReceiveTimeout, 5); break; case eConnType.TcpClient: Endpoint = new IPEndPoint(addr, port); ReceiveSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); ReceiveSocket.Connect(Endpoint); break; case eConnType.RtsaClient: RtsaIO = new RtsaHttpIO(); RtsaIO.FrequencyChanged += (s, e) => { _Frequency = (long)RtsaIO.Frequency; FrequencyChanged?.Invoke(this, null); }; RtsaIO.SamplingRateChanged += (s, e) => { NetShmemSink.Rate = (long)RtsaIO.SamplingRate; }; RtsaIO.ConnectInput(addr, port); _SampleSource.DataFormat = RtsaIO.SampleFormat; break; case eConnType.TcpServer: Endpoint = new IPEndPoint(addr, port); ServerSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); ServerSocket.Bind(Endpoint); ServerSocket.Listen(1); ServerSocket.BeginAccept(new AsyncCallback(AcceptConnection), ServerSocket); break; } ConnectionType = type; StopTransfers = false; TransferThread = new Thread(TransferThreadMain); TransferThread.Start(); DeviceOpened?.Invoke(this, EventArgs.Empty); }
/// <summary> /// Raises the <see cref="FrequencyChanged" /> event. /// </summary> /// <seealso cref="EventArgs" /> protected virtual void OnFrequencyChanged() { FrequencyChanged?.Invoke(this, EventArgs.Empty); }