NScumm.Scumm.Audio.IMuse.IMuseInternal.Pause C# (CSharp) Method

Pause() public method

public Pause ( bool paused ) : void
paused bool
return void
        public void Pause(bool paused)
        {
            lock (_mutex)
            {
                if (_paused == paused)
                    return;
                int vol = _music_volume;
                if (paused)
                    _music_volume = 0;
                UpdateVolumes();
                _music_volume = (byte)vol;

                // Fix for Bug #817871. The MT-32 apparently fails
                // sometimes to respond to a channel volume message
                // (or only uses it for subsequent note events).
                // The result is hanging notes on pause. Reportedly
                // happens in the original distro, too. To fix that,
                // just send AllNotesOff to the channels.
                if (_midi_native != null && _native_mt32)
                {
                    for (int i = 0; i < 16; ++i)
                        _midi_native.Send((byte)(123 << 8 | 0xB0 | i));
                }

                _paused = paused;
            }
        }