MCPcopy Create free account
hub / github.com/RPCSX/rpcsx / cellAudioGetPortTimestamp

Function cellAudioGetPortTimestamp

ps3fw/cellAudio.cpp:1496–1533  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1494}
1495
1496error_code cellAudioGetPortTimestamp(u32 portNum, u64 tag, vm::ptr<u64> stamp)
1497{
1498 cellAudio.trace("cellAudioGetPortTimestamp(portNum=%d, tag=0x%llx, stamp=*0x%x)", portNum, tag, stamp);
1499
1500 auto& g_audio = g_fxo->get<cell_audio>();
1501
1502 std::lock_guard lock(g_audio.mutex);
1503
1504 if (!g_audio.init)
1505 {
1506 return CELL_AUDIO_ERROR_NOT_INIT;
1507 }
1508
1509 if (portNum >= AUDIO_PORT_COUNT)
1510 {
1511 return CELL_AUDIO_ERROR_PARAM;
1512 }
1513
1514 audio_port& port = g_audio.ports[portNum];
1515
1516 if (port.state == audio_port_state::closed)
1517 {
1518 return CELL_AUDIO_ERROR_PORT_NOT_OPEN;
1519 }
1520
1521 if (port.global_counter < tag)
1522 {
1523 return CELL_AUDIO_ERROR_TAG_NOT_FOUND;
1524 }
1525
1526 const u64 delta_tag = port.global_counter - tag;
1527 const u64 delta_tag_stamp = delta_tag * g_audio.cfg.audio_block_period;
1528
1529 // Apparently no error is returned if stamp is null
1530 *stamp = get_guest_system_time(port.timestamp - delta_tag_stamp);
1531
1532 return CELL_OK;
1533}
1534
1535error_code cellAudioGetPortBlockTag(u32 portNum, u64 blockNo, vm::ptr<u64> tag)
1536{

Callers

nothing calls this directly

Calls 1

get_guest_system_timeFunction · 0.85

Tested by

no test coverage detected