Exemple #1
0
        /// <summary>
        /// Adds an audio compressor if needed (by checking the registry)
        /// </summary>
        public void AddAudioCompressor()
        {
            if (RegAudioCompressorEnabled)
            {
                try
                {
                    cg.AddCompressor(AudioCompressor.DefaultFilterInfo());
                    Log(cg.Compressor.Dump());

                    DefaultAudioCompressorSettings();
                }
                catch (Exception e)
                {
                    // If we encounter an error trying to add or configure the
                    // compressor, just disable compressor and log it
                    RegAudioCompressorEnabled = false;
                    Log(e.ToString());
                }
            }
        }
        /// <summary>
        /// Get the selected audio compressor from the registry.  It may be a moniker of a compressor that is enabled
        /// on the system or "Uncompressed".  Otherwise return the default compressor.
        /// </summary>
        /// <returns></returns>
        public static FilterInfo SelectedCompressor()
        {
            FilterInfo selectedCompressor    = AudioCompressor.DefaultFilterInfo();
            string     regSelectedCompressor = (string)AVReg.ReadValue(AVReg.SelectedDevices, AVReg.AudioCompressor);

            if (regSelectedCompressor != null)
            {
                if (regSelectedCompressor == "Uncompressed")
                {
                    return(new FilterInfo("Uncompressed", "Uncompressed", Guid.Empty));
                }

                foreach (FilterInfo fi in AudioCompressor.EnabledCompressors)
                {
                    if (fi.Moniker == regSelectedCompressor)
                    {
                        selectedCompressor = fi;
                        break;
                    }
                }
            }

            return(selectedCompressor);
        }