|
KallistiOS
2.0.0
|
Functions related to sound. More...
Go to the source code of this file.
Typedefs | |
| typedef g2_dma_callback_t | spu_dma_callback_t |
| SPU DMA callback type. | |
Functions | |
| void | spu_write_wait () |
| Waits for the sound FIFO to empty. | |
| void | spu_memload (uint32 to, void *from, int length) |
| Copy a block of data to sound RAM. | |
| void | spu_memread (void *to, uint32 from, int length) |
| Copy a block of data from sound RAM. | |
| void | spu_memset (uint32 to, uint32 what, int length) |
| Set a block of sound RAM to the specified value. | |
| int | spu_dma_transfer (void *from, uint32 dest, uint32 length, int block, spu_dma_callback_t callback, ptr_t cbdata) |
| Copy a block of data from SH4 RAM to sound RAM via DMA. | |
| void | spu_enable () |
| Enable the SPU. | |
| void | spu_disable () |
| Disable the SPU. | |
| void | spu_cdda_volume (int left_volume, int right_volume) |
| Set CDDA volume. | |
| void | spu_cdda_pan (int left_pan, int right_pan) |
| Set CDDA panning. | |
| void | spu_master_mixer (int volume, int stereo) |
| Set master mixer settings. | |
| int | spu_init () |
| Initialize the SPU. | |
| int | spu_shutdown () |
| Shutdown the SPU. | |
| int | spu_dma_init () |
| Initialize SPU DMA support. | |
| void | spu_dma_shutdown () |
| Shutdown SPU DMA support. | |
Functions related to sound.
This file deals with memory transfers and the like for the sound hardware.
| typedef g2_dma_callback_t spu_dma_callback_t |
SPU DMA callback type.
| void spu_cdda_pan | ( | int | left_pan, |
| int | right_pan | ||
| ) |
Set CDDA panning.
Valid values are from 0-31. 16 is centered.
| left_pan | Pan of the left channel. |
| right_pan | Pan of the right channel. |
| void spu_cdda_volume | ( | int | left_volume, |
| int | right_volume | ||
| ) |
Set CDDA volume.
Valid volume values are 0-15.
| left_volume | Volume of the left channel. |
| right_volume | Volume of the right channel. |
| void spu_disable | ( | ) |
Disable the SPU.
This function resets all sound channels and puts the ARM in a reset state.
| int spu_dma_init | ( | ) |
Initialize SPU DMA support.
This function sets up the DMA support for transfers to the sound RAM area.
| 0 | On success (no error conditions defined). |
| void spu_dma_shutdown | ( | ) |
Shutdown SPU DMA support.
| int spu_dma_transfer | ( | void * | from, |
| uint32 | dest, | ||
| uint32 | length, | ||
| int | block, | ||
| spu_dma_callback_t | callback, | ||
| ptr_t | cbdata | ||
| ) |
Copy a block of data from SH4 RAM to sound RAM via DMA.
This function sets up a DMA transfer from main RAM to the sound RAM with G2 DMA.
| from | A pointer in main RAM to transfer from. Must be 32-byte aligned. |
| dest | Offset in sound RAM to transfer to. Do not include the 0xA0800000 part, its implied. Must be 32-byte aligned. |
| length | Number of bytes to copy. Must be a multiple of 32. |
| block | 1 if you want to wait for the transfer to complete, 0 otherwise (use the callback for this case). |
| callback | Function to call when the DMA completes. Can be NULL if you don't want to have a callback. This will be called in an interrupt context, so keep that in mind when writing the function. |
| cbdata | Data to pass to the callback function. |
| -1 | On failure. Sets errno as appropriate. |
| 0 | On success. |
| void spu_enable | ( | ) |
Enable the SPU.
This function resets all sound channels and lets the ARM out of reset.
| int spu_init | ( | ) |
Initialize the SPU.
This function will reset the SPU, clear the sound RAM, reinit the CDDA support and run an infinite loop on the ARM.
| 0 | On success (no error conditions defined). |
| void spu_master_mixer | ( | int | volume, |
| int | stereo | ||
| ) |
Set master mixer settings.
This function sets the master mixer volume and mono/stereo setting.
| volume | The volume to set (0-15). |
| stereo | 1 for stereo output, 0 for mono. |
| void spu_memload | ( | uint32 | to, |
| void * | from, | ||
| int | length | ||
| ) |
Copy a block of data to sound RAM.
This function acts much like memcpy() but copies to the sound RAM area.
| to | The offset in sound RAM to copy to. Do not include the 0xA0800000 part, it is implied. |
| from | A pointer to copy from. |
| length | The number of bytes to copy. Automatically rounded up to be a multiple of 4. |
| void spu_memread | ( | void * | to, |
| uint32 | from, | ||
| int | length | ||
| ) |
Copy a block of data from sound RAM.
This function acts much like memcpy() but copies from the sound RAM area.
| to | A pointer to copy to. |
| from | The offset in sound RAM to copy from. Do not include the 0xA0800000 part, it is implied. |
| length | The number of bytes to copy. Automatically rounded up to be a multiple of 4. |
Set a block of sound RAM to the specified value.
This function acts like memset4(), setting the specified block of sound RAM to the given 32-bit value.
| to | The offset in sound RAM to set at. Do not include the 0xA0800000 part, it is implied. |
| what | The value to set. |
| length | The number of bytes to copy. Automatically rounded up to be a multiple of 4. |
| int spu_shutdown | ( | ) |
Shutdown the SPU.
This function disables the SPU and clears sound RAM.
| 0 | On success (no error conditions defined). |
| void spu_write_wait | ( | ) |
Waits for the sound FIFO to empty.
1.8.1.1