From c9066e72367d8c6fcbc54f711759f15ba772e190 Mon Sep 17 00:00:00 2001 From: Eladash Date: Thu, 24 Oct 2019 18:41:31 +0300 Subject: [PATCH] cellVoice Update * Use shared lock wherever possible. * Fix cellVoiceSetVolume. * Fix error logging of cellVoiceCreateNotifyEventQueue, cellAudioCreateNotifyEventQueue --- rpcs3/Emu/Cell/Modules/cellAudio.cpp | 2 +- rpcs3/Emu/Cell/Modules/cellVoice.cpp | 43 ++++++++++++++-------------- 2 files changed, 23 insertions(+), 22 deletions(-) diff --git a/rpcs3/Emu/Cell/Modules/cellAudio.cpp b/rpcs3/Emu/Cell/Modules/cellAudio.cpp index efad968642..eb29cd589f 100644 --- a/rpcs3/Emu/Cell/Modules/cellAudio.cpp +++ b/rpcs3/Emu/Cell/Modules/cellAudio.cpp @@ -1332,7 +1332,7 @@ error_code cellAudioCreateNotifyEventQueue(vm::ptr id, vm::ptr key) // Create an event queue "bruteforcing" an available key const u64 key_value = 0x80004d494f323221ull + i; - if (const s32 res = sys_event_queue_create(id, attr, key_value, 32)) + if (CellError res{sys_event_queue_create(id, attr, key_value, 32) + 0u}) { if (res != CELL_EEXIST) { diff --git a/rpcs3/Emu/Cell/Modules/cellVoice.cpp b/rpcs3/Emu/Cell/Modules/cellVoice.cpp index bf21cffa6f..27c26e8c0d 100644 --- a/rpcs3/Emu/Cell/Modules/cellVoice.cpp +++ b/rpcs3/Emu/Cell/Modules/cellVoice.cpp @@ -52,7 +52,7 @@ error_code cellVoiceConnectIPortToOPort(u32 ips, u32 ops) const auto manager = g_fxo->get(); - std::scoped_lock lock(manager->mtx); + std::shared_lock lock(manager->mtx); if (manager->is_init) return CELL_VOICE_ERROR_LIBVOICE_NOT_INIT; @@ -76,7 +76,7 @@ error_code cellVoiceCreateNotifyEventQueue(vm::ptr id, vm::ptr key) auto manager = g_fxo->get(); - std::scoped_lock lock(manager->mtx); + std::shared_lock lock(manager->mtx); if (!manager->is_init) return CELL_VOICE_ERROR_LIBVOICE_NOT_INIT; @@ -90,7 +90,7 @@ error_code cellVoiceCreateNotifyEventQueue(vm::ptr id, vm::ptr key) { // Create an event queue "bruteforcing" an available key const u64 key_value = 0x80004d494f323285ull + i; - if (const s32 res = sys_event_queue_create(id, attr, key_value, 0x40)) + if (CellError res{sys_event_queue_create(id, attr, key_value, 0x40) + 0u}) { if (res != CELL_EEXIST) { @@ -135,7 +135,7 @@ error_code cellVoiceCreatePort(vm::ptr portId, vm::cptr case CELLVOICE_PORTTYPE_OUT_VOICE: { // Must be an exact value - switch (auto bitrate = pArg->voice.bitrate) + switch (pArg->voice.bitrate) { case CELLVOICE_BITRATE_3850: case CELLVOICE_BITRATE_4650: @@ -206,7 +206,7 @@ error_code cellVoiceDisconnectIPortFromOPort(u32 ips, u32 ops) const auto manager = g_fxo->get(); - std::scoped_lock lock(manager->mtx); + std::shared_lock lock(manager->mtx); if (!manager->is_init) return CELL_VOICE_ERROR_LIBVOICE_NOT_INIT; @@ -261,7 +261,7 @@ error_code cellVoiceGetBitRate(u32 portId, vm::ptr bitrate) const auto manager = g_fxo->get(); - std::scoped_lock lock(manager->mtx); + std::shared_lock lock(manager->mtx); if (!manager->is_init) return CELL_VOICE_ERROR_LIBVOICE_NOT_INIT; @@ -286,7 +286,7 @@ error_code cellVoiceGetMuteFlag(u32 portId, vm::ptr bMuted) const auto manager = g_fxo->get(); - std::scoped_lock lock(manager->mtx); + std::shared_lock lock(manager->mtx); if (manager->is_init) return CELL_VOICE_ERROR_LIBVOICE_NOT_INIT; @@ -306,7 +306,7 @@ error_code cellVoiceGetPortAttr(u32 portId, u32 attr, vm::ptr attrValue) const auto manager = g_fxo->get(); - std::scoped_lock lock(manager->mtx); + std::shared_lock lock(manager->mtx); if (manager->is_init) return CELL_VOICE_ERROR_LIBVOICE_NOT_INIT; @@ -326,7 +326,7 @@ error_code cellVoiceGetPortInfo(u32 portId, vm::ptr pInfo const auto manager = g_fxo->get(); - std::scoped_lock lock(manager->mtx); + std::shared_lock lock(manager->mtx); if (manager->is_init) return CELL_VOICE_ERROR_LIBVOICE_NOT_INIT; @@ -353,7 +353,7 @@ error_code cellVoiceGetSignalState(u32 portId, u32 attr, vm::ptr attrValue const auto manager = g_fxo->get(); - std::scoped_lock lock(manager->mtx); + std::shared_lock lock(manager->mtx); if (manager->is_init) return CELL_VOICE_ERROR_LIBVOICE_NOT_INIT; @@ -373,7 +373,7 @@ error_code cellVoiceGetVolume(u32 portId, vm::ptr volume) const auto manager = g_fxo->get(); - std::scoped_lock lock(manager->mtx); + std::shared_lock lock(manager->mtx); if (manager->is_init) return CELL_VOICE_ERROR_LIBVOICE_NOT_INIT; @@ -434,7 +434,7 @@ error_code cellVoicePausePort(u32 portId) const auto manager = g_fxo->get(); - std::scoped_lock lock(manager->mtx); + std::shared_lock lock(manager->mtx); if (manager->is_init) return CELL_VOICE_ERROR_LIBVOICE_NOT_INIT; @@ -453,7 +453,7 @@ error_code cellVoicePausePortAll() const auto manager = g_fxo->get(); - std::scoped_lock lock(manager->mtx); + std::shared_lock lock(manager->mtx); if (manager->is_init) return CELL_VOICE_ERROR_LIBVOICE_NOT_INIT; @@ -484,7 +484,7 @@ error_code cellVoiceResetPort(u32 portId) const auto manager = g_fxo->get(); - std::scoped_lock lock(manager->mtx); + std::shared_lock lock(manager->mtx); if (manager->is_init) return CELL_VOICE_ERROR_LIBVOICE_NOT_INIT; @@ -503,7 +503,7 @@ error_code cellVoiceResumePort(u32 portId) const auto manager = g_fxo->get(); - std::scoped_lock lock(manager->mtx); + std::shared_lock lock(manager->mtx); if (manager->is_init) return CELL_VOICE_ERROR_LIBVOICE_NOT_INIT; @@ -522,7 +522,7 @@ error_code cellVoiceResumePortAll() const auto manager = g_fxo->get(); - std::scoped_lock lock(manager->mtx); + std::shared_lock lock(manager->mtx); if (manager->is_init) return CELL_VOICE_ERROR_LIBVOICE_NOT_INIT; @@ -593,7 +593,7 @@ error_code cellVoiceSetMuteFlagAll(u16 bMuted) const auto manager = g_fxo->get(); - std::scoped_lock lock(manager->mtx); + std::shared_lock lock(manager->mtx); if (manager->is_init) return CELL_VOICE_ERROR_LIBVOICE_NOT_INIT; @@ -664,6 +664,7 @@ error_code cellVoiceSetVolume(u32 portId, f32 volume) if (!port) return CELL_VOICE_ERROR_TOPOLOGY; + port->info.volume = volume; return CELL_OK; } @@ -785,7 +786,7 @@ error_code cellVoiceWriteToIPort(u32 ips, vm::cptr data, vm::ptr size const auto manager = g_fxo->get(); - std::scoped_lock lock(manager->mtx); + std::shared_lock lock(manager->mtx); if (manager->is_init) return CELL_VOICE_ERROR_LIBVOICE_NOT_INIT; @@ -804,7 +805,7 @@ error_code cellVoiceWriteToIPortEx(u32 ips, vm::cptr data, vm::ptr si const auto manager = g_fxo->get(); - std::scoped_lock lock(manager->mtx); + std::shared_lock lock(manager->mtx); if (manager->is_init) return CELL_VOICE_ERROR_LIBVOICE_NOT_INIT; @@ -823,7 +824,7 @@ error_code cellVoiceWriteToIPortEx2(u32 ips, vm::cptr data, vm::ptr s const auto manager = g_fxo->get(); - std::scoped_lock lock(manager->mtx); + std::shared_lock lock(manager->mtx); if (manager->is_init) return CELL_VOICE_ERROR_LIBVOICE_NOT_INIT; @@ -842,7 +843,7 @@ error_code cellVoiceReadFromOPort(u32 ops, vm::ptr data, vm::ptr size const auto manager = g_fxo->get(); - std::scoped_lock lock(manager->mtx); + std::shared_lock lock(manager->mtx); if (manager->is_init) return CELL_VOICE_ERROR_LIBVOICE_NOT_INIT;