gig::Sample Class Reference

Encapsulates sample waves used for playback. More...

#include <gig.h>

Inheritance diagram for gig::Sample:

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

Public Member Functions

buffer_t LoadSampleData ()
 Loads (and uncompresses if needed) the whole sample wave into RAM.
buffer_t LoadSampleData (unsigned long SampleCount)
 Reads (uncompresses if needed) and caches the first SampleCount numbers of SamplePoints in RAM.
buffer_t LoadSampleDataWithNullSamplesExtension (uint NullSamplesCount)
 Loads (and uncompresses if needed) the whole sample wave into RAM.
buffer_t LoadSampleDataWithNullSamplesExtension (unsigned long SampleCount, uint NullSamplesCount)
 Reads (uncompresses if needed) and caches the first SampleCount numbers of SamplePoints in RAM.
buffer_t GetCache ()
 Returns current cached sample points.
void ReleaseSampleData ()
 Frees the cached sample from RAM if loaded with LoadSampleData() previously.
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 GetPos ()
 Returns the current position in the sample (in sample points).
unsigned long Read (void *pBuffer, unsigned long SampleCount, buffer_t *pExternalDecompressionBuffer=NULL)
 Reads SampleCount number of sample points from the current position into the buffer pointed by pBuffer and increments the position within the sample.
unsigned long ReadAndLoop (void *pBuffer, unsigned long SampleCount, playback_state_t *pPlaybackState, buffer_t *pExternalDecompressionBuffer=NULL)
 Reads SampleCount number of sample points from the position stored in pPlaybackState into the buffer pointed by pBuffer and moves the position within the sample respectively, this method honors the looping informations of the sample (if any).
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 ()

Static Public Member Functions

static buffer_t CreateDecompressionBuffer (unsigned long MaxReadSize)
 Allocates a decompression buffer for streaming (compressed) samples with Sample::Read().
static void DestroyDecompressionBuffer (buffer_t &DecompressionBuffer)
 Free decompression buffer, previously created with CreateDecompressionBuffer().

Public Attributes

uint16_t SampleGroup
uint32_t Manufacturer
 Specifies the MIDI Manufacturer's Association (MMA) Manufacturer code for the sampler intended to receive this file's waveform. If no particular manufacturer is to be specified, a value of 0 should be used.
uint32_t Product
 Specifies the MIDI model ID defined by the manufacturer corresponding to the Manufacturer field. If no particular manufacturer's product is to be specified, a value of 0 should be used.
uint32_t SamplePeriod
 Specifies the duration of time that passes during the playback of one sample in nanoseconds (normally equal to 1 / Samplers Per Second, where Samples Per Second is the value found in the format chunk).
uint32_t MIDIUnityNote
 Specifies the musical note at which the sample will be played at it's original sample rate.
uint32_t FineTune
 Specifies the fraction of a semitone up from the specified MIDI unity note field. A value of 0x80000000 means 1/2 semitone (50 cents) and a value of 0x00000000 means no fine tuning between semitones.
smpte_format_t SMPTEFormat
 Specifies the Society of Motion Pictures and Television E time format used in the following SMPTEOffset field. If a value of 0 is set, SMPTEOffset should also be set to 0.
uint32_t SMPTEOffset
 The SMPTE Offset value specifies the time offset to be used for the synchronization / calibration to the first sample in the waveform. This value uses a format of 0xhhmmssff where hh is a signed value that specifies the number of hours (-23 to 23), mm is an unsigned value that specifies the number of minutes (0 to 59), ss is an unsigned value that specifies the number of seconds (0 to 59) and ff is an unsigned value that specifies the number of frames (0 to -1).
uint32_t Loops
 Number of defined sample loops (so far only seen single loops in gig files - please report me if you encounter more!).
uint32_t LoopID
 Specifies the unique ID that corresponds to one of the defined cue points in the cue point list (only if Loops > 0), as the Gigasampler format only allows one loop definition at the moment, this attribute isn't really useful for anything.
