Audio services: Difference between revisions

 
(24 intermediate revisions by 3 users not shown)
Line 332: Line 332:
! Cmd || Name
! Cmd || Name
|-
|-
| 0 || EnableDspUsageMeasurement
| 0 || [17.0.0+] GetDspStatistics ([6.0.0-16.1.0] EnableDspUsageMeasurement)
|-
|-
| 1 || DisableDspUsageMeasurement
| 1 || [20.0.0+] GetAppletStateSummaries ([6.0.0-16.1.0] DisableDspUsageMeasurement)
|-
|-
| 6 || GetDspUsage
| 2 || [20.0.0+] SetDspStatisticsParameter
|-
| 3 || [20.0.0+] GetDspStatisticsParameter
|-
| 6 || [6.0.0-16.1.0] GetDspUsage
|}
|}


Line 390: Line 394:
|-
|-
| 11 || [3.0.0+] ExecuteAudioRendererRendering
| 11 || [3.0.0+] ExecuteAudioRendererRendering
|-
| 12 || [15.0.0+] SetVoiceDropParameter
|-
| 13 || [15.0.0+] GetVoiceDropParameter
|}
|}


Line 441: Line 449:
| 12 || [3.0.0+] QueryAudioDeviceOutputEvent
| 12 || [3.0.0+] QueryAudioDeviceOutputEvent
|-
|-
| 13 || [5.0.0+] GetAudioSystemMasterVolumeSetting
| 13 || [13.0.0+] [[#GetActiveAudioOutputDeviceName]] ([5.0.0-12.1.0] [[#GetAudioSystemMasterVolumeSetting]])
|-
|-
| 14 || [13.0.0+]
| 14 || [13.0.0+] ListAudioOutputDeviceName
|-
| 15 || [17.0.0+] AcquireAudioInputDeviceNotification
|-
| 16 || [17.0.0+] ReleaseAudioInputDeviceNotification
|-
| 17 || [17.0.0+] AcquireAudioOutputDeviceNotification
|-
| 18 || [17.0.0+] ReleaseAudioOutputDeviceNotification
|-
| 19 || [18.0.0+] SetAudioDeviceOutputVolumeAutoTuneEnabled
|-
| 20 || [18.0.0+] IsAudioDeviceOutputVolumeAutoTuneEnabled
|}
|}


Line 463: Line 483:
=== GetAudioDeviceOutputVolumeAuto ===
=== GetAudioDeviceOutputVolumeAuto ===
Takes a type-0x21 input buffer containing the '''DeviceName'''. Returns an output float.
Takes a type-0x21 input buffer containing the '''DeviceName'''. Returns an output float.
=== GetAudioSystemMasterVolumeSetting ===
Takes a type-0x5 input buffer, returns 4-bytes of output.
=== GetActiveAudioOutputDeviceName ===
Takes a type-0x6 output buffer, returns no output.


