Waveform Display

A button can display a waveform

system call: newWavObject(owner) creates if necessary: owner.wavObjs[]

wavObj = makeWavObject(owner, color) // sets wavColor wavObj = makeWavObject(owner) // init color __wav.defaultColorTab[sizeof(owner.wavObjs)] creates a waveform object which displays a waveform in the inset rectangle the waveform is stored in circular buffer wavObj.wavBuf[] wavObj.wavIndex points to the place in the buffer to put the next sample

owner.wavSize = defaultNumberOfSamples wavObj.wavSize = numberOfSamples if zero: ignore if NULL: use owner’s defaultNumberOfSamples owner.wavSweep = 0;

wavObj.wavColor = color owner.wavColor = color // same as owner.wavObjs[0].wavColor = color

wavAddSample(wavObj, value); wavAddSample(owner, value); // same as wavAddSample(owner.wavObjs[0], value) add a sample to the waveform object’s buffer

You can set these: wavObj.min // value corresponding to the bottom of the inset rectangle (default: -1) wavObj.max // value corresponding to the top of the inset rectangle (default: 1)

wave object attributes _NSID: pointer to PsiWave Objective C object owner: the UIE (button, for example) to display the waveform in index: index in owner’s wavObjArray wavArr: array of samples wavIndex: we will put next sample into wavArr[wavIndex]

attributes set in owner wavObjArray: array of waveform objects created by newWavObject