예제 #1
0
        protected void PlaySong(Song.Song song)
        {
            if (song == null)
            {
                throw new ArgumentNullException("Song is undefined.");
            }
            else
            {
                if (song.NotesList == null || song.NotesList.Count < 1)
                {
                    throw new ArgumentNullException("Song has no notes.");
                }
                else
                {
                    for (int i = 0; i < song.NotesList.Count; i++)
                    {
                        int    noteLength;
                        String keyBinding = Note.GetKeyBinding(song.NotesList[i]);

                        switch (song.NotesList[i].Length)
                        {
                        case Const.Length.FULL:
                            noteLength = fullNote;
                            break;

                        case Const.Length.HALF:
                            noteLength = halfNote;
                            break;

                        case Const.Length.THIRD:
                            noteLength = thirdNote;
                            break;

                        case Const.Length.QUARTER:
                            noteLength = quarterNote;
                            break;

                        case Const.Length.FIFTH:
                            noteLength = fifthNote;
                            break;

                        case Const.Length.EIGHTH:
                            noteLength = eighthNote;
                            break;

                        default:
                            noteLength = sixteenthNote;
                            break;
                        }

                        SendKeys.SendWait(keyBinding);
                        Thread.Sleep(noteLength);
                    }
                }
            }
        }
예제 #2
0
        static void Main(string[] args)
        {
            Program program = new Program();

            String[]  songLines = program.ReadSongFile(@"C:\Users\1022414\Desktop\song.txt");
            Song.Song song      = Song.Song.Parse(songLines);

            Process process = program.GetFinalFantasyProcess();

            if (process != null)
            {
                program.SetProcessToForeground(process);
                program.PlaySong(song);
            }

            // TODO: Remove debug
            for (int i = 0; i < song.NotesList.Count; i++)
            {
                Console.WriteLine("Note: (" + song.NotesList[i].Pitch + song.NotesList[i].Modifier + song.NotesList[i].Octave + "," + song.NotesList[i].Length + ")");
                Console.WriteLine("Key Binding: " + Note.GetKeyBinding(song.NotesList[i]));
            }
        }