示例#1
0
        public void AddChannel(SmushChannel c)
        {
            var track = c.TrackIdentifier;

            this.Trace().Write(TraceSwitches.Music, "SmushMixer.AddChannel({0})", track);

            for (var i = 0; i < _channels.Length; i++)
            {
                if (_channels[i].Id == track)
                {
                    this.Trace().Write(TraceSwitches.Music, "SmushMixer.AddChannel({0}): channel already exists", track);
                }
            }

            for (var i = 0; i < _channels.Length; i++)
            {
                if ((_channels[i].Chan == null || _channels[i].Id == -1) && !_mixer.IsSoundHandleActive(_channels[i].Handle))
                {
                    _channels[i].Chan = c;
                    _channels[i].Id   = track;
                    return;
                }
            }

            for (var i = 0; i < _channels.Length; i++)
            {
                this.Trace().Write(TraceSwitches.Music, "channel {0} : {1}({2}, {3})", i, _channels[i].Chan,
                                   _channels[i].Chan != null ? _channels[i].Chan.TrackIdentifier : -1,
                                   _channels[i].Chan == null || _channels[i].Chan.IsTerminated);
            }

            throw new InvalidOperationException(string.Format("SmushMixer::addChannel({0}): no channel available", track));
        }
示例#2
0
        public void AddChannel(SmushChannel c)
        {
            var track = c.TrackIdentifier;

            this.Trace().Write(TraceSwitches.Music, "SmushMixer.AddChannel({0})", track);

            for (var i = 0; i < _channels.Length; i++)
            {
                if (_channels[i].Id == track)
                    this.Trace().Write(TraceSwitches.Music, "SmushMixer.AddChannel({0}): channel already exists", track);
            }

            for (var i = 0; i < _channels.Length; i++)
            {
                if ((_channels[i].Chan == null || _channels[i].Id == -1) && !_mixer.IsSoundHandleActive(_channels[i].Handle))
                {
                    _channels[i].Chan = c;
                    _channels[i].Id = track;
                    return;
                }
            }

            for (var i = 0; i < _channels.Length; i++)
            {
                this.Trace().Write(TraceSwitches.Music, "channel {0} : {1}({2}, {3})", i, _channels[i].Chan,
                    _channels[i].Chan != null ? _channels[i].Chan.TrackIdentifier : -1,
                    _channels[i].Chan == null || _channels[i].Chan.IsTerminated);
            }

            throw new InvalidOperationException(string.Format("SmushMixer::addChannel({0}): no channel available", track));
        }