pspsdk-1.0+beta2
User Audio Library

Data Structures

struct  pspAudioInputParams

Macros

#define PSP_AUDIO_VOLUME_MAX   0x8000
 The maximum output volume.
#define PSP_AUDIO_CHANNEL_MAX   8
 The maximum number of hardware channels.
#define PSP_AUDIO_NEXT_CHANNEL   (-1)
 Used to request the next available hardware channel.
#define PSP_AUDIO_SAMPLE_MIN   64
 The minimum number of samples that can be allocated to a channel.
#define PSP_AUDIO_SAMPLE_MAX   65472
 The maximum number of samples that can be allocated to a channel.
#define PSP_AUDIO_SAMPLE_ALIGN(s)   (((s) + 63) & ~63)
 Make the given sample count a multiple of 64.

Enumerations

enum  PspAudioFormats { PSP_AUDIO_FORMAT_STEREO = 0, PSP_AUDIO_FORMAT_MONO = 0x10 }
enum  PspAudioFrequencies { PSP_AUDIO_FREQ_44K = 44100, PSP_AUDIO_FREQ_48K = 48000 }

Functions

int sceAudioChReserve (int channel, int samplecount, int format)
 Allocate and initialize a hardware output channel.
int sceAudioChRelease (int channel)
 Release a hardware output channel.
int sceAudioOutput (int channel, int vol, void *buf)
 Output audio of the specified channel.
int sceAudioOutputBlocking (int channel, int vol, void *buf)
 Output audio of the specified channel (blocking)
int sceAudioOutputPanned (int channel, int leftvol, int rightvol, void *buf)
 Output panned audio of the specified channel.
int sceAudioOutputPannedBlocking (int channel, int leftvol, int rightvol, void *buf)
 Output panned audio of the specified channel (blocking)
int sceAudioGetChannelRestLen (int channel)
 Get count of unplayed samples remaining.
int sceAudioGetChannelRestLength (int channel)
 Get count of unplayed samples remaining.
int sceAudioSetChannelDataLen (int channel, int samplecount)
 Change the output sample count, after it's already been reserved.
int sceAudioChangeChannelConfig (int channel, int format)
 Change the format of a channel.
int sceAudioChangeChannelVolume (int channel, int leftvol, int rightvol)
 Change the volume of a channel.
int sceAudioOutput2Reserve (int samplecount)
 Reserve the audio output and set the output sample count.
int sceAudioOutput2Release (void)
 Release the audio output.
int sceAudioOutput2ChangeLength (int samplecount)
 Change the output sample count, after it's already been reserved.
int sceAudioOutput2OutputBlocking (int vol, void *buf)
 Output audio (blocking)
int sceAudioOutput2GetRestSample (void)
 Get count of unplayed samples remaining.
int sceAudioSRCChReserve (int samplecount, int freq, int channels)
 Reserve the audio output.
int sceAudioSRCChRelease (void)
 Release the audio output.
int sceAudioSRCOutputBlocking (int vol, void *buf)
 Output audio.
int sceAudioInputInit (int unknown1, int gain, int unknown2)
 Init audio input.
int sceAudioInputInitEx (pspAudioInputParams *params)
 Init audio input (with extra arguments)
int sceAudioInputBlocking (int samplecount, int freq, void *buf)
 Perform audio input (blocking)
int sceAudioInput (int samplecount, int freq, void *buf)
 Perform audio input.
int sceAudioGetInputLength (void)
 Get the number of samples that were acquired.
int sceAudioWaitInputEnd (void)
 Wait for non-blocking audio input to complete.
int sceAudioPollInputEnd (void)
 Poll for non-blocking audio input status.
int sceAudioSetFrequency (int frequency)
 Set audio sampling frequency.

Detailed Description

Macro Definition Documentation

#define PSP_AUDIO_CHANNEL_MAX   8

The maximum number of hardware channels.

#define PSP_AUDIO_NEXT_CHANNEL   (-1)

Used to request the next available hardware channel.

#define PSP_AUDIO_SAMPLE_ALIGN (   s)    (((s) + 63) & ~63)

Make the given sample count a multiple of 64.

#define PSP_AUDIO_SAMPLE_MAX   65472

The maximum number of samples that can be allocated to a channel.

#define PSP_AUDIO_SAMPLE_MIN   64

The minimum number of samples that can be allocated to a channel.

#define PSP_AUDIO_VOLUME_MAX   0x8000

The maximum output volume.

Enumeration Type Documentation

Enumerator:
PSP_AUDIO_FORMAT_STEREO 

Channel is set to stereo output.

PSP_AUDIO_FORMAT_MONO 

Channel is set to mono output.

Enumerator:
PSP_AUDIO_FREQ_44K 

Sampling frequency set to 44100Hz.

PSP_AUDIO_FREQ_48K 

Sampling frequency set to 48000Hz.

Function Documentation

int sceAudioChangeChannelConfig ( int  channel,
int  format 
)

Change the format of a channel.

Parameters
channel- The channel number.
format- One of PspAudioFormats
Returns
0 on success, an error if less than 0.
int sceAudioChangeChannelVolume ( int  channel,
int  leftvol,
int  rightvol 
)

Change the volume of a channel.

Parameters
channel- The channel number.
leftvol- The left volume.
rightvol- The right volume.
Returns
0 on success, an error if less than 0.
int sceAudioChRelease ( int  channel)

Release a hardware output channel.

Parameters
channel- The channel to release.
Returns
0 on success, an error if less than 0.

Referenced by pspAudioEnd(), and pspAudioInit().

int sceAudioChReserve ( int  channel,
int  samplecount,
int  format 
)

Allocate and initialize a hardware output channel.

