示例#1
0
        public void TestRevision3()
        {
            BehaviourContext behaviourContext = new BehaviourContext();

            behaviourContext.SetUserRevision(BehaviourContext.BaseRevisionMagic + BehaviourContext.Revision3);

            Assert.IsTrue(behaviourContext.IsAdpcmLoopContextBugFixed());
            Assert.IsTrue(behaviourContext.IsSplitterSupported());
            Assert.IsTrue(behaviourContext.IsLongSizePreDelaySupported());
            Assert.IsFalse(behaviourContext.IsAudioUsbDeviceOutputSupported());
            Assert.IsFalse(behaviourContext.IsFlushVoiceWaveBuffersSupported());
            Assert.IsFalse(behaviourContext.IsSplitterBugFixed());
            Assert.IsFalse(behaviourContext.IsElapsedFrameCountSupported());
            Assert.IsFalse(behaviourContext.IsDecodingBehaviourFlagSupported());
            Assert.IsFalse(behaviourContext.IsBiquadFilterEffectStateClearBugFixed());
            Assert.IsFalse(behaviourContext.IsMixInParameterDirtyOnlyUpdateSupported());
            Assert.IsFalse(behaviourContext.IsWaveBufferVersion2Supported());

            Assert.AreEqual(0.70f, behaviourContext.GetAudioRendererProcessingTimeLimit());
            Assert.AreEqual(1, behaviourContext.GetCommandProcessingTimeEstimatorVersion());
            Assert.AreEqual(1, behaviourContext.GetPerformanceMetricsDataFormat());
        }
示例#2
0
        /// <summary>
        /// Update the internal state from a user parameter.
        /// </summary>
        /// <param name="outErrorInfo">The possible <see cref="ErrorInfo"/> that was generated.</param>
        /// <param name="parameter">The user parameter.</param>
        /// <param name="poolMapper">The mapper to use.</param>
        /// <param name="behaviourContext">The behaviour context.</param>
        public void UpdateParameters(out ErrorInfo outErrorInfo, ref VoiceInParameter parameter, ref PoolMapper poolMapper, ref BehaviourContext behaviourContext)
        {
            InUse  = parameter.InUse;
            Id     = parameter.Id;
            NodeId = parameter.NodeId;

            UpdatePlayState(parameter.PlayState);

            SrcQuality = parameter.SrcQuality;

            Priority      = parameter.Priority;
            SortingOrder  = parameter.SortingOrder;
            SampleRate    = parameter.SampleRate;
            SampleFormat  = parameter.SampleFormat;
            ChannelsCount = parameter.ChannelCount;
            Pitch         = parameter.Pitch;
            Volume        = parameter.Volume;
            parameter.BiquadFilters.ToSpan().CopyTo(BiquadFilters.ToSpan());
            WaveBuffersCount = parameter.WaveBuffersCount;
            WaveBuffersIndex = parameter.WaveBuffersIndex;

            if (behaviourContext.IsFlushVoiceWaveBuffersSupported())
            {
                FlushWaveBufferCount += parameter.FlushWaveBufferCount;
            }

            MixId = parameter.MixId;

            if (behaviourContext.IsSplitterSupported())
            {
                SplitterId = parameter.SplitterId;
            }
            else
            {
                SplitterId = RendererConstants.UnusedSplitterId;
            }

            parameter.ChannelResourceIds.ToSpan().CopyTo(ChannelResourceIds.ToSpan());

            DecodingBehaviour behaviour = DecodingBehaviour.Default;

            if (behaviourContext.IsDecodingBehaviourFlagSupported())
            {
                behaviour = parameter.DecodingBehaviourFlags;
            }

            DecodingBehaviour = behaviour;

            if (parameter.ResetVoiceDropFlag)
            {
                VoiceDropFlag = false;
            }

            if (ShouldUpdateParameters(ref parameter))
            {
                DataSourceStateUnmapped = !poolMapper.TryAttachBuffer(out outErrorInfo, ref DataSourceStateAddressInfo, parameter.DataSourceStateAddress, parameter.DataSourceStateSize);
            }
            else
            {
                outErrorInfo = new ErrorInfo();
            }
        }