loop_type_t LoopType
 The type field defines how the waveform samples will be looped (only if Loops > 0).
uint32_t LoopStart
 The start value specifies the offset (in sample points) in the waveform data of the first sample to be played in the loop (only if Loops > 0).
uint32_t LoopEnd
 The end value specifies the offset (in sample points) in the waveform data which represents the end of the loop (only if Loops > 0).
uint32_t LoopSize
 Length of the looping area (in sample points) which is equivalent to LoopEnd - LoopStart.
uint32_t LoopFraction
 The fractional value specifies a fraction of a sample at which to loop (only if Loops > 0). This allows a loop to be fine tuned at a resolution greater than one sample. A value of 0 means no fraction, a value of 0x80000000 means 1/2 of a sample length. 0xFFFFFFFF is the smallest fraction of a sample that can be represented.
uint32_t LoopPlayCount
 Number of times the loop should be played (only if Loops > 0, a value of 0 = infinite).
bool Compressed
 If the sample wave is compressed (probably just interesting for instrument and sample editors, as this library already handles the decompression in it's sample access methods anyway).
uint32_t TruncatedBits
 For 24-bit compressed samples only: number of bits truncated during compression (0, 4 or 6).
bool Dithered
 For 24-bit compressed samples only: if dithering was used during compression with bit reduction.
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, unsigned long fileNo=0)
 ~Sample ()
void SwapMemoryArea (void *pData, unsigned long AreaSize, uint WordSize)
 Swaps the order of the data words in the given memory area with a granularity given by WordSize.
long Min (long A, long B)
long Abs (long val)
unsigned long GuessSize (unsigned long samples)
unsigned long WorstCaseMaxSamples (buffer_t *pDecompressionBuffer)

Protected Attributes

unsigned long FrameOffset
 Current offset (sample points) in current sample frame (for decompression only).
unsigned long * FrameTable
 For positioning within compressed samples only: stores the offset values for each frame.
unsigned long SamplePos
 For compressed samples only: stores the current position (in sample points).
unsigned long SamplesInLastFrame
 For compressed samples only: length of the last sample frame.
unsigned long WorstCaseFrameSize
 For compressed samples only: size (in bytes) of the largest possible sample frame.
unsigned long SamplesPerFrame
 For compressed samples only: number of samples in a full sample frame.
buffer_t RAMCache
 Buffers samples (already uncompressed) in RAM.
unsigned long FileNo
 File number (> 0 when sample is stored in an extension file, 0 when it's in the gig).
RIFF::ChunkpCkData
RIFF::ChunkpCkFormat
unsigned long ulWavePoolOffset
Resource * pParent

Static Protected Attributes

static unsigned int Instances = 0
 Number of instances of class Sample.
static buffer_t InternalDecompressionBuffer
 Buffer used for decompression as well as for truncation of 24 Bit -> 16 Bit samples.

Friends

class File
class Region

Detailed Description

Encapsulates sample waves used for playback.

Definition at line 497 of file gig.h.


Constructor & Destructor Documentation

gig::Sample::Sample File pFile,
RIFF::List waveList,
unsigned long  WavePoolOffset,
unsigned long  fileNo = 0
[protected]
 

Definition at line 235 of file gig.cpp.

References DLS::Sample::BitDepth, DLS::Sample::Channels, CHUNK_ID_3GIX, CHUNK_ID_EWAV, CHUNK_ID_SMPL, Compressed, Dithered, FileNo, FineTune, FrameOffset, FrameTable, RIFF::List::GetSubChunk(), INITIAL_SAMPLE_BUFFER_SIZE, Instances, InternalDecompressionBuffer, LoopEnd, LoopFraction, LoopID, LoopPlayCount, Loops, LoopSize, LoopStart, LoopType, Manufacturer, MIDIUnityNote, gig::buffer_t::NullExtensionSize, Product, gig::buffer_t::pStart, RAMCache, RIFF::Chunk::Read(), RIFF::Chunk::ReadInt16(), RIFF::Chunk::ReadInt32(), SampleGroup, SamplePeriod, SamplePos, RIFF::Chunk::SetPos(), gig::buffer_t::Size, SMPTEFormat, SMPTEOffset, and TruncatedBits.

gig::Sample::~Sample  )  [protected]
 

