mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-05-18 17:34:52 +00:00
audioout: Add error returns when not initialized. (#2309)
This commit is contained in:
parent
259d5ef60b
commit
e1550c9091
1 changed files with 16 additions and 0 deletions
|
@ -89,6 +89,9 @@ int PS4_SYSV_ABI sceAudioOutChangeAppModuleState() {
|
||||||
|
|
||||||
int PS4_SYSV_ABI sceAudioOutClose(s32 handle) {
|
int PS4_SYSV_ABI sceAudioOutClose(s32 handle) {
|
||||||
LOG_INFO(Lib_AudioOut, "handle = {}", handle);
|
LOG_INFO(Lib_AudioOut, "handle = {}", handle);
|
||||||
|
if (audio == nullptr) {
|
||||||
|
return ORBIS_AUDIO_OUT_ERROR_NOT_INIT;
|
||||||
|
}
|
||||||
if (handle < 1 || handle > SCE_AUDIO_OUT_NUM_PORTS) {
|
if (handle < 1 || handle > SCE_AUDIO_OUT_NUM_PORTS) {
|
||||||
return ORBIS_AUDIO_OUT_ERROR_INVALID_PORT;
|
return ORBIS_AUDIO_OUT_ERROR_INVALID_PORT;
|
||||||
}
|
}
|
||||||
|
@ -171,6 +174,9 @@ int PS4_SYSV_ABI sceAudioOutGetLastOutputTime() {
|
||||||
}
|
}
|
||||||
|
|
||||||
int PS4_SYSV_ABI sceAudioOutGetPortState(s32 handle, OrbisAudioOutPortState* state) {
|
int PS4_SYSV_ABI sceAudioOutGetPortState(s32 handle, OrbisAudioOutPortState* state) {
|
||||||
|
if (audio == nullptr) {
|
||||||
|
return ORBIS_AUDIO_OUT_ERROR_NOT_INIT;
|
||||||
|
}
|
||||||
if (handle < 1 || handle > SCE_AUDIO_OUT_NUM_PORTS) {
|
if (handle < 1 || handle > SCE_AUDIO_OUT_NUM_PORTS) {
|
||||||
return ORBIS_AUDIO_OUT_ERROR_INVALID_PORT;
|
return ORBIS_AUDIO_OUT_ERROR_INVALID_PORT;
|
||||||
}
|
}
|
||||||
|
@ -305,6 +311,10 @@ s32 PS4_SYSV_ABI sceAudioOutOpen(UserService::OrbisUserServiceUserId user_id,
|
||||||
user_id, magic_enum::enum_name(port_type), index, length, sample_rate,
|
user_id, magic_enum::enum_name(port_type), index, length, sample_rate,
|
||||||
magic_enum::enum_name(param_type.data_format.Value()),
|
magic_enum::enum_name(param_type.data_format.Value()),
|
||||||
magic_enum::enum_name(param_type.attributes.Value()));
|
magic_enum::enum_name(param_type.attributes.Value()));
|
||||||
|
if (audio == nullptr) {
|
||||||
|
LOG_ERROR(Lib_AudioOut, "Audio out not initialized");
|
||||||
|
return ORBIS_AUDIO_OUT_ERROR_NOT_INIT;
|
||||||
|
}
|
||||||
if ((port_type < OrbisAudioOutPort::Main || port_type > OrbisAudioOutPort::Padspk) &&
|
if ((port_type < OrbisAudioOutPort::Main || port_type > OrbisAudioOutPort::Padspk) &&
|
||||||
(port_type != OrbisAudioOutPort::Aux)) {
|
(port_type != OrbisAudioOutPort::Aux)) {
|
||||||
LOG_ERROR(Lib_AudioOut, "Invalid port type");
|
LOG_ERROR(Lib_AudioOut, "Invalid port type");
|
||||||
|
@ -368,6 +378,9 @@ int PS4_SYSV_ABI sceAudioOutOpenEx() {
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 PS4_SYSV_ABI sceAudioOutOutput(s32 handle, void* ptr) {
|
s32 PS4_SYSV_ABI sceAudioOutOutput(s32 handle, void* ptr) {
|
||||||
|
if (audio == nullptr) {
|
||||||
|
return ORBIS_AUDIO_OUT_ERROR_NOT_INIT;
|
||||||
|
}
|
||||||
if (handle < 1 || handle > SCE_AUDIO_OUT_NUM_PORTS) {
|
if (handle < 1 || handle > SCE_AUDIO_OUT_NUM_PORTS) {
|
||||||
return ORBIS_AUDIO_OUT_ERROR_INVALID_PORT;
|
return ORBIS_AUDIO_OUT_ERROR_INVALID_PORT;
|
||||||
}
|
}
|
||||||
|
@ -489,6 +502,9 @@ int PS4_SYSV_ABI sceAudioOutSetUsbVolume() {
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 PS4_SYSV_ABI sceAudioOutSetVolume(s32 handle, s32 flag, s32* vol) {
|
s32 PS4_SYSV_ABI sceAudioOutSetVolume(s32 handle, s32 flag, s32* vol) {
|
||||||
|
if (audio == nullptr) {
|
||||||
|
return ORBIS_AUDIO_OUT_ERROR_NOT_INIT;
|
||||||
|
}
|
||||||
if (handle < 1 || handle > SCE_AUDIO_OUT_NUM_PORTS) {
|
if (handle < 1 || handle > SCE_AUDIO_OUT_NUM_PORTS) {
|
||||||
return ORBIS_AUDIO_OUT_ERROR_INVALID_PORT;
|
return ORBIS_AUDIO_OUT_ERROR_INVALID_PORT;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue