/// <summary> /// Constructor /// </summary> /// <param name="ns">Notescheduler handles all the code for playing music</param> /// <param name="_Keyboard">Keyboard to draw the keyboard</param> /// <param name="_canvas">Canvas needed to draw and fill in the colors</param> public LearnHandler(NoteScheduler ns, List <Key> _Keyboard, System.Windows.Forms.Panel _canvas, MetroButton _learnSongBtn, MetroButton _previewSongBtn, KeyColor _mainKeyColor, MidiFileHandler mfh) { MFH = mfh; noteScheduler = ns; MidiFileDirectory = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().CodeBase), "MidiTextFiles"); keyBoard = _Keyboard; canvas = _canvas; LearnSongBtn = _learnSongBtn; PreviewSongBtn = _previewSongBtn; mainKeyColor = _mainKeyColor; }
private void Form1_Load(object sender, EventArgs e) { //CODE FOR THEME this.StyleManager = metroSMMainForm; this.UpdateTheme(); //CODE FOR LOGO pbLogo.Width = 623 / 4; pbLogo.Height = 252 / 4; //CODE FOR GRAPHICAL PIANO whiteKeySpace *= multiplier; blackKeySpace *= multiplier; CreateKeyboard(); //Initialize instrument-list for (int i = 0; i < 128; i++) { Instrument tempInstrument = (Instrument)i; string listItem = tempInstrument.Name(); cbMetroInstruments.Items.Add(listItem); } cbMetroInstruments.SelectedIndex = 0; //Initialize song-list //TOEDIT MFH = new MidiFileHandler(); songlist = MFH.GetSongNames(); foreach (string name in songlist) { cbMetroSongs.Items.Add(name); } //Initialize Clock for piano clock = new Clock(120); clock.Start(); noteScheduler = new NoteScheduler(clock, outputDevice); learnHandler = new LearnHandler(noteScheduler, keyBoard, canvas, LearnSongBtn, PreviewSongBtn, mainKeyColor, MFH); //Initialize pianokeys pianoKeys = new List <PianoKey>(); for (int i = 0; i < 32; i++) { pianoKeys.Add(new PianoKey(i)); } this.KeyPreview = true; BTButtonPressed = false; lblMetroConnection.BackColor = Color.Red; //Find correct COM port for BT MAC ADDRESS [MAKES APP LOAD SLOWER AT STARTUP!!!] ComPortInitialiser(); }