Definition at line 978 of file gig.cpp.

References FrameTable, Instances, InternalDecompressionBuffer, gig::buffer_t::pStart, RAMCache, and gig::buffer_t::Size.


Member Function Documentation

long gig::Sample::Abs long  val  )  [inline, protected]
 

Definition at line 607 of file gig.h.

Referenced by ReadAndLoop().

buffer_t gig::Sample::CreateDecompressionBuffer unsigned long  MaxReadSize  )  [static]
 

Allocates a decompression buffer for streaming (compressed) samples with Sample::Read().

If you are using more than one streaming thread in your application you HAVE to create a decompression buffer for EACH of your streaming threads and provide it with the Sample::Read() call in order to avoid race conditions and crashes.

You should free the memory occupied by the allocated buffer(s) once you don't need one of your streaming threads anymore by calling DestroyDecompressionBuffer().

Parameters:
MaxReadSize - the maximum size (in sample points) you ever expect to read with one Read() call
Returns:
allocated decompression buffer
See also:
DestroyDecompressionBuffer()

Definition at line 952 of file gig.cpp.

References gig::buffer_t::NullExtensionSize, gig::buffer_t::pStart, and gig::buffer_t::Size.

void gig::Sample::DestroyDecompressionBuffer buffer_t DecompressionBuffer  )  [static]
 

Free decompression buffer, previously created with CreateDecompressionBuffer().

Parameters:
DecompressionBuffer - previously allocated decompression buffer to free

Definition at line 969 of file gig.cpp.

References gig::buffer_t::NullExtensionSize, gig::buffer_t::pStart, and gig::buffer_t::Size.

buffer_t gig::Sample::GetCache  ) 
 

Returns current cached sample points.

A buffer_t structure will be returned which contains address pointer to the begin of the cache and the size of the cached sample data in bytes. Use LoadSampleData() to cache a specific amount of sample points in RAM.

Returns:
buffer_t structure with current cached sample points
See also:
LoadSampleData();

Definition at line 472 of file gig.cpp.

References gig::buffer_t::NullExtensionSize, gig::buffer_t::pStart, RAMCache, and gig::buffer_t::Size.

Referenced by LoadSampleDataWithNullSamplesExtension().

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

unsigned long gig::Sample::GetPos  ) 
 

Returns the current position in the sample (in sample points).

Definition at line 548 of file gig.cpp.

References Compressed, DLS::Sample::FrameSize, RIFF::Chunk::GetPos(), DLS::Sample::pCkData, and SamplePos.

Referenced by ReadAndLoop().

unsigned long gig::Sample::GuessSize unsigned long  samples  )  [inline, protected]
 

Definition at line 610 of file gig.h.

References DLS::Sample::BitDepth, DLS::Sample::Channels, and WorstCaseFrameSize.

Referenced by Read().

buffer_t gig::Sample::LoadSampleData unsigned long  SampleCount  ) 
 

Reads (uncompresses if needed) and caches the first SampleCount numbers of SamplePoints in RAM.

Use ReleaseSampleData() to free the memory space if you don't need the cached samples anymore. There is no guarantee that exactly SampleCount samples will be cached; this is not an error. The size will be eventually truncated e.g. to the beginning of a frame of a compressed sample. This is done for efficiency reasons while streaming the wave by your sampler engine later. Read the Size member of the buffer_t structure that will be returned to determine the actual cached samples, but note that the size is given in bytes! You get the number of actually cached samples by dividing it by the frame size of the sample:

        buffer_t buf       = pSample->LoadSampleData(acquired_samples);
        long cachedsamples = buf.Size / pSample->FrameSize;

