using System; using System.Collections.Generic; using System.Linq; using System.Runtime.InteropServices; using System.Text; using System.Threading.Tasks; namespace XdCxRhDW.DataEmulation { public static class DataEmulationHelper { private const string dll = @"AddIns\SignalEmulation.dll"; #region cpp dll Interop [DllImport(dll, EntryPoint = "genSignalsWithDtDf", CallingConvention = CallingConvention.Cdecl)] private extern static void GenSignalsWithDtDfCore(string file1, string file2, long fsHz, int sigLenMs, double dt, double df, int snr2, int snr1); //生成噪声,文件,采样率,时长ms,最大幅度 [DllImport(dll, EntryPoint = "genNoizes", CallingConvention = CallingConvention.Cdecl)] private extern static void GenNoizes(string file1, long fsHz, int tlenms, int Am); #endregion /// /// 生成一组常规信号文件 /// /// 输出文件1 /// 输出文件2 /// 采样率Hz /// 信号时长(毫秒) /// 时差秒 /// 频差Hz /// 文件1信噪比 /// 文件2信噪比 public static void GenSignalsFile(string file1, string file2, long fsHz, int sigTimeLenMs, double dt, double df, int snr1, int snr2) { GenSignalsWithDtDfCore(file1, file2, fsHz, sigTimeLenMs, dt, df, snr2, snr1); } /// /// 生成单个噪声文件 /// /// /// /// /// public static void GenNoizesFile(string file1, long fsHz, int timeLenMs, int am) { GenNoizes(file1, fsHz, timeLenMs, am); } } }