vitasdk
Documentation of the vitasdk

Exports for User. More...

Macros

#define SCE_AUDIO_MIN_LEN   64
 Minimum frame-count granularity.
 
#define SCE_AUDIO_MAX_LEN   65472
 Maximum frame count.
 
#define SCE_AUDIO_OUT_MAX_VOL   32768
 Maximum Q15 output-port volume for game processes on FW 3.60.
 
#define SCE_AUDIO_VOLUME_0DB   SCE_AUDIO_OUT_MAX_VOL
 Q15 unity-gain output-port volume.
 

Enumerations

enum  SceAudioOutErrorCode {
  SCE_AUDIO_OUT_ERROR_NOT_OPENED = 0x80260001 , SCE_AUDIO_OUT_ERROR_BUSY = 0x80260002 , SCE_AUDIO_OUT_ERROR_INVALID_PORT = 0x80260003 , SCE_AUDIO_OUT_ERROR_INVALID_POINTER = 0x80260004 ,
  SCE_AUDIO_OUT_ERROR_PORT_FULL = 0x80260005 , SCE_AUDIO_OUT_ERROR_INVALID_SIZE = 0x80260006 , SCE_AUDIO_OUT_ERROR_INVALID_FORMAT = 0x80260007 , SCE_AUDIO_OUT_ERROR_INVALID_SAMPLE_FREQ = 0x80260008 ,
  SCE_AUDIO_OUT_ERROR_INVALID_VOLUME = 0x80260009 , SCE_AUDIO_OUT_ERROR_INVALID_PORT_TYPE = 0x8026000A , SCE_AUDIO_OUT_ERROR_INVALID_FX_TYPE = 0x8026000B , SCE_AUDIO_OUT_ERROR_INVALID_CONF_TYPE = 0x8026000C ,
  SCE_AUDIO_OUT_ERROR_OUT_OF_MEMORY = 0x8026000D
}
 
enum  SceAudioOutParam { SCE_AUDIO_OUT_PARAM_FORMAT_S16_MONO = 0 , SCE_AUDIO_OUT_PARAM_FORMAT_S16_STEREO = 1 }
 Legacy signed 16-bit PCM format names. More...
 
enum  SceAudioOutPortType { SCE_AUDIO_OUT_PORT_TYPE_MAIN = 0 , SCE_AUDIO_OUT_PORT_TYPE_BGM = 1 , SCE_AUDIO_OUT_PORT_TYPE_VOICE = 2 , SCE_AUDIO_OUT_PORT_TYPE_VOICE_COMPRESSED = 3 }
 
enum  SceAudioOutMode { SCE_AUDIO_OUT_MODE_MONO = 0 , SCE_AUDIO_OUT_MODE_STEREO = 1 }
 
enum  SceAudioOutEffectType {
  SCE_AUDIO_OUT_EFFECT_TYPE_OFF = 0 , SCE_AUDIO_OUT_EFFECT_TYPE_HEAVY = 1 , SCE_AUDIO_OUT_EFFECT_TYPE_POPS = 2 , SCE_AUDIO_OUT_EFFECT_TYPE_JAZZ = 3 ,
  SCE_AUDIO_OUT_EFFECT_TYPE_UNIQUE = 4
}
 BGM seven-band graphic-equalizer presets. More...
 
enum  SceAudioOutSampleRate {
  SCE_AUDIO_OUT_SAMPLE_RATE_8000 = 8000 , SCE_AUDIO_OUT_SAMPLE_RATE_11025 = 11025 , SCE_AUDIO_OUT_SAMPLE_RATE_12000 = 12000 , SCE_AUDIO_OUT_SAMPLE_RATE_16000 = 16000 ,
  SCE_AUDIO_OUT_SAMPLE_RATE_22050 = 22050 , SCE_AUDIO_OUT_SAMPLE_RATE_24000 = 24000 , SCE_AUDIO_OUT_SAMPLE_RATE_32000 = 32000 , SCE_AUDIO_OUT_SAMPLE_RATE_44100 = 44100 ,
  SCE_AUDIO_OUT_SAMPLE_RATE_44184 = 44184 , SCE_AUDIO_OUT_SAMPLE_RATE_48000 = 48000
}
 Audio-output sample rates. More...
 
