PSP2SDK  dirty-f9e4f2d
The free SDK for PSP2
Defines | Enumerations | Functions
include/psp2/audioout.h File Reference

Header file which defines output audio related variables and functions. More...

Go to the source code of this file.

Defines

#define PSP2_AUDIO_MIN_LEN   64
 Minimum granularity.
#define PSP2_AUDIO_MAX_LEN   65472
 Maximum granularity.
#define PSP2_AUDIO_OUT_MAX_VOL   32768
 Maximum output port volume.
#define PSP2_AUDIO_VOLUME_0DB   PSP2_AUDIO_OUT_MAX_VOL
 Maximum output port volume.

Enumerations

enum  {
  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  { PSP2_AUDIO_OUT_PORT_TYPE_MAIN = 0, PSP2_AUDIO_OUT_PORT_TYPE_BGM = 1, PSP2_AUDIO_OUT_PORT_TYPE_VOICE = 2 }
enum  { PSP2_AUDIO_OUT_MODE_MONO = 0, PSP2_AUDIO_OUT_MODE_STEREO = 1 }
enum  { PSP2_AUDIO_VOLUME_FLAG_L_CH = 0x1, PSP2_AUDIO_VOLUME_FLAG_R_CH = 0x2 }
enum  { PSP2_AUDIO_OUT_CONFIG_TYPE_LEN = 0, PSP2_AUDIO_OUT_CONFIG_TYPE_FREQ = 1, PSP2_AUDIO_OUT_CONFIG_TYPE_MODE = 2 }
enum  { PSP2_AUDIO_ALC_OFF = 0, PSP2_AUDIO_ALC_MODE1 = 1, PSP2_AUDIO_ALC_MODE_MAX = 2 }

Functions

int sceAudioOutOpenPort (int type, int len, int freq, int mode)
int sceAudioOutReleasePort (int port)
int sceAudioOutOutput (int port, const void *buf)
int sceAudioOutSetVolume (int port, int ch, int *vol)
int sceAudioOutSetConfig (int port, int len, int freq, int mode)
int sceAudioOutGetConfig (int port, int type)
int sceAudioOutSetAlcMode (int mode)
int sceAudioOutGetRestSample (int port)
int sceAudioOutGetAdopt (int type)

Detailed Description

Header file which defines output audio related variables and functions.

Copyright (C) 2015 PSP2SDK Project

This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.


Enumeration Type Documentation

anonymous enum
Enumerator:
PSP2_AUDIO_OUT_PORT_TYPE_MAIN 

Used for main audio output, freq must be set to 48000 Hz.

PSP2_AUDIO_OUT_PORT_TYPE_BGM 

Used for Background Music port.

PSP2_AUDIO_OUT_PORT_TYPE_VOICE 

Used for voice chat port.

anonymous enum

Flags to use as 'ch' argument for sceAudioOutSetVolume

Enumerator:
PSP2_AUDIO_VOLUME_FLAG_L_CH 

Left Channel.

PSP2_AUDIO_VOLUME_FLAG_R_CH 

Right Channel.

anonymous enum

Config type values to specify to sceAudioOutGetConfig

anonymous enum

Argument 'mode' to specify to sceAudioOutSetAlcMode


Function Documentation

int sceAudioOutGetAdopt ( int  type)

Get status of port type Return different value on whether the port type is used for sound generation or not.

Parameters:
[in]type- One of ::AudioOutPortType
Returns:
(1) if port is in use, (0) otherwise. < 0 on error.
int sceAudioOutGetConfig ( int  port,
int  type 
)

Get a parameter value of specified output port

Parameters:
[in]port- Port number returned by sceAudioOutOpenPort
[in]type- One of ::AudioOutConfigType
Returns:
0 on success, < 0 on error.
int sceAudioOutGetRestSample ( int  port)

Get the number of remaining samples to be output on the specified port

Parameters:
[in]port- Port number returned by sceAudioOutOpenPort
Returns:
Number of samples on success, < 0 on error.
int sceAudioOutOpenPort ( int  type,
int  len,
int  freq,
int  mode 
)

Initialize audio port

Parameters:
[in]type- One of ::AudioOutPortType
[in]len- Number of samples, between PSP2_AUDIO_MIN_LEN and PSP2_AUDIO_MAX_LEN (multiple of 64)
[in]freq- Samping frequency (in Hz), one of the followings : 8000, 11025, 12000, 16000, 22050, 24000, 32000, 44100, 48000
[in]mode- One of ::AudioOutMode
Returns:
port number, < 0 on error.
Note:
- The volume is initially set to its max value (PSP2_AUDIO_OUT_MAX_VOL)
int sceAudioOutOutput ( int  port,
const void *  buf 
)

Output audio (blocking function)

Parameters:
[in]port- Port number returned by sceAudioOutOpenPort
[in]*buf: Pointer to audio data buffer
Returns:
0 on success, < 0 on error.
Note:
- if NULL is specified for *buf, the function will not return until the last output audio data has been output.
int sceAudioOutReleasePort ( int  port)

Release an audio port

Parameters:
[in]type- Port number returned by sceAudioOutOpenPort
Returns:
0 on success, < 0 on error.
int sceAudioOutSetAlcMode ( int  mode)

Set 'Automatic Level Control' mode on the BGM port ALC is also known as 'Dynamic Normalizer'

Parameters:
[in]mode- One of
Returns:
0 on success, < 0 on error.
int sceAudioOutSetConfig ( int  port,
int  len,
int  freq,
int  mode 
)

Change configuration of specified output port

Parameters:
[in]port- Port number returned by sceAudioOutOpenPort
[in]len- see sceAudioOutOpenPort()
[in]freq- see sceAudioOutOpenPort()
[in]mode- see sceAudioOutOpenPort()
Returns:
0 on success, < 0 on error.
Note:
- If (-1) is specified for any argument (excepted for port), current configuration is used instead.
int sceAudioOutSetVolume ( int  port,
int  ch,
int *  vol 
)

Set volume of specified output audio port

Parameters:
[in]port- Port number returned by sceAudioOutOpenPort
[in]ch- Channel numbers as flags (see ::AudioOutChannelFlag)
[in]*vol- Array to int specifying volume for each channel (Left channel first for stereo)
Returns:
0 on success, < 0 on error.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines