Example #1
0
        private void CreateSoundChannels()
        {
            foreach (var ch in this.SoundChannels)
            {
                ch.Stop();
                ch.Dispose();
            }
            this.SoundChannels.Clear();

            var count = SoundChannel.GetDeviceCount();

            LogService.Logger.Error(string.Format("Detect sound card: {0}", count));

            byte address  = 0x19;
            var  settings = GlobalSetting.Instance;

            // SoundCard 1
            if (settings.SoundCard1 >= 0)
            {
                this.SoundChannels.Add(new SoundChannel(this.OwnerHandle, settings.SoundCard1, eSpeakerPan.Left, address++));
                this.SoundChannels.Add(new SoundChannel(this.OwnerHandle, settings.SoundCard1, eSpeakerPan.Right, address++));
            }

            // SoundCard 2
            if (settings.SoundCard2 >= 0)
            {
                this.SoundChannels.Add(new SoundChannel(this.OwnerHandle, settings.SoundCard2, eSpeakerPan.Left, address++));
                this.SoundChannels.Add(new SoundChannel(this.OwnerHandle, settings.SoundCard2, eSpeakerPan.Right, address));
            }
        }