enum  SceAudioOutChannelFlag { SCE_AUDIO_VOLUME_FLAG_L_CH = 1 , SCE_AUDIO_VOLUME_FLAG_R_CH = 2 }
 Channel-flag bits accepted by sceAudioOutSetVolume. More...
 
enum  SceAudioOutConfigType { SCE_AUDIO_OUT_CONFIG_TYPE_LEN = 0 , SCE_AUDIO_OUT_CONFIG_TYPE_FREQ = 1 , SCE_AUDIO_OUT_CONFIG_TYPE_MODE = 2 }
 Configuration selectors accepted by sceAudioOutGetConfig. More...
 
enum  SceAudioOutAlcMode { SCE_AUDIO_ALC_OFF = 0 , SCE_AUDIO_ALC_MODE1 = 1 , SCE_AUDIO_ALC_MODE_MAX = 2 }
 Automatic-level-control modes for sceAudioOutSetAlcMode. More...
 
enum  SceAudioOutPortMask { SCE_AUDIO_OUT_PORT_MASK_MAIN = 2 , SCE_AUDIO_OUT_PORT_MASK_BGM = 4 , SCE_AUDIO_OUT_PORT_MASK_VOICE = 8 }
 Port-selection bits used by the private port-volume APIs. More...
 
enum  SceAudioOutAdoptMode { SCE_AUDIO_OUT_ADOPT_MODE_AUTOMATIC = 0 , SCE_AUDIO_OUT_ADOPT_MODE_MANUAL = 1 }
 New-port adoption behavior selected by sceAudioOutSetAdoptMode. More...
 

Functions

int sceAudioOutOpenPort (SceAudioOutPortType type, int len, int freq, SceAudioOutMode mode)
 Open an audio-output port.
 
int sceAudioOutOpenExtPort (int len, SceAudioOutMode mode)
 Open the calling process's dedicated extended MAIN port.
 
int sceAudioOutReleasePort (int port)
 Release an audio-output port.
 
int sceAudioOutOutput (int port, const void *buf)
 Output one configured PCM buffer.
 
int sceAudioOutSetVolume (int port, SceAudioOutChannelFlag ch, int *vol)
 Set an output port's channel volume.
 
int sceAudioOutSetConfig (int port, SceSize len, int freq, SceAudioOutMode mode)
 Change an output port's configuration.
 
int sceAudioOutGetConfig (int port, SceAudioOutConfigType type)
 Get one property of an output port.
 
int sceAudioOutSetAlcMode (SceAudioOutAlcMode mode)
 Set automatic level control for the calling process's BGM port.
 
int sceAudioOutSetCompress (int port, SceBool enable)
 Set the compressed-audio profile of an open BGM or voice port.
 
int sceAudioOutSetEffectType (SceAudioOutEffectType effect_type)
 Select the BGM seven-band graphic-equalizer preset for the calling process.
 
int sceAudioOutSetAdoptMode (SceAudioOutAdoptMode mode)
 Select whether newly opened BGM and voice-profile ports are adopted automatically.
 
int sceAudioOutSetAdopt_forUser (SceAudioOutPortType type, SceBool adopt, int ramp_length, SceBool wait_for_completion)
 Change the calling process's adoption state for one output profile.
 
int sceAudioOutSetPortVolume_forUser (int port_mask, SceUInt32 volume, int ramp_length)
 Apply a private gain ramp to selected output profiles of the calling process.
 
int sceAudioOutGetPortVolume_forUser (SceAudioOutPortType type)
 Get a private output-profile gain for the calling process.
 
int sceAudioOutGetRestSample (int port)
 Get the number of frames remaining on an output port.
 
