Пример #1
0
        /// <summary>
        /// Removes the effect from the Channel and frees allocated memory.
        /// </summary>
        public void Dispose()
        {
            Bass.ChannelRemoveSync(_channel, _hfsync);

            _channel = _effectHandle = 0;

            if (_gch.IsAllocated)
            {
                _gch.Free();
            }
        }
Пример #2
0
        /// <summary>
        /// Applies the Effect on a <see cref="MediaPlayer"/>.
        /// </summary>
        /// <param name="Player">The <see cref="MediaPlayer"/> to apply the Effect on.</param>
        /// <param name="Priority">Priority of the Effect in DSP chain.</param>
        public void ApplyOn(MediaPlayer Player, int Priority = 0)
        {
            ApplyOn(Player.Handle, Priority);

            _mediaPlayer = true;

            Player.MediaLoaded += NewHandle =>
            {
                if (_wasActive)
                {
                    IsActive = false;
                }

                Bass.ChannelRemoveSync(_channel, _hfsync);

                _channel = NewHandle;
                _hfsync  = Bass.ChannelSetSync(NewHandle, SyncFlags.Free, 0, _syncProcedure);

                IsActive = _wasActive;
            };
        }