Parameters:
SampleCount - number of sample points to load into RAM
Returns:
buffer_t structure with start address and size of the cached sample data in bytes
See also:
ReleaseSampleData(), Read(), SetPos()

Definition at line 391 of file gig.cpp.

References LoadSampleDataWithNullSamplesExtension().

buffer_t gig::Sample::LoadSampleData  ) 
 

Loads (and uncompresses if needed) the whole sample wave into RAM.

Use ReleaseSampleData() to free the memory if you don't need the cached sample data anymore.

Returns:
buffer_t structure with start address and size of the buffer in bytes
See also:
ReleaseSampleData(), Read(), SetPos()

Reimplemented from DLS::Sample.

Definition at line 365 of file gig.cpp.

References LoadSampleDataWithNullSamplesExtension().

Referenced by ExtractSamples().

buffer_t gig::Sample::LoadSampleDataWithNullSamplesExtension unsigned long  SampleCount,
uint  NullSamplesCount
 

Reads (uncompresses if needed) and caches the first SampleCount numbers of SamplePoints in RAM.

Use ReleaseSampleData() to free the memory space if you don't need the cached samples anymore. There is no guarantee that exactly SampleCount samples will be cached; this is not an error. The size will be eventually truncated e.g. to the beginning of a frame of a compressed sample. This is done for efficiency reasons while streaming the wave by your sampler engine later. Read the Size member of the buffer_t structure that will be returned to determine the actual cached samples, but note that the size is given in bytes! You get the number of actually cached samples by dividing it by the frame size of the sample:

        buffer_t buf       = pSample->LoadSampleDataWithNullSamplesExtension(acquired_samples, null_samples);
        long cachedsamples = buf.Size / pSample->FrameSize;
The method will add NullSamplesCount silence samples past the official buffer end (this won't affect the 'Size' member of the buffer_t structure, that means 'Size' always reflects the size of the actual sample data, the buffer might be bigger though). Silence samples past the official buffer are needed for differential algorithms that always have to take subsequent samples into account (resampling/interpolation would be an important example) and avoids memory access faults in such cases.

Parameters:
SampleCount - number of sample points to load into RAM
NullSamplesCount - number of silence samples the buffer should be extended past it's data end
Returns:
buffer_t structure with start address and size of the cached sample data in bytes
See also:
ReleaseSampleData(), Read(), SetPos()

Definition at line 450 of file gig.cpp.

References DLS::Sample::FrameSize, GetCache(), gig::buffer_t::NullExtensionSize, gig::buffer_t::pStart, RAMCache, Read(), DLS::Sample::SamplesTotal, and gig::buffer_t::Size.

buffer_t gig::Sample::LoadSampleDataWithNullSamplesExtension uint  NullSamplesCount  ) 
 

Loads (and uncompresses if needed) the whole sample wave into RAM.

Use ReleaseSampleData() to free the memory if you don't need the cached sample data anymore. The method will add NullSamplesCount silence samples past the official buffer end (this won't affect the 'Size' member of the buffer_t structure, that means 'Size' always reflects the size of the actual sample data, the buffer might be bigger though). Silence samples past the official buffer are needed for differential algorithms that always have to take subsequent samples into account (resampling/interpolation would be an important example) and avoids memory access faults in such cases.

Parameters:
NullSamplesCount - number of silence samples the buffer should be extended past it's data end
Returns:
buffer_t structure with start address and size of the buffer in bytes
See also:
ReleaseSampleData(), Read(), SetPos()

Definition at line 414 of file gig.cpp.

Referenced by LoadSampleData().

long gig::Sample::Min long  A,
long  B
[inline, protected]
 

Definition at line 604 of file gig.h.

Referenced by ReadAndLoop().

