1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-23 03:02:53 +01:00

cellVoice Update

* Use shared lock wherever possible.
* Fix cellVoiceSetVolume.
* Fix error logging of cellVoiceCreateNotifyEventQueue, cellAudioCreateNotifyEventQueue
This commit is contained in:
Eladash 2019-10-24 18:41:31 +03:00 committed by Ani
parent fd433779bb
commit c9066e7236
2 changed files with 23 additions and 22 deletions

View File

@ -1332,7 +1332,7 @@ error_code cellAudioCreateNotifyEventQueue(vm::ptr<u32> id, vm::ptr<u64> 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)
{

View File

@ -52,7 +52,7 @@ error_code cellVoiceConnectIPortToOPort(u32 ips, u32 ops)
const auto manager = g_fxo->get<voice_manager>();
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<u32> id, vm::ptr<u64> key)
auto manager = g_fxo->get<voice_manager>();
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<u32> id, vm::ptr<u64> 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<u32> portId, vm::cptr<CellVoicePortParam>
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<voice_manager>();
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<u32> bitrate)
const auto manager = g_fxo->get<voice_manager>();
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<u16> bMuted)
const auto manager = g_fxo->get<voice_manager>();
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<void> attrValue)
const auto manager = g_fxo->get<voice_manager>();
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<CellVoiceBasePortInfo> pInfo
const auto manager = g_fxo->get<voice_manager>();
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<void> attrValue
const auto manager = g_fxo->get<voice_manager>();
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<f32> volume)
const auto manager = g_fxo->get<voice_manager>();
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<voice_manager>();
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<voice_manager>();
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<voice_manager>();
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<voice_manager>();
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<voice_manager>();
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<voice_manager>();
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<void> data, vm::ptr<u32> size
const auto manager = g_fxo->get<voice_manager>();
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<void> data, vm::ptr<u32> si
const auto manager = g_fxo->get<voice_manager>();
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<void> data, vm::ptr<u32> s
const auto manager = g_fxo->get<voice_manager>();
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<void> data, vm::ptr<u32> size
const auto manager = g_fxo->get<voice_manager>();
std::scoped_lock lock(manager->mtx);
std::shared_lock lock(manager->mtx);
if (manager->is_init)
return CELL_VOICE_ERROR_LIBVOICE_NOT_INIT;