vitasdk
Documentation of the vitasdk

Exports for User. More...

Data Structures

struct  SceVoiceEventPortDataReady
 
struct  SceVoiceEventAudioInputOwnershipChanged
 
struct  SceVoiceEvent
 
struct  SceVoiceInitParam
 
struct  SceVoiceStartParam
 
struct  SceVoicePortParam
 
struct  SceVoiceResourceInfo
 
struct  SceVoicePortInfo
 
union  SceVoiceEvent.event_payload
 
union  SceVoicePortParam.data
 

Macros

#define SCE_VOICE_VERSION   100
 
#define SCE_VOICE_WORKING_MEMORY_SIZE   0x40000
 
#define SCE_VOICE_MAX_EVENT_PORTS   7
 

Typedefs

typedef SceUInt32 SceVoicePortId
 
typedef void(* SceVoiceEventCallback) (const SceVoiceEvent *event)
 Voice event callback.
 

Enumerations

enum  SceVoiceErrorCode {
  SCE_VOICE_ERROR_NOT_INITIALIZED = 0x804E0801 , SCE_VOICE_ERROR_ALREADY_INITIALIZED = 0x804E0802 , SCE_VOICE_ERROR_INTERNAL = 0x804E0803 , SCE_VOICE_ERROR_INVALID_PORT_ID = 0x804E0804 ,
  SCE_VOICE_ERROR_INVALID_ARGUMENT = 0x804E0805 , SCE_VOICE_ERROR_INVALID_MEMBLOCK = 0x804E0806 , SCE_VOICE_ERROR_INVALID_PORT = 0x804E0807 , SCE_VOICE_ERROR_RESOURCE_LIMIT = 0x804E0808 ,
  SCE_VOICE_ERROR_NOT_STARTED = 0x804E080A
}
 
enum  SceVoiceApplicationType { SCE_VOICE_APPLICATION_TYPE_UNK_0x20000000 = 0x20000000 , SCE_VOICE_APPLICATION_TYPE_UNK_0x80000000 = 0x80000000 }
 Voice application profiles accepted by sceVoiceInit. More...
 
enum  SceVoicePortType {
  SCE_VOICE_PORT_TYPE_IN_DEVICE = 0 , SCE_VOICE_PORT_TYPE_IN_PCMAUDIO = 1 , SCE_VOICE_PORT_TYPE_IN_VOICE = 2 , SCE_VOICE_PORT_TYPE_OUT_PCMAUDIO = 3 ,
  SCE_VOICE_PORT_TYPE_OUT_VOICE = 4 , SCE_VOICE_PORT_TYPE_OUT_DEVICE = 5
}
 
enum  SceVoicePortState { SCE_VOICE_PORT_STATE_INACTIVE = 0 , SCE_VOICE_PORT_STATE_IDLE = 1 , SCE_VOICE_PORT_STATE_BUFFERING = 2 , SCE_VOICE_PORT_STATE_ACTIVE = 3 }
 Port processing states reported by sceVoiceGetPortInfo on FW 3.60. More...
 
enum  SceVoiceBitRate {
  SCE_VOICE_BIT_RATE_3850 = 3850 , SCE_VOICE_BIT_RATE_4650 = 4650 , SCE_VOICE_BIT_RATE_5700 = 5700 , SCE_VOICE_BIT_RATE_7300 = 7300 ,
  SCE_VOICE_BIT_RATE_12200 = 12200
}
 8 kHz CELP bitrates supported by the FW 3.60 Voice codec. More...
 
enum  SceVoicePcmDataType { SCE_VOICE_PCM_DATA_TYPE_S16LE = 0 }
 
enum  SceVoiceSamplingRate { SCE_VOICE_SAMPLING_RATE_16000 = 16000 }
 
enum  SceVoicePortAttr { SCE_VOICE_PORT_ATTR_AUDIO_INPUT_OWNERSHIP = 1000 }
 
enum  SceVoiceEventType { SCE_VOICE_EVENT_TYPE_PORT_DATA_READY = 1 , SCE_VOICE_EVENT_TYPE_AUDIO_INPUT_OWNERSHIP_CHANGED = 2 }
 

Functions

 VITASDK_BUILD_ASSERT_EQ (0x10, SceVoiceEventPortDataReady)
 
 VITASDK_BUILD_ASSERT_EQ (0x10, SceVoiceEventAudioInputOwnershipChanged)
 
 VITASDK_BUILD_ASSERT_EQ (0x18, SceVoiceEvent)
 
 VITASDK_BUILD_ASSERT_EQ (0x20, SceVoiceInitParam)
 
 VITASDK_BUILD_ASSERT_EQ (0x20, SceVoiceStartParam)
 
 VITASDK_BUILD_ASSERT_EQ (0x18, SceVoicePortParam)
 
 VITASDK_BUILD_ASSERT_EQ (0xA, SceVoiceResourceInfo)
 
 VITASDK_BUILD_ASSERT_EQ (0x18, SceVoicePortInfo)
 
int sceVoiceInit (const SceVoiceInitParam *param, SceUInt32 version)
 Initialize Voice for the calling process.
 
int sceVoiceEnd (void)
 Shut down Voice for the calling process and release its ports.
 
