示例#1
0
        /// <summary>
        /// Creates the Media Foundation Resampler, allowing modifying of sample rate, bit depth and channel count
        /// </summary>
        /// <param name="sourceProvider">Source provider, must be PCM</param>
        /// <param name="outputFormat">Output format, must also be PCM</param>
        // Token: 0x06000A5D RID: 2653 RVA: 0x0001E318 File Offset: 0x0001C518
        public MediaFoundationResampler(IWaveProvider sourceProvider, WaveFormat outputFormat) : base(sourceProvider, outputFormat)
        {
            if (!MediaFoundationResampler.IsPcmOrIeeeFloat(sourceProvider.WaveFormat))
            {
                throw new ArgumentException("Input must be PCM or IEEE float", "sourceProvider");
            }
            if (!MediaFoundationResampler.IsPcmOrIeeeFloat(outputFormat))
            {
                throw new ArgumentException("Output must be PCM or IEEE float", "outputFormat");
            }
            MediaFoundationApi.Startup();
            this.ResamplerQuality = 60;
            object comObject = this.CreateResamplerComObject();

            this.FreeComObject(comObject);
        }