vitasdk
Documentation of the vitasdk

Exports for Kernel. More...

Typedefs

typedef void(* SceAudioOutPortCallback) (ScePID process_id)
 Callback invoked after a voice or compressed-voice output port is opened or released.
 

Enumerations

enum  SceAudioOutMonitorPath { SCE_AUDIO_OUT_MONITOR_PATH_PRIMARY = 0 , SCE_AUDIO_OUT_MONITOR_PATH_SECONDARY = 1 }
 Mixed-output paths configured and read by the monitor APIs. More...
 
enum  SceAudioOutMonitorPathMode { SCE_AUDIO_OUT_MONITOR_PATH_MODE_LOCAL_I2S = 0 , SCE_AUDIO_OUT_MONITOR_PATH_MODE_HDMI = 1 , SCE_AUDIO_OUT_MONITOR_PATH_MODE_READBACK = 2 }
 Output modes selected for a mixed-output monitor path. More...
 
enum  SceAudioOutMonitorChannelMode { SCE_AUDIO_OUT_MONITOR_CHANNEL_MODE_MONO = 1 , SCE_AUDIO_OUT_MONITOR_CHANNEL_MODE_STEREO = 2 }
 Channel modes accepted by ksceAudioOutMonitorSetChannelMode. More...
 
enum  SceAudioOutSrcMix2Input0SourceMode { SCE_AUDIO_OUT_SRCMIX2_INPUT0_SOURCE_I2S = 0 , SCE_AUDIO_OUT_SRCMIX2_INPUT0_SOURCE_DUMMY = 1 , SCE_AUDIO_OUT_SRCMIX2_INPUT0_SOURCE_PCM = 2 }
 SrcMix2 input-0 sources selected by ksceAudioSrcMix2SetInput0SourceMode. More...
 

Functions

int ksceAudioOutMonitorSetSampleRate (int sample_rate)
 Select the mixed-output monitor sample rate.
 
int ksceAudioOutSetMasterGain (SceUInt32 gain)
 Set the global SrcMix1 master gain.
 
int ksceAudioOutSetAlcMode (SceAudioOutAlcMode mode)
 Set automatic level control for the current process's BGM port.
 
int ksceAudioSrcMixSetSampleRates (SceUInt32 src_mix_index, int input0_rate, int input1_rate, int output_rate)
 Configure one SrcMix block's input and output sample rates.
 
int ksceAudioOutSetAdoptForPid (ScePID process_id, SceAudioOutPortType type, SceBool adopt, int ramp_length, SceBool wait_for_completion)
 Change a process's adoption state for one output profile.
 
int ksceAudioI2s0CaptureTx (SceInt16 *dest, SceSize frame_count)
 Capture the I2S0 transmit FIFO into RAM.
 
int ksceAudioOutSetPortVolumeForPid (ScePID process_id, int port_mask, SceUInt32 volume, int ramp_length)
 Apply a private gain ramp to selected output profiles of a process.
 
int ksceAudioSrcMix2SubmitInput0Pcm (const SceInt16 *src, SceSize frame_count)
 Submit PCM from RAM to SrcMix2 input 0.
 
int ksceAudioSrcMix2CaptureOutput (SceInt16 *dest, SceSize frame_count)
 Queue capture of SrcMix2's main output into RAM.
 
int ksceAudioSrcMix2SetInputI2sIndex (SceUInt32 i2s_index)
 Select the hardware I2S source used by SrcMix2 input 0.
 
int ksceAudioOutMonitorRead (SceAudioOutMonitorPath path, SceInt16 *dest, SceSize frame_count)
 Queue one mixed-output PCM readback.
 
int ksceAudioSrcMix2SetInput0SourceMode (SceAudioOutSrcMix2Input0SourceMode source_mode)
 Select the source used by SrcMix2 input 0.
 
int ksceAudioOutSetEffectType (SceAudioOutEffectType effect_type)
 Select the current process's BGM seven-band graphic-equalizer preset.
 
int ksceAudioOutSetI2sOutputIndex (int i2s_index)
 Select and enable an I2S output.
 
int ksceAudioOutMonitorSetPathMode (SceAudioOutMonitorPath path, SceAudioOutMonitorPathMode mode)
 Select the output mode of a mixed-output monitor path.
 
