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

Diff of /linuxsampler/trunk/src/engines/common/AbstractVoice.h

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

revision 2015 by iliev, Sun Oct 25 22:22:52 2009 UTC revision 2175 by persson, Mon Apr 25 08:12:36 2011 UTC
# Line 3  Line 3 
3   *   LinuxSampler - modular, streaming capable sampler                     *   *   LinuxSampler - modular, streaming capable sampler                     *
4   *                                                                         *   *                                                                         *
5   *   Copyright (C) 2003,2004 by Benno Senoner and Christian Schoenebeck    *   *   Copyright (C) 2003,2004 by Benno Senoner and Christian Schoenebeck    *
6   *   Copyright (C) 2005-2009 Christian Schoenebeck                         *   *   Copyright (C) 2005-2008 Christian Schoenebeck                         *
7   *   Copyright (C) 2009 Grigor Iliev                                       *   *   Copyright (C) 2009-2011 Christian Schoenebeck and Grigor Iliev        *
8   *                                                                         *   *                                                                         *
9   *   This program is free software; you can redistribute it and/or modify  *   *   This program is free software; you can redistribute it and/or modify  *
10   *   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 23  Line 23 
23   ***************************************************************************/   ***************************************************************************/
24    
25  #ifndef __LS_ABSTRACTVOICE_H__  #ifndef __LS_ABSTRACTVOICE_H__
26  #define __LS_ABSTRACTVOICE_H__  #define __LS_ABSTRACTVOICE_H__
27    
28  #include "Voice.h"  #include "Voice.h"
29    
# Line 31  Line 31 
31  #include "../AbstractEngineChannel.h"  #include "../AbstractEngineChannel.h"
32  #include "../common/LFOBase.h"  #include "../common/LFOBase.h"
33  #include "../EngineBase.h"  #include "../EngineBase.h"
34    #include "EG.h"
35  #include "../gig/EGADSR.h"  #include "../gig/EGADSR.h"
36  #include "../gig/EGDecay.h"  #include "../gig/EGDecay.h"
37  #include "../gig/SmoothVolume.h"  #include "../gig/SmoothVolume.h"
# Line 79  namespace LinuxSampler { Line 80  namespace LinuxSampler {
80    
81      class AbstractVoice : public Voice {      class AbstractVoice : public Voice {
82          public:          public:
83              type_t       Type;         ///< Voice Type              type_t       Type;         ///< Voice Type (bit field, a voice may have several types)
84              int          MIDIKey;      ///< MIDI key number of the key that triggered the voice              int          MIDIKey;      ///< MIDI key number of the key that triggered the voice
             uint         KeyGroup;  
85    
86              AbstractVoice();              AbstractVoice();
87              virtual ~AbstractVoice();              virtual ~AbstractVoice();
# Line 105  namespace LinuxSampler { Line 105  namespace LinuxSampler {
105              void processPitchEvent(RTList<Event>::Iterator& itEvent);              void processPitchEvent(RTList<Event>::Iterator& itEvent);
106              void processResonanceEvent(RTList<Event>::Iterator& itEvent);              void processResonanceEvent(RTList<Event>::Iterator& itEvent);
107              void processTransitionEvents(RTList<Event>::Iterator& itEvent, uint End);              void processTransitionEvents(RTList<Event>::Iterator& itEvent, uint End);
108                void processGroupEvents(RTList<Event>::Iterator& itEvent, uint End);
109              void UpdatePortamentoPos(Pool<Event>::Iterator& itNoteOffEvent);              void UpdatePortamentoPos(Pool<Event>::Iterator& itNoteOffEvent);
110              void Kill(Pool<Event>::Iterator& itKillEvent);              void Kill(Pool<Event>::Iterator& itKillEvent);
111    
# Line 133  namespace LinuxSampler { Line 134  namespace LinuxSampler {
134              bool                        RAMLoop;            ///< If this voice has a loop defined which completely fits into the cached RAM part of the sample, in this case we handle the looping within the voice class, else if the loop is located in the disk stream part, we let the disk stream handle the looping              bool                        RAMLoop;            ///< If this voice has a loop defined which completely fits into the cached RAM part of the sample, in this case we handle the looping within the voice class, else if the loop is located in the disk stream part, we let the disk stream handle the looping
135              unsigned long               MaxRAMPos;          ///< The upper allowed limit (not actually the end) in the RAM sample cache, after that point it's not safe to chase the interpolator another time over over the current cache position, instead we switch to disk then.              unsigned long               MaxRAMPos;          ///< The upper allowed limit (not actually the end) in the RAM sample cache, after that point it's not safe to chase the interpolator another time over over the current cache position, instead we switch to disk then.
136              uint                        Delay;              ///< Number of sample points the rendering process of this voice should be delayed (jitter correction), will be set to 0 after the first audio fragment cycle              uint                        Delay;              ///< Number of sample points the rendering process of this voice should be delayed (jitter correction), will be set to 0 after the first audio fragment cycle
137              gig::EGADSR                 EG1;                ///< Envelope Generator 1 (Amplification)              EG*                         pEG1;               ///< Envelope Generator 1 (Amplification)
138              gig::EGADSR                 EG2;                ///< Envelope Generator 2 (Filter cutoff frequency)              EG*                         pEG2;               ///< Envelope Generator 2 (Filter cutoff frequency)
139              gig::EGDecay                EG3;                ///< Envelope Generator 3 (Pitch)              gig::EGDecay                EG3;                ///< Envelope Generator 3 (Pitch) TODO: use common EG instead?
140              midi_ctrl                   VCFCutoffCtrl;              midi_ctrl                   VCFCutoffCtrl;
141              midi_ctrl                   VCFResonanceCtrl;              midi_ctrl                   VCFResonanceCtrl;
142              LFOUnsigned*                pLFO1;               ///< Low Frequency Oscillator 1 (Amplification)              LFOUnsigned*                pLFO1;               ///< Low Frequency Oscillator 1 (Amplification)
# Line 151  namespace LinuxSampler { Line 152  namespace LinuxSampler {
152              float                       fFinalResonance;              float                       fFinalResonance;
153              gig::SynthesisParam         finalSynthesisParameters;              gig::SynthesisParam         finalSynthesisParameters;
154              gig::Loop                   loop;              gig::Loop                   loop;
155                RTList<Event>*              pGroupEvents;        ///< Events directed to an exclusive group
156    
157              virtual AbstractEngine* GetEngine() = 0;              virtual AbstractEngine* GetEngine() = 0;
158              virtual SampleInfo      GetSampleInfo() = 0;              virtual SampleInfo      GetSampleInfo() = 0;
# Line 180  namespace LinuxSampler { Line 181  namespace LinuxSampler {
181    
182              virtual double CalculateVolume(double velocityAttenuation);              virtual double CalculateVolume(double velocityAttenuation);
183    
184                virtual float GetReleaseTriggerAttenuation(float noteLength);
185    
186              /**              /**
187               * Get starting crossfade volume level               * Get starting crossfade volume level
188               */               */
189              virtual double CalculateCrossfadeVolume(uint8_t MIDIKeyVelocity) = 0;              virtual double CalculateCrossfadeVolume(uint8_t MIDIKeyVelocity) = 0;
190    
191                virtual MidiKeyBase* GetMidiKeyInfo(int MIDIKey) = 0;
192    
193              virtual int   OrderNewStream() = 0;              virtual int   OrderNewStream() = 0;
194    
195              virtual PitchInfo CalculatePitchInfo(int PitchBend);              virtual PitchInfo CalculatePitchInfo(int PitchBend);
196    
197                // TODO: cleanup the interface. The following two methods
198                // are maybe not neccessary after the TriggerEG1 method
199                // was added.
200    
201              /**              /**
202               * Get current value of EG1 controller.               * Get current value of EG1 controller.
203               */               */
# Line 199  namespace LinuxSampler { Line 208  namespace LinuxSampler {
208               */               */
209              virtual EGInfo CalculateEG1ControllerInfluence(double eg1ControllerValue) = 0;              virtual EGInfo CalculateEG1ControllerInfluence(double eg1ControllerValue) = 0;
210    
211                // TODO: cleanup the interface. The velrelase and
212                // velocityAttenuation parameters are perhaps too gig
213                // specific.
214                /**
215                 * Trigger the amplitude envelope generator.
216                 */
217                virtual void TriggerEG1(const EGInfo& egInfo, double velrelease, double velocityAttenuation, uint sampleRate, uint8_t velocity) = 0;
218    
219              /**              /**
220               * Get current value of EG2 controller.               * Get current value of EG2 controller.
221               */               */
# Line 209  namespace LinuxSampler { Line 226  namespace LinuxSampler {
226               */               */
227              virtual EGInfo CalculateEG2ControllerInfluence(double eg2ControllerValue) = 0;              virtual EGInfo CalculateEG2ControllerInfluence(double eg2ControllerValue) = 0;
228    
229                virtual void TriggerEG2(const EGInfo& egInfo, double velrelease, double velocityAttenuation, uint sampleRate, uint8_t velocity) = 0;
230    
231              virtual float CalculateCutoffBase(uint8_t MIDIKeyVelocity) = 0;              virtual float CalculateCutoffBase(uint8_t MIDIKeyVelocity) = 0;
232              virtual float CalculateFinalCutoff(float cutoffBase) = 0;              virtual float CalculateFinalCutoff(float cutoffBase) = 0;
233    
# Line 226  namespace LinuxSampler { Line 245  namespace LinuxSampler {
245              virtual double  GetVelocityRelease(uint8_t MIDIKeyVelocity) = 0;              virtual double  GetVelocityRelease(uint8_t MIDIKeyVelocity) = 0;
246    
247              virtual unsigned long GetNoteOnTime(int MIDIKey) = 0;              virtual unsigned long GetNoteOnTime(int MIDIKey) = 0;
248    
249                virtual void    ProcessGroupEvent(RTList<Event>::Iterator& itEvent) = 0;
250                void            EnterReleaseStage();
251      };      };
252  } // namespace LinuxSampler  } // namespace LinuxSampler
253    
254  #endif  /* __LS_ABSTRACTVOICE_H__ */  #endif  /* __LS_ABSTRACTVOICE_H__ */

Legend:
Removed from v.2015  
changed lines
  Added in v.2175

  ViewVC Help
Powered by ViewVC