Animatroller.MonoExpander.Main.ReportChannelPosition C# (CSharp) Method

ReportChannelPosition() private method

private ReportChannelPosition ( Channel channel, string trackId, AudioTypes audioType, int &lastPos ) : bool
channel Channel
trackId string
audioType AudioTypes
lastPos int
return bool
        private bool ReportChannelPosition(Channel? channel, string trackId, AudioTypes audioType, ref int? lastPos)
        {
            if (channel.HasValue)
            {
                var chn = channel.Value;

                int? pos = (int?)chn.GetPosition(TimeUnit.Milliseconds);

                if (pos == lastPos)
                    return false;

                lastPos = pos;

                if (pos.HasValue)
                {
                    SendMessage(new AudioPositionChanged
                    {
                        Id = trackId,
                        Type = audioType,
                        Position = pos.Value
                    });

                    return true;
                }
            }

            lastPos = null;

            return false;
        }