libgig  4.0.0
DLS::Instrument Class Reference

Provides all neccessary information for the synthesis of a DLS Instrument. More...

#include <DLS.h>

Inheritance diagram for DLS::Instrument:
DLS::Resource DLS::Articulator gig::Instrument

Classes

struct  midi_locale_t
 

Public Member Functions

RegionGetFirstRegion ()
 
RegionGetNextRegion ()
 
RegionAddRegion ()
 
void DeleteRegion (Region *pRegion)
 
virtual void UpdateChunks (progress_t *pProgress)
 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...
 
ResourceGetParent ()
 
const ResourceGetParent () const
 
void GenerateDLSID ()
 Generates a new DLSID for the resource. 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...
 
ArticulationGetFirstArticulation ()
 
ArticulationGetNextArticulation ()
 
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...
 

Public Attributes

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...
 
InfopInfo
 Points (in any case) to an Info object, providing additional, optional infos and comments. More...
 
dlsid_tpDLSID
 Points to a dlsid_t structure if the file provided a DLS ID else is NULL. More...
 

Protected Types

typedef std::list< Region * > RegionList
 
typedef std::list< Articulation * > ArticulationList
 

Protected Member Functions

 Instrument (File *pFile, RIFF::List *insList)
 Constructor. More...
 
void CopyAssignCore (const Instrument *orig)
 
virtual void LoadRegions ()
 
virtual ~Instrument ()
 Destructor. More...
 
void LoadArticulations ()
 

Protected Attributes

RIFF::ListpCkInstrument
 
RegionListpRegions
 
RegionList::iterator RegionsIterator
 
ResourcepParent
 
RIFF::ListpResourceList
 
RIFF::ListpParentList
 
ArticulationListpArticulations
 
ArticulationList::iterator ArticulationsIterator
 

Friends

class File
 
class Region
 

Detailed Description

Provides all neccessary information for the synthesis of a DLS Instrument.

Definition at line 459 of file DLS.h.

Member Typedef Documentation

§ ArticulationList

typedef std::list<Articulation*> DLS::Articulator::ArticulationList
protectedinherited

Definition at line 295 of file DLS.h.

§ RegionList

typedef std::list<Region*> DLS::Instrument::RegionList
protected

Definition at line 475 of file DLS.h.

Constructor & Destructor Documentation

§ Instrument()

DLS::Instrument::Instrument ( File pFile,
RIFF::List insList 
)
protected

Constructor.

Load an existing instrument definition or create a new one. An 'ins' list chunk must be given to this constructor. In case this 'ins' list chunk contains a 'insh' chunk, the instrument data fields will be loaded from there, otherwise default values will be used and the 'insh' chunk will be created once File::Save() was called.

Parameters
pFile- pointer to DLS::File where this instrument is located (or will be located)
insList- pointer to 'ins' list chunk which is (or will be) associated with this instrument

Definition at line 1220 of file DLS.cpp.

References DLS::Instrument::midi_locale_t::bank, CHUNK_ID_INSH, DRUM_TYPE_MASK, RIFF::List::GetSubChunk(), DLS::Instrument::midi_locale_t::instrument, IsDrum, MIDI_BANK_COARSE, MIDI_BANK_FINE, MIDI_BANK_MERGE, MIDIBank, MIDIBankCoarse, MIDIBankFine, MIDIProgram, pCkInstrument, pRegions, RIFF::Chunk::Read(), RIFF::Chunk::ReadUint32(), and Regions.

§ ~Instrument()

DLS::Instrument::~Instrument ( )
protectedvirtual

Destructor.

Removes RIFF chunks associated with this Instrument and frees all memory occupied by this instrument.

Reimplemented in gig::Instrument.

Definition at line 1344 of file DLS.cpp.

References RIFF::List::DeleteSubChunk(), RIFF::Chunk::GetParent(), pCkInstrument, DLS::Resource::pParent, and pRegions.

Member Function Documentation

§ AddRegion()

§ CopyAssign() [1/3]

void DLS::Articulator::CopyAssign ( const Articulator orig)
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 240 of file DLS.cpp.

Referenced by DLS::Region::CopyAssign(), and CopyAssignCore().

§ CopyAssign() [2/3]

void Resource::CopyAssign ( const Resource orig)
virtualinherited

Make a deep copy of the Resource object given by orig and assign it to this object.

Parameters
orig- original Resource object to be copied from

Definition at line 542 of file DLS.cpp.

References DLS::Resource::pInfo.

Referenced by DLS::Region::CopyAssign(), DLS::Sample::CopyAssignCore(), and CopyAssignCore().

§ CopyAssign() [3/3]

void DLS::Instrument::CopyAssign ( const Instrument orig)
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!

Parameters
orig- original Instrument object to be copied from

Definition at line 1381 of file DLS.cpp.

References AddRegion(), DLS::Region::CopyAssign(), CopyAssignCore(), DeleteRegion(), GetFirstRegion(), pRegions, and Regions.

§ CopyAssignCore()

void DLS::Instrument::CopyAssignCore ( const Instrument orig)
protected

§ DeleteRegion()