int sceAudioOutGetAdopt (SceAudioOutPortType type)
 Check whether the calling process currently adopts an output profile.
 

Detailed Description

Exports for User.


Using this library in your project

Include the header file in your project:


Link the library to the executable:

SceAudio_stub




Using this library in your project

Include the header file in your project:



Macro Definition Documentation

◆ SCE_AUDIO_MIN_LEN

#define SCE_AUDIO_MIN_LEN   64

Minimum frame-count granularity.

◆ SCE_AUDIO_MAX_LEN

#define SCE_AUDIO_MAX_LEN   65472

Maximum frame count.

◆ SCE_AUDIO_OUT_MAX_VOL

#define SCE_AUDIO_OUT_MAX_VOL   32768

Maximum Q15 output-port volume for game processes on FW 3.60.

◆ SCE_AUDIO_VOLUME_0DB

#define SCE_AUDIO_VOLUME_0DB   SCE_AUDIO_OUT_MAX_VOL

Q15 unity-gain output-port volume.

Enumeration Type Documentation

◆ SceAudioOutErrorCode

Enumerator
SCE_AUDIO_OUT_ERROR_NOT_OPENED 
SCE_AUDIO_OUT_ERROR_BUSY 
SCE_AUDIO_OUT_ERROR_INVALID_PORT 
SCE_AUDIO_OUT_ERROR_INVALID_POINTER 
SCE_AUDIO_OUT_ERROR_PORT_FULL 
SCE_AUDIO_OUT_ERROR_INVALID_SIZE 
SCE_AUDIO_OUT_ERROR_INVALID_FORMAT 
SCE_AUDIO_OUT_ERROR_INVALID_SAMPLE_FREQ 
SCE_AUDIO_OUT_ERROR_INVALID_VOLUME 
SCE_AUDIO_OUT_ERROR_INVALID_PORT_TYPE 
SCE_AUDIO_OUT_ERROR_INVALID_FX_TYPE 
SCE_AUDIO_OUT_ERROR_INVALID_CONF_TYPE 
SCE_AUDIO_OUT_ERROR_OUT_OF_MEMORY 

◆ SceAudioOutParam

Legacy signed 16-bit PCM format names.

Prefer SceAudioOutMode for new declarations.

Enumerator
SCE_AUDIO_OUT_PARAM_FORMAT_S16_MONO 
SCE_AUDIO_OUT_PARAM_FORMAT_S16_STEREO 

◆ SceAudioOutPortType

Enumerator
SCE_AUDIO_OUT_PORT_TYPE_MAIN 

Main output; use SCE_AUDIO_OUT_SAMPLE_RATE_48000.

SCE_AUDIO_OUT_PORT_TYPE_BGM 

Background-music output.

SCE_AUDIO_OUT_PORT_TYPE_VOICE 

Voice-chat output.

SCE_AUDIO_OUT_PORT_TYPE_VOICE_COMPRESSED 

Compressed voice; non-game processes only on FW 3.60.

◆ SceAudioOutMode

Enumerator
SCE_AUDIO_OUT_MODE_MONO 
SCE_AUDIO_OUT_MODE_STEREO 

◆ SceAudioOutEffectType

BGM seven-band graphic-equalizer presets.

The gains below apply to the 63 Hz, 160 Hz, 400 Hz, 1 kHz, 2.5 kHz, 6.3 kHz, and 16 kHz bands, in that order.

Enumerator
SCE_AUDIO_OUT_EFFECT_TYPE_OFF 

Bypasses the equalizer; the stored preset uses 0 dB for every band.

SCE_AUDIO_OUT_EFFECT_TYPE_HEAVY 

+3, +3, 0, -3, +3, +3, 0 dB.

SCE_AUDIO_OUT_EFFECT_TYPE_POPS 

-3, 0, +3, +3, 0, 0, -3 dB.

