Audio services: Difference between revisions

(38 intermediate revisions by 4 users not shown)
Line 47: Line 47:


== OpenAudioOutAuto ==
== OpenAudioOutAuto ==
Same as [[#OpenAudioOut]], but takes a type-0x21 input buffer instead.
Same as [[#OpenAudioOut]], but takes a type-0x21 input buffer and a type-0x22 output buffer instead.


== IAudioOut ==
== IAudioOut ==
Line 79: Line 79:
|-
|-
| 11 || [4.0.0+] FlushAudioOutBuffers
| 11 || [4.0.0+] FlushAudioOutBuffers
|-
| 12 || [6.0.0+] SetAudioOutVolume
|-
| 13 || [6.0.0+] GetAudioOutVolume
|}
|}


Line 136: Line 140:
| 1 || OpenAudioIn
| 1 || OpenAudioIn
|-
|-
| 2 || [3.0.0+]  
| 2 || [3.0.0+] ListAudioInsAuto
|-
|-
| 3 || [3.0.0+] OpenAudioInAuto
| 3 || [3.0.0+] OpenAudioInAuto
|-
|-
| 4 || [3.0.0+] ListAudioInsAuto
| 4 || [3.0.0+] ListAudioInsAutoFiltered
|-
| 5 || [5.0.0+]
|}
|}


Line 177: Line 183:
|-
|-
| 13 || [4.0.0+] GetAudioInDeviceGain
| 13 || [4.0.0+] GetAudioInDeviceGain
|-
| 14 || [6.0.0+] FlushAudioInBuffers
|}
|}


Line 213: Line 221:
| 6 || ContainsFinalOutputRecorderBuffer
| 6 || ContainsFinalOutputRecorderBuffer
|-
|-
| 7 ||
| 7 || GetFinalOutputRecorderBufferEndTime
|-
|-
| 8 || [3.0.0+] AppendFinalOutputRecorderBufferAuto
| 8 || [3.0.0+] AppendFinalOutputRecorderBufferAuto
|-
|-
| 9 || [3.0.0+] GetReleasedFinalOutputRecorderBufferAuto
| 9 || [3.0.0+] GetReleasedFinalOutputRecorderBufferAuto
|-
| 10 || [6.0.0+] FlushFinalOutputRecorderBuffers
|-
| 11 || [9.0.0+]
|}
= auddev =
This is "nn::audio::detail::IAudioSnoopManager".
This was added with [6.0.0+].
{| class="wikitable" border="1"
|-
! Cmd || Name
|-
| 0 || EnableDspUsageMeasurement
|-
| 1 || DisableDspUsageMeasurement
|-
| 6 || GetDspUsage
|}
|}