int sceVoiceStart (const SceVoiceStartParam *param)
 Attach the Voice instance to its working-memory block and start processing.
 
int sceVoiceStop (void)
 Stop Voice processing and detach the working-memory block.
 
int sceVoiceGetResourceInfo (SceVoiceResourceInfo *info)
 Get the port limits assigned to this Voice instance.
 
int sceVoiceCheckTopology (void)
 Check whether the current port connections are valid.
 
int sceVoiceSetMuteFlagAll (SceBool mute)
 Set the process-wide mute-reporting override.
 
int sceVoiceSetMuteFlag (SceVoicePortId port_id, SceBool mute)
 Set one port's mute flag.
 
int sceVoiceGetMuteFlag (SceVoicePortId port_id, SceUInt16 *mute)
 Get one port's reported mute flag.
 
int sceVoiceSetVolume (SceVoicePortId port_id, float volume)
 Set one port's linear volume.
 
int sceVoiceGetVolume (SceVoicePortId port_id, float *volume)
 Get one port's linear volume.
 
int sceVoiceSetBitRate (SceVoicePortId port_id, SceUInt32 bit_rate)
 Change the bitrate of an encoded input or output port.
 
int sceVoiceGetBitRate (SceVoicePortId port_id, SceUInt32 *bit_rate)
 Get the bitrate of an encoded input or output port.
 
int sceVoiceSetPortAttr (SceVoicePortId port_id, SceVoicePortAttr attr, const SceInt32 *value)
 Set a port attribute.
 
int sceVoiceGetPortAttr (SceVoicePortId port_id, SceVoicePortAttr attr, SceInt32 *value)
 Get a port attribute.
 
int sceVoiceCreatePort (SceVoicePortId *port_id, const SceVoicePortParam *param)
 Create a Voice port.
 
int sceVoiceUpdatePort (SceVoicePortId port_id, const SceVoicePortParam *param)
 Update an existing port's configuration.
 
int sceVoiceConnectIPortToOPort (SceVoicePortId input_port_id, SceVoicePortId output_port_id)
 Connect an input port to an output port.
 
int sceVoiceDisconnectIPortFromOPort (SceVoicePortId input_port_id, SceVoicePortId output_port_id)
 Disconnect an input port from an output port.
 
int sceVoiceDeletePort (SceVoicePortId port_id)
 Delete a Voice port and remove its connections.
 
int sceVoiceWriteToIPort (SceVoicePortId port_id, const void *data, SceSize *size, SceInt16 frame_gap)
 Write application data to a PCM or encoded input port.
 
int sceVoiceReadFromOPort (SceVoicePortId port_id, void *data, SceSize *size)
 Read application data from a PCM or encoded output port.
 
int sceVoiceGetPortInfo (SceVoicePortId port_id, SceVoicePortInfo *info)
 Get one port's type, processing state, available data, and frame size.
 
int sceVoiceResetPort (SceVoicePortId port_id)
 Clear one port's buffered data and reset its processing state.
 
int sceVoicePausePort (SceVoicePortId port_id)
 Pause processing for one port.
 
int sceVoiceResumePort (SceVoicePortId port_id)
 Resume processing for one port.
 
int sceVoicePausePortAll (void)
 Pause processing for every Voice port in the calling process.
 
int sceVoiceResumePortAll (void)
 Resume processing for every Voice port in the calling process.
 

Variables

SceInt16 SceVoiceEventPortDataReady::port_count
 Number of valid entries in port_ids.
 
SceUInt16 SceVoiceEventPortDataReady::port_ids [SCE_VOICE_MAX_EVENT_PORTS]
 Output-voice ports with encoded data available.
 
SceUInt8 SceVoiceEventAudioInputOwnershipChanged::owned
 Nonzero when this process owns the adopted audio-input port.
 
SceUInt8 SceVoiceEventAudioInputOwnershipChanged::reserved [0xF]
 
SceUInt32 SceVoiceEvent::event_type
 One of SceVoiceEventType.
 
void * SceVoiceEvent::user_data
 Value supplied to sceVoiceInit.
 
SceVoiceEventPortDataReady SceVoiceEvent::port_data_ready
 
SceVoiceEventAudioInputOwnershipChanged SceVoiceEvent::audio_input_ownership_changed
 
union { 
 
SceVoiceEventPortDataReady port_data_ready
 
SceVoiceEventAudioInputOwnershipChanged audio_input_ownership_changed
 
} SceVoiceEvent::event_payload 
 
SceUInt32 SceVoiceInitParam::application_type
 One of SceVoiceApplicationType.
 
SceVoiceEventCallback SceVoiceInitParam::event_callback
 Optional event callback, or NULL to disable events.
 
void * SceVoiceInitParam::user_data
 Copied to SceVoiceEvent::user_data.
 
SceUInt32 SceVoiceInitParam::reserved [5]
 Ignored on FW 3.60.
 
SceUID SceVoiceStartParam::mem_block_id
 Memory block providing at least SCE_VOICE_WORKING_MEMORY_SIZE bytes.
 
SceUInt32 SceVoiceStartParam::reserved [7]
 Ignored on FW 3.60.
 
SceUInt32 SceVoicePortParam::port_type
 One of SceVoicePortType.
 
