Exemplo n.º 1
0
        public static void Update()
        {
            if (_AllFileNames.Count > 0 && _CurrentMusicStream != -1)
            {
                float timeToPlay;
                if (_CurrentPlaylistElement.Finish == 0f) //No End-Tag defined
                {
                    timeToPlay = CSound.GetLength(_CurrentMusicStream) - CSound.GetPosition(_CurrentMusicStream);
                }
                else //End-Tag found
                {
                    timeToPlay = _CurrentPlaylistElement.Finish - CSound.GetPosition(_CurrentMusicStream);
                }

                bool finished = CSound.IsFinished(_CurrentMusicStream);
                if (_Playing && (timeToPlay <= CSettings.BackgroundMusicFadeTime || finished))
                {
                    if (_RepeatSong)
                    {
                        CSound.SetPosition(_CurrentMusicStream, 0);
                        if (_VideoEnabled && _Video != -1)
                        {
                            CVideo.VdSkip(_Video, 0f, _CurrentPlaylistElement.VideoGap);
                        }
                    }
                    else
                    {
                        Next();
                    }
                }
            }
        }
Exemplo n.º 2
0
        public static int PlaySound(ESounds Sound)
        {
            string file = Path.Combine(Environment.CurrentDirectory, CSettings.sFolderSounds);

            switch (Sound)
            {
            case ESounds.T440:
                file = Path.Combine(file, CSettings.sSoundT440);
                break;

            default:
                break;
            }

            if (file == String.Empty)
            {
                return(-1);
            }

            int   stream = CSound.Load(file);
            float length = CSound.GetLength(stream);

            CSound.Play(stream);
            CSound.FadeAndStop(stream, 100f, length);
            return(stream);
        }
Exemplo n.º 3
0
 public static void Update()
 {
     if (_AllFileNames.Count > 0 && _CurrentMusicStream != -1)
     {
         float timeToPlay = CSound.GetLength(_CurrentMusicStream) - CSound.GetPosition(_CurrentMusicStream);
         bool  finished   = CSound.IsFinished(_CurrentMusicStream);
         if (_Playing && (timeToPlay <= CSettings.BackgroundMusicFadeTime || finished))
         {
             Next();
         }
     }
 }
Exemplo n.º 4
0
 public float GetLength(int soundStream)
 {
     return(CSound.GetLength(soundStream));
 }