unsigned long DLS::Sample::Read void *  pBuffer,
unsigned long  SampleCount
[inherited]
 

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 DLS::Sample::FormatTag, DLS::Sample::FrameSize, DLS::Sample::pCkData, RIFF::Chunk::Read(), and WAVE_FORMAT_PCM.

unsigned long gig::Sample::Read void *  pBuffer,
unsigned long  SampleCount,
buffer_t pExternalDecompressionBuffer = NULL
 

Reads SampleCount number of sample points from the current position into the buffer pointed by pBuffer and increments the position within the sample.

The sample wave stream will be decompressed on the fly if using a compressed sample. Use this method and SetPos() if you don't want to load the sample into RAM, thus for disk streaming.

Caution: If you are using more than one streaming thread, you have to use an external decompression buffer for EACH streaming thread to avoid race conditions and crashes!

Parameters:
pBuffer destination buffer
SampleCount number of sample points to read
pExternalDecompressionBuffer (optional) external buffer to use for decompression
Returns:
number of successfully read sample points
See also:
SetPos(), CreateDecompressionBuffer()

Definition at line 750 of file gig.cpp.

References DLS::Sample::BitDepth, gig::bitsPerSample, gig::bytesPerFrameNoHdr, Compressed, gig::Decompress16(), gig::Decompress24(), FrameOffset, gig::get16(), GuessSize(), InternalDecompressionBuffer, DLS::Sample::pCkData, gig::buffer_t::pStart, RIFF::Chunk::Read(), RIFF::Chunk::RemainingBytes(), SamplePos, SamplesInLastFrame, SamplesPerFrame, DLS::Sample::SamplesTotal, RIFF::Chunk::SetPos(), gig::buffer_t::Size, RIFF::stream_backward, RIFF::stream_ready, TruncatedBits, and WorstCaseMaxSamples().

Referenced by ExtractSamples(), LoadSampleDataWithNullSamplesExtension(), and ReadAndLoop().

unsigned long gig::Sample::ReadAndLoop void *  pBuffer,
unsigned long  SampleCount,
playback_state_t pPlaybackState,
buffer_t pExternalDecompressionBuffer = NULL
 

Reads SampleCount number of sample points from the position stored in pPlaybackState into the buffer pointed by pBuffer and moves the position within the sample respectively, this method honors the looping informations of the sample (if any).

The sample wave stream will be decompressed on the fly if using a compressed sample. Use this method if you don't want to load the sample into RAM, thus for disk streaming. All this methods needs to know to proceed with streaming for the next time you call this method is stored in pPlaybackState. You have to allocate and initialize the playback_state_t structure by yourself before you use it to stream a sample:

 gig::playback_state_t playbackstate;
 playbackstate.position         = 0;
 playbackstate.reverse          = false;
 playbackstate.loop_cycles_left = pSample->LoopPlayCount;
You don't have to take care of things like if there is actually a loop defined or if the current read position is located within a loop area. The method already handles such cases by itself.

Caution: If you are using more than one streaming thread, you have to use an external decompression buffer for EACH streaming thread to avoid race conditions and crashes!

Parameters:
pBuffer destination buffer
SampleCount number of sample points to read
pPlaybackState will be used to store and reload the playback state for the next ReadAndLoop() call
pExternalDecompressionBuffer (optional) external buffer to use for decompression
Returns:
number of successfully read sample points
See also:
CreateDecompressionBuffer()

Definition at line 586 of file gig.cpp.

References Abs(), GetPos(), gig::playback_state_t::loop_cycles_left, gig::loop_type_backward, gig::loop_type_bidirectional, gig::loop_type_normal, LoopEnd, LoopPlayCount, LoopSize, LoopStart, Min(), gig::playback_state_t::position, Read(), gig::playback_state_t::reverse, SetPos(), and SwapMemoryArea().

void gig::Sample::ReleaseSampleData  ) 
 

