libgig
3.3.0.svn4
|
Provides all neccessary information for the synthesis of an Instrument. More...
#include <gig.h>
Public Member Functions | |
Region * | GetFirstRegion () |
Returns the first Region of the instrument. More... | |
Region * | GetNextRegion () |
Returns the next Region of the instrument. More... | |
Region * | AddRegion () |
void | DeleteRegion (Region *pRegion) |
virtual void | UpdateChunks () |
Apply Instrument with all its Regions to the respective RIFF chunks. More... | |
virtual void | CopyAssign (const Instrument *orig) |
Make a (semi) deep copy of the Instrument object given by orig and assign it to this object. More... | |
Region * | GetRegion (unsigned int Key) |
Returns the appropriate Region for a triggered note. More... | |
MidiRule * | GetMidiRule (int i) |
Returns a MIDI rule of the instrument. More... | |
MidiRuleCtrlTrigger * | AddMidiRuleCtrlTrigger () |
Adds the "controller trigger" MIDI rule to the instrument. More... | |
MidiRuleLegato * | AddMidiRuleLegato () |
Adds the legato MIDI rule to the instrument. More... | |
MidiRuleAlternator * | AddMidiRuleAlternator () |
Adds the alternator MIDI rule to the instrument. More... | |
void | DeleteMidiRule (int i) |
Deletes a MIDI rule from the instrument. More... | |
Public Attributes | |
int32_t | Attenuation |
in dB More... | |
uint16_t | EffectSend |
int16_t | FineTune |
in cents More... | |
uint16_t | PitchbendRange |
Number of semitones pitchbend controller can pitch (default is 2). More... | |
bool | PianoReleaseMode |
range_t | DimensionKeyRange |
0-127 (where 0 means C1 and 127 means G9) More... | |
Protected Types | |
typedef std::list< Region * > | RegionList |
typedef std::list< Articulation * > | ArticulationList |
Protected Member Functions | |
Instrument (File *pFile, RIFF::List *insList, progress_t *pProgress=NULL) | |
~Instrument () | |
Destructor. More... | |
void | UpdateRegionKeyTable () |
void | DeleteRegion (Region *pRegion) |
virtual void | CopyAssign (const Instrument *orig) |
Make a (semi) deep copy of the Instrument object given by orig and assign it to this object. More... | |
virtual void | CopyAssign (const Resource *orig) |
Make a deep copy of the Resource object given by orig and assign it to this object. More... | |
virtual void | CopyAssign (const Articulator *orig) |
Not yet implemented in this version, since the .gig format does not need to copy DLS articulators and so far nobody used pure DLS instrument AFAIK. More... | |
void | CopyAssignCore (const Instrument *orig) |
virtual void | LoadRegions () |
Resource * | GetParent () |
void | GenerateDLSID () |
Generates a new DLSID for the resource. More... | |
Articulation * | GetFirstArticulation () |
Articulation * | GetNextArticulation () |
void | LoadArticulations () |
Protected Attributes | |
Region * | RegionKeyTable [128] |
fast lookup for the corresponding Region of a MIDI key More... | |
bool | IsDrum |
Indicates if the Instrument is a drum type, as they differ in the synthesis model of DLS from melodic instruments. More... | |
uint16_t | MIDIBank |
Reflects combination of MIDIBankCoarse and MIDIBankFine (bank 1 - bank 16384). Do not change this value, it will not be saved! Change MIDIBankCoarse and MIDIBankFine instead (we might change that in future). More... | |
uint8_t | MIDIBankCoarse |
Reflects the MIDI Bank number for MIDI Control Change 0 (bank 1 - 128). More... | |
uint8_t | MIDIBankFine |
Reflects the MIDI Bank number for MIDI Control Change 32 (bank 1 - 128). More... | |
uint32_t | MIDIProgram |
Specifies the MIDI Program Change Number this Instrument should be assigned to. More... | |
uint32_t | Regions |
Reflects the number of Region defintions this Instrument has. More... | |
RIFF::List * | pCkInstrument |
RegionList * | pRegions |
RegionList::iterator | RegionsIterator |
Info * | pInfo |
Points (in any case) to an Info object, providing additional, optional infos and comments. More... | |
dlsid_t * | pDLSID |
Points to a dlsid_t structure if the file provided a DLS ID else is NULL. More... | |
Resource * | pParent |
RIFF::List * | pResourceList |
RIFF::List * | pParentList |
ArticulationList * | pArticulations |
ArticulationList::iterator | ArticulationsIterator |
Friends | |
class | File |
class | Region |
Provides all neccessary information for the synthesis of an Instrument.
|
protectedinherited |
|
protectedinherited |
|
protected |
Definition at line 3169 of file gig.cpp.
References Attenuation, CHUNK_ID_3EWG, CHUNK_ID_INAM, CHUNK_ID_ISFT, DimensionKeyRange, EffectSend, FineTune, gig::File::GetAutoLoad(), RIFF::List::GetFirstSubList(), RIFF::List::GetListType(), RIFF::List::GetNextSubList(), RIFF::Chunk::GetSize(), RIFF::List::GetSubChunk(), RIFF::List::GetSubList(), gig::range_t::high, LIST_TYPE_LART, LIST_TYPE_LRGN, LIST_TYPE_RGN, gig::range_t::low, PianoReleaseMode, DLS::Resource::pInfo, PitchbendRange, DLS::Instrument::pRegions, RIFF::Chunk::ReadInt16(), RIFF::Chunk::ReadInt32(), RIFF::Chunk::ReadUint16(), RIFF::Chunk::ReadUint8(), Region, RegionKeyTable, DLS::Instrument::Regions, DLS::Info::SetFixedStringLengths(), RIFF::Chunk::SetPos(), and UpdateRegionKeyTable().
|
protectedvirtual |
Destructor.
Removes RIFF chunks associated with this Instrument and frees all memory occupied by this instrument.
Reimplemented from DLS::Instrument.
MidiRuleAlternator * gig::Instrument::AddMidiRuleAlternator | ( | ) |
MidiRuleCtrlTrigger * gig::Instrument::AddMidiRuleCtrlTrigger | ( | ) |
MidiRuleLegato * gig::Instrument::AddMidiRuleLegato | ( | ) |
Region * gig::Instrument::AddRegion | ( | ) |
Definition at line 3370 of file gig.cpp.
References RIFF::List::AddSubList(), RIFF::List::GetSubList(), LIST_TYPE_LRGN, LIST_TYPE_RGN, DLS::Instrument::pCkInstrument, DLS::Instrument::pRegions, Region, DLS::Instrument::Regions, and UpdateRegionKeyTable().
Referenced by CopyAssign().
|
virtualinherited |
Not yet implemented in this version, since the .gig format does not need to copy DLS articulators and so far nobody used pure DLS instrument AFAIK.
Definition at line 236 of file DLS.cpp.
Referenced by DLS::Region::CopyAssign(), and DLS::Instrument::CopyAssignCore().
|
virtualinherited |
Make a deep copy of the Resource object given by orig and assign it to this object.
orig | - original Resource object to be copied from |
Definition at line 534 of file DLS.cpp.
References DLS::Info::CopyAssign(), and DLS::Resource::pInfo.
Referenced by DLS::Region::CopyAssign(), and DLS::Instrument::CopyAssignCore().
|
virtualinherited |
Make a (semi) deep copy of the Instrument object given by orig and assign it to this object.
Note that all sample pointers referenced by orig are simply copied as memory address. Thus the respective samples are shared, not duplicated!
orig | - original Instrument object to be copied from |
Definition at line 1305 of file DLS.cpp.
References DLS::Instrument::AddRegion(), DLS::Region::CopyAssign(), DLS::Instrument::CopyAssignCore(), DLS::Instrument::DeleteRegion(), DLS::Instrument::GetFirstRegion(), DLS::Instrument::pRegions, and DLS::Instrument::Regions.
|
virtual |
Make a (semi) deep copy of the Instrument object given by orig and assign it to this object.
Note that all sample pointers referenced by orig are simply copied as memory address. Thus the respective samples are shared, not duplicated!
orig | - original Instrument object to be copied from |
Definition at line 3463 of file gig.cpp.
References AddRegion(), Attenuation, gig::Region::CopyAssign(), DLS::Instrument::CopyAssignCore(), DeleteRegion(), DimensionKeyRange, EffectSend, FineTune, GetFirstRegion(), PianoReleaseMode, PitchbendRange, DLS::Instrument::pRegions, DLS::Instrument::Regions, and UpdateRegionKeyTable().
Referenced by gig::File::AddDuplicateInstrument().
|
protectedinherited |
Definition at line 1283 of file DLS.cpp.
References DLS::Articulator::CopyAssign(), DLS::Resource::CopyAssign(), DLS::Instrument::IsDrum, DLS::Instrument::MIDIBank, DLS::Instrument::MIDIBankCoarse, DLS::Instrument::MIDIBankFine, and DLS::Instrument::MIDIProgram.
Referenced by DLS::Instrument::CopyAssign(), and CopyAssign().
void gig::Instrument::DeleteMidiRule | ( | int | i | ) |
|
inherited |
Definition at line 1221 of file DLS.cpp.
References DLS::Instrument::pRegions, and DLS::Instrument::Regions.
Referenced by DLS::Instrument::CopyAssign(), and DeleteRegion().
void gig::Instrument::DeleteRegion | ( | Region * | pRegion | ) |
Definition at line 3384 of file gig.cpp.
References DLS::Instrument::DeleteRegion(), DLS::Instrument::pRegions, and UpdateRegionKeyTable().
Referenced by CopyAssign().
|
inherited |
Generates a new DLSID for the resource.
Definition at line 487 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().
|
inherited |
Definition at line 174 of file DLS.cpp.
References DLS::Articulator::ArticulationsIterator, DLS::Articulator::LoadArticulations(), and DLS::Articulator::pArticulations.
Region * gig::Instrument::GetFirstRegion | ( | ) |
Returns the first Region of the instrument.
You have to call this method once before you use GetNextRegion().
Definition at line 3350 of file gig.cpp.
References DLS::Instrument::pRegions, and DLS::Instrument::RegionsIterator.
Referenced by CopyAssign().
MidiRule * gig::Instrument::GetMidiRule | ( | int | i | ) |
Returns a MIDI rule of the instrument.
The list of MIDI rules, at least in gig v3, always contains at most two rules. The second rule can only be the DEF filter (which currently isn't supported by libgig).
i | - MIDI rule number |
|
inherited |
Definition at line 181 of file DLS.cpp.
References DLS::Articulator::ArticulationsIterator, and DLS::Articulator::pArticulations.
Region * gig::Instrument::GetNextRegion | ( | ) |
Returns the next Region of the instrument.
You have to call GetFirstRegion() once before you can use this method. By calling this method multiple times it iterates through the available Regions.
Definition at line 3364 of file gig.cpp.
References DLS::Instrument::pRegions, and DLS::Instrument::RegionsIterator.
|
inlineinherited |
Definition at line 330 of file DLS.h.
References DLS::Resource::pParent.
Referenced by gig::Region::AddDimension(), DLS::Region::GetSample(), gig::Region::GetSampleFromWavePool(), gig::Region::Region(), DLS::Region::SetKeyRange(), gig::Region::SetKeyRange(), DLS::Region::UpdateChunks(), gig::DimensionRegion::UpdateChunks(), gig::Region::UpdateChunks(), UpdateChunks(), and gig::Sample::Write().
Region * gig::Instrument::GetRegion | ( | unsigned int | Key | ) |
Returns the appropriate Region for a triggered note.
Key | MIDI Key number of triggered note / key (0 - 127) |
Definition at line 3332 of file gig.cpp.
References DLS::Instrument::pRegions, and RegionKeyTable.
|
protectedinherited |
Definition at line 187 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().
|
protectedvirtualinherited |
Definition at line 1186 of file DLS.cpp.
References RIFF::List::GetFirstSubList(), RIFF::List::GetListType(), RIFF::List::GetNextSubList(), RIFF::List::GetSubList(), LIST_TYPE_LRGN, LIST_TYPE_RGN, LIST_TYPE_RGN2, DLS::Instrument::pCkInstrument, DLS::Instrument::pRegions, and DLS::Instrument::Region.
Referenced by DLS::Instrument::AddRegion(), DLS::Instrument::GetFirstRegion(), and DLS::Region::SetKeyRange().
|
virtual |
Apply Instrument with all its Regions 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.
gig::Exception | if samples cannot be dereferenced |
Reimplemented from DLS::Instrument.
Definition at line 3279 of file gig.cpp.
References RIFF::List::AddSubChunk(), RIFF::List::AddSubList(), Attenuation, CHUNK_ID_3EWG, DimensionKeyRange, EffectSend, FineTune, DLS::Resource::GetParent(), RIFF::Chunk::GetSize(), RIFF::List::GetSubChunk(), RIFF::List::GetSubList(), gig::range_t::high, LIST_TYPE_LART, RIFF::Chunk::LoadChunkData(), gig::range_t::low, DLS::version_t::major, DLS::Instrument::pCkInstrument, PianoReleaseMode, PitchbendRange, DLS::Instrument::pRegions, DLS::File::pVersion, DLS::Instrument::UpdateChunks(), and gig::MidiRule::UpdateChunks().
|
protected |
Definition at line 3251 of file gig.cpp.
References DLS::Region::KeyRange, DLS::range_t::low, DLS::Instrument::pRegions, and RegionKeyTable.
Referenced by AddRegion(), CopyAssign(), DeleteRegion(), and Instrument().
|
friend |
Definition at line 788 of file gig.h.
Referenced by AddRegion(), and Instrument().
|
protectedinherited |
Definition at line 278 of file DLS.h.
Referenced by DLS::Articulator::GetFirstArticulation(), and DLS::Articulator::GetNextArticulation().
int32_t gig::Instrument::Attenuation |
in dB
Definition at line 757 of file gig.h.
Referenced by CopyAssign(), Instrument(), and UpdateChunks().
range_t gig::Instrument::DimensionKeyRange |
0-127 (where 0 means C1 and 127 means G9)
Definition at line 762 of file gig.h.
Referenced by CopyAssign(), Instrument(), and UpdateChunks().
uint16_t gig::Instrument::EffectSend |
Definition at line 758 of file gig.h.
Referenced by CopyAssign(), Instrument(), and UpdateChunks().
int16_t gig::Instrument::FineTune |
in cents
Definition at line 759 of file gig.h.
Referenced by CopyAssign(), Instrument(), and UpdateChunks().
|
inherited |
Indicates if the Instrument is a drum type, as they differ in the synthesis model of DLS from melodic instruments.
Definition at line 438 of file DLS.h.
Referenced by DLS::Instrument::CopyAssignCore(), DLS::Instrument::Instrument(), and DLS::Instrument::UpdateChunks().
|
inherited |
Reflects combination of MIDIBankCoarse and MIDIBankFine (bank 1 - bank 16384). Do not change this value, it will not be saved! Change MIDIBankCoarse and MIDIBankFine instead (we might change that in future).
Definition at line 439 of file DLS.h.
Referenced by DLS::Instrument::CopyAssignCore(), DLS::Instrument::Instrument(), and DLS::Instrument::UpdateChunks().
|
inherited |
Reflects the MIDI Bank number for MIDI Control Change 0 (bank 1 - 128).
Definition at line 440 of file DLS.h.
Referenced by DLS::Instrument::CopyAssignCore(), DLS::Instrument::Instrument(), and DLS::Instrument::UpdateChunks().
|
inherited |
Reflects the MIDI Bank number for MIDI Control Change 32 (bank 1 - 128).
Definition at line 441 of file DLS.h.
Referenced by DLS::Instrument::CopyAssignCore(), DLS::Instrument::Instrument(), and DLS::Instrument::UpdateChunks().
|
inherited |
Specifies the MIDI Program Change Number this Instrument should be assigned to.
Definition at line 442 of file DLS.h.
Referenced by DLS::Instrument::CopyAssignCore(), DLS::Instrument::Instrument(), and DLS::Instrument::UpdateChunks().
|
protectedinherited |
Definition at line 277 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().
|
protectedinherited |
Definition at line 458 of file DLS.h.
Referenced by DLS::Instrument::AddRegion(), AddRegion(), DLS::Instrument::Instrument(), DLS::Instrument::LoadRegions(), DLS::Instrument::UpdateChunks(), UpdateChunks(), and DLS::Instrument::~Instrument().
|
inherited |
Points to a dlsid_t structure if the file provided a DLS ID else is NULL.
Definition at line 328 of file DLS.h.
Referenced by DLS::Resource::GenerateDLSID(), DLS::Resource::Resource(), DLS::Resource::UpdateChunks(), and DLS::Resource::~Resource().
bool gig::Instrument::PianoReleaseMode |
Definition at line 761 of file gig.h.
Referenced by CopyAssign(), Instrument(), and UpdateChunks().
|
inherited |
Points (in any case) to an Info object, providing additional, optional infos and comments.
Definition at line 327 of file DLS.h.
Referenced by gig::File::AddInstrument(), DLS::Resource::CopyAssign(), gig::File::File(), Instrument(), DLS::Resource::Resource(), gig::Sample::Sample(), DLS::Resource::UpdateChunks(), and DLS::Resource::~Resource().
uint16_t gig::Instrument::PitchbendRange |
Number of semitones pitchbend controller can pitch (default is 2).
Definition at line 760 of file gig.h.
Referenced by CopyAssign(), Instrument(), and UpdateChunks().
|
protectedinherited |
Definition at line 335 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().
|
protectedinherited |
Definition at line 276 of file DLS.h.
Referenced by DLS::Articulator::Articulator(), gig::Region::DeleteDimension(), and DLS::Articulator::LoadArticulations().
|
protectedinherited |
Definition at line 459 of file DLS.h.
Referenced by DLS::Instrument::AddRegion(), AddRegion(), DLS::Instrument::CopyAssign(), CopyAssign(), DLS::Instrument::DeleteRegion(), DeleteRegion(), DLS::Instrument::GetFirstRegion(), GetFirstRegion(), DLS::Instrument::GetNextRegion(), GetNextRegion(), GetRegion(), DLS::Instrument::Instrument(), Instrument(), DLS::Instrument::LoadRegions(), DLS::Region::SetKeyRange(), DLS::Instrument::UpdateChunks(), UpdateChunks(), UpdateRegionKeyTable(), and DLS::Instrument::~Instrument().
|
protectedinherited |
Definition at line 336 of file DLS.h.
Referenced by DLS::Resource::Resource(), and DLS::Resource::UpdateChunks().
|
protected |
fast lookup for the corresponding Region of a MIDI key
Definition at line 782 of file gig.h.
Referenced by GetRegion(), Instrument(), and UpdateRegionKeyTable().
|
inherited |
Reflects the number of Region defintions this Instrument has.
Definition at line 443 of file DLS.h.
Referenced by DLS::Instrument::AddRegion(), AddRegion(), DLS::Instrument::CopyAssign(), CopyAssign(), DLS::Instrument::DeleteRegion(), DLS::Instrument::Instrument(), Instrument(), and DLS::Instrument::UpdateChunks().
|
protectedinherited |
Definition at line 460 of file DLS.h.
Referenced by DLS::Instrument::GetFirstRegion(), GetFirstRegion(), DLS::Instrument::GetNextRegion(), and GetNextRegion().