Ejemplo n.º 1
0
            [SuppressMessage("ReSharper", "SuggestVarOrType_SimpleTypes")] //because ReSharper doesn't like this method
            private void SetVolume(decimal number)                         //unmutes the speakers and sets the volume
            {
                //installed NuGet AudioSwitcher.AudioApi.CoreAudio 3.0.0.1 for this method
                CoreAudioDevice speakers = new CoreAudioController().DefaultPlaybackDevice;

                if (speakers.IsMuted)
                {
                    speakers.ToggleMute();        //there's no muting this program
                }
                speakers.Volume = (double)number; //so that's what casting is... handy
            }