int ksceAudioOutGetPortVolumeForPid (ScePID process_id, SceAudioOutPortType type)
 Get a process's private output-profile gain.
 
int ksceAudioOutSetAdoptMode (SceAudioOutAdoptMode mode)
 Select whether newly opened BGM and voice-profile ports are adopted automatically.
 
int ksceAudioOutSetPortReleaseCallback (SceAudioOutPortCallback callback)
 Register or clear the output-port release callback.
 
int ksceAudioOutSetPortOpenCallback (SceAudioOutPortCallback callback)
 Register or clear the output-port open callback.
 
int ksceAudioOutMonitorSetChannelMode (SceAudioOutMonitorChannelMode mode)
 Select the mixed-output monitor channel mode.
 

Detailed Description

Exports for Kernel.


Using this library in your project

Include the header file in your project:


Link the library to the executable:

SceAudioForDriver_stub



Typedef Documentation

◆ SceAudioOutPortCallback

typedef void(* SceAudioOutPortCallback) (ScePID process_id)

Callback invoked after a voice or compressed-voice output port is opened or released.

MAIN and BGM ports do not invoke these callbacks on FW 3.60.

Parameters
[in]process_id- Owner PID for an opened port, or former owner PID for a released port.

Enumeration Type Documentation

◆ SceAudioOutMonitorPath

Mixed-output paths configured and read by the monitor APIs.

Enumerator
SCE_AUDIO_OUT_MONITOR_PATH_PRIMARY 

SrcMix1 main output; used for program-audio capture.

SCE_AUDIO_OUT_MONITOR_PATH_SECONDARY 

SrcMix0 secondary output.

◆ SceAudioOutMonitorPathMode

Output modes selected for a mixed-output monitor path.

Enumerator
SCE_AUDIO_OUT_MONITOR_PATH_MODE_LOCAL_I2S 

Route to the selected local I2S output.

SCE_AUDIO_OUT_MONITOR_PATH_MODE_HDMI 

Route to the HDMI audio output.

SCE_AUDIO_OUT_MONITOR_PATH_MODE_READBACK 

Route mixed PCM to RAM through ksceAudioOutMonitorRead.

◆ SceAudioOutMonitorChannelMode

Channel modes accepted by ksceAudioOutMonitorSetChannelMode.

Enumerator
SCE_AUDIO_OUT_MONITOR_CHANNEL_MODE_MONO 
SCE_AUDIO_OUT_MONITOR_CHANNEL_MODE_STEREO 

◆ SceAudioOutSrcMix2Input0SourceMode

SrcMix2 input-0 sources selected by ksceAudioSrcMix2SetInput0SourceMode.

Enumerator
SCE_AUDIO_OUT_SRCMIX2_INPUT0_SOURCE_I2S 

Read the selected I2S transmit FIFO.

SCE_AUDIO_OUT_SRCMIX2_INPUT0_SOURCE_DUMMY 

Read the FW 3.60 dummy page.

SCE_AUDIO_OUT_SRCMIX2_INPUT0_SOURCE_PCM 

Read PCM submitted by ksceAudioSrcMix2SubmitInput0Pcm.

Function Documentation

◆ ksceAudioOutMonitorSetSampleRate()

int ksceAudioOutMonitorSetSampleRate ( int  sample_rate)

Select the mixed-output monitor sample rate.

Selecting SCE_AUDIO_OUT_SAMPLE_RATE_8000 enables the FW 3.60 FIR downsample path.

Parameters
[in]sample_rate- SCE_AUDIO_OUT_SAMPLE_RATE_8000 or SCE_AUDIO_OUT_SAMPLE_RATE_48000.
Returns
0 on success, or a negative error.

◆ ksceAudioOutSetMasterGain()

int ksceAudioOutSetMasterGain ( SceUInt32  gain)

Set the global SrcMix1 master gain.

SceAVConfig uses this control for PS TV master volume. It sets the same gain for the left and right channels.

Parameters
[in]gain- Q15 gain from 0 through SCE_AUDIO_OUT_MAX_VOL.
Returns
0 on success, or a negative error.

◆ ksceAudioOutSetAlcMode()

