Exemplo n.º 1
0
        /// <summary>
        /// Create a new <see cref="PerformanceManager"/>.
        /// </summary>
        /// <param name="performanceBuffer">The backing memory available for use by the manager.</param>
        /// <param name="parameter">The audio renderer configuration.</param>
        /// <param name="behaviourContext">The behaviour context;</param>
        /// <returns>A new <see cref="PerformanceManager"/>.</returns>
        public static PerformanceManager Create(Memory <byte> performanceBuffer, ref AudioRendererConfiguration parameter, BehaviourContext behaviourContext)
        {
            uint version = behaviourContext.GetPerformanceMetricsDataFormat();

            switch (version)
            {
            case 1:
                return(new PerformanceManagerGeneric <PerformanceFrameHeaderVersion1, PerformanceEntryVersion1, PerformanceDetailVersion1>(performanceBuffer,
                                                                                                                                           ref parameter));

            case 2:
                return(new PerformanceManagerGeneric <PerformanceFrameHeaderVersion2, PerformanceEntryVersion2, PerformanceDetailVersion2>(performanceBuffer,
                                                                                                                                           ref parameter));

            default:
                throw new NotImplementedException($"Unknown Performance metrics data format version {version}");
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Get the required size for a single performance frame.
        /// </summary>
        /// <param name="parameter">The audio renderer configuration.</param>
        /// <param name="behaviourContext">The behaviour context.</param>
        /// <returns>The required size for a single performance frame.</returns>
        public static ulong GetRequiredBufferSizeForPerformanceMetricsPerFrame(ref AudioRendererConfiguration parameter, ref BehaviourContext behaviourContext)
        {
            uint version = behaviourContext.GetPerformanceMetricsDataFormat();

            if (version == 2)
            {
                return((ulong)PerformanceManagerGeneric <PerformanceFrameHeaderVersion2,
                                                         PerformanceEntryVersion2,
                                                         PerformanceDetailVersion2> .GetRequiredBufferSizeForPerformanceMetricsPerFrame(ref parameter));
            }
            else if (version == 1)
            {
                return((ulong)PerformanceManagerGeneric <PerformanceFrameHeaderVersion1,
                                                         PerformanceEntryVersion1,
                                                         PerformanceDetailVersion1> .GetRequiredBufferSizeForPerformanceMetricsPerFrame(ref parameter));
            }

            throw new NotImplementedException($"Unknown Performance metrics data format version {version}");
        }
Exemplo n.º 3
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());
        }