SCE_AUDIO_OUT_EFFECT_TYPE_JAZZ 

0, +6, 0, 0, -3, 0, +3 dB.

SCE_AUDIO_OUT_EFFECT_TYPE_UNIQUE 

+6, 0, 0, +3, 0, -3, +6 dB.

◆ SceAudioOutSampleRate

Audio-output sample rates.

Each AudioOut function accepts only the rates documented for that function.

Enumerator
SCE_AUDIO_OUT_SAMPLE_RATE_8000 
SCE_AUDIO_OUT_SAMPLE_RATE_11025 
SCE_AUDIO_OUT_SAMPLE_RATE_12000 
SCE_AUDIO_OUT_SAMPLE_RATE_16000 
SCE_AUDIO_OUT_SAMPLE_RATE_22050 
SCE_AUDIO_OUT_SAMPLE_RATE_24000 
SCE_AUDIO_OUT_SAMPLE_RATE_32000 
SCE_AUDIO_OUT_SAMPLE_RATE_44100 
SCE_AUDIO_OUT_SAMPLE_RATE_44184 

Accepted by SrcMix inputs and PSPemu output ports on FW 3.60.

SCE_AUDIO_OUT_SAMPLE_RATE_48000 

◆ SceAudioOutChannelFlag

Channel-flag bits accepted by sceAudioOutSetVolume.

Enumerator
SCE_AUDIO_VOLUME_FLAG_L_CH 

Left channel.

SCE_AUDIO_VOLUME_FLAG_R_CH 

Right channel.

◆ SceAudioOutConfigType

Configuration selectors accepted by sceAudioOutGetConfig.

Enumerator
SCE_AUDIO_OUT_CONFIG_TYPE_LEN 
SCE_AUDIO_OUT_CONFIG_TYPE_FREQ 
SCE_AUDIO_OUT_CONFIG_TYPE_MODE 

◆ SceAudioOutAlcMode

Automatic-level-control modes for sceAudioOutSetAlcMode.

Enumerator
SCE_AUDIO_ALC_OFF 

Disable the BGM dynamic normalizer.

SCE_AUDIO_ALC_MODE1 

Enable the BGM dynamic normalizer.

SCE_AUDIO_ALC_MODE_MAX 

Number of ALC modes; not a valid mode.

◆ SceAudioOutPortMask

Port-selection bits used by the private port-volume APIs.

Enumerator
SCE_AUDIO_OUT_PORT_MASK_MAIN 
SCE_AUDIO_OUT_PORT_MASK_BGM 
SCE_AUDIO_OUT_PORT_MASK_VOICE 

◆ SceAudioOutAdoptMode

New-port adoption behavior selected by sceAudioOutSetAdoptMode.

Enumerator
SCE_AUDIO_OUT_ADOPT_MODE_AUTOMATIC 

Automatically adopt newly opened BGM and voice-profile ports.

SCE_AUDIO_OUT_ADOPT_MODE_MANUAL 

Do not automatically adopt newly opened BGM and voice-profile ports.

Function Documentation

◆ sceAudioOutOpenPort()

int sceAudioOutOpenPort ( SceAudioOutPortType  type,
int  len,
int  freq,
SceAudioOutMode  mode 
)

Open an audio-output port.

FW 3.60 supports one BGM port and one voice port per process, eight regular MAIN ports, and the dedicated extended MAIN port opened by sceAudioOutOpenExtPort. The MAIN profile requires SCE_AUDIO_OUT_SAMPLE_RATE_48000. BGM and voice accept every SceAudioOutSampleRate value except SCE_AUDIO_OUT_SAMPLE_RATE_44184; PSPemu may additionally use that rate.

Parameters
[in]type- Output profile.
[in]len- Number of PCM frames. Must be a multiple of SCE_AUDIO_MIN_LEN and no greater than SCE_AUDIO_MAX_LEN.
[in]freq- One of the SceAudioOutSampleRate values accepted by the selected output profile.
[in]mode- Mono or stereo signed 16-bit PCM.
Returns
A port handle on success, or a negative SceAudioOutErrorCode value.

