gig::Region Class Reference

Defines Region information of an Instrument. More...

#include <gig.h>

Inheritance diagram for gig::Region:

DLS::Region DLS::Resource DLS::Articulator DLS::Sampler List of all members.

Public Member Functions

DimensionRegionGetDimensionRegionByValue (const uint DimValues[8])
 Use this method in your audio engine to get the appropriate dimension region with it's articulation data for the current situation.
DimensionRegionGetDimensionRegionByBit (const uint8_t DimBits[8])
 Returns the appropriate DimensionRegion for the given dimension bit numbers (zone index).
SampleGetSample ()
 Returns pointer address to the Sample referenced with this region.
void AddDimension (dimension_def_t *pDimDef)
 Einstein would have dreamed of it - create a new dimension.
void DeleteDimension (dimension_def_t *pDimDef)
 Delete an existing dimension.
virtual void SetKeyRange (uint16_t Low, uint16_t High)
 Modifies the key range of this Region and makes sure the respective chunks are in correct order.
virtual void UpdateChunks ()
 Apply Region settings and all its DimensionRegions to the respective RIFF chunks.
void SetSample (Sample *pSample)
 Assign another sample to this Region.
Resource * GetParent ()
void GenerateDLSID ()
 Generates a new DLSID for the resource.
Articulation * GetFirstArticulation ()
Articulation * GetNextArticulation ()
void AddSampleLoop (sample_loop_t *pLoopDef)
 Adds a new sample loop with the provided loop definition.
void DeleteSampleLoop (sample_loop_t *pLoopDef)
 Deletes an existing sample loop.
virtual void SetGain (int32_t gain)

Public Attributes

unsigned int Dimensions
 Number of defined dimensions, do not alter!
dimension_def_t pDimensionDefinitions [8]
 Defines the five (gig2) or eight (gig3) possible dimensions (the dimension's controller and number of bits/splits). Use AddDimension() and DeleteDimension() to create a new dimension or delete an existing one.
uint32_t DimensionRegions
 Total number of DimensionRegions this Region contains, do not alter!
DimensionRegionpDimensionRegions [256]
 Pointer array to the 32 (gig2) or 256 (gig3) possible dimension regions (reflects NULL for dimension regions not in use). Avoid to access the array directly and better use GetDimensionRegionByValue() instead, but of course in some cases it makes sense to use the array (e.g. iterating through all DimensionRegions). Use AddDimension() and DeleteDimension() to create a new dimension or delete an existing one (which will create or delete the respective dimension region(s) automatically).
unsigned int Layers
 Amount of defined layers (1 - 32). A value of 1 actually means no layering, a value > 1 means there is Layer dimension. The same information can of course also be obtained by accessing pDimensionDefinitions. Do not alter this value!
range_t KeyRange
range_t VelocityRange
uint16_t KeyGroup
uint16_t Layer
bool SelfNonExclusive
bool PhaseMaster
uint16_t PhaseGroup
bool MultiChannel
uint32_t Channel
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.
uint8_t UnityNote
int16_t FineTune
int32_t Gain
bool NoSampleDepthTruncation
bool NoSampleCompression
uint32_t SampleLoops
 Reflects the number of sample loops.
sample_loop_t * pSampleLoops
 Points to the beginning of a sample loop array, or is NULL if there are no loops defined.

Protected Types

typedef std::list< Articulation * > ArticulationList

Protected Member Functions

 Region (Instrument *pInstrument, RIFF::List *rgnList)
void LoadDimensionRegions (RIFF::List *rgn)
void UpdateVelocityTable ()
SampleGetSampleFromWavePool (unsigned int WavePoolTableIndex, progress_t *pProgress=NULL)
 ~Region ()
 Destructor.
void LoadArticulations ()

Protected Attributes

RIFF::ListpCkRegion
uint32_t WavePoolTableIndex
SamplepSample
uint16_t FormatOptionFlags
uint16_t WaveLinkOptionFlags
Resource * pParent
RIFF::ListpResourceList
RIFF::ListpParentList
RIFF::ListpParentList
ArticulationListpArticulations
ArticulationList::iterator ArticulationsIterator
uint32_t uiHeaderSize
uint32_t SamplerOptions

Friends

class Instrument

Detailed Description

Defines Region information of an Instrument.

Definition at line 616 of file gig.h.


Member Typedef Documentation

typedef std::list<Articulation*> DLS::Articulator::ArticulationList [protected, inherited]
 

Definition at line 290 of file DLS.h.


Constructor & Destructor Documentation

gig::Region::Region Instrument pInstrument,
RIFF::List rgnList
[protected]
 

Definition at line 2363 of file gig.cpp.

References Dimensions, and pDimensionRegions.

gig::Region::~Region  )  [protected, virtual]
 