SceUInt16 SceVoicePortParam::threshold
 Buffering threshold for application input, in milliseconds; at least two frame durations are used.
 
SceUInt16 SceVoicePortParam::mute_flag
 Nonzero to create the port muted.
 
float SceVoicePortParam::volume
 Linear volume; 1.0 is unity gain.
 
SceSize SceVoicePortParam::buffer_size
 PCM byte capacity for PCMAUDIO ports.
 
SceUInt32 SceVoicePortParam::bit_rate
 One of SceVoiceBitRate for VOICE ports.
 
union { 
 
SceSize buffer_size
 PCM byte capacity for PCMAUDIO ports.
 
SceUInt32 bit_rate
 One of SceVoiceBitRate for VOICE ports.
 
} SceVoicePortParam::data 
 
SceUInt32 SceVoicePortParam::pcm_data_type
 One of SceVoicePcmDataType for PCMAUDIO ports.
 
SceUInt32 SceVoicePortParam::sampling_rate
 One of SceVoiceSamplingRate for PCMAUDIO ports.
 
SceUInt16 SceVoiceResourceInfo::max_voice_input_ports
 Maximum number of IN_VOICE ports.
 
SceUInt16 SceVoiceResourceInfo::max_voice_output_ports
 Maximum number of OUT_VOICE ports.
 
SceUInt16 SceVoiceResourceInfo::max_device_input_ports
 Maximum number of IN_DEVICE ports.
 
SceUInt16 SceVoiceResourceInfo::max_device_output_ports
 Maximum number of OUT_DEVICE ports.
 
SceUInt16 SceVoiceResourceInfo::max_ports
 Maximum number of ports of all types.
 
SceUInt32 SceVoicePortInfo::port_type
 One of SceVoicePortType.
 
SceUInt32 SceVoicePortInfo::state
 One of SceVoicePortState.
 
SceUInt32 SceVoicePortInfo::reserved0
 Not written on FW 3.60.
 
SceSize SceVoicePortInfo::data_size
 Free bytes in the input ring buffer or queued bytes in the output ring buffer.
 
SceSize SceVoicePortInfo::frame_size
 Encoded or PCM processing-frame size in bytes.
 
SceUInt32 SceVoicePortInfo::reserved1
 Not written on FW 3.60.
 

Detailed Description

Exports for User.


Using this library in your project

Include the header file in your project:

#include <psp2/voice.h>


Link the library to the executable:

SceVoice_stub




Data Structure Documentation

◆ SceVoiceEventPortDataReady

struct SceVoiceEventPortDataReady
Data Fields
SceInt16 port_count Number of valid entries in port_ids.
SceUInt16 port_ids[SCE_VOICE_MAX_EVENT_PORTS] Output-voice ports with encoded data available.

◆ SceVoiceEventAudioInputOwnershipChanged

struct SceVoiceEventAudioInputOwnershipChanged
Data Fields
SceUInt8 owned Nonzero when this process owns the adopted audio-input port.
SceUInt8 reserved[0xF]

◆ SceVoiceEvent

struct SceVoiceEvent
Data Fields
SceUInt32 event_type One of SceVoiceEventType.
void * user_data Value supplied to sceVoiceInit.
union SceVoiceEvent.event_payload event_payload

◆ SceVoiceInitParam

struct SceVoiceInitParam
Data Fields
SceUInt32 application_type One of SceVoiceApplicationType.
SceVoiceEventCallback event_callback Optional event callback, or NULL to disable events.
void * user_data Copied to SceVoiceEvent::user_data.
SceUInt32 reserved[5] Ignored on FW 3.60.

◆ SceVoiceStartParam

struct SceVoiceStartParam
Data Fields
SceUID mem_block_id Memory block providing at least SCE_VOICE_WORKING_MEMORY_SIZE bytes.
SceUInt32 reserved[7] Ignored on FW 3.60.

◆ SceVoicePortParam

struct SceVoicePortParam
Data Fields
SceUInt32 port_type One of SceVoicePortType.
SceUInt16 threshold Buffering threshold for application input, in milliseconds; at least two frame durations are used.
SceUInt16 mute_flag Nonzero to create the port muted.
float volume Linear volume; 1.0 is unity gain.
union SceVoicePortParam.data data
SceUInt32 pcm_data_type One of SceVoicePcmDataType for PCMAUDIO ports.
SceUInt32 sampling_rate One of SceVoiceSamplingRate for PCMAUDIO ports.

◆ SceVoiceResourceInfo

struct SceVoiceResourceInfo
Data Fields
SceUInt16 max_voice_input_ports Maximum number of IN_VOICE ports.
SceUInt16 max_voice_output_ports Maximum number of OUT_VOICE ports.
SceUInt16 max_device_input_ports Maximum number of IN_DEVICE ports.
SceUInt16 max_device_output_ports Maximum number of OUT_DEVICE ports.
SceUInt16 max_ports Maximum number of ports of all types.

◆ SceVoicePortInfo

struct SceVoicePortInfo
Data Fields
SceUInt32 port_type One of SceVoicePortType.
SceUInt32 state One of SceVoicePortState.
SceUInt32 reserved0 Not written on FW 3.60.
SceSize data_size Free bytes in the input ring buffer or queued bytes in the output ring buffer.
SceSize frame_size Encoded or PCM processing-frame size in bytes.
SceUInt32 reserved1 Not written on FW 3.60.