Frees the cached sample from RAM if loaded with LoadSampleData() previously.

See also:
LoadSampleData();

Reimplemented from DLS::Sample.

Definition at line 487 of file gig.cpp.

References gig::buffer_t::pStart, RAMCache, and gig::buffer_t::Size.

Referenced by ExtractSamples().

unsigned long gig::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.

Although the original Gigasampler engine doesn't allow positioning within compressed samples, I decided to implement it. Even though the Gigasampler format doesn't allow to define loops for compressed samples at the moment, positioning within compressed samples might be interesting for some sampler engines though. The only drawback about my decision is that it takes longer to load compressed gig Files on startup, because it's neccessary to scan the samples for some mandatory informations. But I think as it doesn't affect the runtime efficiency, nobody will have a problem with that.

Parameters:
SampleCount number of sample points to jump
Whence optional: to which relation SampleCount refers to, if omited RIFF::stream_start is assumed
Returns:
the new sample position
See also:
Read()

Reimplemented from DLS::Sample.

Definition at line 514 of file gig.cpp.

References Compressed, FrameOffset, DLS::Sample::FrameSize, FrameTable, DLS::Sample::pCkData, SamplePos, DLS::Sample::SamplesTotal, RIFF::Chunk::SetPos(), RIFF::stream_backward, RIFF::stream_curpos, RIFF::stream_end, and RIFF::stream_start.

Referenced by ReadAndLoop().

void gig::Sample::SwapMemoryArea void *  pData,
unsigned long  AreaSize,
uint  WordSize
[inline, protected]
 

Swaps the order of the data words in the given memory area with a granularity given by WordSize.

Parameters:
pData - pointer to the memory area to be swapped
AreaSize - size of the memory area to be swapped (in bytes)
WordSize - size of the data words (in bytes)

Definition at line 556 of file gig.h.

Referenced by ReadAndLoop().

unsigned long gig::Sample::WorstCaseMaxSamples buffer_t pDecompressionBuffer  )  [inline, protected]
 

Definition at line 627 of file gig.h.

References SamplesPerFrame, gig::buffer_t::Size, and WorstCaseFrameSize.

Referenced by Read().


Friends And Related Function Documentation

friend class File [friend]
 

Reimplemented from DLS::Sample.

Definition at line 632 of file gig.h.

friend class Region [friend]
 

Reimplemented from DLS::Sample.

Definition at line 633 of file gig.h.


Member Data Documentation

uint32_t DLS::Sample::AverageBytesPerSecond [inherited]
 

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

uint16_t DLS::Sample::BitDepth [inherited]
 

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

uint16_t DLS::Sample::BlockAlign [inherited]
 

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

uint16_t DLS::Sample::Channels [inherited]
 

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

bool gig::Sample::Compressed
 

