private void PlayFile() { if (_TestMusic == -1) { _TestMusic = CSound.Load(Path.Combine(Environment.CurrentDirectory, "Test.mp3")); } CSound.Play(_TestMusic); CSound.Fade(_TestMusic, 100f, 2f); }
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(); } } }
protected override void OnUpdate(GameTime time) { base.OnUpdate(time); if (delay < initialDelay && !loaded) { img.load(content); snd.Load(content); loaded = true; } delay -= time.ElapsedGameTime.TotalMilliseconds; if (delay < 0) { IsFinished = true; } }
private void LoadNextSong() { CGame.NextRound(); if (CGame.IsFinished()) { CGraphics.FadeTo(EScreens.ScreenScore); _FadeOut = true; return; } CSong song = CGame.GetSong(); if (song == null) { CLog.LogError("Critical Error! ScreenSing.LoadNextSong() song is null!"); return; } CloseSong(); if (!song.CoverSmallLoaded) { song.ReadNotes(); } string songname = song.Artist + " - " + song.Title; int rounds = CGame.GetNumSongs(); if (rounds > 1) { songname += " (" + CGame.RoundNr + "/" + rounds.ToString() + ")"; } Texts[htTexts(TextSongName)].Text = songname; _CurrentStream = CSound.Load(song.GetMP3(), true); CSound.SetStreamVolume(_CurrentStream, _Volume); CSound.SetPosition(_CurrentStream, song.Start); _CurrentTime = song.Start; _FinishTime = song.Finish; _TimeToFirstNote = 0f; _TimeToFirstNoteDuet = 0f; CGame.ResetPlayer(); CDraw.RemoveTexture(ref _CurrentVideoTexture); if (song.VideoFileName != String.Empty) { _CurrentVideo = CVideo.VdLoad(Path.Combine(song.Folder, song.VideoFileName)); CVideo.VdSkip(_CurrentVideo, song.Start, song.VideoGap); _VideoAspect = song.VideoAspect; } CDraw.RemoveTexture(ref _Background); if (song.BackgroundFileName != String.Empty) { _Background = CDraw.AddTexture(Path.Combine(song.Folder, song.BackgroundFileName)); } SingNotes[htSingNotes(SingBars)].Reset(); bool LyricsOnTop = CGame.NumPlayer == 2 && CConfig.LyricsOnTop == EOffOn.TR_CONFIG_ON; if (song.IsDuet) { CGame.Player[1].LineNr = 1; Statics[htStatics(StaticLyricsDuet)].Visible = true; Lyrics[htLyrics(LyricMainDuet)].Visible = true; Lyrics[htLyrics(LyricSubDuet)].Visible = true; Lyrics[htLyrics(LyricMainTop)].Visible = false; Lyrics[htLyrics(LyricSubTop)].Visible = false; Statics[htStatics(StaticLyricsTop)].Visible = false; } else { Statics[htStatics(StaticLyricsDuet)].Visible = false; Lyrics[htLyrics(LyricMainDuet)].Visible = false; Lyrics[htLyrics(LyricSubDuet)].Visible = false; Lyrics[htLyrics(LyricMainTop)].Visible = LyricsOnTop; Lyrics[htLyrics(LyricSubTop)].Visible = LyricsOnTop; Statics[htStatics(StaticLyricsTop)].Visible = LyricsOnTop; } for (int p = 0; p < CGame.NumPlayer; p++) { NoteLines[p] = SingNotes[htSingNotes(SingBars)].AddPlayer( SingNotes[htSingNotes(SingBars)].BarPos[p, CGame.NumPlayer - 1], CTheme.GetPlayerColor(p + 1), p); } /* * case 4: * NoteLines[0] = SingNotes[htSingNotes(SingBars)].AddPlayer(new SRectF(35f, 100f, 590f, 200f, -0.5f), CTheme.ThemeColors.Player[0]); * NoteLines[1] = SingNotes[htSingNotes(SingBars)].AddPlayer(new SRectF(35f, 350f, 590f, 200f, -0.5f), CTheme.ThemeColors.Player[1]); * NoteLines[2] = SingNotes[htSingNotes(SingBars)].AddPlayer(new SRectF(640f, 100f, 590f, 200f, -0.5f), CTheme.ThemeColors.Player[2]); * NoteLines[3] = SingNotes[htSingNotes(SingBars)].AddPlayer(new SRectF(640f, 350f, 590f, 200f, -0.5f), CTheme.ThemeColors.Player[3]); * break; */ _TimerSongText.Stop(); _TimerSongText.Reset(); if (song.Notes.Lines.Length != 2) { _TimerSongText.Start(); } StartSong(); }