Line 229: Line 257:
| 0 || OpenAudioRenderer
| 0 || OpenAudioRenderer
|-
|-
| 1 || GetAudioRendererWorkBufferSize
| 1 || GetWorkBufferSize
|-
|-
| 2 || GetAudioDeviceService
| 2 || [[#GetAudioDeviceService]]
|-
|-
| 3 || [3.0.0+] OpenAudioRendererAuto
| 3 || [3.0.0+] OpenAudioRendererForManualExecution
|-
|-
| 4 || [4.0.0+] GetAudioDeviceServiceWithRevisionInfo
| 4 || [4.0.0+] GetAudioDeviceServiceWithRevisionInfo
|}
|}
=== GetAudioDeviceService ===
Takes an input u64 [[AM_services#AppletResourceUserId|AppletResourceUserId]], returns an output [[#IAudioDevice]].


== IAudioRenderer ==
== IAudioRenderer ==
Line 295: Line 326:
! Cmd || Name
! Cmd || Name
|-
|-
| 0 || ListAudioDeviceName
| 0 || [[#ListAudioDeviceName]]
|-
|-
| 1 || SetAudioDeviceOutputVolume
| 1 || [[#SetAudioDeviceOutputVolume]]
|-
|-
| 2 || GetAudioDeviceOutputVolume
| 2 || [[#GetAudioDeviceOutputVolume]]
|-
|-
| 3 || GetActiveAudioDeviceName
| 3 || GetActiveAudioDeviceName
Line 307: Line 338:
| 5 || GetActiveChannelCount
| 5 || GetActiveChannelCount
|-
|-
| 6 || [3.0.0+] ListAudioDeviceNameAuto
| 6 || [3.0.0+] [[#ListAudioDeviceNameAuto]]
|-
|-
| 7 || [3.0.0+] SetAudioDeviceOutputVolumeAuto
| 7 || [3.0.0+] [[#SetAudioDeviceOutputVolumeAuto]]
|-
|-
| 8 || [3.0.0+] GetAudioDeviceOutputVolumeAuto
| 8 || [3.0.0+] [[#GetAudioDeviceOutputVolumeAuto]]
|-
|-
| 10 || [3.0.0+] GetActiveAudioDeviceNameAuto
| 10 || [3.0.0+] GetActiveAudioDeviceNameAuto
Line 321: Line 352:
| 13 || [5.0.0+] GetAudioSystemMasterVolumeSetting
| 13 || [5.0.0+] GetAudioSystemMasterVolumeSetting
|}
|}
=== ListAudioDeviceName ===
Takes a type-0x6 output buffer containing an array of '''DeviceName''', returns an output s32 for total number of output entries.
=== SetAudioDeviceOutputVolume ===
Takes a type-0x5 input buffer containing the '''DeviceName''' and a float. No output.
=== GetAudioDeviceOutputVolume ===
Takes a type-0x5 input buffer containing the '''DeviceName'''. Returns an output float.
=== ListAudioDeviceNameAuto ===
Takes a type-0x22 output buffer containing an array of '''DeviceName''', returns an output s32 for total number of output entries.
=== SetAudioDeviceOutputVolumeAuto ===
Takes a type-0x21 input buffer containing the '''DeviceName''' and a float. No output.
=== GetAudioDeviceOutputVolumeAuto ===
Takes a type-0x21 input buffer containing the '''DeviceName'''. Returns an output float.


= audout:a =
= audout:a =
Line 341: Line 390:
| 5 || [4.0.0+] SetAudioOutsProcessRecordVolume
| 5 || [4.0.0+] SetAudioOutsProcessRecordVolume
|}
|}
[4.0.0+] RequestSuspendAudioOuts/RequestResumeAudioOuts no longer returns an output handle.


= audin:a =
= audin:a =
Line 357: Line 408:
| 3 || SetAudioInsProcessMasterVolume
| 3 || SetAudioInsProcessMasterVolume
|}
|}
[4.0.0+] RequestSuspendAudioIns/RequestResumeAudioIns no longer returns an output handle.


= audrec:a =
= audrec:a =
Line 369: Line 422:
| 1 || RequestResumeFinalOutputRecorders
| 1 || RequestResumeFinalOutputRecorders
|}
|}
[4.0.0+] RequestSuspendFinalOutputRecorders/RequestResumeFinalOutputRecorders no longer returns an output handle.


= audren:a =
= audren:a =
Line 393: Line 448:
| 7 || [4.0.0+] SetAudioRenderersProcessRecordVolume
| 7 || [4.0.0+] SetAudioRenderersProcessRecordVolume
|}
|}
[4.0.0+] RequestSuspendAudioRenderers/RequestResumeAudioRenderers no longer returns an output handle.


= audout:d, audin:d, audrec:d, audren:d =
= audout:d, audin:d, audrec:d, audren:d =
Line 472: Line 529:
|-
|-
| 26 || [4.0.0+] UpdateHeadphoneSettings
| 26 || [4.0.0+] UpdateHeadphoneSettings
|-
| 27 || [7.0.0+] SetVolumeMappingTableForDev
|}
|}


Line 560: Line 619:
| 1 || [[#GetWorkBufferSize]]
| 1 || [[#GetWorkBufferSize]]
|-
|-
| 2 || [3.0.0+] InitializeMultiStream
| 2 || [3.0.0+] [[#OpenHardwareOpusDecoderForMultiStream]]
|-
|-
| 3 || [3.0.0+] GetWorkBufferSizeMultiStream
| 3 || [3.0.0+] [[#GetWorkBufferSizeForMultiStream]]
|}
|}
Official sw can use either software libopus, or hwopus via "nn::codec::HardwareOpus*" (separate from the former).


== Initialize ==
== Initialize ==
Takes two u32s '''SampleRate''' and '''ChannelCount''' packed as an u64, an u32 '''WorkBufferSize''' and a TransferMemory handle for '''WorkBuffer'''. Returns an [[#IHardwareOpusDecoder]] object. The TransferMemory is created by the user-process with permissions=0.
Takes two s32s '''SampleRate''' and '''ChannelCount''' packed as an u64, an u32 '''WorkBufferSize''' and a TransferMemory handle for '''WorkBuffer'''. Returns an [[#IHardwareOpusDecoder]] object. The TransferMemory is created by the user-process with permissions=0.


== GetWorkBufferSize==
== GetWorkBufferSize==
Takes two u32s '''SampleRate''' and '''ChannelCount''' packed as an u64. Returns the required size for the decoder's work buffer.
Takes two s32s '''SampleRate''' and '''ChannelCount''' packed as an u64. Returns the u32 required size for the decoder's work buffer. Official user-processes align the output size to page-alignment.
 
== OpenHardwareOpusDecoderForMultiStream ==
Takes a type-0x19 input buffer, an u32 '''WorkBufferSize''' and a TransferMemory handle for '''WorkBuffer'''. Returns an [[#IHardwareOpusDecoder]] object. The TransferMemory is created by the user-process with permissions=0.
 
The input buffer is a [[#MultiStreamParameters]] struct. The user-process initializes this struct the same way as [[#GetWorkBufferSizeForMultiStream]], except that an u8-array specified by the user is copied to +0x10 with size '''ChannelCount''', when '''ChannelCount''' above 0.
 
== GetWorkBufferSizeForMultiStream ==
Takes a type-0x19 input buffer. Returns the u32 required size for the decoder's work buffer. Official user-processes align the output size to page-alignment.
 
The input buffer is a [[#MultiStreamParameters]] struct.
 
== MultiStreamParameters ==
{| class="wikitable" border="1"
|-
! Offset
! Size
! Description
|-
| 0x0
| 0x4
| Sample rate (Hz)
|-
| 0x4
| 0x4
| Number of channels
|-
| 0x8
| 0x4
| Number of streams
|-
| 0xC
| 0x4
| Number of stereo streams
|-
| 0x10
| 0x100
| u8 array of channel mappings
|}


== IHardwareOpusDecoder ==
== IHardwareOpusDecoder ==
Line 582: Line 681:
| 1 || [[#SetContext]]
| 1 || [[#SetContext]]
|-
|-
| 2 || [4.0.0+] DecodeInterleavedForMultiStreamOld ([3.0.0-3.0.2] DecodeInterleavedForMultiStream)
| 2 || [4.0.0+] [[#DecodeInterleavedForMultiStreamOld]] ([3.0.0-3.0.2] DecodeInterleavedForMultiStream)
|-
|-
| 3 || [3.0.0+] SetContextForMultiStream
| 3 || [3.0.0+] [[#SetContextForMultiStream]]
|-
|-
| 4 || [6.0.0+] DecodeInterleavedWithPerfOld ([4.0.0-5.1.0] DecodeInterleavedWithPerf)
| 4 || [6.0.0+] [[#DecodeInterleavedWithPerfOld]] ([4.0.0-5.1.0] DecodeInterleavedWithPerf)
|-
|-
| 5 || [6.0.0+] DecodeInterleavedForMultiStreamWithPerfOld ([4.0.0-5.1.0] DecodeInterleavedForMultiStreamWithPerf)
| 5 || [6.0.0+] [[#DecodeInterleavedForMultiStreamWithPerfOld]] ([4.0.0-5.1.0] DecodeInterleavedForMultiStreamWithPerf)
|-
|-
| 6 || [6.0.0+] DecodeInterleaved
| 6 || [6.0.0+] [[#DecodeInterleaved]]
|-
|-
| 7 || [6.0.0+] DecodeInterleavedForMultiStream
| 7 || [6.0.0+] [[#DecodeInterleavedForMultiStream]]
|-
| 8 || [7.0.0+]
|-
| 9 || [7.0.0+]
|}
|}


=== DecodeInterleavedOld ===
=== DecodeInterleavedOld ===
Takes a type-5 input buffer ('''OpusDataIn''') and a type-6 output buffer ('''PcmDataOut'''). Decodes the Opus source data to PCM and returns two u32s '''DecodedSampleCount''' and '''DecodedDataSize'''.
Takes a type-5 input buffer ('''OpusDataIn''') and a type-6 output buffer ('''PcmDataOut'''). Decodes the Opus source data to PCM and returns output s32 '''DecodedDataSize''' and s32 '''DecodedSampleCount'''.
 
Calls the same func as [[#DecodeInterleaved]] internally with flag=0 and out_u64_ptr=NULL.


=== SetContext ===
=== SetContext ===
Takes a type-5 input buffer ('''DecoderContextIn'''). Sends the unknown context data to the hardware decoder. The input buffer is unused.
=== DecodeInterleavedForMultiStreamOld ===
Takes a type-5 input buffer ('''OpusDataIn''') and a type-6 output buffer ('''PcmDataOut'''). Decodes the Opus source data to PCM and returns output s32 '''DecodedDataSize''' and s32 '''DecodedSampleCount'''.
Calls the same func as [[#DecodeInterleavedForMultiStream]] internally with flag=0 and out_u64_ptr=NULL.
=== SetContextForMultiStream ===
Takes a type-5 input buffer ('''DecoderContextIn'''). Sends the unknown context data to the hardware decoder.
Takes a type-5 input buffer ('''DecoderContextIn'''). Sends the unknown context data to the hardware decoder.
=== DecodeInterleavedWithPerfOld ===
Takes a type-0x5 input buffer ('''OpusDataIn''') and a type-0x46 output buffer ('''PcmDataOut'''). Decodes the Opus source data to PCM and returns output s32 '''DecodedDataSize''', s32 '''DecodedSampleCount''', and an u64.
The output u64 is ignored by official user-processes.
Calls the same func as [[#DecodeInterleaved]] internally with flag=0.
=== DecodeInterleavedForMultiStreamWithPerfOld ===
Takes a type-0x5 input buffer ('''OpusDataIn''') and a type-0x46 output buffer ('''PcmDataOut'''). Decodes the Opus source data to PCM and returns output s32 '''DecodedDataSize''', s32 '''DecodedSampleCount''', and an u64.
The output u64 is ignored by official user-processes.
Calls the same func as [[#DecodeInterleavedForMultiStream]] internally with flag=0.
=== DecodeInterleaved ===
Takes an input u8 bool flag, a type-0x5 input buffer ('''OpusDataIn''') and a type-0x46 output buffer ('''PcmDataOut'''). Decodes the Opus source data to PCM and returns output s32 '''DecodedDataSize''', s32 '''DecodedSampleCount''', and an u64.
The bool flag indicates whether or not a reset of the decoder context is being requested.
=== DecodeInterleavedForMultiStream ===
Takes an input u8 bool flag, a type-0x5 input buffer ('''OpusDataIn''') and a type-0x46 output buffer ('''PcmDataOut'''). Decodes the Opus source data to PCM and returns output s32 '''DecodedDataSize''', s32 '''DecodedSampleCount''', and an u64.
The bool flag indicates whether or not a reset of the decoder context is being requested.


= auddebug =
= auddebug =
Line 610: Line 747:
! Cmd || Name
! Cmd || Name
|-
|-
| 0 ||
| 0 || StartDspProfiler
|-
|-
| 1 ||
| 1 || StopDspProfiler
|-
|-
| 2 ||
| 2 || StartCpuProfiler
|-
|-
| 3 ||
| 3 || StopCpuProfiler
|}
|}


[[Category:Services]]
[[Category:Services]]