protected override void DisposeProcessors() { base.DisposeProcessors(); _mdc = null; _star = null; _rootDecoder = null; }
public void UpdateDecodeMDC1200(bool decode) { if (decode) { if (_mdc == null) { _mdc = new Decoders.MDC1200(_outFormat.SampleRate, ProcessMDC1200, _sourceName); } } else { _mdc = null; } }
public ProcessorWaveProvider(string sourceName, IWaveProvider sourceWaveProvider, string waveFilePath, WaveFormat outFormat, Common.ProcessRadioSignalingItemDelegate sigDelegate, Action<bool> hasPropertyChanged, bool recordEnabled, Common.SignalRecordingType recordType, int recordKickTime, Common.NoiseFloor noiseFloor, int customNoiseFloor,bool removeNoise, bool decodeMDC1200, bool decodeGEStar, bool decodeFleetSync, bool decodeP25) : base(sourceWaveProvider, waveFilePath) { LastValidStreamTitle = string.Empty; _sourceName = sourceName; _sourceFormat = sourceWaveProvider.WaveFormat; _outFormat = outFormat; _hasPropertyChanged = hasPropertyChanged; _silenceHelper = new SilenceHelper(outFormat.AverageBytesPerSecond / (outFormat.BitsPerSample / 8), noiseFloor, removeNoise, customNoiseFloor); if (outFormat.Equals(sourceWaveProvider.WaveFormat)) { _resampleStream = null; _useResampler = false; } else { if (Common.AppSettings.Instance.DiagnosticMode) { Common.ConsoleHelper.ColorWriteLine(ConsoleColor.Magenta, "{0}: Source Format <> Out Format [{1}] <> [{2}]", sourceName, sourceWaveProvider.WaveFormat, outFormat); } _resampleStream = new NAudio.Wave.Compression.AcmStream(sourceWaveProvider.WaveFormat, outFormat); _useResampler = true; } if (decodeMDC1200) { _mdc = new Decoders.MDC1200(outFormat.SampleRate, ProcessMDC1200, sourceName); } else { _mdc = null; } if (decodeGEStar) { _star = new Decoders.STAR(outFormat.SampleRate, ProcessSTAR, Decoders.STAR.star_format.star_format_1_16383, sourceName); } else { _star = null; } _rootDecoder = new Decoders.RootDecoder(outFormat.SampleRate, decodeFleetSync, decodeP25, ProcessRootDecoder); _recorder = new AudioRecorder(sourceName, recordType, recordKickTime, outFormat, AudioProcessingGlobals.DefaultSaveFileWaveFormat, recordEnabled); _bytesPerSample = outFormat.BitsPerSample / 8; _encoding = outFormat.Encoding; _sigDelegate = sigDelegate; }
public ProcessorWaveProvider(string sourceName, IWaveProvider sourceWaveProvider, string waveFilePath, WaveFormat outFormat, Common.ProcessRadioSignalingItemDelegate sigDelegate, Action <bool> hasPropertyChanged, bool recordEnabled, Common.SignalRecordingType recordType, int recordKickTime, Common.NoiseFloor noiseFloor, int customNoiseFloor, bool removeNoise, bool decodeMDC1200, bool decodeGEStar, bool decodeFleetSync, bool decodeP25) : base(sourceWaveProvider, waveFilePath) { LastValidStreamTitle = string.Empty; _sourceName = sourceName; _sourceFormat = sourceWaveProvider.WaveFormat; _outFormat = outFormat; _hasPropertyChanged = hasPropertyChanged; _silenceHelper = new SilenceHelper(outFormat.AverageBytesPerSecond / (outFormat.BitsPerSample / 8), noiseFloor, removeNoise, customNoiseFloor); if (outFormat.Equals(sourceWaveProvider.WaveFormat)) { _resampleStream = null; _useResampler = false; } else { if (Common.AppSettings.Instance.DiagnosticMode) { Common.ConsoleHelper.ColorWriteLine(ConsoleColor.Magenta, "{0}: Source Format <> Out Format [{1}] <> [{2}]", sourceName, sourceWaveProvider.WaveFormat, outFormat); } _resampleStream = new NAudio.Wave.Compression.AcmStream(sourceWaveProvider.WaveFormat, outFormat); _useResampler = true; } if (decodeMDC1200) { _mdc = new Decoders.MDC1200(outFormat.SampleRate, ProcessMDC1200, sourceName); } else { _mdc = null; } if (decodeGEStar) { _star = new Decoders.STAR(outFormat.SampleRate, ProcessSTAR, Decoders.STAR.star_format.star_format_1_16383, sourceName); } else { _star = null; } _rootDecoder = new Decoders.RootDecoder(outFormat.SampleRate, decodeFleetSync, decodeP25, ProcessRootDecoder); _recorder = new AudioRecorder(sourceName, recordType, recordKickTime, outFormat, AudioProcessingGlobals.DefaultSaveFileWaveFormat, recordEnabled); _bytesPerSample = outFormat.BitsPerSample / 8; _encoding = outFormat.Encoding; _sigDelegate = sigDelegate; }
private void ProcessMDC1200(Decoders.MDC1200 decoder, RadioLog.Common.SignalCode sigCode, int frameCount, byte op, byte arg, ushort unitID, byte extra0, byte extra1, byte extra2, byte extra3, string opMsg) { Common.ConsoleHelper.ColorWriteLine(ConsoleColor.Magenta, "MDC: {0} on stream {1}", opMsg, _sourceName); _silenceHelper.ClearSilenceStats(); if (_sigDelegate != null) { string desc = opMsg; if (!string.IsNullOrWhiteSpace(LastValidStreamTitle)) { desc += ", Stream Title=" + LastValidStreamTitle; } RadioLog.Common.RadioSignalingItem sigItem = new Common.RadioSignalingItem(Common.SignalingSourceType.Streaming, _sourceName, RadioLog.Common.SignalingNames.MDC, sigCode, string.Format("{0:X4}", unitID), desc, DateTime.Now, _recorder.CurrentFileName); _sigDelegate(sigItem); } }