= audout:a =
= audout:a =
Line 589: Line 615:
| 5 || SetTargetMute
| 5 || SetTargetMute
|-
|-
| 6 || IsTargetConnected
| 6 || [20.0.0+] ([1.0.0-17.0.1] IsTargetConnected)
|-
|-
| 7 || SetDefaultTarget
| 7 || SetDefaultTarget
Line 599: Line 625:
| 10 || SetAudioOutputMode
| 10 || SetAudioOutputMode
|-
|-
| 11 || SetForceMutePolicy
| 11 || [1.0.0-13.2.1] SetForceMutePolicy
|-
|-
| 12 || GetForceMutePolicy
| 12 || [1.0.0-13.2.1] GetForceMutePolicy
|-
|-
| 13 || GetOutputModeSetting
| 13 || GetOutputModeSetting
Line 615: Line 641:
| 18 || [3.0.0+] GetHeadphoneOutputLevelMode
| 18 || [3.0.0+] GetHeadphoneOutputLevelMode
|-
|-
| 19 || [3.0.0+] AcquireAudioVolumeUpdateEventForPlayReport
| 19 || [17.0.0+] SetForceMonauralOutputModeEnabled ([3.0.0-13.2.1] AcquireAudioVolumeUpdateEventForPlayReport)
|-
|-
| 20 || [3.0.0+] AcquireAudioOutputDeviceUpdateEventForPlayReport
| 20 || [17.0.0+] IsForceMonauralOutputModeEnabled ([3.0.0-13.2.1] AcquireAudioOutputDeviceUpdateEventForPlayReport)
|-
|-
| 21 || [3.0.0+] GetAudioOutputTargetForPlayReport
| 21 || [3.0.0-13.2.1] GetAudioOutputTargetForPlayReport
|-
|-
| 22 || [3.0.0+] NotifyHeadphoneVolumeWarningDisplayedEvent
| 22 || [3.0.0+] NotifyHeadphoneVolumeWarningDisplayedEvent
|-
|-
| 23 || [4.0.0+] SetSystemOutputMasterVolume
| 23 || [4.0.0+] [[#SetSystemOutputMasterVolume]]
|-
| 24 || [4.0.0+] [[#GetSystemOutputMasterVolume]]
|-
| 25 || [20.0.0+] ([4.0.0-13.2.1] [[#GetAudioVolumeDataForPlayReport]])
|-
| 26 || [4.0.0-14.1.2] [[#UpdateHeadphoneSettings]]
|-
| 27 || [7.0.0-16.1.0] SetVolumeMappingTableForDev
|-
|-
| 24 || [4.0.0+] GetSystemOutputMasterVolume
| 28 || [10.0.0-13.2.1] GetAudioOutputChannelCountForPlayReport
|-
|-
| 25 || [4.0.0+] [[#GetAudioVolumeDataForPlayReport]]
| 29 || [10.0.0-13.2.1] BindAudioOutputChannelCountUpdateEventForPlayReport
|-
|-
| 26 || [4.0.0+] [[#UpdateHeadphoneSettings]]
| 30 || [13.0.0+] SetSpeakerAutoMuteEnabled
|-
|-
| 27 || [7.0.0+] SetVolumeMappingTableForDev
| 31 || [13.0.0+] IsSpeakerAutoMuteEnabled
|-
|-
| 28 || [10.0.0+] GetAudioOutputChannelCountForPlayReport
| 32 || [13.0.0+] GetActiveOutputTarget
|-
|-
| 29 || [10.0.0+] BindAudioOutputChannelCountUpdateEventForPlayReport
| 33 || [13.0.0+] GetTargetDeviceInfo
|-
|-
| 30 || [13.0.0+]
| 34 || [13.0.0+] AcquireTargetNotification
|-
|-
| 31 || [13.0.0+]
| 35 || [14.0.0-14.1.2] SetHearingProtectionSafeguardTimerRemainingTimeForDebug
|-
|-
| 32 || [13.0.0+]
| 36 || [14.0.0-14.1.2] GetHearingProtectionSafeguardTimerRemainingTimeForDebug
|-
|-
| 33 || [13.0.0+]
| 37 || [14.0.0-14.1.2] SetHearingProtectionSafeguardEnabled
|-
|-
| 34 || [13.0.0+]
| 38 || [14.0.0-14.1.2] IsHearingProtectionSafeguardEnabled
|-
|-
| 10000 || [13.0.0+]
| 39 || [14.0.0-14.1.2] IsHearingProtectionSafeguardMonitoringOutputForDebug
|-
|-
| 10001 || [13.0.0+]
| 40 || [14.0.0+] [[#GetSystemInformationForDebug]]
|-
|-
| 10002 || [13.0.0+]
| 41 || [15.0.0-19.0.1] SetVolumeButtonLongPressTime
|-
| 42 || [15.0.0+] SetNativeVolumeForDebug
|-
| 5000 || [19.0.0+]
|-
| 10000 || [13.0.0-19.0.1] NotifyAudioOutputTargetForPlayReport
|-
| 10001 || [13.0.0-19.0.1] NotifyAudioOutputChannelCountForPlayReport
|-
| 10002 || [13.0.0-19.0.1] NotifyUnsupportedUsbOutputDeviceAttachedForPlayReport
|-
| 10100 || [14.0.0+] [[#GetAudioVolumeDataForPlayReport]]
|-
| 10101 || [14.0.0+] BindAudioVolumeUpdateEventForPlayReport
|-
| 10102 || [14.0.0-19.0.1] BindAudioOutputTargetUpdateEventForPlayReport
|-
| 10103 || [14.0.0-19.0.1] GetAudioOutputTargetForPlayReport
|-
| 10104 || [14.0.0-19.0.1] GetAudioOutputChannelCountForPlayReport
|-
| 10105 || [14.0.0-19.0.1] BindAudioOutputChannelCountUpdateEventForPlayReport
|-
| 10106 || [14.0.0-19.0.1] GetDefaultAudioOutputTargetForPlayReport
|-
| 10200 || [20.0.0+]
|-
| 50000 || [15.0.0-18.1.0] SetAnalogInputBoostGainForPrototyping
|-
| 50001 || [19.0.0-19.0.1] OverrideDefaultTargetForDebug
|-
| 50003 || [19.0.0+] SetForceOverrideExternalDeviceNameForDebug
|-
| 50004 || [19.0.0+] ClearForceOverrideExternalDeviceNameForDebug
|}
|}
== SetSystemOutputMasterVolume ==
Takes an input float '''SystemOutputMasterVolume'''. No output.
[20.0.0+] Originally any input was accepted, now input must be in range 0.0-1.0 otherwise it's replaced by nearest accepted value.
== GetSystemOutputMasterVolume ==
No input. Returns an output float '''SystemOutputMasterVolume'''.


== GetAudioVolumeDataForPlayReport ==
== GetAudioVolumeDataForPlayReport ==
[13.0.0] Updated.
No input, returns a total of 7-bytes of output.
 
[13.0.0+] No input, returns a total of 9-bytes of output.


=== UpdateHeadphoneSettings ===
[20.0.0+] Now takes a 0x400-bytes type-0x16 output buffer and no longer returns any output.
 
== UpdateHeadphoneSettings ==
Takes one input bool. No output.
Takes one input bool. No output.
NS calls this with the result of IParentalControlService::IsRestrictionEnabled[https://switchbrew.org/wiki/Parental_Control_services#IParentalControlService].
 
NS calls this with the result of [[Parental_Control_services#IParentalControlService|IParentalControlService::IsRestrictionEnabled]].
 
== GetSystemInformationForDebug ==
Takes a type-0x1A output buffer. No output.
 
[15.0.0+] Now takes a type-0x16 output buffer.
 
[18.0.0+] Originally the output buffer was a binary structure, now it's just a string.
 
[20.0.0+] Now takes a total of 0x40-bytes of input and the type-0x16 output buffer is now 0x2000-bytes instead of 0x1000-bytes.


= codecctl =
= codecctl =
Line 758: Line 848:
|-
|-
| 7 || [12.0.0+] GetWorkBufferSizeForMultiStreamEx
| 7 || [12.0.0+] GetWorkBufferSizeForMultiStreamEx
|-
| 8 || [16.0.0+] GetWorkBufferSizeExEx
|-
| 9 || [16.0.0+] GetWorkBufferSizeForMultiStreamExEx
|}
|}


Line 910: Line 1,004:
|-
|-
| 9 || SetAudioOutputProcessRecordVolume
| 9 || SetAudioOutputProcessRecordVolume
|-
| 10 || [18.0.0-19.0.1] GetAppletStateSummaries
|}
|}


Line 1,351: Line 1,447:
| u8 array of channel mappings
| u8 array of channel mappings
|}
|}
= Notes =
Once nnMain finishes running, it calls a func which handles ADSP Aborts. This waits on an event, calls a func, then Aborts with Result 0xC0899.
That func just calls another func, which:
* Calls various AGIC funcs for this IRQ, etc.
* Copies data from devicemem+0x608C (the 0x7000-byte devicemem "shared memory segment") to a stack struct.
* A funcptr is called if set with the above struct, then this returns.
That funcptr, besides other func-calls, will log an [[Error_Report_services|erpt]] using the input struct when set with the "AdspException*" fields.
This is triggered by AGIC IRQ adsp_wdresetreq, "ADSP Watchdog Timer Reset Request". The ADSP updates the watchdog from a thread, so normally the watchdog only expires when the ADSP configures it to trigger immediately.
When handling an assert/exception, the ADSP:
* Logs exception info in text form into devicemem.
* Logs the binary form of the exception into devicemem (offset above).
* Eventually configures the watchdog to trigger immediately, prints "HALT: spinning forever...\n", then enters a loop using instruction "wfe".


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