libgig  4.4.1
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 DLS::Storage DLS::Storage gig::Instrument

Public Member Functions

size_t CountRegions ()
 Returns the amount of regions of this instrument. More...
 
RegionGetRegionAt (size_t pos)
 Returns Region at supplied pos position within the region list of this instrument. More...
 
RegionGetFirstRegion ()
 Returns the first Region of the instrument. More...
 
RegionGetNextRegion ()
 Returns the next Region of the instrument. More...
 
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 DeleteChunks ()
 Remove all RIFF chunks associated with this Instrument object. 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.
 
virtual void CopyAssign (const Resource *orig)
 Make a deep copy of the Resource object given by orig and assign it to this object. More...
 
ArticulationGetArticulation (size_t pos)
 Returns Articulation at supplied pos position within the articulation list. More...
 
ArticulationGetFirstArticulation ()
 Returns the first Articulation in the list of articulations. More...
 
ArticulationGetNextArticulation ()
 Returns the next Articulation from the list of articulations. 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.
 

Static Public Member Functions

static void GenerateDLSID (dlsid_t *pDLSID)
 

Public Attributes

bool IsDrum
 Indicates if the Instrument is a drum type, as they differ in the synthesis model of DLS from melodic instruments.
 
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).
 
uint8_t MIDIBankCoarse
 Reflects the MIDI Bank number for MIDI Control Change 0 (bank 1 - 128).
 
uint8_t MIDIBankFine
 Reflects the MIDI Bank number for MIDI Control Change 32 (bank 1 - 128).
 
uint32_t MIDIProgram
 Specifies the MIDI Program Change Number this Instrument should be assigned to.
 
uint32_t Regions
 Reflects the number of Region defintions this Instrument has.
 
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 Types

typedef std::vector< Region * > RegionList
 
typedef std::vector< 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
 
RegionList * pRegions
 
RegionList::iterator RegionsIterator
 
ResourcepParent
 
RIFF::ListpResourceList
 
RIFF::ListpParentList
 
ArticulationList * pArticulations
 
ArticulationList::iterator ArticulationsIterator
 

Detailed Description

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

Definition at line 524 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 1372 of file DLS.cpp.

References RIFF::List::GetSubChunk(), IsDrum, MIDIBank, MIDIBankCoarse, MIDIBankFine, MIDIProgram, RIFF::Chunk::Read(), RIFF::Chunk::ReadUint32(), Regions, and RIFF::Chunk::SetPos().

◆ ~Instrument()

DLS::Instrument::~Instrument ( )
protectedvirtual

Destructor.

Frees all memory occupied by this instrument.

Reimplemented in gig::Instrument.

Definition at line 1559 of file DLS.cpp.

Member Function Documentation

◆ CopyAssign() [1/2]

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 637 of file DLS.cpp.

References RIFF::List::GetSubChunk(), DLS::Resource::pInfo, RIFF::Chunk::Read(), RIFF::Chunk::ReadInt16(), RIFF::Chunk::ReadInt32(), RIFF::Chunk::ReadUint16(), RIFF::Chunk::ReadUint32(), and RIFF::Chunk::SetPos().

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

◆ CopyAssign() [2/2]

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 1618 of file DLS.cpp.

References DLS::Region::CopyAssign(), GetRegionAt(), and Regions.

◆ CountRegions()

size_t DLS::Instrument::CountRegions ( )

Returns the amount of regions of this instrument.

See also
GetRegionAt()

Definition at line 1402 of file DLS.cpp.

◆ DeleteChunks()

◆ GetArticulation()

Articulation * DLS::Articulator::GetArticulation ( size_t  pos)
inherited

Returns Articulation at supplied pos position within the articulation list.

If supplied pos is out of bounds then NULL is returned.

Parameters
pos- position of sought Articulation in articulation list
Returns
pointer address to requested articulation or NULL if pos is out of bounds

Definition at line 200 of file DLS.cpp.

◆ GetFirstArticulation()

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

Returns the first Articulation in the list of articulations.

You have to call this method once before you can use GetNextArticulation().

Returns
pointer address to first Articulation or NULL if there is none
See also
GetNextArticulation()
Deprecated:
This method is not reentrant-safe, use GetArticulation() instead.

Definition at line 216 of file DLS.cpp.

◆ GetFirstRegion()

Region * DLS::Instrument::GetFirstRegion ( )

Returns the first Region of the instrument.

You have to call this method once before you use GetNextRegion().

Returns
pointer address to first region or NULL if there is none
See also
GetNextRegion()
Deprecated:
This method is not reentrant-safe, use GetRegionAt() instead.

Definition at line 1434 of file DLS.cpp.

◆ GetNextArticulation()

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

Returns the next Articulation from the list of articulations.

You have to call GetFirstArticulation() once before you can use this method. By calling this method multiple times it iterates through the available articulations.

Returns
pointer address to the next Articulation or NULL if end reached
See also
GetFirstArticulation()
Deprecated:
This method is not reentrant-safe, use GetArticulation() instead.

Definition at line 234 of file DLS.cpp.

References RIFF::List::GetListType(), RIFF::List::GetSubChunkAt(), and RIFF::List::GetSubList().

◆ GetNextRegion()

Region * DLS::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.

Returns
pointer address to the next region or NULL if end reached
See also
GetFirstRegion()
Deprecated:
This method is not reentrant-safe, use GetRegionAt() instead.

Definition at line 1451 of file DLS.cpp.

References RIFF::List::AddSubList(), DLS::Region::DeleteChunks(), RIFF::List::GetSubList(), RIFF::List::GetSubListAt(), RIFF::List::MoveSubChunk(), and Regions.

◆ GetRegionAt()

Region * DLS::Instrument::GetRegionAt ( size_t  pos)

Returns Region at supplied pos position within the region list of this instrument.

If supplied pos is out of bounds then NULL is returned.

Parameters
pos- position of sought Region in region list
Returns
pointer address to requested region or NULL if pos is out of bounds
See also
CountRegions()

Definition at line 1418 of file DLS.cpp.

Referenced by CopyAssign().

◆ 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 1519 of file DLS.cpp.

References RIFF::List::AddSubChunk(), RIFF::List::GetSubChunk(), IsDrum, RIFF::Chunk::LoadChunkData(), MIDIBank, MIDIBankCoarse, MIDIBankFine, MIDIProgram, Regions, DLS::Articulator::UpdateChunks(), and DLS::Resource::UpdateChunks().

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


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