Exemple #1
0
        public void Tick()
        {
            if (!_enabled)
            {
                return;
            }

            for (var i = 0; i < _allModes.Length; i++)
            {
                var abstractSoundMode = _allModes[i];
                var channel           = abstractSoundMode.Tick();
                _channels[i] = channel;
            }

            var selection = _ram.GetByte(0xff25);
            var left      = 0;
            var right     = 0;

            for (var i = 0; i < 4; i++)
            {
                if (!_overridenEnabled[i])
                {
                    continue;
                }

                if ((selection & (1 << i + 4)) != 0)
                {
                    left += _channels[i];
                }

                if ((selection & (1 << i)) != 0)
                {
                    right += _channels[i];
                }
            }

            left  /= 4;
            right /= 4;

            var volumes = _ram.GetByte(0xff24);

            left  *= ((volumes >> 4) & 0b111);
            right *= (volumes & 0b111);

            _output.Play((byte)left, (byte)right);
        }
        public async Task HandleAsync(PlayCommand command)
        {
            Log.Info("Processing PlayCommand");

            var playlistPlayStrategy = _session.PlaylistPlayStrategy;

            var track = playlistPlayStrategy.CurrentTrack;

            await track.Load();

            if (_session.PlayerState != PlayerState.Paused)
            {
                LoadTrack(track);
            }

            _soundOutput.Play();

            _session.PlayerState = PlayerState.Playing;
        }
 private void RetroThreadStarted(object sender, EventArgs e)
 {
     _controllerWrapper.Start();
     _soundOutput.Play();
     Logger.Debug("LibRetroFrontend: Libretro thread running");
 }