public virtual void Process(AudioBuffer input) { var processed = Process1(input); while (buffer.Count >= bufferSize) { buffer.Dequeue(); } buffer.Enqueue(processed); onInsert.Invoke(buffer); onProcessed.Invoke(processed); }
private void DoPlan(long dotime) { #region ObjectLock if (planDoTime == -1) { lock (planObjectLock) { if (planDoTime == -1) { planDoTime = dotime; } } } #endregion if (planDoTime == dotime) { try { GetData(); // 当前订单不在缓存中 robotSession.CheckLostOrders(currentOrder); //遍历缓存订单对比当前订单,处理成交订单 if (filledOrders.Count != 0) { UpdateFilledSessionOrders(); robotSession.FilledSessionOrders(FilledSessionOrders, currentOrder); } if (CheckLittleTrade(info.ResetTimes, info.ShockTimes)) { CurrentEvent?.Invoke(null, new CurrentEventArgs(CurrentEventType.LittleTrade, null, null)); } LimitFilledSessionOrders(); } #region catch finally catch (Exception e) { ////DbHelper.CreateInstance().AddErrInfo("DoPlan", e); Log4NetUtility.Error("DoPlan", Utils.Exception2String(e)); DbHelper.CreateInstance().AddError("DoPlan", e); } finally { planDoTime = -1; } #endregion } }
protected virtual void OnCurrentEvent(string current) { CurrentEvent?.Invoke(this, current); }