예제 #1
0
        public virtual void ApplyVolume(float VolumeMax)
        {
            _MaxVolume = VolumeMax;

            foreach (int stream in _streams)
            {
                CSound.SetStreamVolumeMax(stream, _MaxVolume);
            }
        }
예제 #2
0
        protected void SelectSong(int nr)
        {
            if (CSongs.Category >= 0 && (CSongs.NumVisibleSongs > 0) && (nr >= 0) && ((_actsong != nr) || (_streams.Count == 0)))
            {
                foreach (int stream in _streams)
                {
                    CSound.FadeAndStop(stream, 0f, 1f);
                }
                _streams.Clear();

                CVideo.VdClose(_video);
                _video = -1;

                CDraw.RemoveTexture(ref _vidtex);

                _actsong = nr;
                if (_actsong >= CSongs.NumVisibleSongs)
                {
                    _actsong = 0;
                }


                int _stream = CSound.Load(Path.Combine(CSongs.VisibleSongs[_actsong].Folder, CSongs.VisibleSongs[_actsong].MP3FileName), true);
                CSound.SetStreamVolumeMax(_stream, _MaxVolume);
                CSound.SetStreamVolume(_stream, 0f);

                float startposition = CSongs.VisibleSongs[_actsong].PreviewStart;

                if (startposition == 0f)
                {
                    startposition = CSound.GetLength(_stream) / 4f;
                }

                CSound.SetPosition(_stream, startposition);
                CSound.Play(_stream);
                CSound.Fade(_stream, 100f, 3f);
                _streams.Add(_stream);
                _actsongstream = _stream;

                if (CSongs.VisibleSongs[_actsong].VideoFileName != String.Empty && CConfig.VideoPreview == EOffOn.TR_CONFIG_ON)
                {
                    _video = CVideo.VdLoad(Path.Combine(CSongs.VisibleSongs[_actsong].Folder, CSongs.VisibleSongs[_actsong].VideoFileName));
                    if (_video == -1)
                    {
                        return;
                    }
                    CVideo.VdSkip(_video, startposition, CSongs.VisibleSongs[_actsong].VideoGap);
                    _VideoFadeTimer.Stop();
                    _VideoFadeTimer.Reset();
                    _VideoFadeTimer.Start();
                }
            }
        }