/// <param name="sampleRate">Sample rate, in Hertz (Hz).</param>
        /// <param name="channels">Number of channels (mono or stereo).</param>
        public DynamicSoundEffectInstance(int sampleRate, AudioChannels channels)
        {
            SoundEffect.Initialize();
            if (SoundEffect._systemState != SoundEffect.SoundSystemState.Initialized)
            {
                throw new NoAudioHardwareException("Audio has failed to initialize. Call SoundEffect.Initialize() before sound operation to get more specific errors.");
            }

            if ((sampleRate < 8000) || (sampleRate > 48000))
            {
                throw new ArgumentOutOfRangeException("sampleRate");
            }
            if ((channels != AudioChannels.Mono) && (channels != AudioChannels.Stereo))
            {
                throw new ArgumentOutOfRangeException("channels");
            }

            _sampleRate = sampleRate;
            _channels   = channels;
            _state      = SoundState.Stopped;
            PlatformCreate();

            // This instance is added to the pool so that its volume reflects master volume changes
            // and it contributes to the playing instances limit, but the source/voice is not owned by the pool.
            _isPooled  = false;
            _isDynamic = true;
        }