If the sample wave is compressed (probably just interesting for instrument and sample editors, as this library already handles the decompression in it's sample access methods anyway).

Definition at line 515 of file gig.h.

Referenced by ExtractSamples(), GetPos(), PrintSamples(), Read(), Sample(), and SetPos().

bool gig::Sample::Dithered
 

For 24-bit compressed samples only: if dithering was used during compression with bit reduction.

Definition at line 517 of file gig.h.

Referenced by Sample().

unsigned long gig::Sample::FileNo [protected]
 

File number (> 0 when sample is stored in an extension file, 0 when it's in the gig).

Definition at line 544 of file gig.h.

Referenced by gig::Region::GetSampleFromWavePool(), and Sample().

uint32_t gig::Sample::FineTune
 

Specifies the fraction of a semitone up from the specified MIDI unity note field. A value of 0x80000000 means 1/2 semitone (50 cents) and a value of 0x00000000 means no fine tuning between semitones.

Definition at line 504 of file gig.h.

Referenced by Sample().

uint16_t DLS::Sample::FormatTag [inherited]
 

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

unsigned long gig::Sample::FrameOffset [protected]
 

Current offset (sample points) in current sample frame (for decompression only).

Definition at line 537 of file gig.h.

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

uint DLS::Sample::FrameSize [inherited]
 

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(), GetPos(), LoadSampleDataWithNullSamplesExtension(), DLS::Sample::Read(), DLS::Sample::Sample(), SetPos(), and DLS::Sample::SetPos().

unsigned long* gig::Sample::FrameTable [protected]
 

For positioning within compressed samples only: stores the offset values for each frame.

Definition at line 538 of file gig.h.

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

unsigned int gig::Sample::Instances = 0 [static, protected]
 

Number of instances of class Sample.

Definition at line 535 of file gig.h.

Referenced by Sample(), and ~Sample().

buffer_t gig::Sample::InternalDecompressionBuffer [static, protected]
 

Buffer used for decompression as well as for truncation of 24 Bit -> 16 Bit samples.

Definition at line 536 of file gig.h.

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

uint32_t gig::Sample::LoopEnd
 

The end value specifies the offset (in sample points) in the waveform data which represents the end of the loop (only if Loops > 0).

Definition at line 511 of file gig.h.

Referenced by PrintSamples(), ReadAndLoop(), and Sample().

uint32_t gig::Sample::LoopFraction
 

The fractional value specifies a fraction of a sample at which to loop (only if Loops > 0). This allows a loop to be fine tuned at a resolution greater than one sample. A value of 0 means no fraction, a value of 0x80000000 means 1/2 of a sample length. 0xFFFFFFFF is the smallest fraction of a sample that can be represented.

Definition at line 513 of file gig.h.

Referenced by PrintSamples(), and Sample().

uint32_t gig::Sample::LoopID
 

Specifies the unique ID that corresponds to one of the defined cue points in the cue point list (only if Loops > 0), as the Gigasampler format only allows one loop definition at the moment, this attribute isn't really useful for anything.

Definition at line 508 of file gig.h.

Referenced by Sample().

uint32_t gig::Sample::LoopPlayCount
 

Number of times the loop should be played (only if Loops > 0, a value of 0 = infinite).

Definition at line 514 of file gig.h.

Referenced by PrintSamples(), ReadAndLoop(), and Sample().

uint32_t gig::Sample::Loops
 

Number of defined sample loops (so far only seen single loops in gig files - please report me if you encounter more!).

Definition at line 507 of file gig.h.

Referenced by PrintSamples(), and Sample().

uint32_t gig::Sample::LoopSize
 

Length of the looping area (in sample points) which is equivalent to LoopEnd - LoopStart.

Definition at line 512 of file gig.h.

Referenced by ReadAndLoop(), and Sample().

uint32_t gig::Sample::LoopStart
 

The start value specifies the offset (in sample points) in the waveform data of the first sample to be played in the loop (only if Loops > 0).

Definition at line 510 of file gig.h.

Referenced by PrintSamples(), ReadAndLoop(), and Sample().

loop_type_t gig::Sample::LoopType
 

The type field defines how the waveform samples will be looped (only if Loops > 0).

Definition at line 509 of file gig.h.

Referenced by PrintSamples(), and Sample().

uint32_t gig::Sample::Manufacturer
 

Specifies the MIDI Manufacturer's Association (MMA) Manufacturer code for the sampler intended to receive this file's waveform. If no particular manufacturer is to be specified, a value of 0 should be used.

Definition at line 500 of file gig.h.

Referenced by Sample().

uint32_t gig::Sample::MIDIUnityNote
 

Specifies the musical note at which the sample will be played at it's original sample rate.

Definition at line 503 of file gig.h.

Referenced by Sample().

RIFF::Chunk* DLS::Sample::pCkData [protected, inherited]
 

Definition at line 391 of file DLS.h.

Referenced by GetPos(), DLS::Sample::LoadSampleData(), Read(), DLS::Sample::Read(), DLS::Sample::ReleaseSampleData(), DLS::Sample::Sample(), SetPos(), and DLS::Sample::SetPos().

RIFF::Chunk* DLS::Sample::pCkFormat [protected, inherited]
 

Definition at line 392 of file DLS.h.

Referenced by DLS::Sample::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 gig::Sample::Product
 

Specifies the MIDI model ID defined by the manufacturer corresponding to the Manufacturer field. If no particular manufacturer's product is to be specified, a value of 0 should be used.

Definition at line 501 of file gig.h.

Referenced by Sample().

buffer_t gig::Sample::RAMCache [protected]
 

Buffers samples (already uncompressed) in RAM.

Definition at line 543 of file gig.h.

Referenced by GetCache(), LoadSampleDataWithNullSamplesExtension(), ReleaseSampleData(), Sample(), and ~Sample().

uint16_t gig::Sample::SampleGroup
 

Definition at line 499 of file gig.h.

Referenced by Sample().

uint32_t gig::Sample::SamplePeriod
 

Specifies the duration of time that passes during the playback of one sample in nanoseconds (normally equal to 1 / Samplers Per Second, where Samples Per Second is the value found in the format chunk).

Definition at line 502 of file gig.h.

Referenced by Sample().

unsigned long gig::Sample::SamplePos [protected]
 

For compressed samples only: stores the current position (in sample points).

Definition at line 539 of file gig.h.

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

unsigned long gig::Sample::SamplesInLastFrame [protected]
 

For compressed samples only: length of the last sample frame.

Definition at line 540 of file gig.h.

Referenced by Read().

unsigned long gig::Sample::SamplesPerFrame [protected]
 

For compressed samples only: number of samples in a full sample frame.

Definition at line 542 of file gig.h.

Referenced by Read(), and WorstCaseMaxSamples().

uint32_t DLS::Sample::SamplesPerSecond [inherited]
 

Sampling rate at which each channel should be played.

Definition at line 379 of file DLS.h.

Referenced by ExtractSamples(), PrintDimensionRegions(), PrintRegions(), PrintSamples(), and DLS::Sample::Sample().

unsigned long DLS::Sample::SamplesTotal [inherited]
 

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(), LoadSampleDataWithNullSamplesExtension(), PrintSamples(), Read(), DLS::Sample::Sample(), and SetPos().

smpte_format_t gig::Sample::SMPTEFormat
 

Specifies the Society of Motion Pictures and Television E time format used in the following SMPTEOffset field. If a value of 0 is set, SMPTEOffset should also be set to 0.

Definition at line 505 of file gig.h.

Referenced by Sample().

uint32_t gig::Sample::SMPTEOffset
 

The SMPTE Offset value specifies the time offset to be used for the synchronization / calibration to the first sample in the waveform. This value uses a format of 0xhhmmssff where hh is a signed value that specifies the number of hours (-23 to 23), mm is an unsigned value that specifies the number of minutes (0 to 59), ss is an unsigned value that specifies the number of seconds (0 to 59) and ff is an unsigned value that specifies the number of frames (0 to -1).

Definition at line 506 of file gig.h.

Referenced by Sample().

uint32_t gig::Sample::TruncatedBits
 

For 24-bit compressed samples only: number of bits truncated during compression (0, 4 or 6).

Definition at line 516 of file gig.h.

Referenced by Read(), and Sample().

unsigned long DLS::Sample::ulWavePoolOffset [protected, inherited]
 

Definition at line 393 of file DLS.h.

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

unsigned long gig::Sample::WorstCaseFrameSize [protected]
 

For compressed samples only: size (in bytes) of the largest possible sample frame.

Definition at line 541 of file gig.h.

Referenced by GuessSize(), and WorstCaseMaxSamples().


The documentation for this class was generated from the following files:
Generated on Wed Nov 23 15:53:45 2005 for libgig by  doxygen 1.4.5