コード例 #1
0
        public IAudioRenderer(
            Horizon system,
            MemoryManager memory,
            IAalOutput audioOut,
            AudioRendererParameter rendererParams)
        {
            _updateEvent = new KEvent(system.KernelContext);

            _memory   = memory;
            _audioOut = audioOut;
            _params   = rendererParams;

            _track = audioOut.OpenTrack(
                AudioRendererConsts.HostSampleRate,
                AudioRendererConsts.HostChannelsCount,
                AudioCallback);

            _memoryPools = CreateArray <MemoryPoolContext>(rendererParams.EffectCount + rendererParams.VoiceCount * 4);

            _voices = CreateArray <VoiceContext>(rendererParams.VoiceCount);

            _effects = CreateArray <EffectContext>(rendererParams.EffectCount);

            _elapsedFrameCount = 0;

            InitializeAudioOut();

            _playState = PlayState.Stopped;
        }
コード例 #2
0
        public static long CalcWorkBufferSize(BehaviorInfo behaviorInfo, AudioRendererParameter parameters)
        {
            if (!behaviorInfo.IsSplitterSupported())
            {
                return(0);
            }

            long size = parameters.SplitterDestinationDataCount * 0xE0 +
                        parameters.SplitterCount * 0x20;

            if (!behaviorInfo.IsSplitterBugFixed())
            {
                size += BitUtils.AlignUp(4 * parameters.SplitterDestinationDataCount, 16);
            }

            return(size);
        }
コード例 #3
0
        public static long GetRequiredBufferSizeForPerformanceMetricsPerFrame(BehaviorInfo behaviorInfo, AudioRendererParameter parameters)
        {
            int performanceMetricsDataFormat = behaviorInfo.GetPerformanceMetricsDataFormat();

            if (performanceMetricsDataFormat == 2)
            {
                return(24 * (parameters.VoiceCount +
                             parameters.EffectCount +
                             parameters.SubMixCount +
                             parameters.SinkCount + 1) + 0x990);
            }

            if (performanceMetricsDataFormat != 1)
            {
                Logger.Warning?.Print(LogClass.ServiceAudio, $"PerformanceMetricsDataFormat: {performanceMetricsDataFormat} is not supported!");
            }

            return((((parameters.VoiceCount +
                      parameters.EffectCount +
                      parameters.SubMixCount +
                      parameters.SinkCount + 1) << 32) >> 0x1C) + 0x658);
        }