Destructor.

Removes RIFF chunks associated with this Region.

Reimplemented from DLS::Region.

Definition at line 2801 of file gig.cpp.

References pDimensionRegions.


Member Function Documentation

void gig::Region::AddDimension dimension_def_t pDimDef  ) 
 

Einstein would have dreamed of it - create a new dimension.

Creates a new dimension with the dimension definition given by pDimDef. The appropriate amount of DimensionRegions will be created. There is a hard limit of dimensions and total amount of "bits" all dimensions can have. This limit is dependant to what gig file format version this file refers to. The gig v2 (and lower) format has a dimension limit and total amount of bits limit of 5, whereas the gig v3 format has a limit of 8.

Parameters:
pDimDef - defintion of the new dimension
Exceptions:
gig::Exception if dimension of the same type exists already
gig::Exception if amount of dimensions or total amount of dimension bits limit is violated

Definition at line 2625 of file gig.cpp.

References gig::dimension_def_t::bits, gig::dimension_def_t::dimension, gig::dimension_samplechannel, DLS::Resource::GetParent(), pDimensionDefinitions, pDimensionRegions, and DLS::File::pVersion.

void DLS::Sampler::AddSampleLoop sample_loop_t pLoopDef  )  [inherited]
 

Adds a new sample loop with the provided loop definition.

Parameters:
pLoopDef - points to a loop definition that is to be copied

Definition at line 575 of file DLS.cpp.

References DLS::Sampler::pSampleLoops, and DLS::Sampler::SampleLoops.

void gig::Region::DeleteDimension dimension_def_t pDimDef  ) 
 

Delete an existing dimension.

Deletes the dimension given by pDimDef and deletes all respective dimension regions, that is all dimension regions where the dimension's bit(s) part is greater than 0. In case of a 'sustain pedal' dimension for example this would delete all dimension regions for the case(s) where the sustain pedal is pressed down.

Parameters:
pDimDef - dimension to delete
Exceptions:
gig::Exception if given dimension cannot be found

Definition at line 2725 of file gig.cpp.

References Dimensions, and pDimensionDefinitions.

void DLS::Sampler::DeleteSampleLoop sample_loop_t pLoopDef  )  [inherited]
 

Deletes an existing sample loop.

Parameters:
pLoopDef - pointer to existing loop definition
Exceptions:
Exception - if given loop definition does not exist

Definition at line 597 of file DLS.cpp.

References DLS::Sampler::pSampleLoops, and DLS::Sampler::SampleLoops.

void DLS::Resource::GenerateDLSID  )  [inherited]
 

Generates a new DLSID for the resource.

Definition at line 449 of file DLS.cpp.

References DLS::dlsid_t::abData, DLS::Resource::pDLSID, DLS::dlsid_t::ulData1, DLS::dlsid_t::usData2, and DLS::dlsid_t::usData3.

Referenced by gig::File::AddInstrument(), and gig::File::File().

DimensionRegion * gig::Region::GetDimensionRegionByBit const uint8_t  DimBits[8]  ) 
 

Returns the appropriate DimensionRegion for the given dimension bit numbers (zone index).

