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

Detailed Description

Wave sound effect.

#include <srl_sound.hpp>

Inheritance diagram for SRL::Sound::Pcm::WaveSound:
SRL::Sound::Pcm::IPcmFile

Public Member Functions

 WaveSound (Cd::File *file)
 Initializes a new wave sound.
 
 ~WaveSound ()
 Destroy loaded sound.
 
int8_t Play (uint8_t volume=127, int8_t pan=0)
 Try to play sound on the first free channel.
 
bool PlayOnChannel (uint8_t channel, uint8_t volume=127, int8_t pan=0)
 Try to play a sound on a specific channel.
 

Protected Member Functions

void * AllocateWithBehaviour (const Pcm::PcmMalloc malloc, size_t size)
 Use specified malloc to allocate memory block.
 

Protected Attributes

int8_t * data = nullptr
 Sound data.
 
uint32_t dataSize = 0
 Number of bytes to play.
 
uint8_t depth = _PCM8Bit
 Bit depth (_PCM8Bit or _PCM16Bit)
 
uint8_t mode = _Mono
 Sound mode (_Mono or _Stereo)
 
uint16_t sampleRate = 11020
 Sound sample rate.
 

Constructor & Destructor Documentation

◆ WaveSound()

SRL::Sound::Pcm::WaveSound::WaveSound ( Cd::File * file)
inline

Initializes a new wave sound.

Parameters
fileSound file

Member Function Documentation

◆ AllocateWithBehaviour()

void * SRL::Sound::Pcm::IPcmFile::AllocateWithBehaviour ( const Pcm::PcmMalloc malloc,
size_t size )
inlineprotectedinherited

Use specified malloc to allocate memory block.

Parameters
mallocMalloc to use
sizeSize in bytes to allocate
Returns
Pointer to allocated block

◆ Play()

int8_t SRL::Sound::Pcm::IPcmFile::Play ( uint8_t volume = 127,
int8_t pan = 0 )
inlineinherited

Try to play sound on the first free channel.

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

◆ PlayOnChannel()

bool SRL::Sound::Pcm::IPcmFile::PlayOnChannel ( uint8_t channel,
uint8_t volume = 127,
int8_t pan = 0 )
inlineinherited

Try to play a sound on a specific channel.

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