|
psl1ght
A free SDK for Sony's PS3 console
|
Audio library. More...
#include <sys/event_queue.h>Go to the source code of this file.
Data Structures | |
| struct | _audio_port_param |
| Audio port parameter data structure. More... | |
| struct | _audio_port_config |
| Audio port config data structure. More... | |
Macros | |
| #define | AUDIO_BLOCK_SAMPLES 256 |
| Number of samples in an audio block. | |
| #define | AUDIO_STATUS_READY 1 |
| Audio port is ready to play. | |
| #define | AUDIO_STATUS_RUN 2 |
| Audio port is playing. | |
| #define | AUDIO_STATUS_CLOSE 0x1010 |
| Audio port has been closed. | |
| #define | AUDIO_PORT_2CH 2 |
| 2-channel (stereo) output. | |
| #define | AUDIO_PORT_8CH 8 |
| 8-channel output. | |
| #define | AUDIO_PORT_INITLEVEL 0x1000 |
| Set initial output level. | |
| #define | AUDIO_BLOCK_8 8 |
| 8 blocks are allocated in the audio buffer | |
| #define | AUDIO_BLOCK_16 16 |
| 16 blocks are allocated in the audio buffer | |
| #define | AUDIO_BLOCK_32 32 |
| 32 blocks are allocated in the audio buffer | |
Typedefs | |
| typedef struct _audio_port_param | audioPortParam |
| Audio port parameter data structure. | |
| typedef struct _audio_port_config | audioPortConfig |
| Audio port config data structure. | |
Functions | |
| s32 | audioInit () |
| Initialize audio subsystem. | |
| s32 | audioQuit () |
| Initialize audio subsystem. | |
| s32 | audioPortOpen (audioPortParam *param, u32 *portNum) |
| Open audio port. | |
| s32 | audioPortStart (u32 portNum) |
| Start playing on audio port. | |
| s32 | audioPortStop (u32 portNum) |
| Stop playing on audio port. | |
| s32 | audioGetPortConfig (u32 portNum, audioPortConfig *config) |
| Get config of opened audio port. | |
| s32 | audioPortClose (u32 portNum) |
| Close an opened audio port. | |
| s32 | audioCreateNotifyEventQueue (sys_event_queue_t *eventQ, sys_ipc_key_t *queueKey) |
| Create a notify event queue for audio events. | |
| s32 | audioSetNotifyEventQueue (sys_ipc_key_t queueKey) |
| Set the current event queue for audio events. | |
| s32 | audioRemoveNotifyEventQueue (sys_ipc_key_t queueKey) |
| Disconnect the current event queue from the audio subsystem. | |
Audio library.
This library manages communications of the application with the system audio server. It basically allows the application to play raw PCM audio by filling a circular buffer.
To play audio, follow these steps:
x is audioDataStart + x * numChannels * AUDIO_BLOCK_SAMPLES * sizeof(float). The size of each block in bytes is numChannels * AUDIO_BLOCK_SAMPLES * sizeof(float).To stop playing audio, the steps are:
The PCM audio sample format is 32-bit floating point where sample values vary from -1 to 1. Samples are interlaced: for instance in stereo mode, even sample positions correspond to the left channel, and odd ones correspond to the right channel.
Definition in file audio.h.
| #define AUDIO_BLOCK_16 16 |
| #define AUDIO_BLOCK_32 32 |
| #define AUDIO_BLOCK_8 8 |
| #define AUDIO_BLOCK_SAMPLES 256 |
| #define AUDIO_PORT_INITLEVEL 0x1000 |
| #define AUDIO_STATUS_CLOSE 0x1010 |
| typedef struct _audio_port_config audioPortConfig |
Audio port config data structure.
| typedef struct _audio_port_param audioPortParam |
Audio port parameter data structure.
| s32 audioCreateNotifyEventQueue | ( | sys_event_queue_t * | eventQ, |
| sys_ipc_key_t * | queueKey | ||
| ) |
Create a notify event queue for audio events.
| eventQ | Pointer to the event queue object to be updated. |
| queueKey | Pointer to storage for the returned queue key. |
| s32 audioGetPortConfig | ( | u32 | portNum, |
| audioPortConfig * | config | ||
| ) |
Get config of opened audio port.
| portNum | Port id as returned by audioPortOpen. |
| config | Pointer to the port config structure to be updated. |
| s32 audioInit | ( | ) |
Initialize audio subsystem.
| s32 audioPortClose | ( | u32 | portNum | ) |
Close an opened audio port.
| portNum | Port id as returned by audioPortOpen. |
| s32 audioPortOpen | ( | audioPortParam * | param, |
| u32 * | portNum | ||
| ) |
Open audio port.
| param | Pointer to and audio port parameter data structure. |
| portNum | Pointer to storage for the returned port id. |
| s32 audioPortStart | ( | u32 | portNum | ) |
Start playing on audio port.
| portNum | Port id as returned by audioPortOpen. |
| s32 audioPortStop | ( | u32 | portNum | ) |
Stop playing on audio port.
| portNum | Port id as returned by audioPortOpen. |
| s32 audioQuit | ( | ) |
Initialize audio subsystem.
| s32 audioRemoveNotifyEventQueue | ( | sys_ipc_key_t | queueKey | ) |
Disconnect the current event queue from the audio subsystem.
| queueKey | The queue key value (must have been created using audioCreateNotifyEventQueue). |
| s32 audioSetNotifyEventQueue | ( | sys_ipc_key_t | queueKey | ) |
Set the current event queue for audio events.
| queueKey | The queue key value (musthave been created using audioCreateNotifyEventQueue). |