◆ SceVoiceEvent.event_payload

union SceVoiceEvent.event_payload
Data Fields
SceVoiceEventPortDataReady port_data_ready
SceVoiceEventAudioInputOwnershipChanged audio_input_ownership_changed

◆ SceVoicePortParam.data

union SceVoicePortParam.data
Data Fields
SceSize buffer_size PCM byte capacity for PCMAUDIO ports.
SceUInt32 bit_rate One of SceVoiceBitRate for VOICE ports.

Macro Definition Documentation

◆ SCE_VOICE_VERSION

#define SCE_VOICE_VERSION   100

◆ SCE_VOICE_WORKING_MEMORY_SIZE

#define SCE_VOICE_WORKING_MEMORY_SIZE   0x40000

◆ SCE_VOICE_MAX_EVENT_PORTS

#define SCE_VOICE_MAX_EVENT_PORTS   7

Typedef Documentation

◆ SceVoicePortId

◆ SceVoiceEventCallback

typedef void(* SceVoiceEventCallback) (const SceVoiceEvent *event)

Voice event callback.

Callbacks run one at a time on SceVoice's private event thread. The event is stored on that thread's stack and is valid only until the callback returns. Other SceVoice functions may be called from the callback, but sceVoiceEnd must not be called because it waits for the event thread.

Parameters
[in]event- Event record valid for the duration of the callback.

Enumeration Type Documentation

◆ SceVoiceErrorCode

Enumerator
SCE_VOICE_ERROR_NOT_INITIALIZED 

sceVoiceInit has not succeeded.

SCE_VOICE_ERROR_ALREADY_INITIALIZED 

Voice is already initialized for this process.

SCE_VOICE_ERROR_INTERNAL 

An internal backend operation failed.

SCE_VOICE_ERROR_INVALID_PORT_ID 

The port ID is out of range or not allocated for the operation.

SCE_VOICE_ERROR_INVALID_ARGUMENT 

An argument, format, or port type is invalid.

SCE_VOICE_ERROR_INVALID_MEMBLOCK 

The working-memory UID could not be resolved to a memory block.

SCE_VOICE_ERROR_INVALID_PORT 

The port does not exist or is unsuitable for the operation.

SCE_VOICE_ERROR_RESOURCE_LIMIT 

A port, connection, codec, or memory limit was reached.

SCE_VOICE_ERROR_NOT_STARTED 

sceVoiceStart has not attached working memory.

◆ SceVoiceApplicationType

Voice application profiles accepted by sceVoiceInit.

FW 3.60 treats both values identically: they select the same port and working-memory limits. SceParty and SceVoiceQoS use 0x20000000; no FW 3.60 system module uses 0x80000000.

Enumerator
SCE_VOICE_APPLICATION_TYPE_UNK_0x20000000 
SCE_VOICE_APPLICATION_TYPE_UNK_0x80000000 

◆ SceVoicePortType

Enumerator
SCE_VOICE_PORT_TYPE_IN_DEVICE 

Microphone/device input.

SCE_VOICE_PORT_TYPE_IN_PCMAUDIO 

Signed 16-bit PCM supplied by the application.

SCE_VOICE_PORT_TYPE_IN_VOICE 

Encoded voice supplied by the application.

SCE_VOICE_PORT_TYPE_OUT_PCMAUDIO 

Signed 16-bit PCM read by the application.

SCE_VOICE_PORT_TYPE_OUT_VOICE 

Encoded voice read by the application.

SCE_VOICE_PORT_TYPE_OUT_DEVICE 

Speaker/headset output.

◆ SceVoicePortState

Port processing states reported by sceVoiceGetPortInfo on FW 3.60.

Enumerator
SCE_VOICE_PORT_STATE_INACTIVE 

The port is not currently processing audio.

SCE_VOICE_PORT_STATE_IDLE 

The port is ready to process audio but is waiting for data.

SCE_VOICE_PORT_STATE_BUFFERING 

Buffering or rebuffering application input to the port's effective threshold.

SCE_VOICE_PORT_STATE_ACTIVE 

The port is processing audio after enough data became available.

◆ SceVoiceBitRate

8 kHz CELP bitrates supported by the FW 3.60 Voice codec.

Enumerator
SCE_VOICE_BIT_RATE_3850 

20 encoded bytes and 320 decoded samples per 40-ms frame.

SCE_VOICE_BIT_RATE_4650 

24 encoded bytes and 320 decoded samples per 40-ms frame.

SCE_VOICE_BIT_RATE_5700 

15 encoded bytes and 160 decoded samples per 20-ms frame.

SCE_VOICE_BIT_RATE_7300 

19 encoded bytes and 160 decoded samples per 20-ms frame.

SCE_VOICE_BIT_RATE_12200 

16 encoded bytes and 80 decoded samples per 10-ms frame.

◆ SceVoicePcmDataType

Enumerator
SCE_VOICE_PCM_DATA_TYPE_S16LE 

Signed 16-bit little-endian PCM.

◆ SceVoiceSamplingRate

Enumerator
SCE_VOICE_SAMPLING_RATE_16000 

◆ SceVoicePortAttr

