private void startStopButton_Click(object sender, RoutedEventArgs e) { if (startStopButton.Content.Equals("Start")) { // Start the audio source running sio.start(); // Output debugging info textOutput.Text = "Sound Parameters:\n"; textOutput.Text += "Input: " + sio.getInputNumChannels() + " channels at " + sio.getInputSampleRate() / 1000.0 + " KHz, " + sio.getInputBitdepth() + " bits per sample\n"; textOutput.Text += "Output: " + sio.getOutputNumChannels() + " channels at " + sio.getOutputSampleRate() / 1000.0 + " KHz, " + sio.getOutputBitdepth() + " bits per sample\n"; startStopButton.Content = "Stop"; } else { sio.stop(); textOutput.Text = "Sound Stopped"; startStopButton.Content = "Start"; } }
protected override void OnNavigatedTo(NavigationEventArgs e) { base.OnNavigatedTo(e); // Setup SoundIO right away sio.audioInEvent += sio_audioInEvent; sio.start(); }
private void setupSensors() { // Initialize the combined orientation sensor try { motion = new Motion(); motion.TimeBetweenUpdates = TimeSpan.FromMilliseconds(100); motion.CurrentValueChanged += motion_CurrentValueChanged; motion.Start(); } catch { // Print out an error MessageBox.Show("Could not initialize Motion API. This phone does not have the necessary sensors to run this code properly!"); // The kill the current application Application.Current.Terminate(); } // Setup sound output sio = new SoundIO(); sio.audioOutEvent += sio_audioOutEvent; sio.start(); at = new AudioTool(sio.getOutputNumChannels(), sio.getOutputSampleRate()); }