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

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

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

revision 2427 by persson, Sat Mar 2 07:03:04 2013 UTC revision 2879 by schoenebeck, Tue Apr 19 14:07:53 2016 UTC
# Line 31  Line 31 
31  #include "../common/ConditionServer.h"  #include "../common/ConditionServer.h"
32  #include "../common/Pool.h"  #include "../common/Pool.h"
33  #include "../common/RingBuffer.h"  #include "../common/RingBuffer.h"
34    #include "../common/ChangeFlagRelaxed.h"
35    #include "../common/ResourceManager.h"
36  #include "../drivers/audio/AudioOutputDevice.h"  #include "../drivers/audio/AudioOutputDevice.h"
37  #include "common/Event.h"  #include "common/Event.h"
38    #include "common/Note.h"
39  #include "common/SignalUnitRack.h"  #include "common/SignalUnitRack.h"
40    #include "common/InstrumentScriptVM.h"
41    
42  namespace LinuxSampler {  namespace LinuxSampler {
43    
# Line 51  namespace LinuxSampler { Line 55  namespace LinuxSampler {
55              virtual ~AbstractEngine();              virtual ~AbstractEngine();
56    
57              // implementation of abstract methods derived from class 'LinuxSampler::Engine'              // implementation of abstract methods derived from class 'LinuxSampler::Engine'
58              virtual void   SendSysex(void* pData, uint Size, MidiInputPort* pSender);              virtual void   SendSysex(void* pData, uint Size, MidiInputPort* pSender) OVERRIDE;
59              virtual void   Reset();              virtual void   Reset() OVERRIDE;
60              virtual void   Enable();              virtual void   Enable() OVERRIDE;
61              virtual void   Disable();              virtual void   Disable() OVERRIDE;
62              virtual uint   VoiceCount();              virtual uint   VoiceCount() OVERRIDE;
63              virtual uint   VoiceCountMax();              virtual uint   VoiceCountMax() OVERRIDE;
64              virtual String EngineName();              virtual String EngineName() OVERRIDE;
65                virtual void   AdjustScaleTuning(const int8_t ScaleTunes[12]) OVERRIDE;
66                virtual void   GetScaleTuning(int8_t* pScaleTunes) OVERRIDE;
67                virtual void   ResetScaleTuning() OVERRIDE;
68    
69              virtual Format GetEngineFormat() = 0;              virtual Format GetEngineFormat() = 0;
70              virtual void   Connect(AudioOutputDevice* pAudioOut) = 0;              virtual void   Connect(AudioOutputDevice* pAudioOut) = 0;
# Line 65  namespace LinuxSampler { Line 72  namespace LinuxSampler {
72    
73              void SetVoiceCount(uint Count);              void SetVoiceCount(uint Count);
74    
75                /**
76                 * Returns event with the given event ID.
77                 */
78                RTList<Event>::Iterator EventByID(event_id_t id) {
79                    return pEventPool->fromID(id);
80                }
81    
82                virtual NoteBase* NoteByID(note_id_t id) = 0;
83    
84              float Random() {              float Random() {
85                  RandomSeed = RandomSeed * 1103515245 + 12345; // classic pseudo random number generator                  RandomSeed = RandomSeed * 1103515245 + 12345; // classic pseudo random number generator
86                  return RandomSeed / 4294967296.0f;                  return RandomSeed / 4294967296.0f;
# Line 96  namespace LinuxSampler { Line 112  namespace LinuxSampler {
112              template<class V, class R, class I> friend class EngineChannelBase;              template<class V, class R, class I> friend class EngineChannelBase;
113              template<class EC, class R, class S, class D> friend class VoiceBase;              template<class EC, class R, class S, class D> friend class VoiceBase;
114    
115          protected:          //protected:
116              ArrayList<EngineChannel*>  engineChannels; ///< All engine channels of a Engine instance.              ArrayList<EngineChannel*>  engineChannels; ///< All engine channels of a Engine instance.
117              ConditionServer            EngineDisabled;              ConditionServer            EngineDisabled;
118              int8_t                     ScaleTuning[12];    ///< contains optional detune factors (-64..+63 cents) for all 12 semitones of an octave              int8_t                     ScaleTuning[12];    ///< contains optional detune factors (-64..+63 cents) for all 12 semitones of an octave
119                ChangeFlagRelaxed          ScaleTuningChanged; ///< Boolean flag indicating whenever ScaleTuning has been modified by a foreign thread (i.e. by API).
120              RingBuffer<Event,false>*   pEventQueue;        ///< Input event queue for engine global events (e.g. SysEx messages).              RingBuffer<Event,false>*   pEventQueue;        ///< Input event queue for engine global events (e.g. SysEx messages).
121              EventGenerator*            pEventGenerator;              EventGenerator*            pEventGenerator;
122              RTList<Event>*             pGlobalEvents;         ///< All engine global events for the current audio fragment (usually only SysEx messages).              RTList<Event>*             pGlobalEvents;         ///< All engine global events for the current audio fragment (usually only SysEx messages).
# Line 111  namespace LinuxSampler { Line 128  namespace LinuxSampler {
128              int                        ActiveVoiceCountMax;   ///< the maximum voice usage since application start              int                        ActiveVoiceCountMax;   ///< the maximum voice usage since application start
129              atomic_t                   ActiveVoiceCount;      ///< number of currently active voices              atomic_t                   ActiveVoiceCount;      ///< number of currently active voices
130              int                        VoiceSpawnsLeft;       ///< We only allow CONFIG_MAX_VOICES voices to be spawned per audio fragment, we use this variable to ensure this limit.              int                        VoiceSpawnsLeft;       ///< We only allow CONFIG_MAX_VOICES voices to be spawned per audio fragment, we use this variable to ensure this limit.
131                InstrumentScriptVM*        pScriptVM; ///< Real-time instrument script virtual machine runner for this engine.
132    
133              void RouteAudio(EngineChannel* pEngineChannel, uint Samples);              void RouteAudio(EngineChannel* pEngineChannel, uint Samples);
134              void RouteDedicatedVoiceChannels(EngineChannel* pEngineChannel, optional<float> FxSendLevels[2], uint Samples);              void RouteDedicatedVoiceChannels(EngineChannel* pEngineChannel, optional<float> FxSendLevels[2], uint Samples);
135              void ClearEventLists();              void ClearEventLists();
136              void ImportEvents(uint Samples);              void ImportEvents(uint Samples);
137              void ProcessSysex(Pool<Event>::Iterator& itSysexEvent);              void ProcessSysex(Pool<Event>::Iterator& itSysexEvent);
             void ResetScaleTuning();  
138              void ProcessPitchbend(AbstractEngineChannel* pEngineChannel, Pool<Event>::Iterator& itPitchbendEvent);              void ProcessPitchbend(AbstractEngineChannel* pEngineChannel, Pool<Event>::Iterator& itPitchbendEvent);
139    
140              void ProcessFxSendControllers (              void ProcessFxSendControllers (
# Line 132  namespace LinuxSampler { Line 149  namespace LinuxSampler {
149              virtual void ProcessNoteOn(EngineChannel* pEngineChannel, Pool<Event>::Iterator& itNoteOnEvent) = 0;              virtual void ProcessNoteOn(EngineChannel* pEngineChannel, Pool<Event>::Iterator& itNoteOnEvent) = 0;
150              virtual void ProcessNoteOff(EngineChannel* pEngineChannel, Pool<Event>::Iterator& itNoteOffEvent) = 0;              virtual void ProcessNoteOff(EngineChannel* pEngineChannel, Pool<Event>::Iterator& itNoteOffEvent) = 0;
151              virtual void ProcessControlChange(EngineChannel* pEngineChannel, Pool<Event>::Iterator& itControlChangeEvent) = 0;              virtual void ProcessControlChange(EngineChannel* pEngineChannel, Pool<Event>::Iterator& itControlChangeEvent) = 0;
152                virtual void ProcessChannelPressure(EngineChannel* pEngineChannel, Pool<Event>::Iterator& itChannelPressureEvent) = 0;
153                virtual void ProcessPolyphonicKeyPressure(EngineChannel* pEngineChannel, Pool<Event>::Iterator& itNotePressureEvent) = 0;
154              virtual int  GetMinFadeOutSamples() = 0;              virtual int  GetMinFadeOutSamples() = 0;
155                virtual note_id_t LaunchNewNote(LinuxSampler::EngineChannel* pEngineChannel, Event* pNoteOnEvent) = 0;
156                virtual void CreateInstrumentScriptVM();
157    
158          private:          private:
159              static std::map<Format, std::map<AudioOutputDevice*,AbstractEngine*> > engines;              static std::map<Format, std::map<AudioOutputDevice*,AbstractEngine*> > engines;
# Line 143  namespace LinuxSampler { Line 164  namespace LinuxSampler {
164              static float* InitCrossfadeCurve();              static float* InitCrossfadeCurve();
165              static float* InitCurve(const float* segments, int size = 128);              static float* InitCurve(const float* segments, int size = 128);
166    
             void AdjustScale(int8_t ScaleTunes[12]);  
167              bool RouteFxSend(FxSend* pFxSend, AudioChannel* ppSource[2], float FxSendLevel, uint Samples);              bool RouteFxSend(FxSend* pFxSend, AudioChannel* ppSource[2], float FxSendLevel, uint Samples);
168      };      };
169    

Legend:
Removed from v.2427  
changed lines
  Added in v.2879

  ViewVC Help
Powered by ViewVC