Example #1
0
        public bool soundThreadStartup()
        {
            // populate device list, pulling default from config file
            ISoundDeviceList sdl = new IrrKlang.ISoundDeviceList(IrrKlang.SoundDeviceListType.PlaybackDevice);
            //Add each device to a combo box.
            for (int i = 0; i < sdl.DeviceCount; i++)
            {
                string desc = sdl.getDeviceDescription(i);
                cbDevices.Items.Add(desc);
            }

            // take the value in the config file and set the drop-down to that
            cbDevices.SelectedIndex = Settings.Default.DeviceID;

            // fire up sound processing thread
            SoundObject = new SoundEngine();
            SoundThread = new Thread(SoundObject.Run);
            // Start the worker thread.
            SoundThread.Start();
            Debug.WriteLine("Telemetry processing thread: Starting sound thread...");
            while (!SoundThread.IsAlive);

            if (cbDevices.SelectedIndex == -1)
            {
                SoundObject.Initialize("0");  // using the default
            }
            else
            {
                string dev = sdl.getDeviceID(cbDevices.SelectedIndex);
                SoundObject.Initialize(dev);  // using the selected value
            }
            return true;
        }