#include <DLS.h>
Inheritance diagram for DLS::Sample:
Public Member Functions | |
void * | LoadSampleData () |
Load sample data into RAM. Returns a pointer to the data in RAM on success, NULL otherwise. | |
void | ReleaseSampleData () |
Release the samples once you used them if you don't want to be bothered to. | |
unsigned long | SetPos (unsigned long SampleCount, RIFF::stream_whence_t Whence=RIFF::stream_start) |
Sets the position within the sample (in sample points, not in bytes). | |
unsigned long | Read (void *pBuffer, unsigned long SampleCount) |
Reads SampleCount number of sample points from the current position into the buffer pointed by pBuffer and increments the position within the sample. | |
Resource * | GetParent () |
Public Attributes | |
uint16_t | FormatTag |
Format ID of the waveform data (should be WAVE_FORMAT_PCM for DLS1 compliant files). | |
uint16_t | Channels |
Number of channels represented in the waveform data, e.g. 1 for mono, 2 for stereo (). | |
uint32_t | SamplesPerSecond |
Sampling rate at which each channel should be played. | |
uint32_t | AverageBytesPerSecond |
The average number of bytes per second at which the waveform data should be transferred (Playback software can estimate the buffer size using this value). | |
uint16_t | BlockAlign |
The block alignment (in bytes) of the waveform data. Playback software needs to process a multiple of BlockAlign bytes of data at a time, so the value of BlockAlign can be used for buffer alignment. | |
uint16_t | BitDepth |
Size of each sample per channel (only if known sample data format is used, 0 otherwise). | |
unsigned long | SamplesTotal |
Reflects total number of samples (only if known sample data format is used, 0 otherwise). | |
uint | FrameSize |
Reflects the size (in bytes) of one single sample (only if known sample data format is used, 0 otherwise). | |
Info * | pInfo |
Points (in any case) to an Info object, providing additional, optional infos and comments. | |
dlsid_t * | pDLSID |
Points to a dlsid_t structure if the file provided a DLS ID else is NULL. | |
Protected Member Functions | |
Sample (File *pFile, RIFF::List *waveList, unsigned long WavePoolOffset) | |
Protected Attributes | |
RIFF::Chunk * | pCkData |
RIFF::Chunk * | pCkFormat |
unsigned long | ulWavePoolOffset |
Resource * | pParent |
Friends | |
class | File |
class | Region |
Definition at line 375 of file DLS.h.
DLS::Sample::Sample | ( | File * | pFile, | |
RIFF::List * | waveList, | |||
unsigned long | WavePoolOffset | |||
) | [protected] |
Definition at line 218 of file DLS.cpp.
References AverageBytesPerSecond, BitDepth, BlockAlign, Channels, CHUNK_ID_DATA, CHUNK_ID_FMT, FormatTag, FrameSize, RIFF::Chunk::GetSize(), RIFF::List::GetSubChunk(), LIST_HEADER_SIZE, pCkData, pCkFormat, RIFF::Chunk::ReadUint16(), RIFF::Chunk::ReadUint32(), SamplesPerSecond, SamplesTotal, ulWavePoolOffset, and WAVE_FORMAT_PCM.
Resource* DLS::Resource::GetParent | ( | ) | [inline, inherited] |
Definition at line 350 of file DLS.h.
Referenced by DLS::Region::GetSample(), gig::Region::GetSampleFromWavePool(), and gig::Region::Region().
void * DLS::Sample::LoadSampleData | ( | ) |
Load sample data into RAM. Returns a pointer to the data in RAM on success, NULL otherwise.
Reimplemented in gig::Sample.
Definition at line 246 of file DLS.cpp.
References RIFF::Chunk::LoadChunkData(), and pCkData.
unsigned long DLS::Sample::Read | ( | void * | pBuffer, | |
unsigned long | SampleCount | |||
) |
Reads SampleCount number of sample points from the current position into the buffer pointed by pBuffer and increments the position within the sample.
Use this method and SetPos() if you don't want to load the sample into RAM, thus for disk streaming.
pBuffer | destination buffer | |
SampleCount | number of sample points to read |
Definition at line 279 of file DLS.cpp.
References FormatTag, FrameSize, pCkData, RIFF::Chunk::Read(), and WAVE_FORMAT_PCM.
void DLS::Sample::ReleaseSampleData | ( | ) |
Release the samples once you used them if you don't want to be bothered to.
Reimplemented in gig::Sample.
Definition at line 250 of file DLS.cpp.
References pCkData, and RIFF::Chunk::ReleaseChunkData().
unsigned long DLS::Sample::SetPos | ( | unsigned long | SampleCount, | |
RIFF::stream_whence_t | Whence = RIFF::stream_start | |||
) |
Sets the position within the sample (in sample points, not in bytes).
Use this method and Read() if you don't want to load the sample into RAM, thus for disk streaming.
SampleCount | number of sample points | |
Whence | to which relation SampleCount refers to |
Reimplemented in gig::Sample.
Definition at line 262 of file DLS.cpp.
References FormatTag, FrameSize, pCkData, RIFF::Chunk::SetPos(), and WAVE_FORMAT_PCM.
friend class File [friend] |
friend class Region [friend] |
uint32_t DLS::Sample::AverageBytesPerSecond |
uint16_t DLS::Sample::BitDepth |
Size of each sample per channel (only if known sample data format is used, 0 otherwise).
Definition at line 382 of file DLS.h.
Referenced by ExtractSamples(), gig::Sample::GuessSize(), gig::Sample::Read(), gig::Sample::Sample(), and Sample().
uint16_t DLS::Sample::BlockAlign |
uint16_t DLS::Sample::Channels |
Number of channels represented in the waveform data, e.g. 1 for mono, 2 for stereo ().
Definition at line 378 of file DLS.h.
Referenced by ExtractSamples(), gig::Sample::GuessSize(), PrintSamples(), gig::Sample::Sample(), and Sample().
uint16_t DLS::Sample::FormatTag |
Reflects the size (in bytes) of one single sample (only if known sample data format is used, 0 otherwise).
Definition at line 384 of file DLS.h.
Referenced by ExtractSamples(), gig::Sample::GetPos(), gig::Sample::LoadSampleDataWithNullSamplesExtension(), Read(), Sample(), gig::Sample::SetPos(), and SetPos().
RIFF::Chunk* DLS::Sample::pCkData [protected] |
Definition at line 391 of file DLS.h.
Referenced by gig::Sample::GetPos(), LoadSampleData(), gig::Sample::Read(), Read(), ReleaseSampleData(), Sample(), gig::Sample::SetPos(), and SetPos().
RIFF::Chunk* DLS::Sample::pCkFormat [protected] |
dlsid_t* DLS::Resource::pDLSID [inherited] |
Points to a dlsid_t structure if the file provided a DLS ID else is NULL.
Definition at line 348 of file DLS.h.
Referenced by DLS::Resource::Resource(), and DLS::Resource::~Resource().
Info* DLS::Resource::pInfo [inherited] |
Points (in any case) to an Info object, providing additional, optional infos and comments.
Definition at line 347 of file DLS.h.
Referenced by ExtractSamples(), main(), PrintDimensionRegions(), PrintInstruments(), PrintRegions(), PrintSamples(), DLS::Resource::Resource(), and DLS::Resource::~Resource().
Resource* DLS::Resource::pParent [protected, inherited] |
uint32_t DLS::Sample::SamplesPerSecond |
Sampling rate at which each channel should be played.
Definition at line 379 of file DLS.h.
Referenced by ExtractSamples(), PrintDimensionRegions(), PrintRegions(), PrintSamples(), and Sample().
unsigned long DLS::Sample::SamplesTotal |
Reflects total number of samples (only if known sample data format is used, 0 otherwise).
Definition at line 383 of file DLS.h.
Referenced by ExtractSamples(), gig::Sample::LoadSampleDataWithNullSamplesExtension(), PrintSamples(), gig::Sample::Read(), Sample(), and gig::Sample::SetPos().
unsigned long DLS::Sample::ulWavePoolOffset [protected] |
Definition at line 393 of file DLS.h.
Referenced by DLS::Region::GetSample(), gig::Region::GetSampleFromWavePool(), and Sample().