Trade-offs and warnings
Consult the linked header for this operation’s ownership, lifetime and failure behavior.
PSYQO SDK
Method · 2 overloads
Declarations are extracted from the pinned headers. Examples and general guidance are generated sketches, not verified complete programs; consult the linked source and guides for the actual contract.
Synchronously uploads data to the SPU's sound RAM.
static void dmaWrite(uint32_t spuAddress, const void* ramAddress, size_t dataSize, size_t blockSize = 0)Synchronously uploads data to the SPU's sound RAM.
| Parameter | Type | Meaning |
|---|---|---|
spuAddress | uint32_t | The destination address in sound RAM. Must be 8 byte aligned, and the transfer has to fit within `SOUND_RAM_SIZE`. |
ramAddress | const void * | The source address in main RAM. Must be 4 byte aligned. |
dataSize | size_t | The number of bytes to transfer. Must be a non-zero multiple of `ADPCM_BLOCK_SIZE`. |
blockSize | size_t | The DMA block size in bytes, or 0 to pick the largest one dividing `dataSize`. Must be a multiple of 4 and no larger than `MAX_DMA_BLOCK_SIZE`. |
Returns: Nothing (void).
#include "psyqo/spu.hh"
// Assume these named values have been initialized with valid data:
// uint32_t spuAddress
// const void * ramAddress
// size_t dataSize
// size_t blockSize
psyqo::SPU::dmaWrite(spuAddress, ramAddress, dataSize, blockSize);Consult the linked header for this operation’s ownership, lifetime and failure behavior.
Declared in https://github.com/epokengine/nugget/blob/4a01183295182b8e7702c908e1efaaa8f4538ffd/psyqo/spu.hh:101
void dmaWrite(uint32_t spuAddress, const void* ramAddress, size_t dataSize, eastl::function<void()>&& callback, DMA::DmaCallback dmaCallback = DMA::FROM_MAIN_LOOP)Asynchronously uploads data to the SPU's sound RAM.
| Parameter | Type | Meaning |
|---|---|---|
spuAddress | uint32_t | The destination address in sound RAM. Must be 8 byte aligned, and the transfer has to fit within `SOUND_RAM_SIZE`. |
ramAddress | const void * | The source address in main RAM. Must be 4 byte aligned, and has to stay alive until the callback fires. |
dataSize | size_t | The number of bytes to transfer. Must be a non-zero multiple of `ADPCM_BLOCK_SIZE`. |
callback | eastl::function<void ()> && | The function to call once the transfer has completed. |
dmaCallback | DMA::DmaCallback | Whether to call it from the interrupt handler, or from the main loop. |
Returns: Nothing (void).
#include "psyqo/spu.hh"
// Assume these named values have been initialized with valid data:
// uint32_t spuAddress
// const void * ramAddress
// size_t dataSize
// eastl::function<void ()> && callback
// DMA::DmaCallback dmaCallback
psyqo::SPU& object = /* obtain a valid instance */;
object.dmaWrite(spuAddress, ramAddress, dataSize, callback, dmaCallback);Consult the linked header for this operation’s ownership, lifetime and failure behavior.
Declared in https://github.com/epokengine/nugget/blob/4a01183295182b8e7702c908e1efaaa8f4538ffd/psyqo/spu.hh:120
getNextFreeChannelReturns next free channel as part of SPU RAM, voices, ADSR and sound transfer.MethodinitAsyncEnables asynchronous DMA transfers for this SPU object.MethodinitializeResets the SPU to a known, silent state.MethodplayADPCMStarts playing an ADPCM sample on the given channel.MethodsilenceChannelsSilences the given channels.Method