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

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

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

Member Typedef Documentation

◆ ArticulationList

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

Definition at line 352 of file DLS.h.

◆ RegionList

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

Definition at line 540 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 1335 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 1465 of file DLS.cpp.

Member Function Documentation

◆ AddRegion()

Region * DLS::Instrument::AddRegion ( )

Definition at line 1388 of file DLS.cpp.

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

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

◆ CopyAssign() [2/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 1524 of file DLS.cpp.

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

◆ CopyAssign() [3/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 601 of file DLS.cpp.

References DLS::Info::CopyAssign(), and DLS::Resource::pInfo.

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

◆ CopyAssignCore()

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

Definition at line 1502 of file DLS.cpp.

◆ DeleteChunks()

void DLS::Instrument::DeleteChunks ( )
virtual

Remove all RIFF chunks associated with this Instrument object.

See Storage::DeleteChunks() for details.

Reimplemented from DLS::Articulator.

Definition at line 1481 of file DLS.cpp.

References DLS::Articulator::DeleteChunks(), DLS::Resource::DeleteChunks(), RIFF::List::DeleteSubChunk(), and RIFF::Chunk::GetParent().

Referenced by DLS::File::DeleteInstrument(), and gig::File::DeleteInstrument().

◆ DeleteRegion()

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

Definition at line 1408 of file DLS.cpp.

◆ GenerateDLSID() [1/2]

void Resource::GenerateDLSID ( )
inherited

Generates a new DLSID for the resource.

Definition at line 551 of file DLS.cpp.

References DLS::Resource::GenerateDLSID(), and DLS::Resource::pDLSID.

Referenced by gig::File::AddInstrument(), DLS::Resource::GenerateDLSID(), gig::Script::GenerateUuid(), and DLS::File::UpdateChunks().

◆ GenerateDLSID() [2/2]

void Resource::GenerateDLSID ( dlsid_t pDLSID)
staticinherited

Definition at line 558 of file DLS.cpp.

◆ GetFirstArticulation()

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

Definition at line 192 of file DLS.cpp.

◆ GetFirstRegion()

Region * DLS::Instrument::GetFirstRegion ( )

Definition at line 1360 of file DLS.cpp.

◆ GetNextArticulation()

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

Definition at line 199 of file DLS.cpp.

◆ GetNextRegion()

Region * DLS::Instrument::GetNextRegion ( )

Definition at line 1367 of file DLS.cpp.

◆ GetParent() [1/2]

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

Definition at line 408 of file DLS.h.

◆ GetParent() [2/2]

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

Definition at line 409 of file DLS.h.

◆ LoadArticulations()

void DLS::Articulator::LoadArticulations ( )
protectedinherited

Definition at line 205 of file DLS.cpp.

◆ LoadRegions()

void DLS::Instrument::LoadRegions ( )
protectedvirtual

Definition at line 1373 of file DLS.cpp.

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

Member Data Documentation

◆ ArticulationsIterator

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

Definition at line 355 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 525 of file DLS.h.

Referenced by 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 526 of file DLS.h.

Referenced by 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 527 of file DLS.h.

Referenced by 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 528 of file DLS.h.

Referenced by Instrument(), and UpdateChunks().

◆ MIDIProgram

uint32_t DLS::Instrument::MIDIProgram

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

Definition at line 529 of file DLS.h.

Referenced by Instrument(), and UpdateChunks().

◆ pArticulations

ArticulationList* DLS::Articulator::pArticulations
protectedinherited

Definition at line 354 of file DLS.h.

◆ pCkInstrument

RIFF::List* DLS::Instrument::pCkInstrument
protected

Definition at line 546 of file DLS.h.

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

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

◆ pInfo

Info* DLS::Resource::pInfo
inherited

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

Definition at line 405 of file DLS.h.

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

◆ pParent

Resource* DLS::Resource::pParent
protectedinherited

Definition at line 416 of file DLS.h.

◆ pParentList

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

Definition at line 353 of file DLS.h.

◆ pRegions

RegionList* DLS::Instrument::pRegions
protected

Definition at line 547 of file DLS.h.

◆ pResourceList

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

Definition at line 417 of file DLS.h.

◆ Regions

uint32_t DLS::Instrument::Regions

Reflects the number of Region defintions this Instrument has.

Definition at line 530 of file DLS.h.

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

◆ RegionsIterator

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

Definition at line 548 of file DLS.h.


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