rpcsx/rpcs3/Emu/Cell/Modules/cellVoice.cpp

456 lines
12 KiB
C++
Raw Normal View History

2018-03-24 15:42:14 +01:00
#include "stdafx.h"
2015-02-22 12:38:14 +01:00
#include "Emu/System.h"
2018-03-24 15:42:14 +01:00
#include "Emu/IdManager.h"
2016-03-21 20:43:03 +01:00
#include "Emu/Cell/PPUModule.h"
#include "cellVoice.h"
LOG_CHANNEL(cellVoice);
2018-03-24 15:42:14 +01:00
template<>
void fmt_class_string<CellVoiceError>::format(std::string& out, u64 arg)
{
format_enum(out, arg, [](auto error)
{
switch (error)
{
STR_CASE(CELL_VOICE_ERROR_ADDRESS_INVALID);
STR_CASE(CELL_VOICE_ERROR_ARGUMENT_INVALID);
STR_CASE(CELL_VOICE_ERROR_CONTAINER_INVALID);
STR_CASE(CELL_VOICE_ERROR_DEVICE_NOT_PRESENT);
STR_CASE(CELL_VOICE_ERROR_EVENT_DISPATCH);
STR_CASE(CELL_VOICE_ERROR_EVENT_QUEUE);
STR_CASE(CELL_VOICE_ERROR_GENERAL);
STR_CASE(CELL_VOICE_ERROR_LIBVOICE_INITIALIZED);
STR_CASE(CELL_VOICE_ERROR_LIBVOICE_NOT_INIT);
STR_CASE(CELL_VOICE_ERROR_NOT_IMPLEMENTED);
STR_CASE(CELL_VOICE_ERROR_PORT_INVALID);
STR_CASE(CELL_VOICE_ERROR_RESOURCE_INSUFFICIENT);
STR_CASE(CELL_VOICE_ERROR_SERVICE_ATTACHED);
STR_CASE(CELL_VOICE_ERROR_SERVICE_DETACHED);
STR_CASE(CELL_VOICE_ERROR_SERVICE_HANDLE);
STR_CASE(CELL_VOICE_ERROR_SERVICE_NOT_FOUND);
STR_CASE(CELL_VOICE_ERROR_SHAREDMEMORY);
STR_CASE(CELL_VOICE_ERROR_TOPOLOGY);
}
return unknown;
});
}
2018-03-24 15:42:14 +01:00
error_code cellVoiceConnectIPortToOPort(u32 ips, u32 ops)
{
2018-03-24 15:42:14 +01:00
cellVoice.todo("cellVoiceConnectIPortToOPort(ips=%d, ops=%d)", ips, ops);
if (!g_fxo->get<voice_manager>()->is_init)
return CELL_VOICE_ERROR_LIBVOICE_NOT_INIT;
return CELL_OK;
}
2018-03-24 15:42:14 +01:00
error_code cellVoiceCreateNotifyEventQueue(vm::ptr<u32> id, vm::ptr<u64> key)
{
2018-03-24 15:42:14 +01:00
cellVoice.todo("cellVoiceCreateNotifyEventQueue(id=*0x%x, key=*0x%x)", id, key);
if (!g_fxo->get<voice_manager>()->is_init)
return CELL_VOICE_ERROR_LIBVOICE_NOT_INIT;
return CELL_OK;
}
2018-03-24 15:42:14 +01:00
error_code cellVoiceCreatePort(vm::ptr<u32> portId, vm::cptr<CellVoicePortParam> pArg)
{
2018-03-24 15:42:14 +01:00
cellVoice.todo("cellVoiceCreatePort(portId=*0x%x, pArg=*0x%x)", portId, pArg);
if (!g_fxo->get<voice_manager>()->is_init)
return CELL_VOICE_ERROR_LIBVOICE_NOT_INIT;
if (!pArg)
return CELL_VOICE_ERROR_ARGUMENT_INVALID;
return CELL_OK;
}
2018-03-24 15:42:14 +01:00
error_code cellVoiceDeletePort(u32 portId)
{
2018-03-24 15:42:14 +01:00
cellVoice.todo("cellVoiceDeletePort(portId=%d)", portId);
if (!g_fxo->get<voice_manager>()->is_init)
return CELL_VOICE_ERROR_LIBVOICE_NOT_INIT;
return CELL_OK;
}
2018-03-24 15:42:14 +01:00
error_code cellVoiceDisconnectIPortFromOPort(u32 ips, u32 ops)
{
2018-03-24 15:42:14 +01:00
cellVoice.todo("cellVoiceDisconnectIPortFromOPort(ips=%d, ops=%d)", ips, ops);
if (!g_fxo->get<voice_manager>()->is_init)
return CELL_VOICE_ERROR_LIBVOICE_NOT_INIT;
return CELL_OK;
}
2018-03-24 15:42:14 +01:00
error_code cellVoiceEnd()
{
2018-03-24 15:42:14 +01:00
cellVoice.todo("cellVoiceEnd()");
const auto manager = g_fxo->get<voice_manager>();
if (!manager->is_init)
return CELL_VOICE_ERROR_LIBVOICE_NOT_INIT;
manager->is_init = false;
return CELL_OK;
}
2018-03-24 15:42:14 +01:00
error_code cellVoiceGetBitRate(u32 portId, vm::ptr<u32> bitrate)
{
2018-03-24 15:42:14 +01:00
cellVoice.todo("cellVoiceGetBitRate(portId=%d, bitrate=*0x%x)", portId, bitrate);
if (!g_fxo->get<voice_manager>()->is_init)
return CELL_VOICE_ERROR_LIBVOICE_NOT_INIT;
return CELL_OK;
}
2018-03-24 15:42:14 +01:00
error_code cellVoiceGetMuteFlag(u32 portId, vm::ptr<u16> bMuted)
{
2018-03-24 15:42:14 +01:00
cellVoice.todo("cellVoiceGetMuteFlag(portId=%d, bMuted=*0x%x)", portId, bMuted);
if (!g_fxo->get<voice_manager>()->is_init)
return CELL_VOICE_ERROR_LIBVOICE_NOT_INIT;
return CELL_OK;
}
2018-03-24 15:42:14 +01:00
error_code cellVoiceGetPortAttr(u32 portId, u32 attr, vm::ptr<void> attrValue)
{
2018-03-24 15:42:14 +01:00
cellVoice.todo("cellVoiceGetPortAttr(portId=%d, attr=%d, attrValue=*0x%x)", portId, attr, attrValue);
if (!g_fxo->get<voice_manager>()->is_init)
return CELL_VOICE_ERROR_LIBVOICE_NOT_INIT;
return CELL_OK;
}
2018-03-24 15:42:14 +01:00
error_code cellVoiceGetPortInfo(u32 portId, vm::ptr<CellVoiceBasePortInfo> pInfo)
{
2018-03-24 15:42:14 +01:00
cellVoice.todo("cellVoiceGetPortInfo(portId=%d, pInfo=*0x%x)", portId, pInfo);
if (!g_fxo->get<voice_manager>()->is_init)
return CELL_VOICE_ERROR_LIBVOICE_NOT_INIT;
return CELL_OK;
}
2018-03-24 15:42:14 +01:00
error_code cellVoiceGetSignalState(u32 portId, u32 attr, vm::ptr<void> attrValue)
{
2018-03-24 15:42:14 +01:00
cellVoice.todo("cellVoiceGetSignalState(portId=%d, attr=%d, attrValue=*0x%x)", portId, attr, attrValue);
if (!g_fxo->get<voice_manager>()->is_init)
return CELL_VOICE_ERROR_LIBVOICE_NOT_INIT;
return CELL_OK;
}
2018-03-24 15:42:14 +01:00
error_code cellVoiceGetVolume(u32 portId, vm::ptr<f32> volume)
{
2018-03-24 15:42:14 +01:00
cellVoice.todo("cellVoiceGetVolume(portId=%d, volume=*0x%x)", portId, volume);
if (!g_fxo->get<voice_manager>()->is_init)
return CELL_VOICE_ERROR_LIBVOICE_NOT_INIT;
return CELL_OK;
}
2018-03-24 15:42:14 +01:00
error_code cellVoiceInit(vm::ptr<CellVoiceInitParam> pArg)
{
2018-03-24 15:42:14 +01:00
cellVoice.todo("cellVoiceInit(pArg=*0x%x)", pArg);
const auto manager = g_fxo->get<voice_manager>();
if (manager->is_init)
return CELL_VOICE_ERROR_LIBVOICE_INITIALIZED;
if (!pArg)
return CELL_VOICE_ERROR_ARGUMENT_INVALID;
manager->is_init = true;
return CELL_OK;
}
2018-03-24 15:42:14 +01:00
error_code cellVoiceInitEx(vm::ptr<CellVoiceInitParam> pArg)
{
2018-03-24 15:42:14 +01:00
cellVoice.todo("cellVoiceInitEx(pArg=*0x%x)", pArg);
const auto manager = g_fxo->get<voice_manager>();
if (manager->is_init)
return CELL_VOICE_ERROR_LIBVOICE_INITIALIZED;
if (!pArg)
return CELL_VOICE_ERROR_ARGUMENT_INVALID;
manager->is_init = true;
return CELL_OK;
}
2018-03-24 15:42:14 +01:00
error_code cellVoicePausePort(u32 portId)
{
2018-03-24 15:42:14 +01:00
cellVoice.todo("cellVoicePausePort(portId=%d)", portId);
if (!g_fxo->get<voice_manager>()->is_init)
return CELL_VOICE_ERROR_LIBVOICE_NOT_INIT;
return CELL_OK;
}
2018-03-24 15:42:14 +01:00
error_code cellVoicePausePortAll()
{
2018-03-24 15:42:14 +01:00
cellVoice.todo("cellVoicePausePortAll()");
if (!g_fxo->get<voice_manager>()->is_init)
return CELL_VOICE_ERROR_LIBVOICE_NOT_INIT;
return CELL_OK;
}
2018-03-24 15:42:14 +01:00
error_code cellVoiceRemoveNotifyEventQueue(u64 key)
{
2018-03-24 15:42:14 +01:00
cellVoice.todo("cellVoiceRemoveNotifyEventQueue(key=0x%llx)", key);
if (!g_fxo->get<voice_manager>()->is_init)
return CELL_VOICE_ERROR_LIBVOICE_NOT_INIT;
return CELL_OK;
}
2018-03-24 15:42:14 +01:00
error_code cellVoiceResetPort(u32 portId)
{
2018-03-24 15:42:14 +01:00
cellVoice.todo("cellVoiceResetPort(portId=%d)", portId);
if (!g_fxo->get<voice_manager>()->is_init)
return CELL_VOICE_ERROR_LIBVOICE_NOT_INIT;
return CELL_OK;
}
2018-03-24 15:42:14 +01:00
error_code cellVoiceResumePort(u32 portId)
{
2018-03-24 15:42:14 +01:00
cellVoice.todo("cellVoiceResumePort(portId=%d)", portId);
if (!g_fxo->get<voice_manager>()->is_init)
return CELL_VOICE_ERROR_LIBVOICE_NOT_INIT;
return CELL_OK;
}
2018-03-24 15:42:14 +01:00
error_code cellVoiceResumePortAll()
{
2018-03-24 15:42:14 +01:00
cellVoice.todo("cellVoiceResumePortAll()");
if (!g_fxo->get<voice_manager>()->is_init)
return CELL_VOICE_ERROR_LIBVOICE_NOT_INIT;
return CELL_OK;
}
2018-03-24 15:42:14 +01:00
error_code cellVoiceSetBitRate(u32 portId, s32 bitrate)
{
2018-03-24 15:42:14 +01:00
cellVoice.todo("cellVoiceSetBitRate(portId=%d, bitrate=%d)", portId, bitrate);
if (!g_fxo->get<voice_manager>()->is_init)
return CELL_VOICE_ERROR_LIBVOICE_NOT_INIT;
return CELL_OK;
}
2018-03-24 15:42:14 +01:00
error_code cellVoiceSetMuteFlag(u32 portId, u16 bMuted)
{
2018-03-24 15:42:14 +01:00
cellVoice.todo("cellVoiceSetMuteFlag(portId=%d, bMuted=%d)", portId, bMuted);
if (!g_fxo->get<voice_manager>()->is_init)
return CELL_VOICE_ERROR_LIBVOICE_NOT_INIT;
return CELL_OK;
}
2018-03-24 15:42:14 +01:00
error_code cellVoiceSetMuteFlagAll(u16 bMuted)
{
2018-03-24 15:42:14 +01:00
cellVoice.todo("cellVoiceSetMuteFlagAll(bMuted=%d)", bMuted);
if (!g_fxo->get<voice_manager>()->is_init)
return CELL_VOICE_ERROR_LIBVOICE_NOT_INIT;
return CELL_OK;
}
2018-03-24 15:42:14 +01:00
error_code cellVoiceSetNotifyEventQueue(u64 key, u64 source)
{
2018-03-24 15:42:14 +01:00
cellVoice.todo("cellVoiceSetNotifyEventQueue(key=0x%llx, source=%d)", key, source);
if (!g_fxo->get<voice_manager>()->is_init)
return CELL_VOICE_ERROR_LIBVOICE_NOT_INIT;
return CELL_OK;
}
2018-03-24 15:42:14 +01:00
error_code cellVoiceSetPortAttr(u32 portId, u32 attr, vm::ptr<void> attrValue)
{
2018-03-24 15:42:14 +01:00
cellVoice.todo("cellVoiceSetPortAttr(portId=%d, attr=%d, attrValue=*0x%x)", portId, attr, attrValue);
if (!g_fxo->get<voice_manager>()->is_init)
return CELL_VOICE_ERROR_LIBVOICE_NOT_INIT;
return CELL_OK;
}
2018-03-24 15:42:14 +01:00
error_code cellVoiceSetVolume(u32 portId, f32 volume)
{
2018-03-24 15:42:14 +01:00
cellVoice.todo("cellVoiceSetVolume(portId=%d, volume=%f)", portId, volume);
if (!g_fxo->get<voice_manager>()->is_init)
return CELL_VOICE_ERROR_LIBVOICE_NOT_INIT;
return CELL_OK;
}
2018-03-24 15:42:14 +01:00
error_code cellVoiceStart()
{
2018-03-24 15:42:14 +01:00
cellVoice.todo("cellVoiceStart()");
if (!g_fxo->get<voice_manager>()->is_init)
return CELL_VOICE_ERROR_LIBVOICE_NOT_INIT;
return CELL_OK;
}
2018-03-24 15:42:14 +01:00
error_code cellVoiceStartEx(vm::ptr<CellVoiceStartParam> pArg)
{
2018-03-24 15:42:14 +01:00
cellVoice.todo("cellVoiceStartEx(pArg=*0x%x)", pArg);
if (!g_fxo->get<voice_manager>()->is_init)
return CELL_VOICE_ERROR_LIBVOICE_NOT_INIT;
if (!pArg)
return CELL_VOICE_ERROR_ARGUMENT_INVALID;
return CELL_OK;
}
2018-03-24 15:42:14 +01:00
error_code cellVoiceStop()
{
2018-03-24 15:42:14 +01:00
cellVoice.todo("cellVoiceStop()");
if (!g_fxo->get<voice_manager>()->is_init)
return CELL_VOICE_ERROR_LIBVOICE_NOT_INIT;
return CELL_OK;
}
2018-03-24 15:42:14 +01:00
error_code cellVoiceUpdatePort(u32 portId, vm::cptr<CellVoicePortParam> pArg)
{
2018-03-24 15:42:14 +01:00
cellVoice.todo("cellVoiceUpdatePort(portId=%d, pArg=*0x%x)", portId, pArg);
if (!g_fxo->get<voice_manager>()->is_init)
return CELL_VOICE_ERROR_LIBVOICE_NOT_INIT;
if (!pArg)
return CELL_VOICE_ERROR_ARGUMENT_INVALID;
return CELL_OK;
}
2018-03-24 15:42:14 +01:00
error_code cellVoiceWriteToIPort(u32 ips, vm::cptr<void> data, vm::ptr<u32> size)
{
2018-03-24 15:42:14 +01:00
cellVoice.todo("cellVoiceWriteToIPort(ips=%d, data=*0x%x, size=*0x%x)", ips, data, size);
if (!g_fxo->get<voice_manager>()->is_init)
return CELL_VOICE_ERROR_LIBVOICE_NOT_INIT;
return CELL_OK;
}
2018-03-24 15:42:14 +01:00
error_code cellVoiceWriteToIPortEx(u32 ips, vm::cptr<void> data, vm::ptr<u32> size, u32 numFrameLost)
{
2018-03-24 15:42:14 +01:00
cellVoice.todo("cellVoiceWriteToIPortEx(ips=%d, data=*0x%x, size=*0x%x, numFrameLost=%d)", ips, data, size, numFrameLost);
if (!g_fxo->get<voice_manager>()->is_init)
return CELL_VOICE_ERROR_LIBVOICE_NOT_INIT;
return CELL_OK;
}
2018-03-24 15:42:14 +01:00
error_code cellVoiceWriteToIPortEx2(u32 ips, vm::cptr<void> data, vm::ptr<u32> size, s16 frameGaps)
2015-08-01 03:46:42 +02:00
{
2018-03-24 15:42:14 +01:00
cellVoice.todo("cellVoiceWriteToIPortEx2(ips=%d, data=*0x%x, size=*0x%x, frameGaps=%d)", ips, data, size, frameGaps);
if (!g_fxo->get<voice_manager>()->is_init)
return CELL_VOICE_ERROR_LIBVOICE_NOT_INIT;
return CELL_OK;
2015-08-01 03:46:42 +02:00
}
2018-03-24 15:42:14 +01:00
error_code cellVoiceReadFromOPort(u32 ops, vm::ptr<void> data, vm::ptr<u32> size)
{
2018-03-24 15:42:14 +01:00
cellVoice.todo("cellVoiceReadFromOPort(ops=%d, data=*0x%x, size=*0x%x)", ops, data, size);
if (!g_fxo->get<voice_manager>()->is_init)
return CELL_VOICE_ERROR_LIBVOICE_NOT_INIT;
return CELL_OK;
}
2018-03-24 15:42:14 +01:00
error_code cellVoiceDebugTopology()
{
UNIMPLEMENTED_FUNC(cellVoice);
2018-03-24 15:42:14 +01:00
if (!g_fxo->get<voice_manager>()->is_init)
return CELL_VOICE_ERROR_LIBVOICE_NOT_INIT;
return CELL_VOICE_ERROR_NOT_IMPLEMENTED;
}
2016-03-21 20:43:03 +01:00
DECLARE(ppu_module_manager::cellVoice)("cellVoice", []()
{
REG_FUNC(cellVoice, cellVoiceConnectIPortToOPort);
REG_FUNC(cellVoice, cellVoiceCreateNotifyEventQueue);
REG_FUNC(cellVoice, cellVoiceCreatePort);
REG_FUNC(cellVoice, cellVoiceDeletePort);
REG_FUNC(cellVoice, cellVoiceDisconnectIPortFromOPort);
REG_FUNC(cellVoice, cellVoiceEnd);
REG_FUNC(cellVoice, cellVoiceGetBitRate);
REG_FUNC(cellVoice, cellVoiceGetMuteFlag);
REG_FUNC(cellVoice, cellVoiceGetPortAttr);
REG_FUNC(cellVoice, cellVoiceGetPortInfo);
REG_FUNC(cellVoice, cellVoiceGetSignalState);
REG_FUNC(cellVoice, cellVoiceGetVolume);
REG_FUNC(cellVoice, cellVoiceInit);
REG_FUNC(cellVoice, cellVoiceInitEx);
REG_FUNC(cellVoice, cellVoicePausePort);
REG_FUNC(cellVoice, cellVoicePausePortAll);
REG_FUNC(cellVoice, cellVoiceRemoveNotifyEventQueue);
REG_FUNC(cellVoice, cellVoiceResetPort);
REG_FUNC(cellVoice, cellVoiceResumePort);
REG_FUNC(cellVoice, cellVoiceResumePortAll);
REG_FUNC(cellVoice, cellVoiceSetBitRate);
REG_FUNC(cellVoice, cellVoiceSetMuteFlag);
REG_FUNC(cellVoice, cellVoiceSetMuteFlagAll);
REG_FUNC(cellVoice, cellVoiceSetNotifyEventQueue);
REG_FUNC(cellVoice, cellVoiceSetPortAttr);
REG_FUNC(cellVoice, cellVoiceSetVolume);
REG_FUNC(cellVoice, cellVoiceStart);
REG_FUNC(cellVoice, cellVoiceStartEx);
REG_FUNC(cellVoice, cellVoiceStop);
REG_FUNC(cellVoice, cellVoiceUpdatePort);
REG_FUNC(cellVoice, cellVoiceWriteToIPort);
REG_FUNC(cellVoice, cellVoiceWriteToIPortEx);
2015-08-01 03:46:42 +02:00
REG_FUNC(cellVoice, cellVoiceWriteToIPortEx2);
REG_FUNC(cellVoice, cellVoiceReadFromOPort);
REG_FUNC(cellVoice, cellVoiceDebugTopology);
2015-02-22 12:38:14 +01:00
});