예제 #1
0
        public long OpenAudioRenderer(ServiceCtx Context)
        {
            IAalOutput AudioOut = Context.Device.AudioOut;

            AudioRendererParameter Params = GetAudioRendererParameter(Context);

            MakeObject(Context, new IAudioRenderer(Context.Memory, AudioOut, Params));

            return(0);
        }
예제 #2
0
        public long OpenAudioRenderer(ServiceCtx context)
        {
            IAalOutput audioOut = context.Device.AudioOut;

            AudioRendererParameter Params = GetAudioRendererParameter(context);

            MakeObject(context, new IAudioRenderer(
                           context.Device.System,
                           context.Memory,
                           audioOut,
                           Params));

            return(0);
        }
예제 #3
0
        private AudioRendererParameter GetAudioRendererParameter(ServiceCtx Context)
        {
            AudioRendererParameter Params = new AudioRendererParameter();

            Params.SampleRate                   = Context.RequestData.ReadInt32();
            Params.SampleCount                  = Context.RequestData.ReadInt32();
            Params.Unknown8                     = Context.RequestData.ReadInt32();
            Params.MixCount                     = Context.RequestData.ReadInt32();
            Params.VoiceCount                   = Context.RequestData.ReadInt32();
            Params.SinkCount                    = Context.RequestData.ReadInt32();
            Params.EffectCount                  = Context.RequestData.ReadInt32();
            Params.PerformanceManagerCount      = Context.RequestData.ReadInt32();
            Params.VoiceDropEnable              = Context.RequestData.ReadInt32();
            Params.SplitterCount                = Context.RequestData.ReadInt32();
            Params.SplitterDestinationDataCount = Context.RequestData.ReadInt32();
            Params.Unknown2C                    = Context.RequestData.ReadInt32();
            Params.Revision                     = Context.RequestData.ReadInt32();

            return(Params);
        }
예제 #4
0
        public long GetAudioRendererWorkBufferSize(ServiceCtx Context)
        {
            AudioRendererParameter Params = GetAudioRendererParameter(Context);

            int Revision = (Params.Revision - Rev0Magic) >> 24;

            if (Revision <= Rev)
            {
                bool IsSplitterSupported = Revision >= 3;

                long Size;

                Size  = IntUtils.AlignUp(Params.Unknown8 * 4, 64);
                Size += Params.MixCount * 0x400;
                Size += (Params.MixCount + 1) * 0x940;
                Size += Params.VoiceCount * 0x3F0;
                Size += IntUtils.AlignUp((Params.MixCount + 1) * 8, 16);
                Size += IntUtils.AlignUp(Params.VoiceCount * 8, 16);
                Size += IntUtils.AlignUp(
                    ((Params.SinkCount + Params.MixCount) * 0x3C0 + Params.SampleCount * 4) *
                    (Params.Unknown8 + 6), 64);
                Size += (Params.SinkCount + Params.MixCount) * 0x2C0;
                Size += (Params.EffectCount + Params.VoiceCount * 4) * 0x30 + 0x50;

                if (IsSplitterSupported)
                {
                    Size += IntUtils.AlignUp((
                                                 NodeStatesGetWorkBufferSize(Params.MixCount + 1) +
                                                 EdgeMatrixGetWorkBufferSize(Params.MixCount + 1)), 16);

                    Size += Params.SplitterDestinationDataCount * 0xE0;
                    Size += Params.SplitterCount * 0x20;
                    Size += IntUtils.AlignUp(Params.SplitterDestinationDataCount * 4, 16);
                }

                Size = Params.EffectCount * 0x4C0 +
                       Params.SinkCount * 0x170 +
                       Params.VoiceCount * 0x100 +
                       IntUtils.AlignUp(Size, 64) + 0x40;

                if (Params.PerformanceManagerCount >= 1)
                {
                    Size += (((Params.EffectCount +
                               Params.SinkCount +
                               Params.VoiceCount +
                               Params.MixCount + 1) * 16 + 0x658) *
                             (Params.PerformanceManagerCount + 1) + 0x13F) & ~0x3FL;
                }

                Size = (Size + 0x1907D) & ~0xFFFL;

                Context.ResponseData.Write(Size);

                Context.Device.Log.PrintDebug(LogClass.ServiceAudio, $"WorkBufferSize is 0x{Size:x16}.");

                return(0);
            }
            else
            {
                Context.ResponseData.Write(0L);

                Context.Device.Log.PrintWarning(LogClass.ServiceAudio, $"Library Revision 0x{Params.Revision:x8} is not supported!");

                return(MakeError(ErrorModule.Audio, AudErr.UnsupportedRevision));
            }
        }
