Hey, I'm really stumped on this and it just seems like I'm missing something obvious.
I'm trying to implement a feature in a C# windows store app that allows you to speak through the microphone and that sound to come out of the speakers in real-time.
Recording sound to a file for later playback was a piece of cake, but no matter what I try I can't get it to play back immediately. This is really easy on non-store apps using NAudio, but unfortunately there is no support for that yet.
I'm using a mediacapture object to record to a stream, and then using that stream as the source of a mediaelement object, but this doesn't work.
MediaCapture input = new MediaCapture()
MediaCaptureInitializationSettings inputSettings = new MediaCaptureInitializationSettings();
MediaEncodingProfile encodingProfile = new MediaEncoding Profile();
InMemoryRandomAccessStream recStream = new InMemoryRandomAccessStream();
MediaElement playback = new MediaElement();
inputSettings.AudioDeviceId = "";
inputSettings.StreamingCaptureMode = StreamingCaptureMode.Audio;
encodingProfile = MediaEncodingProfile.CreateWma(AudioEncodingQuality.Auto);
playback.RealTimePlayback = true;
playback.AudioCategory = AudioCategory.Communications;
await input.StartRecordToStreamAsync(encodingProfile, recStream);
This code works if i change it to record to a storage file, so I know the device is set up ok.
Has anyone done anything like this on Windows 8 before? Any help would be greatly appreciated.