KallistiOS git master
Independent SDK for the Sega Dreamcast
Loading...
Searching...
No Matches
sound.h File Reference

Low-level sound support and memory management. More...

#include <sys/cdefs.h>
#include <arch/types.h>
#include <stdint.h>
#include <stdbool.h>

Go to the source code of this file.

Functions

uint32 snd_mem_malloc (size_t size)
 Allocate memory in the SPU RAM pool.
 
void snd_mem_free (uint32 addr)
 Free a block of allocated memory in the SPU RAM pool.
 
uint32 snd_mem_available (void)
 Get the size of the largest allocateable block in the SPU RAM pool.
 
int snd_mem_init (uint32 reserve)
 Reinitialize the SPU RAM pool.
 
void snd_mem_shutdown (void)
 Shutdown the SPU RAM allocator.
 
int snd_init (void)
 Initialize the sound system.
 
void snd_shutdown (void)
 Shut down the sound system.
 
int snd_sh4_to_aica (void *packet, uint32 size)
 Copy a request packet to the AICA queue.
 
void snd_sh4_to_aica_start (void)
 Begin processing AICA queue requests.
 
void snd_sh4_to_aica_stop (void)
 Stop processing AICA queue requests.
 
int snd_aica_to_sh4 (void *packetout)
 Transfer a packet of data from the AICA's SH4 queue.
 
void snd_poll_resp (void)
 Poll for a response from the AICA.
 
void snd_pcm16_split (uint32_t *data, uint32_t *left, uint32_t *right, size_t size)
 Separates stereo PCM samples into 2 mono channels.
 
void snd_pcm16_split_sq (uint32_t *data, uintptr_t left, uintptr_t right, size_t size)
 Separates stereo PCM samples into 2 mono channels with SQ transfer.
 
void snd_pcm8_split (uint32_t *data, uint32_t *left, uint32_t *right, size_t size)
 Separates stereo PCM samples into 2 mono channels.
 
void snd_adpcm_split (uint32_t *data, uint32_t *left, uint32_t *right, size_t size)
 Separates stereo ADPCM samples into 2 mono channels.
 
uint16_t snd_get_pos (unsigned int ch)
 Get AICA channel position.
 
bool snd_is_playing (unsigned int ch)
 Get AICA channel playback state.
 

Detailed Description

Low-level sound support and memory management.

This file contains declarations for low-level sound operations and for SPU RAM pool memory management. Most of the time you'll be better off using the higher-level functionality in the sound effect support or streaming support, but this stuff can be very useful for some things.

Author
Megan Potter
Ruslan Rostovtsev

Function Documentation

◆ snd_get_pos()

uint16_t snd_get_pos ( unsigned int ch)

Get AICA channel position.

This function returns actual the channel position that stores in SPU memory and updated by the SPU firmware.

Parameters
chnThe channel to retrieve position.
Returns
Last channel position in samples.

◆ snd_is_playing()

bool snd_is_playing ( unsigned int ch)

Get AICA channel playback state.

This function returns actual the channel playback state that stores in AICA registers directly.

Parameters
chnThe channel to check.
Returns
True if the channel is playing.