You usually use GetDimensionRegionByValue instead of calling this method directly!

Parameters:
DimBits Bit numbers for dimension 0 to 7
Returns:
adress to the DimensionRegion for the given dimension bit numbers
See also:
GetDimensionRegionByValue()

Definition at line 2882 of file gig.cpp.

References gig::dimension_def_t::bits, pDimensionDefinitions, and pDimensionRegions.

DimensionRegion * gig::Region::GetDimensionRegionByValue const uint  DimValues[8]  ) 
 

Use this method in your audio engine to get the appropriate dimension region with it's articulation data for the current situation.

Just call the method with the current MIDI controller values and you'll get the DimensionRegion with the appropriate articulation data for the current situation (for this Region of course only). To do that you'll first have to look which dimensions with which controllers and in which order are defined for this Region when you load the .gig file. Special cases are e.g. layer or channel dimensions where you just put in the index numbers instead of a MIDI controller value (means 0 for left channel, 1 for right channel or 0 for layer 0, 1 for layer 1, etc.).

Parameters:
DimValues MIDI controller values (0-127) for dimension 0 to 7
Returns:
adress to the DimensionRegion for the given situation
See also:
pDimensionDefinitions

Dimensions

Definition at line 2825 of file gig.cpp.

References gig::dimension_velocity, and pDimensionDefinitions.

Articulation * DLS::Articulator::GetFirstArticulation  )  [inherited]
 

Definition at line 173 of file DLS.cpp.

References DLS::Articulator::ArticulationsIterator, DLS::Articulator::LoadArticulations(), and DLS::Articulator::pArticulations.

Articulation * DLS::Articulator::GetNextArticulation  )  [inherited]
 

Definition at line 180 of file DLS.cpp.

References DLS::Articulator::ArticulationsIterator, and DLS::Articulator::pArticulations.

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

Definition at line 344 of file DLS.h.

References DLS::Resource::pParent.

Referenced by AddDimension(), DLS::Region::GetSample(), GetSampleFromWavePool(), SetKeyRange(), DLS::Region::SetKeyRange(), gig::Instrument::UpdateChunks(), gig::DimensionRegion::UpdateChunks(), and DLS::Region::UpdateChunks().

Sample * gig::Region::GetSample  ) 
 

Returns pointer address to the Sample referenced with this region.

This is the global Sample for the entire Region (not sure if this is actually used by the Gigasampler engine - I would only use the Sample referenced by the appropriate DimensionRegion instead of this sample).

Returns:
address to Sample or NULL if there is no reference to a sample saved in the .gig file

Reimplemented from DLS::Region.

Definition at line 2901 of file gig.cpp.

References GetSampleFromWavePool(), DLS::Region::pSample, and DLS::Region::WavePoolTableIndex.

Sample * gig::Region::GetSampleFromWavePool unsigned int  WavePoolTableIndex,
progress_t pProgress = NULL
[protected]
 

Definition at line 2906 of file gig.cpp.

References gig::Sample::FileNo, gig::File::GetFirstSample(), gig::File::GetNextSample(), DLS::Resource::GetParent(), DLS::File::pWavePoolTable, DLS::File::pWavePoolTableHi, and DLS::Sample::ulWavePoolOffset.

Referenced by GetSample().

void DLS::Articulator::LoadArticulations  )  [protected, inherited]
 

Definition at line 186 of file DLS.cpp.

References CHUNK_ID_ART2, CHUNK_ID_ARTL, RIFF::Chunk::GetChunkID(), RIFF::List::GetFirstSubChunk(), RIFF::List::GetListType(), RIFF::List::GetNextSubChunk(), RIFF::List::GetSubList(), LIST_TYPE_LAR2, LIST_TYPE_LART, DLS::Articulator::pArticulations, and DLS::Articulator::pParentList.

Referenced by DLS::Articulator::GetFirstArticulation().

void gig::Region::LoadDimensionRegions RIFF::List rgn  )  [protected]
 