Enumerator
SCE_VOICE_PORT_ATTR_AUDIO_INPUT_OWNERSHIP 

Audio-input adoption state of a device-input port.

◆ SceVoiceEventType

Enumerator
SCE_VOICE_EVENT_TYPE_PORT_DATA_READY 

One or more OUT_VOICE ports contain encoded data.

SCE_VOICE_EVENT_TYPE_AUDIO_INPUT_OWNERSHIP_CHANGED 

Audio-input ownership was acquired or lost.

Function Documentation

◆ VITASDK_BUILD_ASSERT_EQ() [1/8]

VITASDK_BUILD_ASSERT_EQ ( 0x10  ,
SceVoiceEventPortDataReady   
)

◆ VITASDK_BUILD_ASSERT_EQ() [2/8]

VITASDK_BUILD_ASSERT_EQ ( 0x10  ,
SceVoiceEventAudioInputOwnershipChanged   
)

◆ VITASDK_BUILD_ASSERT_EQ() [3/8]

VITASDK_BUILD_ASSERT_EQ ( 0x18  ,
SceVoiceEvent   
)

◆ VITASDK_BUILD_ASSERT_EQ() [4/8]

VITASDK_BUILD_ASSERT_EQ ( 0x20  ,
SceVoiceInitParam   
)

◆ VITASDK_BUILD_ASSERT_EQ() [5/8]

VITASDK_BUILD_ASSERT_EQ ( 0x20  ,
SceVoiceStartParam   
)

◆ VITASDK_BUILD_ASSERT_EQ() [6/8]

VITASDK_BUILD_ASSERT_EQ ( 0x18  ,
SceVoicePortParam   
)

◆ VITASDK_BUILD_ASSERT_EQ() [7/8]

VITASDK_BUILD_ASSERT_EQ ( 0xA  ,
SceVoiceResourceInfo   
)

◆ VITASDK_BUILD_ASSERT_EQ() [8/8]

VITASDK_BUILD_ASSERT_EQ ( 0x18  ,
SceVoicePortInfo   
)

◆ sceVoiceInit()

int sceVoiceInit ( const SceVoiceInitParam *  param,
SceUInt32  version 
)

Initialize Voice for the calling process.

Parameters
[in]param- Initialization parameters. The callback may be NULL.
[in]version- Must be SCE_VOICE_VERSION on FW 3.60.
Returns
0 on success, or a negative SceVoiceErrorCode value.

◆ sceVoiceEnd()

int sceVoiceEnd ( void  )

Shut down Voice for the calling process and release its ports.

If Voice is started, this function stops all audio processing and detaches the working-memory block before destroying the ports and event thread. The caller remains responsible for freeing the working-memory block.

Returns
0 on success, or a negative SceVoiceErrorCode value.

◆ sceVoiceStart()

int sceVoiceStart ( const SceVoiceStartParam *  param)

Attach the Voice instance to its working-memory block and start processing.

FW 3.60 uses 0x28000 bytes as private memory followed by 0x18000 bytes as shared memory. It does not validate the memory-block size, so the supplied block must contain at least SCE_VOICE_WORKING_MEMORY_SIZE bytes. SceVoice does not take ownership of the block; it must remain allocated until sceVoiceStop or sceVoiceEnd returns.

Calling this function for an already started instance succeeds without changing the current working-memory block. A non-NULL param is still required in that case.

Parameters
[in]param- Start parameters.
Returns
0 on success, or a negative SceVoiceErrorCode value.

◆ sceVoiceStop()

int sceVoiceStop ( void  )

Stop Voice processing and detach the working-memory block.

Port configurations and connections are retained, but their audio-processing resources and buffered data are discarded. A later sceVoiceStart recreates the processing resources. SceVoice does not free the caller-owned memory block.

Calling this function when Voice is initialized but already stopped succeeds.

Returns
0 on success, or a negative SceVoiceErrorCode value.

◆ sceVoiceGetResourceInfo()

int sceVoiceGetResourceInfo ( SceVoiceResourceInfo *  info)

Get the port limits assigned to this Voice instance.

On FW 3.60 the returned limits are seven encoded input ports, seven encoded output ports, one device input port, one device output port, and 64 ports in total.

Parameters
[out]info- Receives the resource limits.
Returns
0 on success, or a negative SceVoiceErrorCode value.

◆ sceVoiceCheckTopology()

int sceVoiceCheckTopology ( void  )

Check whether the current port connections are valid.

FW 3.60 checks that every created port has at least one connection. It also requires each adjacent pair of OUT_VOICE ports in the internal output list to use the same bitrate, the same per-port mute state (zero or nonzero), and exactly equal volume values. When both IN_DEVICE and IN_PCMAUDIO ports exist, it also rejects an OUT_VOICE port connected from IN_PCMAUDIO while that output's encoder has not been assigned, as occurs before Voice is started.

Returns
0 when the port connections are valid, or a negative SceVoiceErrorCode value.

◆ sceVoiceSetMuteFlagAll()

int sceVoiceSetMuteFlagAll ( SceBool  mute)

Set the process-wide mute-reporting override.

A nonzero value forces sceVoiceGetMuteFlag to report every port as muted. FW 3.60 audio processing reads each port's individual mute flag directly, so this function does not itself silence the ports.