◆ sceAudioOutOpenExtPort()

int sceAudioOutOpenExtPort ( int  len,
SceAudioOutMode  mode 
)

Open the calling process's dedicated extended MAIN port.

The port uses handle 8 and SCE_AUDIO_OUT_SAMPLE_RATE_48000 on FW 3.60.

Parameters
[in]len- Number of PCM frames. Must be a multiple of SCE_AUDIO_MIN_LEN and no greater than SCE_AUDIO_MAX_LEN.
[in]mode- Mono or stereo signed 16-bit PCM.
Returns
Port handle 8 on success, or a negative SceAudioOutErrorCode value.

◆ sceAudioOutReleasePort()

int sceAudioOutReleasePort ( int  port)

Release an audio-output port.

Parameters
[in]port- Port handle returned by sceAudioOutOpenPort or sceAudioOutOpenExtPort.
Returns
0 on success, or a negative SceAudioOutErrorCode value.

◆ sceAudioOutOutput()

int sceAudioOutOutput ( int  port,
const void *  buf 
)

Output one configured PCM buffer.

The call blocks until the supplied buffer has been accepted. Passing NULL waits until the port's previously queued audio has finished playing.

Parameters
[in]port- Open port handle.
[in]buf- Interleaved signed 16-bit PCM, or NULL to wait for queued audio to finish playing.
Returns
0 on success, or a negative SceAudioOutErrorCode value.

◆ sceAudioOutSetVolume()

int sceAudioOutSetVolume ( int  port,
SceAudioOutChannelFlag  ch,
int *  vol 
)

Set an output port's channel volume.

Parameters
[in]port- Open port handle.
[in]ch- Bitwise OR of SceAudioOutChannelFlag values.
[in]vol- Read-only array containing the left- and right-channel Q15 volume values, in that order. FW 3.60 reads both values, including for a mono port. Game processes may use values from 0 through SCE_AUDIO_OUT_MAX_VOL; system and other non-game processes may use values through 0xFFFF. Channel-mask bits other than left and right are ignored.
Returns
0 on success, or a negative SceAudioOutErrorCode value.

◆ sceAudioOutSetConfig()

int sceAudioOutSetConfig ( int  port,
SceSize  len,
int  freq,
SceAudioOutMode  mode 
)

Change an output port's configuration.

A negative value for len, freq, or mode leaves that setting unchanged.

For a BGM port, the low byte of mode contains one of SceAudioOutMode, while its high byte contains one of SceAudioOutEffectType.

Parameters
[in]port- Open port handle.
[in]len- New frame count, or a negative value to leave it unchanged.
[in]freq- New SceAudioOutSampleRate value accepted by the output profile, or a negative value to leave it unchanged.
[in]mode- New channel mode and optional BGM effect preset, or a negative value to leave them unchanged.
Example:
Configure stereo output with the Heavy equalizer preset without changing the frame count or sample rate:
sceAudioOutSetConfig(port, -1, -1, mode);
int sceAudioOutSetConfig(int port, SceSize len, int freq, SceAudioOutMode mode)
Change an output port's configuration.
@ SCE_AUDIO_OUT_EFFECT_TYPE_HEAVY
+3, +3, 0, -3, +3, +3, 0 dB.
Definition audioout.h:61
@ SCE_AUDIO_OUT_MODE_STEREO
Definition audioout.h:50
Returns
0 on success, or a negative SceAudioOutErrorCode value.

◆ sceAudioOutGetConfig()

int sceAudioOutGetConfig ( int  port,
SceAudioOutConfigType  type 
)

Get one property of an output port.

Parameters
[in]port- Open port handle.
[in]type- Property to query.
Returns
The selected frame count, sample rate, or channel mode on success; otherwise a negative SceAudioOutErrorCode value.

◆ sceAudioOutSetAlcMode()

