|
PSPSDK 2026-04-21
|
This module contains the imports for sceSasCore, the PSP's audio software mixer. More...
Data Structures | |
| struct | SceSasCore |
| Contains all data related to a sceSasCore state. More... | |
Macros | |
| #define | PSP_SAS_GET_VOICE_BIT(voice) |
| Macro utility to obtain the corresponding bit of a voice index. | |
| #define | PSP_SAS_GET_FLAG_AT(flags, voice) |
| Macro utility for reading voice bitfield flags. | |
| #define | PSP_SAS_GRAIN_SIZE (256) |
| The recommended sceSasCore grain size that's used by most games. | |
| #define | PSP_SAS_GRAIN_SIZE_MIN (64) |
| The minimum sceSasCore grain size. | |
| #define | PSP_SAS_GRAIN_SIZE_MAX (2048) |
| The maximum sceSasCore grain size. | |
| #define | PSP_SAS_VOICES_MAX (32) |
| The maximum number of voices that sceSas can playback all at once. | |
| #define | PSP_SAS_SAMPLE_RATE (44100) |
| The sample rate of sceSasCore mixer. | |
| #define | PSP_SAS_VOLUME_MAX (0x1000) |
| The maximum output volume of sceSas voices. | |
| #define | PSP_SAS_PITCH_BASE (0x1000) |
| Represents 1x voice pitch. | |
| #define | PSP_SAS_PITCH_MIN (0x1) |
| The minimum supported voice pitch. | |
| #define | PSP_SAS_PITCH_MAX (0x4000) |
| The maximum supported voice pitch. | |
| #define | PSP_SAS_NOISE_FREQ_MAX (0x3F) |
| The maximum noise frequency. | |
| #define | PSP_SAS_ENVELOPE_HEIGHT_MAX (0x40000000) |
| Represents maximum ADSR envelope height. | |
| #define | PSP_SAS_ENVELOPE_FREQ_MAX (0x7FFFFFFF) |
| Represents maximum ADSR envelope frequency. | |
| #define | PSP_SAS_ADSR_EVERYTHING (PSP_SAS_ADSR_ATTACK | PSP_SAS_ADSR_DECAY | PSP_SAS_ADSR_SUSTAIN | PSP_SAS_ADSR_RELEASE) |
Functions | |
| int | __sceSasInit (SceSasCore *core, int grainsize, int maxvoices, PspSasOutputModes outputmode, int samplerate) |
| Initializes a SceSasCore instance. | |
| int | __sceSasGetOutputmode (SceSasCore *core) |
| Gets the current output mode from the SceSasCore instance. | |
| int | __sceSasSetOutputmode (SceSasCore *core, PspSasOutputModes outputmode) |
| Sets the current output mode of the SceSasCore instance. | |
| int | __sceSasRevType (SceSasCore *core, PspSasEffectTypes type) |
| Sets the reverb effect of the SceSasCore instance. | |
| int | __sceSasRevEVOL (SceSasCore *core, int leftvol, int rightvol) |
| Sets the effect volume of the SceSasCore instance. | |
| int | __sceSasRevVON (SceSasCore *core, int dry, int wet) |
| Toggles dry and wet audio signals of the SceSasCore instance. | |
| int | __sceSasRevParam (SceSasCore *core, int delay, int feedback) |
| Sets the effect delay and feedback parameters of the SceSasCore instance. | |
| int | __sceSasGetGrain (SceSasCore *core) |
| Gets the grain size of the SceSasCore instance. | |
| int | __sceSasSetGrain (SceSasCore *core, int grainsize) |
| Sets the grain size of the SceSasCore instance. | |
| u32 | __sceSasGetEndFlag (SceSasCore *core) |
| Gets the end status of the voices from an SceSasCore nstance. | |
| int | __sceSasSetVoice (SceSasCore *core, int voice, void *vag, int size, int loop) |
| Sets PlayStation VAG data for a given sceSas voice. | |
| int | __sceSasSetVoicePCM (SceSasCore *core, int voice, void *pcm, int samplecount, int loopstart) |
| Sets PCM data for the given sceSas voice. | |
| int | __sceSasSetKeyOn (SceSasCore *core, int voice) |
| Plays the voice (starts Attack phase). | |
| int | __sceSasSetKeyOff (SceSasCore *core, int voice) |
| Stops the voice (starts Release phase). | |
| int | __sceSasSetPitch (SceSasCore *core, int voice, int pitch) |
| Sets the pitch value of a voice. | |
| int | __sceSasSetADSRmode (SceSasCore *core, int voice, u32 mask, PspSasADSRCurveModes attackcurve, PspSasADSRCurveModes decaycurve, PspSasADSRCurveModes sustaincurve, PspSasADSRCurveModes releasecurve) |
| Sets the voice ADSR envelope curves. | |
| int | __sceSasSetADSR (SceSasCore *core, int voice, u32 mask, int attackrate, int decayrate, int sustainrate, int releaserate) |
| Sets the voice ADSR envelope rates for a voice. | |
| int | __sceSasSetSimpleADSR (SceSasCore *core, int voice, u32 envelope1, u32 envelope2) |
| Configures the entire voice ADSR envelope (rates & curves). | |
| int | __sceSasSetSL (SceSasCore *core, int voice, int level) |
| Sets the voice ADSR envelope sustain level height. | |
| int | __sceSasSetVolume (SceSasCore *core, int voice, int leftvol, int rightvol, int sendleftvol, int sendrightvol) |
| Sets the output volume of the voice. | |
| int | __sceSasCore (SceSasCore *core, void *dst) |
| Runs a sceSas cycle iteration and outputs samples onto destination buffer. | |
| int | __sceSasCoreWithMix (SceSasCore *core, void *dst, int leftvol, int rightvol) |
| Runs a sceSas cycle iteration and mixes samples onto destination buffer. | |
| int | __sceSasGetPauseFlag (SceSasCore *core) |
| Get the pause status of every voice in a bitfield. | |
| int | __sceSasGetEnvelopeHeight (SceSasCore *core, int voice) |
| Gets the current envelope height of a voice. | |
| int | __sceSasGetAllEnvelopeHeights (SceSasCore *core, int heights[32]) |
| Gets the current envelope height of all voices. | |
| int | __sceSasSetPause (SceSasCore *core, u32 voicebit, int pause) |
| Pauses/unpauses voice playback using a bitmask. | |
| int | __sceSasSetNoise (SceSasCore *core, int voice, int freq) |
| Configures the voice to play a noise waveform. | |
| int | __sceSasSetTrianglarWave (SceSasCore *core, int voice, int unk) |
| Configures the voice to play a triangular waveform. | |
| int | __sceSasSetTriangularWave (SceSasCore *core, int voice, int unk) |
| A function alias of __sceSasSetTrianglarWave. | |
| int | __sceSasSetSteepWave (SceSasCore *core, int voice, int duty) |
| Configures the voice to play a square waveform. | |
| int | __sceSasSetVoiceATRAC3 (SceSasCore *core, int voice, void *atrac3ctx) |
| int | __sceSasConcatenateATRAC3 (SceSasCore *core, int voice, void *data, int size) |
| int | __sceSasUnsetATRAC3 (SceSasCore *core, int voice) |
This module contains the imports for sceSasCore, the PSP's audio software mixer.
| #define PSP_SAS_ADSR_EVERYTHING (PSP_SAS_ADSR_ATTACK | PSP_SAS_ADSR_DECAY | PSP_SAS_ADSR_SUSTAIN | PSP_SAS_ADSR_RELEASE) |
| #define PSP_SAS_ENVELOPE_FREQ_MAX (0x7FFFFFFF) |
Represents maximum ADSR envelope frequency.
| #define PSP_SAS_ENVELOPE_HEIGHT_MAX (0x40000000) |
Represents maximum ADSR envelope height.
| #define PSP_SAS_GET_FLAG_AT | ( | flags, | |
| voice ) |
Macro utility for reading voice bitfield flags.
| flags | - The 32-bit bitfield representing each voice. |
| voice | - The voice index, ranging from 0 to PSP_SAS_VOICES_MAX-1 |
| #define PSP_SAS_GET_VOICE_BIT | ( | voice | ) |
Macro utility to obtain the corresponding bit of a voice index.
| voice | - The voice index, ranging from 0 to PSP_SAS_VOICES_MAX-1 |
| #define PSP_SAS_GRAIN_SIZE (256) |
The recommended sceSasCore grain size that's used by most games.
| #define PSP_SAS_GRAIN_SIZE_MAX (2048) |
The maximum sceSasCore grain size.
| #define PSP_SAS_GRAIN_SIZE_MIN (64) |
The minimum sceSasCore grain size.
| #define PSP_SAS_NOISE_FREQ_MAX (0x3F) |
The maximum noise frequency.
| #define PSP_SAS_PITCH_BASE (0x1000) |
Represents 1x voice pitch.
| #define PSP_SAS_PITCH_MAX (0x4000) |
The maximum supported voice pitch.
| #define PSP_SAS_PITCH_MIN (0x1) |
The minimum supported voice pitch.
| #define PSP_SAS_SAMPLE_RATE (44100) |
The sample rate of sceSasCore mixer.
| #define PSP_SAS_VOICES_MAX (32) |
The maximum number of voices that sceSas can playback all at once.
| #define PSP_SAS_VOLUME_MAX (0x1000) |
The maximum output volume of sceSas voices.
| enum PspSasADSRCurveModes |
ADSR envelope curve modes.
| enum PspSasADSRFlags |
| enum PspSasEffectTypes |
| enum PspSasErrorCodes |
Error codes used as return values by sceSasCore.
| enum PspSasOutputModes |
| int __sceSasConcatenateATRAC3 | ( | SceSasCore * | core, |
| int | voice, | ||
| void * | data, | ||
| int | size ) |
| int __sceSasCore | ( | SceSasCore * | core, |
| void * | dst ) |
Runs a sceSas cycle iteration and outputs samples onto destination buffer.
This is the heart of sceSasCore, hence its name. Processes and updates voices, mixes them together and updates end/pause flags.
| core | - Pointer to a valid sceSas instance. |
| dst | - A destination buffer of N bytes, where N == (grainSize * 4 * sizeof(int16_t)). The data layout gets decided from the current output mode, which is one of PspSasOutputModes. |
| int __sceSasCoreWithMix | ( | SceSasCore * | core, |
| void * | dst, | ||
| int | leftvol, | ||
| int | rightvol ) |
Runs a sceSas cycle iteration and mixes samples onto destination buffer.
This is similar to __sceSasCore, except that the destination buffer does not get cleared.
| core | - Pointer to a valid sceSas instance. |
| dst | - A destination buffer of N bytes, where N == (grainSize * 4 * sizeof(int16_t)). The data layout gets decided from the current output mode, which is one of PspSasOutputModes. |
| leftvol | - A number between 0 and PSP_SAS_VOLUME_MAX. |
| rightvol | - A number between 0 and PSP_SAS_VOLUME_MAX. |
| int __sceSasGetAllEnvelopeHeights | ( | SceSasCore * | core, |
| int | heights[32] ) |
Gets the current envelope height of all voices.
| core | - Pointer to a valid sceSas instance. |
| heights | - An int array of 32 indices where the results will be inserted into. |
| u32 __sceSasGetEndFlag | ( | SceSasCore * | core | ) |
Gets the end status of the voices from an SceSasCore nstance.
Each bit corresponds to a voice index:
| core | - Pointer to a valid Sas instance |
| int __sceSasGetEnvelopeHeight | ( | SceSasCore * | core, |
| int | voice ) |
Gets the current envelope height of a voice.
| core | - Pointer to a valid sceSas instance. |
| voice | - The voice index to read from. |
| int __sceSasGetGrain | ( | SceSasCore * | core | ) |
Gets the grain size of the SceSasCore instance.
| core | - Pointer to a valid sceSas instance. |
| int __sceSasGetOutputmode | ( | SceSasCore * | core | ) |
Gets the current output mode from the SceSasCore instance.
| core | - Pointer to a valid sceSas instance. |
| int __sceSasGetPauseFlag | ( | SceSasCore * | core | ) |
Get the pause status of every voice in a bitfield.
Each bit corresponds to a voice index:
| core | - Pointer to a valid Sas instance |
| int __sceSasInit | ( | SceSasCore * | core, |
| int | grainsize, | ||
| int | maxvoices, | ||
| PspSasOutputModes | outputmode, | ||
| int | samplerate ) |
Initializes a SceSasCore instance.
Make sure to load PSP_MODULE_AV_AVCODEC and PSP_MODULE_AV_SASCORE with sceUtilityLoadModule or sceUtilityLoadAvModule before calling this function.
| core | - Pointer to SceSasCore for initialization. Must be 64-byte aligned. |
| grainsize | - Tells how many frames (samples per channel) the mixer will process and output per iteration. It must be a value between PSP_SAS_GRAIN_SIZE_MIN and PSP_SAS_GRAIN_SIZE_MAX, and it must be a multiple of 64. |
| maxvoices | - The maximum number of voices SceSasCore will process. It must be a number between 1 and PSP_SAS_VOICES_MAX. |
| outputmode | - The output mode to use. One of PspSasOutputModes. |
| samplerate | - Must be PSP_SAS_SAMPLE_RATE (44100). Any other value will result in an error. |
| int __sceSasRevEVOL | ( | SceSasCore * | core, |
| int | leftvol, | ||
| int | rightvol ) |
Sets the effect volume of the SceSasCore instance.
| core | - Pointer to a valid sceSas instance. |
| leftvol | - Must be a number between 0 and PSP_SAS_VOLUME_MAX. |
| rightvol | - Must be a number between 0 and PSP_SAS_VOLUME_MAX. |
| int __sceSasRevParam | ( | SceSasCore * | core, |
| int | delay, | ||
| int | feedback ) |
Sets the effect delay and feedback parameters of the SceSasCore instance.
| core | - Pointer to a valid sceSas instance. |
| delay | - Must be a number between 0 and 128. |
| feedback | - Must be a number between 0 and 128. |
| int __sceSasRevType | ( | SceSasCore * | core, |
| PspSasEffectTypes | type ) |
Sets the reverb effect of the SceSasCore instance.
| core | - Pointer to a valid sceSas instance. |
| type | - The reverb effect to use. One of PspSasEffectTypes. |
| int __sceSasRevVON | ( | SceSasCore * | core, |
| int | dry, | ||
| int | wet ) |
Toggles dry and wet audio signals of the SceSasCore instance.
| core | - A valid sceSas instance. |
| dry | - Enable/disable dry signal. |
| wet | - Enable/disable wet/send signal. |
| int __sceSasSetADSR | ( | SceSasCore * | core, |
| int | voice, | ||
| u32 | mask, | ||
| int | attackrate, | ||
| int | decayrate, | ||
| int | sustainrate, | ||
| int | releaserate ) |
Sets the voice ADSR envelope rates for a voice.
Configures how fast the envelope progresses through its Attack, Decay, Sustain, and Release phases.
| core | - Pointer to a valid sceSas instance. |
| voice | - The target voice index. |
| mask | - Bitmask selecting which ADSR parameters to update. Use PspSasADSRFlags values or PSP_SAS_ADSR_EVERYTHING. |
| attackrate | - Attack step rate (rise towards PSP_SAS_ENVELOPE_HEIGHT_MAX). |
| decayrate | - Decay step rate (fall towards sustain level). |
| sustainrate | - Sustain phase rate (envelope change while key is held) |
| releaserate | - Release step rate (fall toward 0 after key is off). |
| int __sceSasSetADSRmode | ( | SceSasCore * | core, |
| int | voice, | ||
| u32 | mask, | ||
| PspSasADSRCurveModes | attackcurve, | ||
| PspSasADSRCurveModes | decaycurve, | ||
| PspSasADSRCurveModes | sustaincurve, | ||
| PspSasADSRCurveModes | releasecurve ) |
Sets the voice ADSR envelope curves.
Configures "how" the envelope progresses through its Attack, Decay, Sustain, and Release phases. Often used alongside __sceSasSetADSR to set the envelope rates.
| core | - Pointer to a valid sceSas instance. |
| voice | - The target voice index. |
| mask | - Bitmask selecting which ADSR parameters to update. Use PspSasADSRFlags values or PSP_SAS_ADSR_EVERYTHING. |
| attackcurve | - Attack step curve. One of PspSasADSRCurveModes |
| decaycurve | - Decay step curve. One of PspSasADSRCurveModes |
| sustaincurve | - Sustain step curve. One of PspSasADSRCurveModes |
| releasecurve | - Release step curve. One of PspSasADSRCurveModes |
| int __sceSasSetGrain | ( | SceSasCore * | core, |
| int | grainsize ) |
Sets the grain size of the SceSasCore instance.
| core | - A valid sceSas instance. |
| grainsize | - The new grain size to set. It must be a value between PSP_SAS_GRAIN_SIZE_MIN and PSP_SAS_GRAIN_SIZE_MAX, and it must be a multiple of 64. |
| int __sceSasSetKeyOff | ( | SceSasCore * | core, |
| int | voice ) |
Stops the voice (starts Release phase).
| core | - Pointer to a valid sceSas instance. |
| voice | - The target voice index. |
| int __sceSasSetKeyOn | ( | SceSasCore * | core, |
| int | voice ) |
Plays the voice (starts Attack phase).
| core | - Pointer to a valid sceSas instance. |
| voice | - The target voice index. |
| int __sceSasSetNoise | ( | SceSasCore * | core, |
| int | voice, | ||
| int | freq ) |
Configures the voice to play a noise waveform.
| core | - Pointer to a valid sceSas instance. |
| voice | - The target voice index |
| freq | - How often the wave will randomly alternate? Must be a number from 0 to PSP_SAS_NOISE_FREQ_MAX. |
| int __sceSasSetOutputmode | ( | SceSasCore * | core, |
| PspSasOutputModes | outputmode ) |
Sets the current output mode of the SceSasCore instance.
| core | - Pointer to a valid sceSas instance. |
| outputmode | - The output mode to use. One of PspSasOutputModes. |
| int __sceSasSetPause | ( | SceSasCore * | core, |
| u32 | voicebit, | ||
| int | pause ) |
Pauses/unpauses voice playback using a bitmask.
| core | - Pointer to a valid sceSas instance. |
| voicebit | - 32-bit bitmask selecting which voices to update. Each bit corresponds to a voice index. You can use PSP_SAS_GET_VOICE_BIT to convert a voice index into a proper bitmask. |
| pause | - Whether to pause or unpause the selected voices |
| int __sceSasSetPitch | ( | SceSasCore * | core, |
| int | voice, | ||
| int | pitch ) |
Sets the pitch value of a voice.
Can be used to set the playback speed of the voice. For waveform voices (such as steep/triangular/noise waves), this value gets treated as the tonal frequency (in hertz).
| core | - Pointer to a valid sceSas instance. |
| voice | - The target voice index. |
| pitch | - Fixed-point ratio where PSP_SAS_PITCH_BASE means 1x in pitch-scale, or the tonal frequency (in hertz) of waveform voices. It must be a number between PSP_SAS_PITCH_MIN ad PSP_SAS_PITCH_MAX. |
| int __sceSasSetSimpleADSR | ( | SceSasCore * | core, |
| int | voice, | ||
| u32 | envelope1, | ||
| u32 | envelope2 ) |
Configures the entire voice ADSR envelope (rates & curves).
envelope1 and envelope2.This is used to set the entire ADSR envelope in a single call, acting as a replacement to __sceSasSetADSR and __sceSasSetADSRmode.
| core | - Pointer to a valid sceSas instance. |
| voice | - The target voice index. |
| envelope1 | - First envelope config value. |
| envelope2 | - Second envelope config value. |
| int __sceSasSetSL | ( | SceSasCore * | core, |
| int | voice, | ||
| int | level ) |
Sets the voice ADSR envelope sustain level height.
| core | - Pointer to a valid sceSas instance. |
| voice | - The target voice index. |
| level | - A number between 0 and PSP_SAS_ENVELOPE_HEIGHT_MAX |
| int __sceSasSetSteepWave | ( | SceSasCore * | core, |
| int | voice, | ||
| int | duty ) |
Configures the voice to play a square waveform.
| core | - Pointer to a valid sceSas instance. |
| voice | - The target voice index |
| duty | - The percentage of the square's duty cycle (e.g. a value of 50 means a symmetrical 50% duty cycle). Must be a number from 0 to 100. |
| int __sceSasSetTrianglarWave | ( | SceSasCore * | core, |
| int | voice, | ||
| int | unk ) |
Configures the voice to play a triangular waveform.
| core | - Pointer to a valid sceSas instance. |
| voice | - The target voice index |
| unk | - Unsure. Probably duty cycle + some other thing that gets packed into 7 bits? Apparently it must be a number from 0 to 100. |
| int __sceSasSetTriangularWave | ( | SceSasCore * | core, |
| int | voice, | ||
| int | unk ) |
A function alias of __sceSasSetTrianglarWave.
| int __sceSasSetVoice | ( | SceSasCore * | core, |
| int | voice, | ||
| void * | vag, | ||
| int | size, | ||
| int | loop ) |
Sets PlayStation VAG data for a given sceSas voice.
| core | - Pointer to a valid sceSas instance. |
| voice | - The target voice index. |
| vag | - A stable pointer to VAG ADPCM data. |
| size | - The size in bytes of the VAG ADPCM data. |
| loop | - Whether this voice should loop or not. The VAG file itself has to contain the end loop flag in its data in order for looping to work. Must be 0 or 1. |
| int __sceSasSetVoiceATRAC3 | ( | SceSasCore * | core, |
| int | voice, | ||
| void * | atrac3ctx ) |
| int __sceSasSetVoicePCM | ( | SceSasCore * | core, |
| int | voice, | ||
| void * | pcm, | ||
| int | samplecount, | ||
| int | loopstart ) |
Sets PCM data for the given sceSas voice.
| core | - Pointer to a valid sceSas instance. |
| voice | - The target voice index. |
| pcm | - A stable pointer to the audio PCM data. The audio MUST be mono and its format HAS to be in 16-bit signed integer (little-endian). |
| samplecount | - The amount of samples the voice will play. |
| loopstart | - The sample position the loop will start from. Pass -1 to disable looping. |
| int __sceSasSetVolume | ( | SceSasCore * | core, |
| int | voice, | ||
| int | leftvol, | ||
| int | rightvol, | ||
| int | sendleftvol, | ||
| int | sendrightvol ) |
Sets the output volume of the voice.
| core | - Pointer to a valid sceSas instance. |
| voice | - The target voice index. |
| leftvol | - Left dry channel volume. Must be a number between 0 and PSP_SAS_VOLUME_MAX. |
| rightvol | - Right dry channel volume. Must be a number between 0 and PSP_SAS_VOLUME_MAX. |
| sendleftvol | - Send-Left channel volume. Must be a number between 0 and PSP_SAS_VOLUME_MAX. |
| sendrightvol | - Send-Right channel volume. Must be a number between 0 and PSP_SAS_VOLUME_MAX. |
| int __sceSasUnsetATRAC3 | ( | SceSasCore * | core, |
| int | voice ) |