Playing a sound from a generated buffer in a Windows phone app
问题 I new in windows phone sdk. I can't find example of playing a sound from a generated buffer in a Windows phone app. Help pls. i found this example: byte] buffer = new byte[44100 * 2 * 5]; float t = 0; for (int i = 0; i < 44100 * 2 * 5; i += 2) { short val = (short)(Math.Sin(t * 2 * Math.PI * 440) * short.MaxValue); buffer[i] = (byte)(val & 0xFF); buffer[i + 1] = (byte)(val >> 8); t += 1 / 44100.0f; } sf = new SoundEffect(buffer, 44100, AudioChannels.Mono); // Play. sf.Play(); but it's crash