int ksceAudioOutSetAlcMode ( SceAudioOutAlcMode  mode)

Set automatic level control for the current 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.

◆ ksceAudioSrcMixSetSampleRates()

int ksceAudioSrcMixSetSampleRates ( SceUInt32  src_mix_index,
int  input0_rate,
int  input1_rate,
int  output_rate 
)

Configure one SrcMix block's input and output sample rates.

A positive input rate may be any SceAudioOutSampleRate value. For each rate argument, a negative value leaves the setting unchanged and zero disables that input or output. FW 3.60 accepts positive output rates 8000, 12000, 16000, 22050, 24000, 32000, 44100, and 48000 Hz. The command encoder recognizes 11050, but a later rate check rejects it; neither 11050 nor 11025 is a usable output rate. FW 3.60 does not validate src_mix_index; callers must use 0 through 2.

Parameters
[in]src_mix_index- SrcMix block index from 0 through 2.
[in]input0_rate- Input-0 SceAudioOutSampleRate value, zero to disable the input, or a negative value to leave it unchanged.
[in]input1_rate- Input-1 SceAudioOutSampleRate value, zero to disable the input, or a negative value to leave it unchanged.
[in]output_rate- Output rate listed above, zero to disable output, or a negative value to leave it unchanged.
Returns
0 on success, or a negative error.

◆ ksceAudioOutSetAdoptForPid()

int ksceAudioOutSetAdoptForPid ( ScePID  process_id,
SceAudioOutPortType  type,
SceBool  adopt,
int  ramp_length,
SceBool  wait_for_completion 
)

Change a process's adoption state for one output profile.