int sceAudioOutSetAlcMode ( SceAudioOutAlcMode  mode)

Set automatic level control for the calling process's BGM port.

Mode 1 enables the FW 3.60 dynamic normalizer; mode 0 bypasses it.

Parameters
[in]mode- Automatic-level-control mode.
Returns
0 on success, or a negative error.

◆ sceAudioOutSetCompress()

int sceAudioOutSetCompress ( int  port,
SceBool  enable 
)

Set the compressed-audio profile of an open BGM or voice port.

Parameters
[in]port- Open BGM or voice port handle.
[in]enable- SCE_TRUE to select the compressed external-codec profile, or SCE_FALSE for the normal profile.
Returns
0 on success, or a negative error.

◆ sceAudioOutSetEffectType()

int sceAudioOutSetEffectType ( SceAudioOutEffectType  effect_type)

Select the BGM seven-band graphic-equalizer preset for the calling process.

Parameters
[in]effect_type- Equalizer preset.
Returns
0 on success, or a negative error.

◆ sceAudioOutSetAdoptMode()

int sceAudioOutSetAdoptMode ( SceAudioOutAdoptMode  mode)

Select whether newly opened BGM and voice-profile ports are adopted automatically.

Parameters
[in]mode- Adoption mode. Any nonzero value behaves as manual mode on FW 3.60.
Returns
0.

◆ sceAudioOutSetAdopt_forUser()

int sceAudioOutSetAdopt_forUser ( SceAudioOutPortType  type,
SceBool  adopt,
int  ramp_length,
SceBool  wait_for_completion 
)

Change the calling process's adoption state for one output profile.

Parameters
[in]type- MAIN, BGM, or voice port selector.
[in]adopt- SCE_TRUE to adopt the port, or SCE_FALSE to release it.
[in]ramp_length- Gain-transition duration in milliseconds, clamped to 1..4096 on FW 3.60.
[in]wait_for_completion- When releasing adoption, wait for the transition to finish if nonzero.
Returns
0 on success, or a negative error.

◆ sceAudioOutSetPortVolume_forUser()

int sceAudioOutSetPortVolume_forUser ( int  port_mask,
SceUInt32  volume,
int  ramp_length 
)

Apply a private gain ramp to selected output profiles of the calling process.

This 0..256 gain is separate from the Q15 per-channel volume configured by sceAudioOutSetVolume. A zero mask does nothing, and FW 3.60 ignores mask bits not defined by SceAudioOutPortMask.

Parameters
[in]port_mask- Bitwise OR of SceAudioOutPortMask values.
[in]volume- Target gain from 0 through 256.
[in]ramp_length- Gain-transition duration in milliseconds, clamped to 1..4096 on FW 3.60.
Returns
0 on success, or a negative error.

◆ sceAudioOutGetPortVolume_forUser()

int sceAudioOutGetPortVolume_forUser ( SceAudioOutPortType  type)

Get a private output-profile gain for the calling process.

Parameters
[in]type- MAIN, BGM, or voice port selector.
Returns
The private target gain, normally from 0 through 256, on success; or a negative error.

◆ sceAudioOutGetRestSample()

int sceAudioOutGetRestSample ( int  port)

Get the number of frames remaining on an output port.

Parameters
[in]port- Open port handle.
Returns
The queued frame count on success, or a negative SceAudioOutErrorCode value.

◆ sceAudioOutGetAdopt()

int sceAudioOutGetAdopt ( SceAudioOutPortType  type)

Check whether the calling process currently adopts an output profile.

FW 3.60 also accepts SCE_AUDIO_OUT_PORT_TYPE_VOICE_COMPRESSED for a non-game process and queries the same adoption state as the voice profile. For the MAIN selector, this function returns 1 when the process's MAIN adoption flag is set or when the process has no selected MAIN port.

Parameters
[in]type- Output profile selector.
Returns
1 when adopted, 0 otherwise, or a negative error.