--- linuxsampler/trunk/src/engines/sfz/sfz.h 2011/07/28 08:05:57 2218 +++ linuxsampler/trunk/src/engines/sfz/sfz.h 2011/08/05 17:59:10 2230 @@ -83,6 +83,28 @@ pSample->Close(); } }; + + class CC { + public: + uint8_t Controller; ///< MIDI controller number. + short int Curve; + float Influence; ///< Controller Value. + + CC(uint8_t Controller = 0, float Influence = 0.0f, short int Curve = -1) { + this->Controller = Controller; + this->Influence = Influence; + this->Curve = Curve; + } + + CC(const CC& cc) { Copy(cc); } + void operator=(const CC& cc) { Copy(cc); } + + void Copy(const CC& cc) { + Controller = cc.Controller; + Influence = cc.Influence; + Curve = cc.Curve; + } + }; ///////////////////////////////////////////////////////////// // class Exception @@ -225,7 +247,13 @@ float level; float shape; float curve; + LinuxSampler::ArrayList time_oncc; + LinuxSampler::ArrayList level_oncc; + EGNode(); + EGNode(const EGNode& egNode) { Copy(egNode); } + void operator=(const EGNode& egNode) { Copy(egNode); } + void Copy(const EGNode& egNode); }; class EG @@ -238,19 +266,34 @@ float amplitude; float cutoff; EG(); + EG(const EG& eg) { Copy(eg); } + void operator=(const EG& eg) { Copy(eg); } + void Copy(const EG& eg); }; class LFO { public: + float delay; // 0 to 100 seconds float freq; // 0 to 20 Hz + float fade; // 0 to 100 seconds + float phase; // 0 to 360 degrees uint wave; // 0 to 4294967296 - float delay; // 0 to 100 seconds + float volume; // -144 to 6 dB int pitch; // -9600 to 9600 cents int cutoff; // -9600 to 9600 cents float resonance; // 0 to 40 dB float pan; // -100 to 100 % + + LinuxSampler::ArrayList freq_oncc; // 0 to 20 Hz + LinuxSampler::ArrayList fade_oncc; // 0 to 100 seconds + LinuxSampler::ArrayList phase_oncc; // 0 to 360 degrees + LinuxSampler::ArrayList pitch_oncc; + LFO(); + LFO(const LFO& lfo) { Copy(lfo); } + void operator=(const LFO& lfo) { Copy(lfo); } + void Copy(const LFO& lfo); }; // Fixed size array with copy-on-write semantics @@ -412,18 +455,31 @@ //Deprecated (from version 1) float ampeg_delay, ampeg_start, ampeg_attack, ampeg_hold, ampeg_decay, ampeg_sustain, ampeg_release; float ampeg_vel2delay, ampeg_vel2attack, ampeg_vel2hold, ampeg_vel2decay, ampeg_vel2sustain, ampeg_vel2release; + LinuxSampler::ArrayList ampeg_delaycc, ampeg_startcc, ampeg_attackcc, ampeg_holdcc; + LinuxSampler::ArrayList ampeg_decaycc, ampeg_sustaincc, ampeg_releasecc; float fileg_delay, fileg_start, fileg_attack, fileg_hold, fileg_decay, fileg_sustain, fileg_release; + float fileg_vel2delay, fileg_vel2attack, fileg_vel2hold, fileg_vel2decay, fileg_vel2sustain, fileg_vel2release; float pitcheg_delay, pitcheg_start, pitcheg_attack, pitcheg_hold, pitcheg_decay, pitcheg_sustain, pitcheg_release; + float pitcheg_vel2delay, pitcheg_vel2attack, pitcheg_vel2hold, pitcheg_vel2decay, pitcheg_vel2sustain, pitcheg_vel2release; + int fileg_depth, pitcheg_depth; float amplfo_delay, amplfo_fade, amplfo_freq, amplfo_depth; float fillfo_delay, fillfo_fade, fillfo_freq, fillfo_depth; float pitchlfo_delay, pitchlfo_fade, pitchlfo_freq; int pitchlfo_depth; + Array pitchlfo_depthcc; + + LinuxSampler::ArrayList pitchlfo_freqcc; // 0 to 20 Hz + LinuxSampler::ArrayList fillfo_freqcc; // 0 to 20 Hz + LinuxSampler::ArrayList amplfo_freqcc; // 0 to 20 Hz // envelope generators LinuxSampler::ArrayList eg; // low frequency oscillators LinuxSampler::ArrayList lfos; + + LinuxSampler::ArrayList volume_oncc; + LinuxSampler::ArrayList volume_curvecc; // used only as temporary buffer during the parsing - values are then moved to volume_oncc }; class Query { @@ -490,6 +546,15 @@ Instrument* pInstrument; int seq_counter; }; + + class Curve { + public: + float v[128]; + Curve() { for (int i = 0; i < 128; i++) v[i] = 0; } + Curve(const Curve& curve) { Copy(curve); } + void operator=(const Curve& curve) { Copy(curve); } + void Copy(const Curve& curve) { for (int i = 0; i < 128; i++) v[i] = curve.v[i]; } + }; ///////////////////////////////////////////////////////////// // class Instrument @@ -510,6 +575,7 @@ /// List of Regions belonging to this Instrument std::vector regions; + ::LinuxSampler::ArrayList curves; friend class File; friend class Query; @@ -566,16 +632,18 @@ EG& eg(int x); EGNode& egnode(int x, int y); LFO& lfo(int x); + void copyCurves(LinuxSampler::ArrayList& curves, LinuxSampler::ArrayList& dest); std::string currentDir; /// Pointer to the Instrument belonging to this file Instrument* _instrument; // state variables - enum section_t { UNKNOWN, GROUP, REGION, CONTROL }; + enum section_t { UNKNOWN, GROUP, REGION, CONTROL, CURVE }; section_t _current_section; Region* _current_region; Group* _current_group; + Curve* _current_curve; Definition* pCurDef; // control header directives