void PlaylistItemStarted(Container cSender, Effect cEffect) { PlaylistItem cPLI = null; lock (_aPlaylistItems) { if (null != (cPLI = _aPlaylistItems.FirstOrDefault(o => o.nAtomHashCode == cEffect.GetHashCode()))) (new Logger()).WriteNotice("effect started: [" + cPLI.sFilename + "]"); if (0 < _aPlaylistItems.Count) { PlaylistItem cPLIPrevious = null; foreach (PlaylistItem cPlaylistItem in _aPlaylistItems) { if (cPlaylistItem.nAtomHashCode == cEffect.GetHashCode()) { DateTime dtNow = DateTime.Now; cPlaylistItem.dtStartReal = dtNow.AddSeconds(IW.Preferences.nQueuesCompensation); Player.dtPlaylistStopPlanned = dtPlaylistStopPlanned; if (null != cPLIPrevious) cPLIPrevious.dtStopReal = cPlaylistItem.dtStartReal; if (cPlaylistItem._eType == PlaylistItem.PLIType.Clip && null != cPlaylistItem._cClipSCR) { sCurrentClass = cPlaylistItem._cClipSCR.sClassName; tClipStop.Stop(); AutomationWrite(cPlaylistItem._cClipSCR.nID + ", clip, started"); sClipStop = cPlaylistItem._cClipSCR.nID + ", clip, stopped"; tClipStop.Interval = (cPlaylistItem._cClipSCR.nFramesQty - IW.Preferences.nStopOffset) * IW.Preferences.nFrameDuration_ms; tClipStop.Start(); } else if (cPlaylistItem._eType == PlaylistItem.PLIType.AdvBlockItem && null != cPlaylistItem._cAdvertSCR) sCurrentClass = cPlaylistItem._cAdvertSCR.sClassName; return; } cPLIPrevious = cPlaylistItem; } } } throw (new Exception("Template.cs:cPL_PLIPrepared(Effect cEffect):Получен сигнал о старте элемента, которого нет в плейлисте.")); //TODO LANG }
void PlaylistItemStopped(Container cSender, Effect cEffect) { PlaylistItem cPLI = null; string sMessage = null; DateTime dtDuration; lock (_aPlaylistItems) { if (null != (cPLI = _aPlaylistItems.FirstOrDefault(o => o.nAtomHashCode == cEffect.GetHashCode()))) (new Logger()).WriteNotice("effect stopped: [" + cPLI.sFilename + "]"); if (0 < _aPlaylistItems.Count) { int ni = 0; foreach (PlaylistItem cPlaylistItem in _aPlaylistItems) { if (cPlaylistItem.nAtomHashCode == cEffect.GetHashCode()) { if (_aPlaylistItems.Count - 1 == _aPlaylistItems.IndexOf(cPlaylistItem)) { sCurrentClass = null; //Player.dtPlaylistStopPlanned = DateTime.MinValue; } if (cPlaylistItem.dtStopReal == DateTime.MinValue) { cPlaylistItem.dtStopReal = DateTime.Now.AddSeconds(IW.Preferences.nQueuesCompensation); for (int nj = ni + 1; _aPlaylistItems.Count > nj; nj++) if (nj == ni + 1) _aPlaylistItems[nj].dtStartReal = cPlaylistItem.dtStopReal; //else //_aPlaylistItems[nj].dtStartReal = _aPlaylistItems[nj - 1].dtStartReal + new TimeSpan(0, 0, 0, (int)(_aPlaylistItems[nj - 1]._nFramesQty * 40)); //FPS } if (cPlaylistItem._eType == PlaylistItem.PLIType.Clip && null != cPlaylistItem._cClipSCR) { AutomationWrite(cPlaylistItem._cClipSCR.nID + ", clip, stopped"); dtDuration = cPlaylistItem.dtStopReal.AddTicks(-cPlaylistItem.dtStartReal.Ticks); sMessage = cPlaylistItem.dtStartReal + "\t" + cPlaylistItem._cClipSCR.sArtist + "\t" + cPlaylistItem._cClipSCR.sSong + "\t" + cPlaylistItem._nFramesQty.ToFramesString(false, false, false, false, true) + "\t" + dtDuration.ToString("HH:mm:ss"); // yyyy.MM.dd hh:mm:ss lock (_cSyncRoot) sMessage += "\t" + sPreset; } if (cPlaylistItem._eType == PlaylistItem.PLIType.AdvBlockItem && null != cPlaylistItem._cAdvertSCR) _aAdvertsStoppedPLIsIDs.Add(cPlaylistItem._cAdvertSCR.nPlaylistID); if (null == sMessage) { dtDuration = cPlaylistItem.dtStopReal.AddTicks(-cPlaylistItem.dtStartReal.Ticks); sMessage = cPlaylistItem.dtStartReal + "\t\t\t\t\t" + cPlaylistItem.sName + "\t" + cPlaylistItem._nFramesQty.ToFramesString(false, false, false, false, true) + "\t" + dtDuration.ToString("HH:mm:ss"); } break; } ni++; } } } if (null != sMessage) LogWrite(sMessage); else throw (new Exception("Template.cs:cPL_PLIStopped(Effect cEffect):Получен сигнал об остановке элемента, которого нет в плейлисте.")); //TODO LANG }
void PlaylistItemPrepared(Container cSender, Effect cEffect) { PlaylistItem cPLI = null; lock (_aPlaylistItems) if (null != (cPLI = _aPlaylistItems.FirstOrDefault(o => o.nAtomHashCode == cEffect.GetHashCode()))) (new Logger()).WriteNotice("effect prepared: [" + cPLI.sFilename + "]"); }