Skip to content

Commit

Permalink
audctl: Updated sysver checks.
Browse files Browse the repository at this point in the history
  • Loading branch information
yellows8 committed Nov 24, 2024
1 parent 6c430b2 commit d4f5f4b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
10 changes: 5 additions & 5 deletions nx/include/switch/services/audctl.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,21 +48,21 @@ Result audctlGetTargetVolumeMin(s32* volume_out);
Result audctlGetTargetVolumeMax(s32* volume_out);
Result audctlIsTargetMute(bool* mute_out, AudioTarget target);
Result audctlSetTargetMute(AudioTarget target, bool mute);
Result audctlIsTargetConnected(bool* connected_out, AudioTarget target);
Result audctlIsTargetConnected(bool* connected_out, AudioTarget target); ///< [1.0.0-17.0.1]
Result audctlSetDefaultTarget(AudioTarget target, u64 fade_in_ns, u64 fade_out_ns);
Result audctlGetDefaultTarget(AudioTarget* target_out);
Result audctlGetAudioOutputMode(AudioOutputMode* mode_out, AudioTarget target);
Result audctlSetAudioOutputMode(AudioTarget target, AudioOutputMode mode);
Result audctlSetForceMutePolicy(AudioForceMutePolicy policy);
Result audctlGetForceMutePolicy(AudioForceMutePolicy* policy_out);
Result audctlSetForceMutePolicy(AudioForceMutePolicy policy); ///< [1.0.0-13.2.1]
Result audctlGetForceMutePolicy(AudioForceMutePolicy* policy_out); ///< [1.0.0-13.2.1]
Result audctlGetOutputModeSetting(AudioOutputMode* mode_out, AudioTarget target);
Result audctlSetOutputModeSetting(AudioTarget target, AudioOutputMode mode);
Result audctlSetOutputTarget(AudioTarget target);
Result audctlSetInputTargetForceEnabled(bool enable);
Result audctlSetHeadphoneOutputLevelMode(AudioHeadphoneOutputLevelMode mode); ///< [3.0.0+]
Result audctlGetHeadphoneOutputLevelMode(AudioHeadphoneOutputLevelMode* mode_out); ///< [3.0.0+]
Result audctlAcquireAudioVolumeUpdateEventForPlayReport(Event* event_out); ///< [3.0.0+]
Result audctlAcquireAudioOutputDeviceUpdateEventForPlayReport(Event* event_out); ///< [3.0.0+]
Result audctlAcquireAudioVolumeUpdateEventForPlayReport(Event* event_out); ///< [3.0.0-13.2.1]
Result audctlAcquireAudioOutputDeviceUpdateEventForPlayReport(Event* event_out); ///< [3.0.0-13.2.1]
Result audctlGetAudioOutputTargetForPlayReport(AudioTarget* target_out); ///< [3.0.0+]
Result audctlNotifyHeadphoneVolumeWarningDisplayedEvent(void); ///< [3.0.0+]
Result audctlSetSystemOutputMasterVolume(float volume); ///< [4.0.0+]
Expand Down
13 changes: 11 additions & 2 deletions nx/source/services/audctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,9 @@ Result audctlSetTargetMute(AudioTarget target, bool mute) {
}

Result audctlIsTargetConnected(bool* connected_out, AudioTarget target) {
if (hosversionAtLeast(18,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);

const struct {
u32 target;
} in = { target };
Expand Down Expand Up @@ -166,6 +169,9 @@ Result audctlSetAudioOutputMode(AudioTarget target, AudioOutputMode mode) {
}

Result audctlSetForceMutePolicy(AudioForceMutePolicy policy) {
if (hosversionAtLeast(14,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);

const struct {
u32 policy;
} in = { policy };
Expand All @@ -174,6 +180,9 @@ Result audctlSetForceMutePolicy(AudioForceMutePolicy policy) {
}

Result audctlGetForceMutePolicy(AudioForceMutePolicy* policy_out) {
if (hosversionAtLeast(14,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);

struct {
u32 policy;
} out;
Expand Down Expand Up @@ -256,7 +265,7 @@ Result audctlGetHeadphoneOutputLevelMode(AudioHeadphoneOutputLevelMode* mode_out
}

Result audctlAcquireAudioVolumeUpdateEventForPlayReport(Event* event_out) {
if (hosversionBefore(3,0,0))
if (!hosversionBetween(3,14))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);

Handle tmp_handle;
Expand All @@ -274,7 +283,7 @@ Result audctlAcquireAudioVolumeUpdateEventForPlayReport(Event* event_out) {
}

Result audctlAcquireAudioOutputDeviceUpdateEventForPlayReport(Event* event_out) {
if (hosversionBefore(3,0,0))
if (!hosversionBetween(3,14))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);

Handle tmp_handle;
Expand Down

0 comments on commit d4f5f4b

Please sign in to comment.