SaturnRingLibrary 0.6
SGL wrapper
 
Loading...
Searching...
No Matches
SRL::Sound::Pcm Class Reference

Detailed Description

PCM playback.

#include <srl_sound.hpp>

Classes

class  IPcmFile
 Base PCM file interface. More...
 
class  RawPcm
 Raw PCM sound. More...
 
class  WaveSound
 Wave sound effect. More...
 

Public Types

enum  PcmBitDepth { Pcm8Bit = _PCM8Bit , Pcm16Bit = _PCM16Bit }
 PCM audio bit depth. More...
 
enum  PcmChannels { Mono = _Mono , Stereo = _Stereo }
 PCM audio channels. More...
 
enum  PcmMalloc : uint16_t { Default = 0 , HwRam = 1 , LwRam = 2 , CartRam = 3 }
 Malloc types to use for loading PCM. More...
 

Static Public Member Functions

static bool IsChannelFree (uint8_t channel)
 Check whether sound channel is currently free.
 
static int8_t Play (Pcm::IPcmFile &pcm, uint8_t volume=127, int8_t pan=0)
 Try to play sound on the first free channel.
 
static bool PlayOnChannel (Pcm::IPcmFile &pcm, uint8_t channel, uint8_t volume=127, int8_t pan=0)
 Try to play a sound on a specific channel.
 
static void SetMemAllocationBehaviour (const Pcm::PcmMalloc work, const Pcm::PcmMalloc data)
 Set the Mem Allocation Behaviour for loading PCM files.
 
static void SetVolumePan (uint8_t channel, uint8_t volume, int8_t pan=0)
 Set the Volume & Panning.
 
static bool StopSound (uint8_t channel)
 Stop currently playing sound.
 

Member Enumeration Documentation

◆ PcmBitDepth

PCM audio bit depth.

Enumerator
Pcm8Bit 

8-bit data

sound format is pcm_s8

Pcm16Bit 

16-bit data

sound format is pcm_s16be

◆ PcmChannels

PCM audio channels.

Enumerator
Mono 

Single channel.

Stereo 

Dual channel.

◆ PcmMalloc

enum SRL::Sound::Pcm::PcmMalloc : uint16_t

Malloc types to use for loading PCM.

Enumerator
Default 

Will use the same malloc as what was used for object creation.

HwRam 

High Work RAM malloc, (main system RAM)

LwRam 

Low work RAM malloc.

CartRam 

Cart RAM malloc.

Member Function Documentation

◆ IsChannelFree()

static bool SRL::Sound::Pcm::IsChannelFree ( uint8_t channel)
inlinestatic

Check whether sound channel is currently free.

Parameters
channelSound channel to check (0-3)
Returns
true if channel is not playing anything

◆ Play()

static int8_t SRL::Sound::Pcm::Play ( Pcm::IPcmFile & pcm,
uint8_t volume = 127,
int8_t pan = 0 )
inlinestatic

Try to play sound on the first free channel.

Parameters
pcmSound effect to play
volumePlayback volume (0-127)
panAudio channel panning (-127 to 127)
Returns
Channel number if sound was played or -1 if it was not

◆ PlayOnChannel()

static bool SRL::Sound::Pcm::PlayOnChannel ( Pcm::IPcmFile & pcm,
uint8_t channel,
uint8_t volume = 127,
int8_t pan = 0 )
inlinestatic

Try to play a sound on a specific channel.

Parameters
pcmSound effect to play
channelSound channel to play sound on (0-3)
volumePlayback volume (0-127)
panAudio channel panning (-127 to 127)
Returns
true if sound was played

◆ SetMemAllocationBehaviour()

static void SRL::Sound::Pcm::SetMemAllocationBehaviour ( const Pcm::PcmMalloc work,
const Pcm::PcmMalloc data )
inlinestatic

Set the Mem Allocation Behaviour for loading PCM files.

Parameters
workThis malloc will be used to allocate memory for parsing a file
dataThis malloc will be used to allocate memory for a parsed file

◆ SetVolumePan()

static void SRL::Sound::Pcm::SetVolumePan ( uint8_t channel,
uint8_t volume,
int8_t pan = 0 )
inlinestatic

Set the Volume & Panning.

Parameters
channelSound channel to modify (0-3)
volumePlayback volume (0-127)
panAudio channel panning (-127 to 127)

◆ StopSound()

static bool SRL::Sound::Pcm::StopSound ( uint8_t channel)
inlinestatic

Stop currently playing sound.

Parameters
channelSound channel to stop (0-3)
Returns
true if successfully stopped