diff options
| author | Mary <me@thog.eu> | 2021-02-26 01:11:56 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-02-26 01:11:56 +0100 |
| commit | f556c80d0230056335632b60c71f1567e177239e (patch) | |
| tree | 748aa6be62b93a8e941e25dbd83f39e1dbb37035 /Ryujinx.HLE/HOS/Services/Audio/IAudioInManager.cs | |
| parent | 1c49089ff00fc87dc4872f135dc6a0d36169a970 (diff) | |
Haydn: Part 1 (#2007)
* Haydn: Part 1
Based on my reverse of audio 11.0.0.
As always, core implementation under LGPLv3 for the same reasons as for Amadeus.
This place the bases of a more flexible audio system while making audout & audin accurate.
This have the following improvements:
- Complete reimplementation of audout and audin.
- Audin currently only have a dummy backend.
- Dramatically reduce CPU usage by up to 50% in common cases (SoundIO and OpenAL).
- Audio Renderer now can output to 5.1 devices when supported.
- Audio Renderer init its backend on demand instead of keeping two up all the time.
- All backends implementation are now in their own project.
- Ryujinx.Audio.Renderer was renamed Ryujinx.Audio and was refactored because of this.
As a note, games having issues with OpenAL haven't improved and will not
because of OpenAL design (stopping when buffers finish playing causing
possible audio "pops" when buffers are very small).
* Update for latest hexkyz's edits on Switchbrew
* audren: Rollback channel configuration changes
* Address gdkchan's comments
* Fix typo in OpenAL backend driver
* Address last comments
* Fix a nit
* Address gdkchan's comments
Diffstat (limited to 'Ryujinx.HLE/HOS/Services/Audio/IAudioInManager.cs')
| -rw-r--r-- | Ryujinx.HLE/HOS/Services/Audio/IAudioInManager.cs | 85 |
1 files changed, 5 insertions, 80 deletions
diff --git a/Ryujinx.HLE/HOS/Services/Audio/IAudioInManager.cs b/Ryujinx.HLE/HOS/Services/Audio/IAudioInManager.cs index b3f7f5e0..9bbe5b0e 100644 --- a/Ryujinx.HLE/HOS/Services/Audio/IAudioInManager.cs +++ b/Ryujinx.HLE/HOS/Services/Audio/IAudioInManager.cs @@ -1,87 +1,12 @@ -using Ryujinx.Cpu; -using Ryujinx.Memory; -using System; -using System.Text; +using Ryujinx.Audio.Common; +using Ryujinx.HLE.HOS.Services.Audio.AudioIn; namespace Ryujinx.HLE.HOS.Services.Audio { - [Service("audin:u")] - class IAudioInManager : IpcService + interface IAudioInManager { - private const string DefaultAudioInsName = "BuiltInHeadset"; + public string[] ListAudioIns(bool filtered); - public IAudioInManager(ServiceCtx context) { } - - [Command(0)] - // ListAudioIns() -> (u32 count, buffer<bytes, 6> names) - public ResultCode ListAudioIns(ServiceCtx context) - { - long bufferPosition = context.Request.ReceiveBuff[0].Position; - long bufferSize = context.Request.ReceiveBuff[0].Size; - - // NOTE: The service check if AudioInManager thread is started, if not it starts it. - - uint count = ListAudioInsImpl(context.Memory, bufferPosition, bufferSize, false); - - context.ResponseData.Write(count); - - return ResultCode.Success; - } - - [Command(2)] // 3.0.0+ - // ListAudioInsAuto() -> (u32 count, buffer<bytes, 0x22> names) - public ResultCode ListAudioInsAuto(ServiceCtx context) - { - (long bufferPosition, long bufferSize) = context.Request.GetBufferType0x22(); - - // NOTE: The service check if AudioInManager thread is started, if not it starts it. - - uint count = ListAudioInsImpl(context.Memory, bufferPosition, bufferSize, false); - - context.ResponseData.Write(count); - - return ResultCode.Success; - } - - [Command(4)] // 3.0.0+ - // ListAudioInsAutoFiltered() -> (u32 count, buffer<bytes, 0x22> names) - public ResultCode ListAudioInsAutoFiltered(ServiceCtx context) - { - (long bufferPosition, long bufferSize) = context.Request.GetBufferType0x22(); - - // NOTE: The service check if AudioInManager thread is started, if not it starts it. - - uint count = ListAudioInsImpl(context.Memory, bufferPosition, bufferSize, true); - - context.ResponseData.Write(count); - - return ResultCode.Success; - } - - private uint ListAudioInsImpl(IVirtualMemoryManager memory, long bufferPosition, long bufferSize, bool filtered = false) - { - uint count = 0; - - MemoryHelper.FillWithZeros(memory, bufferPosition, (int)bufferSize); - - if (bufferSize > 0) - { - // NOTE: The service also check that the input target is enabled when in filtering mode, as audctl and most of the audin logic isn't supported, we don't support it. - if (!filtered) - { - byte[] deviceNameBuffer = Encoding.ASCII.GetBytes(DefaultAudioInsName + "\0"); - - memory.Write((ulong)bufferPosition, deviceNameBuffer); - - count++; - } - - // NOTE: The service adds other input devices names available in the buffer, - // every name is aligned to 0x100 bytes. - // Since we don't support it for now, it's fine to do nothing here. - } - - return count; - } + public ResultCode OpenAudioIn(ServiceCtx context, out string outputDeviceName, out AudioOutputConfiguration outputConfiguration, out IAudioIn obj, string inputDeviceName, ref AudioInputConfiguration parameter, ulong appletResourceUserId, uint processHandle); } }
\ No newline at end of file |
