#include <stdio.h>
#include <thbase.h>
#include <thsemap.h>
#include <loadcore.h>
#include <sysmem.h>
#include <intrman.h>
#include <libsd.h>
#include <sysclib.h>
#include <audsrv.h>
#include "audsrv_internal.h"
#include "common.h"
#include "rpc_server.h"
#include "spu.h"
#include "debug_printf.h"
Go to the source code of this file.
audsrv adpcm module
Definition in file adpcm.c.
◆ adpcm_list_t
Definition at line 31 of file adpcm.c.
| Data Fields |
|
struct adpcm_list_t * |
next |
|
|
int |
id |
|
|
int |
pitch |
|
|
int |
loop |
|
|
int |
channels |
|
|
int |
size |
|
|
int |
spu2_addr |
|
◆ __attribute__()
SOURCE CHAIN TAG for DMA CHAIN MODE
Definition at line 19 of file netcnfif.c.
◆ alloc_new_sample()
Allocates memory for a new sample.
Definition at line 49 of file adpcm.c.
◆ free_all_samples()
| static void free_all_samples |
( |
| ) |
|
|
static |
Frees up all memory taken by the linked list of samples
Definition at line 62 of file adpcm.c.
◆ free_sample()
| int free_sample |
( |
u32 |
id | ) |
|
Remove an adpcm sample uploaded with audsrv_load_adpcm() from the list of loaded sounds
- Parameters
-
| id | sample identifier, as specified in load() |
SPU memory is freed only when there are no sounds in the list that where loaded after the ones that have been freed
Definition at line 84 of file adpcm.c.
◆ adpcm_loaded()
Looks up the given identifier in list of loaded samples
- Parameters
-
- Returns
- node entry from container, NULL on failure
Definition at line 126 of file adpcm.c.
Referenced by audsrv_ch_play_adpcm().
◆ audsrv_read_adpcm_header()
| static void audsrv_read_adpcm_header |
( |
adpcm_list_t * |
adpcm, |
|
|
const u32 * |
buffer |
|
) |
| |
|
static |
Extracts adpcm parameters from header
- Parameters
-
| adpcm | node entry |
| buffer | pointer to adpcm header |
Definition at line 147 of file adpcm.c.
◆ audsrv_load_adpcm()
| void* audsrv_load_adpcm |
( |
u32 * |
buffer, |
|
|
int |
size, |
|
|
int |
id |
|
) |
| |
Uploads a sample to SPU2 memory
- Parameters
-
| buffer | pointer to adpcm sample header |
| size | size of sample in bytes |
| id | sample identifier (to be later used in play()) |
- Returns
- pointer to local adpcm buffer
Definition at line 160 of file adpcm.c.
◆ audsrv_ch_play_adpcm()
| int audsrv_ch_play_adpcm |
( |
int |
ch, |
|
|
u32 |
id |
|
) |
| |
Plays an adpcm sample already uploaded with audsrv_load_adpcm()
- Parameters
-
| ch | channel identifier. Specifies one of the 24 voice channel to play the ADPCM channel on. If set to an invalid channel ID, an unoccupied channel will be selected. |
| id | sample identifier, as specified in load() |
- Returns
- channel identifier on success, negative value on error
When ch is set to an invalid channel ID, the sample will be played in an unoccupied channel. If all 24 channels are used, then -AUDSRV_ERR_NO_MORE_CHANNELS is returned. When ch is set to a valid channel ID, -AUDSRV_ERR_NO_MORE_CHANNELS is returned if the channel is currently in use. Trying to play a sample which is unavailable will result in -AUDSRV_ERR_ARGS
Definition at line 277 of file adpcm.c.
References adpcm_loaded().
◆ audsrv_adpcm_init()
| int audsrv_adpcm_init |
( |
| ) |
|
◆ audsrv_adpcm_set_volume()
| int audsrv_adpcm_set_volume |
( |
int |
ch, |
|
|
int |
voll, |
|
|
int |
volr |
|
) |
| |
Sets output volume for the specified voice channel.
- Parameters
-
| ch | Voice channel ID |
| voll | left volume in SPU2 units [0 .. 0x3fff] |
| volr | right volume in SPU2 units [0 .. 0x3fff] |
- Returns
- 0 on success, negative otherwise
Definition at line 347 of file adpcm.c.
References MAX_VOLUME.