コード例 #1
0
        static void Main(string[] args)
        {
            var dynamics = System.Console.ReadLine();

            Piano _piano = new Piano();
            //ピアノを演奏します。
            _piano.Play(dynamics);

            System.Console.ReadLine();
        }
コード例 #2
0
ファイル: PianoTest.cs プロジェクト: GodArthur/Piano-Player
        public void PlayOneNoteTest()
        {
            //There isn't really a feasible way to test whether or not the sampling returned will add up to the same thing for two different piano's
            //so I just made copied over
            Piano testPiano = new Piano("q2we4r5ty7u8i9op-[=zxdcfvgbnjmk,.;/' ", 44100);

            testPiano.StrikeKey('q');
            PianoWire testWire = (PianoWire)testPiano.returnKeyAtIndex('q');

            double[] testArray = testWire.buffer.getValues();

            Assert.AreEqual(testArray[0], testPiano.Play());
        }
コード例 #3
0
ファイル: PianoTest.cs プロジェクト: GodArthur/Piano-Player
        public void PlayMultipleNotesTest()
        {
            Piano testPiano = new Piano("q2we4r5ty7u8i9op-[=zxdcfvgbnjmk,.;/' ", 44100);

            testPiano.StrikeKey('q');
            testPiano.StrikeKey('2');
            testPiano.StrikeKey('w');
            PianoWire testWire1 = (PianoWire)testPiano.returnKeyAtIndex('q');
            PianoWire testWire2 = (PianoWire)testPiano.returnKeyAtIndex('2');
            PianoWire testWire3 = (PianoWire)testPiano.returnKeyAtIndex('w');

            double[] testArray1 = testWire1.buffer.getValues();
            double[] testArray2 = testWire2.buffer.getValues();
            double[] testArray3 = testWire3.buffer.getValues();
            double   result     = testArray1[0] + testArray2[0] + testArray3[0];

            Assert.AreEqual(result, testPiano.Play());
        }
コード例 #4
0
ファイル: Program.cs プロジェクト: JoelEche20/MusicInstrument
        static void Main(string[] args)
        {
            List <StringInstrument> stringInstruments = new List <StringInstrument>();
            Guitar guitar = new Guitar("Guitarra Acustica", "Dreadnought", 6);
            Piano  piano  = new Piano("Piano", "Piano de Cola", 230);

            stringInstruments.Add(guitar);
            stringInstruments.Add(piano);
            Console.WriteLine(guitar.Play());
            Console.WriteLine(guitar.Play());
            Console.WriteLine(piano.Play());
            Console.WriteLine(guitar.showTuning());
            Console.WriteLine(piano.showTuning());

            foreach (StringInstrument instrument in stringInstruments)
            {
                guitar.FineTune();
                piano.FineTune();
            }

            Console.WriteLine(guitar.showTuning());
            Console.WriteLine(piano.showTuning());
        }
コード例 #5
0
ファイル: PianoTest.cs プロジェクト: GodArthur/Piano-Player
        public void PlayNoNotesTest()
        {
            Piano testPiano = new Piano("q2we4r5ty7u8i9op-[=zxdcfvgbnjmk,.;/' ", 44100);

            Assert.AreEqual(0, testPiano.Play());
        }