DLS::Sample Class Reference

Encapsulates sample waves used for playback. More...

#include <DLS.h>

Inheritance diagram for DLS::Sample:

DLS::Resource gig::Sample List of all members.

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.
ResourceGetParent ()

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).
InfopInfo
 Points (in any case) to an Info object, providing additional, optional infos and comments.
dlsid_tpDLSID
 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::ChunkpCkData
RIFF::ChunkpCkFormat
unsigned long ulWavePoolOffset
ResourcepParent

Friends

class File
class Region

Detailed Description

Encapsulates sample waves used for playback.

Definition at line 375 of file DLS.h.


Constructor & Destructor Documentation

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.


Member Function Documentation

Resource* DLS::Resource::GetParent  )  [inline, inherited]
 

Definition at line 350 of file DLS.h.

Referenced by DLS::Region::GetSample(), and gig::Region::GetSampleFromWavePool().

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.

Parameters:
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.

Parameters:
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.


Friends And Related Function Documentation

friend class File [friend]
 

Reimplemented in gig::Sample.

Definition at line 396 of file DLS.h.

friend class Region [friend]
 

Reimplemented in gig::Sample.

Definition at line 397 of file DLS.h.


Member Data Documentation

uint32_t DLS::Sample::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).

Definition at line 380 of file DLS.h.

Referenced by Sample().

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::Read(), gig::Sample::Sample(), and Sample().

uint16_t DLS::Sample::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.

Definition at line 381 of file DLS.h.

Referenced by Sample().

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(), PrintSamples(), gig::Sample::Sample(), and Sample().

uint16_t DLS::Sample::FormatTag
 

Format ID of the waveform data (should be WAVE_FORMAT_PCM for DLS1 compliant files).

Definition at line 377 of file DLS.h.

Referenced by Read(), Sample(), and SetPos().

uint DLS::Sample::FrameSize
 

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]
 

Definition at line 392 of file DLS.h.

Referenced by Sample().

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]
 

Definition at line 350 of file DLS.h.

Referenced by DLS::Resource::Resource().

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(), 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().


The documentation for this class was generated from the following files:
Generated on Tue Mar 28 00:50:37 2006 for libgig by  doxygen 1.4.6