Parameters
[in]mute- Nonzero to force the reported mute state to one, or zero to report each port's individual mute flag.
Returns
0 on success, or a negative SceVoiceErrorCode value.

◆ sceVoiceSetMuteFlag()

int sceVoiceSetMuteFlag ( SceVoicePortId  port_id,
SceBool  mute 
)

Set one port's mute flag.

Parameters
[in]port_id- Port identifier returned by sceVoiceCreatePort.
[in]mute- Nonzero to mute the port, or zero to unmute it.
Returns
0 on success, or a negative SceVoiceErrorCode value.

◆ sceVoiceGetMuteFlag()

int sceVoiceGetMuteFlag ( SceVoicePortId  port_id,
SceUInt16 *  mute 
)

Get one port's reported mute flag.

The process-wide flag set by sceVoiceSetMuteFlagAll overrides the individual flag returned by this function. On FW 3.60 that process-wide flag does not affect audio processing.

Parameters
[in]port_id- Port identifier returned by sceVoiceCreatePort.
[out]mute- Receives 1 when muted or 0 when unmuted.
Returns
0 on success, or a negative SceVoiceErrorCode value.

◆ sceVoiceSetVolume()

int sceVoiceSetVolume ( SceVoicePortId  port_id,
float  volume 
)

Set one port's linear volume.

FW 3.60 stores the value without limiting its range. During PCM processing, scaled samples are clamped to the signed 16-bit range.

Parameters
[in]port_id- Port identifier returned by sceVoiceCreatePort.
[in]volume- Linear volume; 1.0 is unity gain.
Returns
0 on success, or a negative SceVoiceErrorCode value.

◆ sceVoiceGetVolume()

int sceVoiceGetVolume ( SceVoicePortId  port_id,
float *  volume 
)

Get one port's linear volume.

Parameters
[in]port_id- Port identifier returned by sceVoiceCreatePort.
[out]volume- Receives the stored volume.
Returns
0 on success, or a negative SceVoiceErrorCode value.

◆ sceVoiceSetBitRate()

int sceVoiceSetBitRate ( SceVoicePortId  port_id,
SceUInt32  bit_rate 
)

Change the bitrate of an encoded input or output port.

Changing the bitrate creates a new encoder or decoder for the port and discards its buffered data.

Parameters
[in]port_id- Encoded input or output port identifier.
[in]bit_rate- New codec bitrate; one of SceVoiceBitRate.
Returns
0 on success, or a negative SceVoiceErrorCode value.

◆ sceVoiceGetBitRate()

int sceVoiceGetBitRate ( SceVoicePortId  port_id,
SceUInt32 *  bit_rate 
)

Get the bitrate of an encoded input or output port.

Parameters
[in]port_id- Encoded input or output port identifier.
[out]bit_rate- Receives the configured codec bitrate; one of SceVoiceBitRate.
Returns
0 on success, or a negative SceVoiceErrorCode value.

◆ sceVoiceSetPortAttr()

int sceVoiceSetPortAttr ( SceVoicePortId  port_id,
SceVoicePortAttr  attr,
const SceInt32 *  value 
)

Set a port attribute.

This function is exported, but FW 3.60 rejects every attribute for an existing port with SCE_VOICE_ERROR_INVALID_ARGUMENT. For a port ID within the valid range that does not identify an existing port, it returns SCE_VOICE_ERROR_INVALID_PORT_ID.

Parameters
[in]port_id- Port identifier.
[in]attr- Attribute selector.
[in]value- Attribute value.
Returns
A negative SceVoiceErrorCode value on FW 3.60.

◆ sceVoiceGetPortAttr()

int sceVoiceGetPortAttr ( SceVoicePortId  port_id,
SceVoicePortAttr  attr,
SceInt32 *  value 
)

Get a port attribute.

On FW 3.60, querying SCE_VOICE_PORT_ATTR_AUDIO_INPUT_OWNERSHIP writes a defined value only for a SCE_VOICE_PORT_TYPE_IN_DEVICE port. Other port types return success without modifying value.

Parameters
[in]port_id- Port identifier.
[in]attr- Attribute selector.
[out]value- Receives the attribute value.
Returns
0 on success, or a negative SceVoiceErrorCode value.

◆ sceVoiceCreatePort()

int sceVoiceCreatePort ( SceVoicePortId *  port_id,
const SceVoicePortParam *  param 
)

Create a Voice port.

PCMAUDIO ports accept signed 16-bit little-endian PCM at 16000 Hz. Their effective byte capacity is rounded down to a multiple of 512 and must be from 1024 through 64512 bytes. VOICE ports use one of SceVoiceBitRate. FW 3.60 truncates the rounded PCM capacity to 16 bits before validating it; callers should pass a value in the documented range rather than relying on that wraparound.

For application-fed input ports, SceVoicePortParam::threshold must be shorter than the duration represented by the port's buffer. The type-specific union member must be zero for a device port.

Parameters
[out]port_id- Receives a port identifier from 0 through 63.
[in]param- Port configuration.

FW 3.60 writes 0xFF to port_id before validation. If immediate startup of the port's audio processing fails, the function returns that error after creating the port and replacing 0xFF with its valid port ID.

Returns
0 on success, or a negative SceVoiceErrorCode value.

