/[svn]/linuxsampler/trunk/src/engines/sfz/sfz.h
ViewVC logotype

Diff of /linuxsampler/trunk/src/engines/sfz/sfz.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2021 by iliev, Fri Oct 30 16:36:20 2009 UTC revision 2072 by persson, Sat Mar 20 11:37:52 2010 UTC
# Line 2  Line 2 
2   *                                                                         *   *                                                                         *
3   *   LinuxSampler - modular, streaming capable sampler                     *   *   LinuxSampler - modular, streaming capable sampler                     *
4   *                                                                         *   *                                                                         *
5   *   Copyright (C) 2008-2009 Anders Dahnielson <anders@dahnielson.com>     *   *   Copyright (C) 2008 Anders Dahnielson <anders@dahnielson.com>          *
6   *   Copyright (C) 2009 Grigor Iliev                                       *   *   Copyright (C) 2009 - 2010 Anders Dahnielson and Grigor Iliev          *
7   *                                                                         *   *                                                                         *
8   *   This program is free software; you can redistribute it and/or modify  *   *   This program is free software; you can redistribute it and/or modify  *
9   *   it under the terms of the GNU General Public License as published by  *   *   it under the terms of the GNU General Public License as published by  *
# Line 32  Line 32 
32    
33  #include "../common/SampleFile.h"  #include "../common/SampleFile.h"
34  #include "../common/SampleManager.h"  #include "../common/SampleManager.h"
35    #include "../../common/ArrayList.h"
36    
37  #define TRIGGER_ATTACK  ((unsigned char) (1 << 0)) // 0x01  #define TRIGGER_ATTACK  ((unsigned char) (1 << 0)) // 0x01
38  #define TRIGGER_RELEASE ((unsigned char) (1 << 1)) // 0x02  #define TRIGGER_RELEASE ((unsigned char) (1 << 1)) // 0x02
39  #define TRIGGER_FIRST   ((unsigned char) (1 << 2)) // 0x04  #define TRIGGER_FIRST   ((unsigned char) (1 << 2)) // 0x04
40  #define TRIGGER_LEGATO  ((unsigned char) (1 << 3)) // 0x08  #define TRIGGER_LEGATO  ((unsigned char) (1 << 3)) // 0x08
41    
42  namespace sfz  namespace sfz
43  {  {
44      // Forward declarations      // Forward declarations
45      class Articulation;      class Articulation;
# Line 46  namespace sfz Line 47  namespace sfz
47      class Group;      class Group;
48      class Instrument;      class Instrument;
49      class File;      class File;
50        
51      class Sample : public LinuxSampler::SampleFileBase<Region> {      class Sample : public LinuxSampler::SampleFileBase<Region> {
52          public:          public:
53              Sample(String File, bool DontClose = false) : LinuxSampler::SampleFileBase<Region>(File, DontClose) { }              Sample(String File, bool DontClose = false) : LinuxSampler::SampleFileBase<Region>(File, DontClose) { }
# Line 214  namespace sfz Line 215  namespace sfz
215          virtual ~Articulation();          virtual ~Articulation();
216      };      };
217    
218        class EGNode
219        {
220        public:
221            float time;
222            float level;
223            float shape;
224            float curve;
225            EGNode();
226        };
227    
228        class EG
229        {
230        public:
231            LinuxSampler::ArrayList<EGNode> node;
232            int sustain;
233            int loop;
234            int loop_count;
235            float amplitude;
236            float cutoff;
237            EG();
238        };
239    
240      /////////////////////////////////////////////////////////////      /////////////////////////////////////////////////////////////
241      // class Definition      // class Definition
242    
# Line 255  namespace sfz Line 278  namespace sfz
278    
279          trigger_t trigger;          trigger_t trigger;
280    
281          optional<int> group;          uint group;
282          optional<int> off_by;          optional<int> off_by;
283          off_mode_t off_mode;          off_mode_t off_mode;
284    
# Line 331  namespace sfz Line 354  namespace sfz
354          float ampeg_delay, ampeg_start, ampeg_attack, ampeg_hold, ampeg_decay, ampeg_sustain, ampeg_release;          float ampeg_delay, ampeg_start, ampeg_attack, ampeg_hold, ampeg_decay, ampeg_sustain, ampeg_release;
355          float fileg_delay, fileg_start, fileg_attack, fileg_hold, fileg_decay, fileg_sustain, fileg_release;          float fileg_delay, fileg_start, fileg_attack, fileg_hold, fileg_decay, fileg_sustain, fileg_release;
356          float pitcheg_delay, pitcheg_start, pitcheg_attack, pitcheg_hold, pitcheg_decay, pitcheg_sustain, pitcheg_release;          float pitcheg_delay, pitcheg_start, pitcheg_attack, pitcheg_hold, pitcheg_decay, pitcheg_sustain, pitcheg_release;
357            float amplfo_delay, amplfo_fade, amplfo_freq, amplfo_depth;
358            float fillfo_delay, fillfo_fade, fillfo_freq, fillfo_depth;
359            float pitchlfo_delay, pitchlfo_fade, pitchlfo_freq;
360            int pitchlfo_depth;
361    
362            // envelope generators
363            LinuxSampler::ArrayList<EG> eg;
364      };      };
365    
366      /////////////////////////////////////////////////////////////      /////////////////////////////////////////////////////////////
# Line 361  namespace sfz Line 391  namespace sfz
391          bool OnKey(uint8_t chan, uint8_t key, uint8_t vel,          bool OnKey(uint8_t chan, uint8_t key, uint8_t vel,
392                 int bend, uint8_t bpm, uint8_t chanaft, uint8_t polyaft,                 int bend, uint8_t bpm, uint8_t chanaft, uint8_t polyaft,
393                 uint8_t prog, float rand, trigger_t trig, uint8_t* cc,                 uint8_t prog, float rand, trigger_t trig, uint8_t* cc,
394                 float timer, uint8_t seq, bool* sw, uint8_t last_sw_key, uint8_t prev_sw_key);                 float timer, bool* sw, uint8_t last_sw_key, uint8_t prev_sw_key);
395    
396          /// Return true if region is triggered by control change          /// Return true if region is triggered by control change
397          bool OnControl(uint8_t chan, uint8_t cont, uint8_t val,          bool OnControl(uint8_t chan, uint8_t cont, uint8_t val,
398                     int bend, uint8_t bpm, uint8_t chanaft, uint8_t polyaft,                     int bend, uint8_t bpm, uint8_t chanaft, uint8_t polyaft,
399                     uint8_t prog, float rand, trigger_t trig, uint8_t* cc,                     uint8_t prog, float rand, trigger_t trig, uint8_t* cc,
400                     float timer, uint8_t seq, bool* sw, uint8_t last_sw_key, uint8_t prev_sw_key);                     float timer, bool* sw, uint8_t last_sw_key, uint8_t prev_sw_key);
401    
402          /// Return an articulation for the current state          /// Return an articulation for the current state
403           Articulation* GetArticulation(int bend, uint8_t bpm, uint8_t chanaft, uint8_t polyaft, uint8_t* cc);           Articulation* GetArticulation(int bend, uint8_t bpm, uint8_t chanaft, uint8_t polyaft, uint8_t* cc);
# Line 377  namespace sfz Line 407  namespace sfz
407    
408      private:      private:
409          Instrument* pInstrument;          Instrument* pInstrument;
410            int seq_counter;
411      };      };
412    
413      /////////////////////////////////////////////////////////////      /////////////////////////////////////////////////////////////
# Line 399  namespace sfz Line 430  namespace sfz
430              uint8_t chan, uint8_t key, uint8_t vel,              uint8_t chan, uint8_t key, uint8_t vel,
431              int bend, uint8_t bpm, uint8_t chanaft, uint8_t polyaft,              int bend, uint8_t bpm, uint8_t chanaft, uint8_t polyaft,
432              uint8_t prog, float rand, trigger_t trig, uint8_t* cc,              uint8_t prog, float rand, trigger_t trig, uint8_t* cc,
433              float timer, uint8_t seq, bool* sw, uint8_t last_sw_key, uint8_t prev_sw_key              float timer, bool* sw, uint8_t last_sw_key, uint8_t prev_sw_key
434          );          );
435    
436          bool DestroyRegion(Region* pRegion);          bool DestroyRegion(Region* pRegion);
# Line 457  namespace sfz Line 488  namespace sfz
488      private:      private:
489          void  push_header(std::string token);          void  push_header(std::string token);
490          void  push_opcode(std::string token);          void  push_opcode(std::string token);
491          int   parseInt(std::string value);          int parseKey(const std::string& value);
492          float parseFloat(std::string value);          EG& eg(int x);
493            EGNode& egnode(int x, int y);
494    
495          std::string currentDir;          std::string currentDir;
496          /// Pointer to the Instrument belonging to this file          /// Pointer to the Instrument belonging to this file

Legend:
Removed from v.2021  
changed lines
  Added in v.2072

  ViewVC Help
Powered by ViewVC