MusicKit  0.0.0
MKTimbre Class Reference

The MusicKit supports a Timbre Data Base. Each element in the data base is a MKTimbre. More...

#include <MKTimbre.h>


Detailed Description

The MusicKit supports a Timbre Data Base. Each element in the data base is a MKTimbre.

Each MKTimbre maps a timbre name to a NSArray of MKWaveTable objects and a parallel list of frequencies for those MKWaveTables. The Data Base is initialized with an extensive set of timbres. These timbres may be removed or modified, additional timbres may be added, etc.

The waveTables List is a List object of WaveTables sorted according to frequency. The table that corresponds to the lowest frequency is first in the List. freqs is a NSMutableArray object containing the frequencies corresponding to each MKWaveTable. The timbreName may be any string, but should not have a number in it and should not be longer than MK_MAXTIMBRENAMELEN, which is defined in MKTimbre.h.

You normally create or retrieve an MKTimbre with +newTimbre:, passing the name of the timbre you want. If that timbre exists, it is retrieved, otherwise it is created and installed in the Data Base. Alternatively, you can create a new anonymous timbre with +alloc and init. In this case, the timbre is not put in the Data Base until its name is set with setTimbreName:. setTimbreName: can also be used to change the name of a timbre that is already in the Data Base. timbreName may be used to retrieve the name of an MKTimbre. An anonymous timbre has a name field of NULL.

The MusicKit MKSynthPatches use the Data Base by passing it a "timbre key". A timbre key is a timbre name with an optional integer appended to it and an optional 0 or 1 prepended to it. The trailing number in a timbre key specifies a particular table (1-based). A leading 0 or 1 specifies use of the freq0 or freq1 parameter, respectively, to determine the appropriate MKWaveTable. For convenience in supporting this functionality in your own MKSynthPatch subclasses, we provide the function MKWaveTableForTimbreKey().

The Data Base is stored in a HashTable object that maps names to MKTimbre objects. This HashTable can be retrieved by the +timbres method. See <objc/HashTable.h> for how to enumerate the objects in a HashTable.

An individual timbre can be written to an archive file. Alternatively, the entire database can be saved to an archive file using the +timbres method to retrieve the database and then archiving that object.

See also:
MKWaveTable, MKPartials, MKSamples, SynthPatchLibrary.rtf

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