◆ sceVoiceUpdatePort()

int sceVoiceUpdatePort ( SceVoicePortId  port_id,
const SceVoicePortParam *  param 
)

Update an existing port's configuration.

The port type cannot be changed. Changing an encoded bitrate creates a new encoder or decoder for the port and discards its buffered data.

Do not change a PCMAUDIO port's data.buffer_size on FW 3.60. The function never reallocates or reinitializes the PCM ring buffers. The first update stores the new requested size but keeps the old size used for resource accounting. A later update recalculates the accounting size from that stored value. Deleting the port then releases resources according to the changed accounting size, not the capacity originally allocated. This function does not check SceVoicePortParam::threshold again against the queue duration.

Parameters
[in]port_id- Port identifier returned by sceVoiceCreatePort.
[in]param- Replacement configuration with the same port type.
Returns
0 on success, or a negative SceVoiceErrorCode value.

◆ sceVoiceConnectIPortToOPort()

int sceVoiceConnectIPortToOPort ( SceVoicePortId  input_port_id,
SceVoicePortId  output_port_id 
)

Connect an input port to an output port.

Input types 0 through 2 can connect to output types 3 through 5. FW 3.60 rejects a direct IN_VOICE to OUT_VOICE connection and duplicate connections. An instance can contain at most 128 connections.

Parameters
[in]input_port_id- Device, PCM, or encoded input port.
[in]output_port_id- PCM, encoded, or device output port.
Returns
0 on success, or a negative SceVoiceErrorCode value.

◆ sceVoiceDisconnectIPortFromOPort()

int sceVoiceDisconnectIPortFromOPort ( SceVoicePortId  input_port_id,
SceVoicePortId  output_port_id 
)

Disconnect an input port from an output port.

Parameters
[in]input_port_id- Connected input port.
[in]output_port_id- Connected output port.
Returns
0 on success, or a negative SceVoiceErrorCode value.

◆ sceVoiceDeletePort()

int sceVoiceDeletePort ( SceVoicePortId  port_id)

Delete a Voice port and remove its connections.

Parameters
[in]port_id- Port identifier returned by sceVoiceCreatePort.
Returns
0 on success, or a negative SceVoiceErrorCode value.

◆ sceVoiceWriteToIPort()

int sceVoiceWriteToIPort ( SceVoicePortId  port_id,
const void *  data,
SceSize *  size,
SceInt16  frame_gap 
)

Write application data to a PCM or encoded input port.

On return, size contains the number of bytes accepted. PCM writes ignore frame_gap. For encoded input, a nonnegative frame gap inserts that many missing frames before the supplied data. A negative value begins backfilling previously marked missing frames at that relative frame offset behind the current stream write point.

Parameters
[in]port_id- SCE_VOICE_PORT_TYPE_IN_PCMAUDIO or SCE_VOICE_PORT_TYPE_IN_VOICE port.
[in]data- Data to write.
[in,out]size- Requested byte count and resulting accepted byte count.
[in]frame_gap- Encoded-stream frame gap or negative backfill offset; ignored for PCM input.

When the operation fails after argument validation, FW 3.60 sets size to zero.

Returns
0 on success, or a negative SceVoiceErrorCode value.

◆ sceVoiceReadFromOPort()

int sceVoiceReadFromOPort ( SceVoicePortId  port_id,
void *  data,
SceSize *  size 
)

Read application data from a PCM or encoded output port.

On return, size contains the number of bytes copied. Encoded reads are rounded down to complete codec frames; PCM reads are rounded down to an even byte count.

Parameters
[in]port_id- SCE_VOICE_PORT_TYPE_OUT_PCMAUDIO or SCE_VOICE_PORT_TYPE_OUT_VOICE port.
[out]data- Destination buffer.
[in,out]size- Destination capacity and resulting byte count.

When the operation fails after argument validation, FW 3.60 sets size to zero.

Returns
0 on success, or a negative SceVoiceErrorCode value.

◆ sceVoiceGetPortInfo()

int sceVoiceGetPortInfo ( SceVoicePortId  port_id,
SceVoicePortInfo *  info 
)

Get one port's type, processing state, available data, and frame size.

If Voice has not been started, FW 3.60 clears the complete output structure and returns SCE_VOICE_ERROR_NOT_STARTED. On success, it writes only port_type, state, data_size, and frame_size; the two reserved members are unchanged.

Parameters
[in]port_id- Port identifier returned by sceVoiceCreatePort.
[out]info- Receives the port information.
Returns
0 on success, or a negative SceVoiceErrorCode value.

◆ sceVoiceResetPort()

int sceVoiceResetPort ( SceVoicePortId  port_id)

Clear one port's buffered data and reset its processing state.

An ACTIVE port becomes IDLE. INACTIVE, IDLE, and BUFFERING ports retain their current internal state. The state visible through sceVoiceGetPortInfo is updated by a later processing synchronization.

Parameters
[in]port_id- Port identifier returned by sceVoiceCreatePort.
Returns
0 on success, or a negative SceVoiceErrorCode value.

◆ sceVoicePausePort()

int sceVoicePausePort ( SceVoicePortId  port_id)

Pause processing for one port.

