Exemplo n.º 1
0
        private void OutputCombo_SelectionChanged(object sender, SelectionChangedEventArgs e) // this will need to be modified to support scaling
        {
            var    WhichBoxObj = ((ComboBox)sender).Tag;
            string WhichBox    = WhichBoxObj.ToString();

            if (WhichBox == "1")
            {
                if (Output1Combo.SelectedItem == Output2Combo.SelectedItem)
                {
                    ChangeOutputDevice(0, Output1Combo.SelectedItem.ToString());
                    ChangeOutputDevice(1, "None");
                    Output2Combo.SelectedIndex = 0;
                    // set 1 to the device and 2 to null
                }
                ChangeOutputDevice(0, Output1Combo.SelectedItem.ToString());
            }
            if (WhichBox == "2")
            {
                if (Output1Combo.SelectedItem == Output2Combo.SelectedItem)
                {
                    ChangeOutputDevice(1, Output2Combo.SelectedItem.ToString());
                    ChangeOutputDevice(0, "None");
                    Output1Combo.SelectedIndex = 0;
                    // set 2 to the device and 1 to null
                }
                ChangeOutputDevice(1, Output2Combo.SelectedItem.ToString());
                SoundPlayers.StopAll();
            }
        }
Exemplo n.º 2
0
        public MainWindow()
        {
            InitializeComponent();
            AudioCollection Clips = AudioCollection.InitialiseLibrary();

            ButtonGrid.ItemsSource = AudioCollection.AudioLibrary;
            //SoundPlayers.CreateSoundPlayers();
            SoundPlayers.InitialisePlayers();

            List <string> Devices = DetectAudioDevices();

            Output1Combo.ItemsSource = Devices;
            Output2Combo.ItemsSource = Devices;

            outputDevice1 = new WaveOutEvent()
            {
                DeviceNumber = 1
            };;
            outputDevice1.PlaybackStopped += OnPlaybackStoppedVBCable;
            outputDevice2 = new WaveOutEvent()
            {
                DeviceNumber = 0
            };;
            outputDevice2.PlaybackStopped += OnPlaybackStopped;
        }
Exemplo n.º 3
0
        private void SoundButton_Click(object sender, RoutedEventArgs e)
        {
            //outputDevice2.Stop();
            //outputDevice1.Stop();

            var ClipIDObj = ((Button)sender).Tag;
            int ClipID    = Convert.ToInt32(ClipIDObj);

            SoundPlayers.StopAll();

            //audioFile1 = new AudioFileReader(AudioCollection.AudioLibrary[ClipID].FilePath);
            //audioFile2 = new AudioFileReader(AudioCollection.AudioLibrary[ClipID].FilePath);

            //outputDevice1.Init(audioFile1);
            //outputDevice2.Init(audioFile2);

            //outputDevice1.Play();
            //outputDevice2.Play();

            foreach (int i in Enumerable.Range(0, SoundPlayers.SoundPlayersCollection.Count))
            {
                SoundPlayers.SoundPlayersCollection[i].PlayFile(AudioCollection.AudioLibrary[ClipID].FilePath);
            }
        }