void DLS::Instrument::DeleteRegion ( Region pRegion)

Definition at line 1291 of file DLS.cpp.

References pRegions, and Regions.

Referenced by CopyAssign(), and gig::Instrument::DeleteRegion().

§ GenerateDLSID()

void Resource::GenerateDLSID ( )
inherited

Generates a new DLSID for the resource.

Definition at line 495 of file DLS.cpp.

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

§ GetFirstArticulation()

Articulation * DLS::Articulator::GetFirstArticulation ( )
inherited

Definition at line 176 of file DLS.cpp.

§ GetFirstRegion()

Region * DLS::Instrument::GetFirstRegion ( )

Definition at line 1243 of file DLS.cpp.

References LoadRegions(), pRegions, and RegionsIterator.

Referenced by CopyAssign().

§ GetNextArticulation()

Articulation * DLS::Articulator::GetNextArticulation ( )
inherited

Definition at line 183 of file DLS.cpp.

§ GetNextRegion()

Region * DLS::Instrument::GetNextRegion ( )

Definition at line 1250 of file DLS.cpp.

References pRegions, and RegionsIterator.

§ GetParent() [1/2]

§ GetParent() [2/2]

const Resource* DLS::Resource::GetParent ( ) const
inlineinherited

Definition at line 351 of file DLS.h.

§ LoadArticulations()

§ LoadRegions()

§ UpdateChunks()

void DLS::Instrument::UpdateChunks ( progress_t pProgress)
virtual

Apply Instrument with all its Regions to the respective RIFF chunks.

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

Parameters
pProgress- callback function for progress notification
Exceptions
Exception- on errors

Reimplemented from DLS::Articulator.

Reimplemented in gig::Instrument.

Definition at line 1307 of file DLS.cpp.

References RIFF::List::AddSubChunk(), DLS::Instrument::midi_locale_t::bank, CHUNK_ID_INSH, DRUM_TYPE_MASK, RIFF::List::GetSubChunk(), DLS::Instrument::midi_locale_t::instrument, IsDrum, RIFF::Chunk::LoadChunkData(), MIDI_BANK_ENCODE, MIDI_BANK_MERGE, MIDIBank, MIDIBankCoarse, MIDIBankFine, MIDIProgram, pCkInstrument, pRegions, Regions, DLS::Articulator::UpdateChunks(), and DLS::Resource::UpdateChunks().

Referenced by gig::Instrument::UpdateChunks().

Friends And Related Function Documentation

§ File

friend class File
friend

Definition at line 489 of file DLS.h.

§ Region

friend class Region
friend

Definition at line 490 of file DLS.h.

Referenced by AddRegion(), and LoadRegions().

Member Data Documentation

§ ArticulationsIterator

ArticulationList::iterator DLS::Articulator::ArticulationsIterator
protectedinherited

Definition at line 298 of file DLS.h.

§ IsDrum

bool DLS::Instrument::IsDrum

Indicates if the Instrument is a drum type, as they differ in the synthesis model of DLS from melodic instruments.

Definition at line 461 of file DLS.h.

Referenced by CopyAssignCore(), Instrument(), and UpdateChunks().

§ MIDIBank

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

Definition at line 462 of file DLS.h.

Referenced by CopyAssignCore(), Instrument(), and UpdateChunks().

§ MIDIBankCoarse

uint8_t DLS::Instrument::MIDIBankCoarse

Reflects the MIDI Bank number for MIDI Control Change 0 (bank 1 - 128).

Definition at line 463 of file DLS.h.

Referenced by CopyAssignCore(), Instrument(), and UpdateChunks().

§ MIDIBankFine

uint8_t DLS::Instrument::MIDIBankFine

Reflects the MIDI Bank number for MIDI Control Change 32 (bank 1 - 128).

Definition at line 464 of file DLS.h.

Referenced by CopyAssignCore(), Instrument(), and UpdateChunks().

§ MIDIProgram

uint32_t DLS::Instrument::MIDIProgram

Specifies the MIDI Program Change Number this Instrument should be assigned to.

Definition at line 465 of file DLS.h.

Referenced by CopyAssignCore(), Instrument(), and UpdateChunks().

§ pArticulations

ArticulationList* DLS::Articulator::pArticulations
protectedinherited

Definition at line 297 of file DLS.h.

§ pCkInstrument

§ pDLSID

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.

§ pInfo

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 gig::File::AddInstrument(), DLS::Resource::CopyAssign(), gig::File::File(), gig::Instrument::Instrument(), and gig::Sample::Sample().

§ pParent

Resource* DLS::Resource::pParent
protectedinherited

§ pParentList

RIFF::List* DLS::Articulator::pParentList
protectedinherited

Definition at line 296 of file DLS.h.

Referenced by gig::Region::DeleteDimension().

§ pRegions

§ pResourceList

RIFF::List* DLS::Resource::pResourceList
protectedinherited

Definition at line 357 of file DLS.h.

§ Regions

uint32_t DLS::Instrument::Regions

§ RegionsIterator

RegionList::iterator DLS::Instrument::RegionsIterator
protected

The documentation for this class was generated from the following files: