public MainPage() { this.InitializeComponent(); this.NavigationCacheMode = NavigationCacheMode.Required; dispatcher = CoreWindow.GetForCurrentThread().Dispatcher; socket = new TaskCompletionSource <StreamSocket>(null); capturer = new MAudioCapturer(); capturer.InitializeAsync().ContinueWith((preTask) => { format = capturer.Format; }); }
private void Page_Loaded(object sender, RoutedEventArgs e) { capturer = new MAudioCapturer(); var ignore = capturer.InitializeAsync(). ContinueWith((preTask) => { MAudioFormat format = capturer.Format; int ratio = format.NumberOfChannels * format.SampleRate / 16000; switch (format.EncodingType) { case MAudioEncodingType.PCM16bits: capturer.Stream.OutputStream = new ConverterStream(new ShortSimplifier(client, ratio, 1)); break; case MAudioEncodingType.Float: capturer.Stream.OutputStream = new ConverterStream(new FloatSimplifier(new FloatToPCMConverter(client), ratio, 1)); break; } capturer.Start(); }); }
public async Task ActivateAsyncPhone() { capturer = new MAudioCapturer(); await capturer.InitializeAsync(). ContinueWith((preTask) => ActivationPostTask()); }
public async Task ActivateAsync() { capturer = new MAudioCapturer(); await capturer.InitializeAsync(new MAudioFormat(MAudioEncodingType.PCM16bits, 1, 48000)). ContinueWith((preTask) => ActivationPostTask()); }