Definition at line 2517 of file gig.cpp.

References RIFF::List::GetFirstSubList(), RIFF::List::GetListType(), RIFF::List::GetNextSubList(), RIFF::List::GetSubList(), LIST_TYPE_3EWL, LIST_TYPE_3PRG, and pDimensionRegions.

void DLS::Sampler::SetGain int32_t  gain  )  [virtual, inherited]
 

Reimplemented in gig::DimensionRegion.

Definition at line 530 of file DLS.cpp.

References DLS::Sampler::Gain.

Referenced by gig::DimensionRegion::SetGain().

void gig::Region::SetKeyRange uint16_t  Low,
uint16_t  High
[virtual]
 

Modifies the key range of this Region and makes sure the respective chunks are in correct order.

Parameters:
Low - lower end of key range
High - upper end of key range

Reimplemented from DLS::Region.

Definition at line 2533 of file gig.cpp.

References DLS::Resource::GetParent(), and DLS::Region::SetKeyRange().

void DLS::Region::SetSample Sample pSample  )  [inherited]
 

Assign another sample to this Region.

Parameters:
pSample - sample to be assigned

Definition at line 931 of file DLS.cpp.

References DLS::Region::pSample, and DLS::Region::WavePoolTableIndex.

void gig::Region::UpdateChunks  )  [virtual]
 

Apply Region settings and all its DimensionRegions to the respective RIFF chunks.

You have to call File::Save() to make changes persistent.

Usually there is absolutely no need to call this method explicitly. It will be called automatically when File::Save() was called.

Exceptions:
gig::Exception if samples cannot be dereferenced

Reimplemented from DLS::Region.

Definition at line 2452 of file gig.cpp.

References DimensionRegions, pDimensionRegions, gig::DimensionRegion::pSample, DLS::Region::pSample, and DLS::Region::UpdateChunks().

void gig::Region::UpdateVelocityTable  )  [protected]
 

Definition at line 2540 of file gig.cpp.

References gig::dimension_velocity, Dimensions, and pDimensionDefinitions.


Friends And Related Function Documentation

friend class Instrument [friend]
 

Reimplemented from DLS::Region.

Definition at line 639 of file gig.h.


Member Data Documentation

ArticulationList::iterator DLS::Articulator::ArticulationsIterator [protected, inherited]
 

Definition at line 293 of file DLS.h.

Referenced by DLS::Articulator::GetFirstArticulation(), and DLS::Articulator::GetNextArticulation().

uint32_t DLS::Region::Channel [inherited]
 

Definition at line 428 of file DLS.h.

Referenced by DLS::Region::Region().

uint32_t gig::Region::DimensionRegions
 

Total number of DimensionRegions this Region contains, do not alter!

Definition at line 620 of file gig.h.

Referenced by UpdateChunks().

unsigned int gig::Region::Dimensions
 

Number of defined dimensions, do not alter!

Definition at line 618 of file gig.h.

Referenced by DeleteDimension(), Region(), and UpdateVelocityTable().

int16_t DLS::Sampler::FineTune [inherited]
 

Definition at line 359 of file DLS.h.

Referenced by DLS::Sampler::Sampler().

uint16_t DLS::Region::FormatOptionFlags [protected, inherited]
 

Definition at line 438 of file DLS.h.

Referenced by DLS::Region::Region(), and DLS::Region::UpdateChunks().

int32_t DLS::Sampler::Gain [inherited]
 

Deprecated:
Don't alter directly, use SetGain() instead!

Definition at line 360 of file DLS.h.

Referenced by DLS::Sampler::Sampler(), gig::DimensionRegion::SetGain(), and DLS::Sampler::SetGain().

uint16_t DLS::Region::KeyGroup [inherited]
 

Definition at line 422 of file DLS.h.

Referenced by DLS::Region::Region(), and DLS::Region::UpdateChunks().

range_t DLS::Region::KeyRange [inherited]
 

