MusicKit  0.0.0
MKWaveTable Class Reference

A MKWaveTable represents a single period of a sound waveform as a series of samples. More...

#include <MKWaveTable.h>


Detailed Description

A MKWaveTable represents a single period of a sound waveform as a series of samples.

MKWaveTable is an abstract class that's succeeded by two inheriting classes: MKSamples and MKPartials. The MKSamples subclass lets you define a MKWaveTable through association with a Sound object or soundfile; MKPartials lets you build a waveform by adding sine wave components. If you're interested in using Wavetables to create a library of timbres you should refer to the descriptions of the MKSamples and MKPartials subclasses. Detailed familiarity with the MKWaveTable class, in this case, isn't necessary.

MKWaveTable objects are designed to be used as lookup tables for oscillator MKUnitGenerators such as OscgafiUG. When it's instructed to run, the oscillator downloads the WaveTable's data to a portion of memory on the DSP and then cycles over the data to generate a timbre that's defined by the shape of the waveform that the data represents. To assist this process, a MKWaveTable object maintains two separate arrays of data pointed to by the dataDSP and dataDouble

A MKWaveTable contain an array of data that's used by a MKUnitGenerator object as a lookup table. The Music Kit provides two subclasses of this absract class: MKPartials, and MKSamples.

Access to the data is through one of the data: methods. The method used depends on the data type needed (type DSPDatum (i.e., for the DSP) or type double), the scaling needed and the length of the array needed. If necessary, the subclass is called upon to recompute the data. These methods do not copy the data. Thus, the caller should not free or alter the array of data. The need to recompute is recognized on the basis of whether the length or scaling instance variables have changed. The subclass can signal that a recomputation is needed by setting length to 0.

The computation of the data is handled by the subclass method fillTableLength:scale:.

Subclasses provided by the MusicKit are:

The MKWaveTable class caches multiple formats for the data. This is useful because it is expensive to recompute the data. Access to the data is through one of the "data" methods (-dataDSP, -dataDouble, etc.). The method used depends on the data type needed (type DSPDatum for the DSP or type double), the scaling needed, and the length of the array needed. The caller should not free nor alter the array of data.

If necessary, the subclass is called upon to recompute the data. The computation of the data is handled by the subclass method fillTableLength:scale:.


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