Raw PCM sound.
Data format should be either pcm_s16be or pcm_s8. To do stereo, right channel must occupy first half of the file and left channel second half.
#include <srl_sound.hpp>
Public Member Functions | |
RawPcm (Cd::File *file, const Pcm::PcmChannels channels, const Pcm::PcmBitDepth depth, const uint16_t sampleRate) | |
Initializes a new PCM audio handle. | |
~RawPcm () | |
Destroy the Raw Pcm object. | |
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. | |
|
inline |
Initializes a new PCM audio handle.
file | PCM file |
channels | Number of channels (Mono or Stereo) |
depth | Bit depth (8 or 16 bit) |
sampleRate | Sample rate (in Hz) |
|
inlineprotectedinherited |
Use specified malloc to allocate memory block.
malloc | Malloc to use |
size | Size in bytes to allocate |
|
inlineinherited |
Try to play sound on the first free channel.
volume | Playback volume (0-127) |
pan | Audio channel panning (-127 to 127) |
|
inlineinherited |
Try to play a sound on a specific channel.
channel | Sound channel to play sound on (0-3) |
volume | Playback volume (0-127) |
pan | Audio channel panning (-127 to 127) |