Deprecated:
Only read, don't write! Use SetKeyRange() instead.

Definition at line 420 of file DLS.h.

Referenced by DLS::Region::Region(), DLS::Region::SetKeyRange(), and DLS::Region::UpdateChunks().

uint16_t DLS::Region::Layer [inherited]
 

Definition at line 423 of file DLS.h.

Referenced by DLS::Region::Region(), and DLS::Region::UpdateChunks().

unsigned int gig::Region::Layers
 

Amount of defined layers (1 - 32). A value of 1 actually means no layering, a value > 1 means there is Layer dimension. The same information can of course also be obtained by accessing pDimensionDefinitions. Do not alter this value!

Definition at line 622 of file gig.h.

bool DLS::Region::MultiChannel [inherited]
 

Definition at line 427 of file DLS.h.

Referenced by DLS::Region::Region(), and DLS::Region::UpdateChunks().

bool DLS::Sampler::NoSampleCompression [inherited]
 

Definition at line 362 of file DLS.h.

Referenced by DLS::Sampler::Sampler().

bool DLS::Sampler::NoSampleDepthTruncation [inherited]
 

Definition at line 361 of file DLS.h.

Referenced by DLS::Sampler::Sampler().

ArticulationList* DLS::Articulator::pArticulations [protected, inherited]
 

Definition at line 292 of file DLS.h.

Referenced by DLS::Articulator::Articulator(), DLS::Articulator::GetFirstArticulation(), DLS::Articulator::GetNextArticulation(), DLS::Articulator::LoadArticulations(), DLS::Articulator::UpdateChunks(), and DLS::Articulator::~Articulator().

RIFF::List* DLS::Region::pCkRegion [protected, inherited]
 

Definition at line 435 of file DLS.h.

Referenced by DLS::Region::Region(), DLS::Region::UpdateChunks(), and DLS::Region::~Region().

dimension_def_t gig::Region::pDimensionDefinitions[8]
 

