NScumm.Core.Audio.PCSpeakerDriver.Open C# (CSharp) Method

Open() public method

public Open ( ) : MidiDriverError
return MidiDriverError
        public override MidiDriverError Open()
        {
            if (IsOpen)
                return MidiDriverError.AlreadyOpen;

            base.Open();

            for (var i = 0; i < _channels.Length; ++i)
                _channels[i].Init(this, i);
            _activeChannel = null;
            _effectTimer = 0;
            _randBase = 1;

            // We need to take care we only send note frequencies, when the internal
            // settings actually changed, thus we need some extra state to keep track
            // of that.
            _lastActiveChannel = null;
            _lastActiveOut = 0;

            // We set the output sound type to music here to allow sound volume
            // adjustment. The drawback here is that we can not control the music and
            // sfx separately here. But the AdLib output has the same issue so it
            // should not be that bad.
            _mixerSoundHandle = _mixer.PlayStream(SoundType.Music, this, -1, Mixer.MaxChannelVolume, 0, false, true);
            return 0;
        }