Parameters
channel- Use a value between 0 - 7 to reserve a specific channel. Pass PSP_AUDIO_NEXT_CHANNEL to get the first available channel.
samplecount- The number of samples that can be output on the channel per output call. It must be a value between PSP_AUDIO_SAMPLE_MIN and PSP_AUDIO_SAMPLE_MAX, and it must be aligned to 64 bytes (use the PSP_AUDIO_SAMPLE_ALIGN macro to align it).
format- The output format to use for the channel. One of PspAudioFormats.
Returns
The channel number on success, an error code if less than 0.

Referenced by pspAudioInit().

int sceAudioGetChannelRestLen ( int  channel)

Get count of unplayed samples remaining.

Parameters
channel- The channel number.
Returns
Number of samples to be played, an error if less than 0.
int sceAudioGetChannelRestLength ( int  channel)

Get count of unplayed samples remaining.

Parameters
channel- The channel number.
Returns
Number of samples to be played, an error if less than 0.
int sceAudioGetInputLength ( void  )

Get the number of samples that were acquired.

Returns
Number of samples acquired, an error if less than 0.
int sceAudioInput ( int  samplecount,
int  freq,
void *  buf 
)

Perform audio input.

Parameters
samplecount- Number of samples.
freq- Either 44100, 22050 or 11025.
buf- Pointer to where the audio data will be stored.
Returns
0 on success, an error if less than 0.
int sceAudioInputBlocking ( int  samplecount,
int  freq,
void *  buf 
)

Perform audio input (blocking)

Parameters
samplecount- Number of samples.
freq- Either 44100, 22050 or 11025.
buf- Pointer to where the audio data will be stored.
Returns
0 on success, an error if less than 0.
int sceAudioInputInit ( int  unknown1,
int  gain,
int  unknown2 
)

Init audio input.

Parameters
unknown1- Unknown. Pass 0.
gain- Gain.
unknown2- Unknown. Pass 0.
Returns
0 on success, an error if less than 0.
int sceAudioInputInitEx ( pspAudioInputParams params)

Init audio input (with extra arguments)

Parameters
params- A pointer to a pspAudioInputParams struct.
Returns
0 on success, an error if less than 0.
int sceAudioOutput ( int  channel,
int  vol,
void *  buf 
)

Output audio of the specified channel.

Parameters
channel- The channel number.
vol- The volume.
buf- Pointer to the PCM data to output.
Returns
0 on success, an error if less than 0.
int sceAudioOutput2ChangeLength ( int  samplecount)

Change the output sample count, after it's already been reserved.

Parameters
samplecount- The number of samples to output in one output call (min 17, max 4111).
Returns
0 on success, an error if less than 0.
int sceAudioOutput2GetRestSample ( void  )

Get count of unplayed samples remaining.

Returns
Number of samples to be played, an error if less than 0.
int sceAudioOutput2OutputBlocking ( int  vol,
void *  buf 
)

Output audio (blocking)

Parameters
vol- The volume.
buf- Pointer to the PCM data.
Returns
0 on success, an error if less than 0.
int sceAudioOutput2Release ( void  )

Release the audio output.

Returns
0 on success, an error if less than 0.
int sceAudioOutput2Reserve ( int  samplecount)

Reserve the audio output and set the output sample count.

Parameters
samplecount- The number of samples to output in one output call (min 17, max 4111).
Returns
0 on success, an error if less than 0.
int sceAudioOutputBlocking ( int  channel,
int  vol,
void *  buf 
)

Output audio of the specified channel (blocking)

Parameters
channel- The channel number.
vol- The volume.
buf- Pointer to the PCM data to output.
Returns
0 on success, an error if less than 0.
int sceAudioOutputPanned ( int  channel,
int  leftvol,
int  rightvol,
void *  buf 
)

Output panned audio of the specified channel.

Parameters
channel- The channel number.
leftvol- The left volume.
rightvol- The right volume.
buf- Pointer to the PCM data to output.
Returns
0 on success, an error if less than 0.
int sceAudioOutputPannedBlocking ( int  channel,
int  leftvol,
int  rightvol,
void *  buf 
)

Output panned audio of the specified channel (blocking)

Parameters
channel- The channel number.
leftvol- The left volume.
rightvol- The right volume.
buf- Pointer to the PCM data to output.
Returns
0 on success, an error if less than 0.

Referenced by pspAudioOutBlocking().

int sceAudioPollInputEnd ( void  )

Poll for non-blocking audio input status.

Returns
0 if input has completed, 1 if not completed or an error if less than 0.
int sceAudioSetChannelDataLen ( int  channel,
int  samplecount 
)

Change the output sample count, after it's already been reserved.

Parameters
channel- The channel number.
samplecount- The number of samples to output in one output call.
Returns
0 on success, an error if less than 0.
int sceAudioSetFrequency ( int  frequency)

Set audio sampling frequency.

Parameters
frequency- Sampling frequency to set audio output to - either 44100 or 48000.
Returns
0 on success, an error if less than 0.
int sceAudioSRCChRelease ( void  )

Release the audio output.

Returns
0 on success, an error if less than 0.
int sceAudioSRCChReserve ( int  samplecount,
int  freq,
int  channels 
)

Reserve the audio output.

Parameters
samplecount- The number of samples to output in one output call (min 17, max 4111).
freq- The frequency. One of 48000, 44100, 32000, 24000, 22050, 16000, 12000, 11050, 8000.
channels- Number of channels. Pass 2 (stereo).
Returns
0 on success, an error if less than 0.
int sceAudioSRCOutputBlocking ( int  vol,
void *  buf 
)

Output audio.

Parameters
vol- The volume.
buf- Pointer to the PCM data to output.
Returns
0 on success, an error if less than 0.
int sceAudioWaitInputEnd ( void  )

Wait for non-blocking audio input to complete.

Returns
0 on success, an error if less than 0.