Defines the five (gig2) or eight (gig3) possible dimensions (the dimension's controller and number of bits/splits). Use AddDimension() and DeleteDimension() to create a new dimension or delete an existing one.

Definition at line 619 of file gig.h.

Referenced by AddDimension(), DeleteDimension(), GetDimensionRegionByBit(), GetDimensionRegionByValue(), and UpdateVelocityTable().

DimensionRegion* gig::Region::pDimensionRegions[256]
 

Pointer array to the 32 (gig2) or 256 (gig3) possible dimension regions (reflects NULL for dimension regions not in use). Avoid to access the array directly and better use GetDimensionRegionByValue() instead, but of course in some cases it makes sense to use the array (e.g. iterating through all DimensionRegions). Use AddDimension() and DeleteDimension() to create a new dimension or delete an existing one (which will create or delete the respective dimension region(s) automatically).

Definition at line 621 of file gig.h.

Referenced by AddDimension(), GetDimensionRegionByBit(), LoadDimensionRegions(), Region(), UpdateChunks(), and ~Region().

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 342 of file DLS.h.

Referenced by DLS::Resource::GenerateDLSID(), DLS::Resource::Resource(), DLS::Resource::UpdateChunks(), and DLS::Resource::~Resource().

uint16_t DLS::Region::PhaseGroup [inherited]
 

Definition at line 426 of file DLS.h.

Referenced by DLS::Region::Region().

bool DLS::Region::PhaseMaster [inherited]
 

Definition at line 425 of file DLS.h.

Referenced by DLS::Region::Region(), and DLS::Region::UpdateChunks().

Info* DLS::Resource::pInfo [inherited]
 

Points (in any case) to an Info object, providing additional, optional infos and comments.

Definition at line 341 of file DLS.h.

Referenced by gig::File::AddInstrument(), gig::File::File(), gig::Instrument::Instrument(), DLS::Resource::Resource(), gig::Sample::Sample(), DLS::Resource::UpdateChunks(), and DLS::Resource::~Resource().

Resource* DLS::Resource::pParent [protected, inherited]
 

Definition at line 348 of file DLS.h.

Referenced by DLS::Resource::GetParent(), DLS::Resource::Resource(), gig::Sample::UpdateChunks(), DLS::Instrument::~Instrument(), DLS::Region::~Region(), and DLS::Sample::~Sample().

RIFF::List* DLS::Sampler::pParentList [protected, inherited]
 

Definition at line 371 of file DLS.h.

Referenced by gig::DimensionRegion::DimensionRegion(), DLS::Sampler::Sampler(), gig::DimensionRegion::UpdateChunks(), and DLS::Sampler::UpdateChunks().

RIFF::List* DLS::Articulator::pParentList [protected, inherited]
 

Definition at line 291 of file DLS.h.

Referenced by DLS::Articulator::Articulator(), and DLS::Articulator::LoadArticulations().

RIFF::List* DLS::Resource::pResourceList [protected, inherited]
 

Definition at line 349 of file DLS.h.

Referenced by DLS::Resource::Resource(), and DLS::Resource::UpdateChunks().

Sample* DLS::Region::pSample [protected, inherited]
 

Definition at line 437 of file DLS.h.

Referenced by GetSample(), DLS::Region::GetSample(), DLS::Region::Region(), DLS::Region::SetSample(), UpdateChunks(), and DLS::Region::UpdateChunks().

sample_loop_t* DLS::Sampler::pSampleLoops [inherited]
 

Points to the beginning of a sample loop array, or is NULL if there are no loops defined.

Definition at line 364 of file DLS.h.

Referenced by DLS::Sampler::AddSampleLoop(), DLS::Sampler::DeleteSampleLoop(), gig::DimensionRegion::DimensionRegion(), gig::Sample::ReadAndLoop(), DLS::Sampler::Sampler(), and DLS::Sampler::~Sampler().

uint32_t DLS::Sampler::SampleLoops [inherited]
 

Reflects the number of sample loops.

Definition at line 363 of file DLS.h.

Referenced by DLS::Sampler::AddSampleLoop(), DLS::Sampler::DeleteSampleLoop(), gig::DimensionRegion::DimensionRegion(), gig::Sample::ReadAndLoop(), DLS::Sampler::Sampler(), and DLS::Sampler::UpdateChunks().

uint32_t DLS::Sampler::SamplerOptions [protected, inherited]
 

Definition at line 373 of file DLS.h.

Referenced by gig::DimensionRegion::DimensionRegion(), and DLS::Sampler::Sampler().

bool DLS::Region::SelfNonExclusive [inherited]
 

Definition at line 424 of file DLS.h.

Referenced by DLS::Region::Region(), and DLS::Region::UpdateChunks().

uint32_t DLS::Sampler::uiHeaderSize [protected, inherited]
 

Definition at line 372 of file DLS.h.

Referenced by DLS::Sampler::Sampler(), and DLS::Sampler::UpdateChunks().

uint8_t DLS::Sampler::UnityNote [inherited]
 

Definition at line 358 of file DLS.h.

Referenced by DLS::Sampler::Sampler().

range_t DLS::Region::VelocityRange [inherited]
 

Definition at line 421 of file DLS.h.

Referenced by DLS::Region::Region(), and DLS::Region::UpdateChunks().

uint16_t DLS::Region::WaveLinkOptionFlags [protected, inherited]
 

Definition at line 439 of file DLS.h.

Referenced by DLS::Region::Region(), and DLS::Region::UpdateChunks().

uint32_t DLS::Region::WavePoolTableIndex [protected, inherited]
 

Definition at line 436 of file DLS.h.

Referenced by GetSample(), DLS::Region::GetSample(), DLS::Region::Region(), and DLS::Region::SetSample().


The documentation for this class was generated from the following files:
Generated on Fri Nov 30 19:42:09 2007 for libgig by  doxygen 1.4.6