Pausing retains buffered data. Application-fed input ports retain their internal processing state; device and output ports change their internal state to INACTIVE. FW 3.60 does not update the reported state while a port is paused, so sceVoiceGetPortInfo can continue reporting the state from before the pause until processing resumes.

Parameters
[in]port_id- Port identifier returned by sceVoiceCreatePort.
Returns
0 on success, or a negative SceVoiceErrorCode value.

◆ sceVoiceResumePort()

int sceVoiceResumePort ( SceVoicePortId  port_id)

Resume processing for one port.

Parameters
[in]port_id- Port identifier returned by sceVoiceCreatePort.
Returns
0 on success, or a negative SceVoiceErrorCode value.

◆ sceVoicePausePortAll()

int sceVoicePausePortAll ( void  )

Pause processing for every Voice port in the calling process.

Pausing retains buffered data and each port's internal processing state. FW 3.60 also retains the previously reported state, so sceVoiceGetPortInfo can continue reporting that state while all ports are paused.

Returns
0 on success, or a negative SceVoiceErrorCode value.

◆ sceVoiceResumePortAll()

int sceVoiceResumePortAll ( void  )

Resume processing for every Voice port in the calling process.

Returns
0 on success, or a negative SceVoiceErrorCode value.

Variable Documentation

◆ port_count

SceInt16 SceVoiceEventPortDataReady::port_count

Number of valid entries in port_ids.

◆ port_ids

SceUInt16 SceVoiceEventPortDataReady::port_ids[SCE_VOICE_MAX_EVENT_PORTS]

Output-voice ports with encoded data available.

◆ owned

SceUInt8 SceVoiceEventAudioInputOwnershipChanged::owned

Nonzero when this process owns the adopted audio-input port.

◆ reserved [1/3]

SceUInt8 SceVoiceEventAudioInputOwnershipChanged::reserved[0xF]

◆ event_type

SceUInt32 SceVoiceEvent::event_type

◆ user_data [1/2]

void* SceVoiceEvent::user_data

Value supplied to sceVoiceInit.

◆ []

SceVoiceEventPortDataReady { ... } ::port_data_ready

◆ []

SceVoiceEventAudioInputOwnershipChanged { ... } ::audio_input_ownership_changed

◆ [union]

union { ... } SceVoiceEvent::event_payload

◆ application_type

SceUInt32 SceVoiceInitParam::application_type

◆ event_callback

SceVoiceEventCallback SceVoiceInitParam::event_callback

Optional event callback, or NULL to disable events.

◆ user_data [2/2]

void* SceVoiceInitParam::user_data

◆ reserved [2/3]

SceUInt32 SceVoiceInitParam::reserved[5]

Ignored on FW 3.60.

◆ mem_block_id

SceUID SceVoiceStartParam::mem_block_id

Memory block providing at least SCE_VOICE_WORKING_MEMORY_SIZE bytes.

◆ reserved [3/3]

SceUInt32 SceVoiceStartParam::reserved[7]

Ignored on FW 3.60.

◆ port_type [1/2]

SceUInt32 SceVoicePortParam::port_type

◆ threshold

SceUInt16 SceVoicePortParam::threshold

Buffering threshold for application input, in milliseconds; at least two frame durations are used.

◆ mute_flag

SceUInt16 SceVoicePortParam::mute_flag

Nonzero to create the port muted.

◆ volume

float SceVoicePortParam::volume

Linear volume; 1.0 is unity gain.

◆ []

SceSize { ... } ::buffer_size

PCM byte capacity for PCMAUDIO ports.

◆ []

SceUInt32 { ... } ::bit_rate

One of SceVoiceBitRate for VOICE ports.

◆ [union]

union { ... } SceVoicePortParam::data

◆ pcm_data_type

SceUInt32 SceVoicePortParam::pcm_data_type

One of SceVoicePcmDataType for PCMAUDIO ports.

◆ sampling_rate

SceUInt32 SceVoicePortParam::sampling_rate

One of SceVoiceSamplingRate for PCMAUDIO ports.

◆ max_voice_input_ports

SceUInt16 SceVoiceResourceInfo::max_voice_input_ports

Maximum number of IN_VOICE ports.

◆ max_voice_output_ports

SceUInt16 SceVoiceResourceInfo::max_voice_output_ports

Maximum number of OUT_VOICE ports.

◆ max_device_input_ports

SceUInt16 SceVoiceResourceInfo::max_device_input_ports

Maximum number of IN_DEVICE ports.

◆ max_device_output_ports

SceUInt16 SceVoiceResourceInfo::max_device_output_ports

Maximum number of OUT_DEVICE ports.

◆ max_ports

SceUInt16 SceVoiceResourceInfo::max_ports

Maximum number of ports of all types.

◆ port_type [2/2]

SceUInt32 SceVoicePortInfo::port_type

◆ state

SceUInt32 SceVoicePortInfo::state

◆ reserved0

SceUInt32 SceVoicePortInfo::reserved0

Not written on FW 3.60.

◆ data_size

SceSize SceVoicePortInfo::data_size

Free bytes in the input ring buffer or queued bytes in the output ring buffer.

◆ frame_size

SceSize SceVoicePortInfo::frame_size

Encoded or PCM processing-frame size in bytes.

◆ reserved1

SceUInt32 SceVoicePortInfo::reserved1

Not written on FW 3.60.