00001 /* 00002 $Id: Shape.h 3291 2005-05-31 10:57:33Z leighsmith $ 00003 00004 Defined In: The MusicKit 00005 Description: 00006 (See discussion below) 00007 00008 Original Author: Eric J. Graves and David A. Jaffe 00009 00010 Copyright (c) 1992 Eric J. Graves & Stanford University. 00011 Portions Copyright (c) 1994 NeXT Computer, Inc. and reproduced under license from NeXT 00012 Portions Copyright (c) 1994 Stanford University. 00013 Portions Copyright (c) 1999-2005, The MusicKit Project. 00014 */ 00123 #ifndef __MK_Shape_H___ 00124 #define __MK_Shape_H___ 00125 00126 #import <MusicKit/MKSynthPatch.h> 00127 #import <MusicKit/MKEnvelope.h> 00128 #import <MusicKit/MKWaveTable.h> 00129 00130 @interface Shape:MKSynthPatch 00131 { 00132 /* Amplitude parameters. */ 00133 MKEnvelope *ampEnv;/* the Envelope object for amplitude */ 00134 double amp1, /* amplitude scaler */ 00135 amp0, /* amplitude offset */ 00136 ampAtt, /* ampEnv attack duration in seconds */ 00137 ampRel; /* ampEnv release duration in seconds */ 00138 00139 /* Frequency parameters. */ 00140 MKEnvelope *freqEnv;/* the Envelope object for frequency */ 00141 double freq1, /* frequency scaler */ 00142 freq0, /* frequency offset */ 00143 freqAtt, /* freqEnv attack duration in seconds */ 00144 freqRel; /* freqEnv release duration in seconds */ 00145 00146 /* Waveshaping index Parameters. */ 00147 MKEnvelope *indEnv; /* the Envelope for the index */ 00148 double indAtt, /* indEnv attack duration in seconds */ 00149 indRel; /* indEnv release duration in seconds */ 00150 double m1Ind0, m1Ind1; /* Effective index must be between 0 and 1 */ 00151 00152 /* Other parameters. */ 00153 double portamento; /* transition time in seconds */ 00154 double bearing; /* stereo location */ 00155 00156 id table; /* The waveshaping table itself */ 00157 MKWaveTable *tableInfo; /* Description of table */ 00158 00159 double phase; /* Initial phase of osc */ 00160 00161 double velocitySensitivity; /* Sensitivity to velocity. Scale of 0 to 1 */ 00162 double pitchbendSensitivity; /* Sensitivity to pitchBend in semitones. */ 00163 00164 id waveform; /* Wavetable for oscillator */ 00165 int wavelen; /* Length of wavetable */ 00166 int velocity; /* MIDI velocity. Boosts or attenuates amplitude. */ 00167 int pitchbend; /* MIDI pitchBend. Raises or lowers pitch. */ 00168 int volume; /* MIDI volume pedal. Anything less than full pedal 00169 functions as an attenuation. */ 00170 double bright; /* A multiplier on index */ 00171 00172 /* Store unit generators in instance variables for convenience in 00173 * subclassing 00174 */ 00175 id freqAsymp,indAsymp,osc,tab,mul,ampAsymp,ampPp,stereoOut,ySig,xSig; 00176 } 00177 00178 00186 + patchTemplateFor: (MKNote *) aNote; 00187 00195 - noteOnSelf: (MKNote *) aNote; 00196 00204 - noteUpdateSelf: (MKNote *) aNote; 00205 00213 - (double)noteOffSelf: (MKNote *) aNote; 00214 00221 - noteEndSelf; 00222 00230 - preemptFor: (MKNote *) aNote; 00231 - init; 00232 00233 /* These methods are used by the subclass */ 00234 -_setDefaults; 00235 -_initUGvars; 00236 - _applyParameters:aNote; 00237 00238 @end 00239 00240 #endif