예제 #5
0
        public long GetAudioRendererWorkBufferSize(ServiceCtx context)
        {
            AudioRendererParameter Params = GetAudioRendererParameter(context);

            int revision = (Params.Revision - Rev0Magic) >> 24;

            if (revision <= Rev)
            {
                bool isSplitterSupported = revision >= 3;
                bool isVariadicCommandBufferSizeSupported = revision >= 5;

                long size;

                size  = IntUtils.AlignUp(Params.Unknown8 * 4, 64);
                size += Params.MixCount * 0x400;
                size += (Params.MixCount + 1) * 0x940;
                size += Params.VoiceCount * 0x3F0;
                size += IntUtils.AlignUp((Params.MixCount + 1) * 8, 16);
                size += IntUtils.AlignUp(Params.VoiceCount * 8, 16);
                size += IntUtils.AlignUp(
                    ((Params.SinkCount + Params.MixCount) * 0x3C0 + Params.SampleCount * 4) *
                    (Params.Unknown8 + 6), 64);
                size += (Params.SinkCount + Params.MixCount) * 0x2C0;
                size += (Params.EffectCount + Params.VoiceCount * 4) * 0x30 + 0x50;

                if (isSplitterSupported)
                {
                    size += IntUtils.AlignUp((
                                                 NodeStatesGetWorkBufferSize(Params.MixCount + 1) +
                                                 EdgeMatrixGetWorkBufferSize(Params.MixCount + 1)), 16);

                    size += Params.SplitterDestinationDataCount * 0xE0;
                    size += Params.SplitterCount * 0x20;
                    size += IntUtils.AlignUp(Params.SplitterDestinationDataCount * 4, 16);
                }

                size = Params.EffectCount * 0x4C0 +
                       Params.SinkCount * 0x170 +
                       Params.VoiceCount * 0x100 +
                       IntUtils.AlignUp(size, 64) + 0x40;

                if (Params.PerformanceManagerCount >= 1)
                {
                    size += (((Params.EffectCount +
                               Params.SinkCount +
                               Params.VoiceCount +
                               Params.MixCount + 1) * 16 + 0x658) *
                             (Params.PerformanceManagerCount + 1) + 0x13F) & ~0x3FL;
                }

                if (isVariadicCommandBufferSizeSupported)
                {
                    size += Params.EffectCount * 0x840 +
                            Params.MixCount * 0x5A38 +
                            Params.SinkCount * 0x148 +
                            Params.SplitterDestinationDataCount * 0x540 +
                            Params.VoiceCount * (Params.SplitterCount * 0x68 + 0x2E0) +
                            ((Params.VoiceCount + Params.MixCount + Params.EffectCount + Params.SinkCount + 0x65) << 6) + 0x3F8 + 0x7E;
                }
                else
                {
                    size += 0x1807E;
                }

                size = size & ~0xFFFL;

                context.ResponseData.Write(size);

                Logger.PrintDebug(LogClass.ServiceAudio, $"WorkBufferSize is 0x{size:x16}.");

                return(0);
            }
            else
            {
                context.ResponseData.Write(0L);

                Logger.PrintWarning(LogClass.ServiceAudio, $"Library Revision 0x{Params.Revision:x8} is not supported!");

                return(MakeError(ErrorModule.Audio, AudErr.UnsupportedRevision));
            }
        }