Parameters
[in]process_id- Process whose output state is changed.
[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.

◆ ksceAudioI2s0CaptureTx()

int ksceAudioI2s0CaptureTx ( SceInt16 *  dest,
SceSize  frame_count 
)

Capture the I2S0 transmit FIFO into RAM.

The result is interleaved stereo signed 16-bit PCM. Calls with a non-NULL destination form a two-entry pipeline and may return while the destination is still being filled. You may reuse the destination buffer after the next call with a non-NULL destination returns. A call with a NULL destination waits for all queued captures to complete, after which you may reuse their buffers.

Parameters
[out]dest- 128-byte-aligned destination, or NULL.
[in]frame_count- At least 64 frames and a multiple of 32. FW 3.60 validates this argument even when dest is NULL.
Returns
0 on success, or a negative error.

◆ ksceAudioOutSetPortVolumeForPid()

int ksceAudioOutSetPortVolumeForPid ( ScePID  process_id,
int  port_mask,
SceUInt32  volume,
int  ramp_length 
)

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

A zero mask does nothing, and FW 3.60 ignores mask bits not defined by SceAudioOutPortMask.

Parameters
[in]process_id- Process whose output state is changed.
[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.

◆ ksceAudioSrcMix2SubmitInput0Pcm()

int ksceAudioSrcMix2SubmitInput0Pcm ( const SceInt16 *  src,
SceSize  frame_count 
)

Submit PCM from RAM to SrcMix2 input 0.

SCE_AUDIO_OUT_SRCMIX2_INPUT0_SOURCE_PCM must be selected first. The input is interleaved stereo signed 16-bit PCM.

Parameters
[in]src- Source PCM buffer. The caller must keep it readable until the queued DMA transfer has finished reading it; this function does not provide a completion callback.
[in]frame_count- More than 4 frames and a multiple of 4.
Returns
0 on success, or a negative error.

◆ ksceAudioSrcMix2CaptureOutput()

int ksceAudioSrcMix2CaptureOutput ( SceInt16 *  dest,
SceSize  frame_count 
)

Queue capture of SrcMix2's main output into RAM.

Calls with a non-NULL destination form a two-entry pipeline and may return while the destination is still being filled. You may reuse the destination buffer after the next call with a non-NULL destination returns. Passing NULL waits until all already queued captures complete.

Parameters
[out]dest- 16-byte-aligned destination for interleaved stereo signed 16-bit PCM, or NULL to wait for queued captures to finish.
[in]frame_count- More than 4 frames and a multiple of 4; ignored when dest is NULL.
Returns
0 on success, or a negative error.

◆ ksceAudioSrcMix2SetInputI2sIndex()

int ksceAudioSrcMix2SetInputI2sIndex ( SceUInt32  i2s_index)

Select the hardware I2S source used by SrcMix2 input 0.

Parameters
[in]i2s_index- I2S index from 0 through 2.
Returns
0 on success, or -1 for an invalid index.

◆ ksceAudioOutMonitorRead()

int ksceAudioOutMonitorRead ( SceAudioOutMonitorPath  path,
SceInt16 *  dest,
SceSize  frame_count 
)

Queue one mixed-output PCM readback.

SceAVConfig uses the primary path as the post-mix program-audio source for Bluetooth transmission. At 48000 Hz in stereo, a frame occupies four bytes. When either 8000 Hz or mono conversion is selected, FW 3.60 requires exactly 120 frames. Only one destination can be pending per path.

Parameters
[in]path- Mixed-output path.
[out]dest- Destination for signed 16-bit PCM. The caller must keep the buffer writable until the queued readback completes.
[in]frame_count- More than 4 frames and a multiple of 4; exactly 120 when conversion is enabled.
Returns
0 when queued, -2 when the path is not in readback mode, or another negative error.

◆ ksceAudioSrcMix2SetInput0SourceMode()

int ksceAudioSrcMix2SetInput0SourceMode ( SceAudioOutSrcMix2Input0SourceMode  source_mode)

Select the source used by SrcMix2 input 0.

FW 3.60 does not validate this value. Values other than 0 and 2 use the dummy-page source, but only value 2 permits ksceAudioSrcMix2SubmitInput0Pcm.

Parameters
[in]source_mode- Input source.
Returns
0.

◆ ksceAudioOutSetEffectType()

int ksceAudioOutSetEffectType ( SceAudioOutEffectType  effect_type)

Select the current process's BGM seven-band graphic-equalizer preset.

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

◆ ksceAudioOutSetI2sOutputIndex()

int ksceAudioOutSetI2sOutputIndex ( int  i2s_index)

Select and enable an I2S output.

Parameters
[in]i2s_index- I2S index from 3 through 7.
Returns
0 on success, or -1 for an invalid index.

◆ ksceAudioOutMonitorSetPathMode()

int ksceAudioOutMonitorSetPathMode ( SceAudioOutMonitorPath  path,
SceAudioOutMonitorPathMode  mode 
)

Select the output mode of a mixed-output monitor path.

On FW 3.60 this function accepts path value 2, but that value indexes beyond the two intended monitor contexts and is rejected by ksceAudioOutMonitorRead. Do not use it. This function does not validate mode; values outside SceAudioOutMonitorPathMode are stored but do not select a usable output path.

Parameters
[in]path- Primary or secondary mixed-output path.
[in]mode- Output mode for the path.
Returns
0 on success, or a negative error.

◆ ksceAudioOutGetPortVolumeForPid()

int ksceAudioOutGetPortVolumeForPid ( ScePID  process_id,
SceAudioOutPortType  type 
)

Get a process's private output-profile gain.

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

◆ ksceAudioOutSetAdoptMode()

int ksceAudioOutSetAdoptMode ( 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.

◆ ksceAudioOutSetPortReleaseCallback()

int ksceAudioOutSetPortReleaseCallback ( SceAudioOutPortCallback  callback)

Register or clear the output-port release callback.

Parameters
[in]callback- Callback invoked with the former owner PID after a voice or compressed-voice port is released, or NULL to clear it.
Returns
0.

◆ ksceAudioOutSetPortOpenCallback()

int ksceAudioOutSetPortOpenCallback ( SceAudioOutPortCallback  callback)

Register or clear the output-port open callback.

Parameters
[in]callback- Callback invoked with the owner PID after a voice or compressed-voice port opens, or NULL to clear it.
Returns
0.

◆ ksceAudioOutMonitorSetChannelMode()

int ksceAudioOutMonitorSetChannelMode ( SceAudioOutMonitorChannelMode  mode)

Select the mixed-output monitor channel mode.

On FW 3.60 this also configures the monitor clock generator for a 48000 Hz source.

Parameters
[in]mode- Mono or stereo monitor mode.
Returns
0 on success, or a negative error.