public StartScreen() { InitializeComponent(); mp3Player = new MP3Player(); mp3Path = null; sp = new SoundPlayer(Resources.Initial_song); sp.PlayLooping(); }
public Settings(MP3Player mp3,string mp3Path,SoundPlayer sb,Font font,int timerGame,Boolean isPlaying) { InitializeComponent(); mp3Player = mp3; path = mp3Path; initialPlayer = sb; SetMusicFile(mp3Path); defaultFont = font; playing = isPlaying; if (isPlaying == false) cbMusicOnOff.Checked = false; setTimer(timerGame); // By the default set the volume to 0 uint CurrVol = 0; // At this point, CurrVol gets assigned the volume waveOutGetVolume(IntPtr.Zero, out CurrVol); // Calculate the volume ushort CalcVol = (ushort)(CurrVol & 0x0000ffff); // Get the volume on a scale of 1 to 10 (to fit the trackbar) tbarVolume.Value = CalcVol / (ushort.MaxValue / 10); }
private void myButton3_Click(object sender, EventArgs e) { //Settings Settings settings = new Settings(mp3Player,mp3Path,sp,font,TIMER_GAME,isPlaying); DialogResult settingsResult = settings.ShowDialog(); if (settingsResult == System.Windows.Forms.DialogResult.Cancel) { isPlaying = settings.playing; TIMER_GAME = settings.timer; mp3Player = settings.mp3Player; mp3Path = settings.path; } }