コード例 #1
0
ファイル: MainWindow.xaml.cs プロジェクト: Dpvh/BeatPad
        //click functions, all identical(aside from filepaths), refer to button1 for comments
        private void Button1_Click(object sender, RoutedEventArgs e)
        {
            //assign soundbite to path
            String basePath = System.IO.Path.Combine(Environment.CurrentDirectory, @"audio\");
            String path     = System.IO.Path.Combine(basePath, @"VEC4_Snares_080.mp3");

            Console.WriteLine("Button1 clicked.");
            //this would need to be changed should the keys be remapped
            System.Windows.Input.Key key = Key.Q;
            try
            {
                //play soundbite located at path
                player1.Play(path);
                //check to see that its turning on rather than off
                if (storeNote == true)
                {
                    //create new loopevent object and add to list
                    eventList.Add(new loopEvent(tickCount, key));
                    Console.WriteLine("Added key: " + key + " at " + tickCount);
                }
            }
            catch (Exception exp)
            {
                Console.WriteLine("error: " + exp);
            }
        }
コード例 #2
0
ファイル: MainWindow.xaml.cs プロジェクト: Dpvh/BeatPad
        private void Button16_Click(object sender, RoutedEventArgs e)
        {
            String basePath = System.IO.Path.Combine(Environment.CurrentDirectory, @"audio\");
            String path     = System.IO.Path.Combine(basePath, @"VEC4 Rides 27.mp3");

            Console.WriteLine("Button16 clicked.");
            System.Windows.Input.Key key = Key.L;
            try
            {
                player16.Play(path);
                if (storeNote == true)
                {
                    eventList.Add(new loopEvent(tickCount, key));
                    Console.WriteLine("Added key: " + key + " at " + tickCount);
                }
            }
            catch (Exception exp)
            {
                Console.WriteLine("error: " + exp);
            }
        }