Menu
support@nursinghomework.org
+1 714-215-3097

(Solved) : Xamarin Forms Basically Modification Monkeytapwithsound Make Respond Faster Book Https Doc Q35611132

Xamarin Forms

This is basically a modification of the MonkeyTapWithSound tomake it respond faster from the book athttps://docs.microsoft.com/en-us/xamarin/xamarin-forms/creating-mobile-apps-xamarin-forms/

The last bit of instructions for this modification are asfollows:

5.   Split PlaySound into a MakeBuffer method withparameters (frequency) that returns a sound buffer, and anothermethod PlayBufferedSound with the parameter (<buffer>).
6.   Add a method to MonkeyTapWithSoundPage to initializethe buffers in SoundPlayer. A good choice is to overrideInitializeBoxView. This method should step through the 4 existingfrequencies and add a 5th buffer for the error sound. Make a forloop to set up buffers 0, 1, 2 and 3 with the frequency andflashDuration, and one more call outside the loop with endFrequencyand errorDuration Modify FlashBoxView to call PlayBufferedSoundwith buffers[index] and flashDuration, and EndGame to usePlayBufferedSound with endBuffer and endDuration.

Anyways, I’ve hit a wall and I’m not sure on how to finish thispage.

Here’s the code I have so far for theMonkeyTapWithSoundPage.cs:

namespace MTWSFast
{
class MonkeyTapWithSoundPage : MonkeyTap.MonkeyTapPage
{
const int errorDuration = 500;

// Diminished 7th in 1st inversion: C, Eb, F#, A
double[] frequencies = { 523.25, 622.25, 739.99, 880 };
double endFrequency = 65.4;

List<byte[]> buffers;
byte[] endBuffer;

protected override void FlashBoxView(int index)
{
SoundPlayer.PlaySound(frequencies[index]);
base.FlashBoxView(index);
}

protected override void InitializeBoxView()
{
buffers = new List<byte[]>();
for(int i = 0; i<frequencies.Length; i++)
{ buffers.Add(SoundPlayer.MakeBuffer(frequencies[i]); }
endBuffer
base.InitializeBoxView();
}

protected override void EndGame()
{
SoundPlayer.PlaySound(65.4);
base.EndGame();
}
}
}

Leave a Reply

Your email address will not be published. Required fields are marked *