/[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 2297 by iliev, Fri Dec 9 15:04:55 2011 UTC revision 2559 by schoenebeck, Sun May 18 17:38:25 2014 UTC
# Line 4  Line 4 
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-2008 Christian Schoenebeck                         *   *   Copyright (C) 2005-2008 Christian Schoenebeck                         *
7   *   Copyright (C) 2009-2010 Christian Schoenebeck and Grigor Iliev        *   *   Copyright (C) 2009-2013 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 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 "../drivers/audio/AudioOutputDevice.h"  #include "../drivers/audio/AudioOutputDevice.h"
36  #include "common/Event.h"  #include "common/Event.h"
37  #include "common/SignalUnitRack.h"  #include "common/SignalUnitRack.h"
# Line 51  namespace LinuxSampler { Line 52  namespace LinuxSampler {
52              virtual ~AbstractEngine();              virtual ~AbstractEngine();
53    
54              // implementation of abstract methods derived from class 'LinuxSampler::Engine'              // implementation of abstract methods derived from class 'LinuxSampler::Engine'
55              virtual void   SendSysex(void* pData, uint Size, MidiInputPort* pSender);              virtual void   SendSysex(void* pData, uint Size, MidiInputPort* pSender) OVERRIDE;
56              virtual void   Reset();              virtual void   Reset() OVERRIDE;
57              virtual void   Enable();              virtual void   Enable() OVERRIDE;
58              virtual void   Disable();              virtual void   Disable() OVERRIDE;
59              virtual uint   VoiceCount();              virtual uint   VoiceCount() OVERRIDE;
60              virtual uint   VoiceCountMax();              virtual uint   VoiceCountMax() OVERRIDE;
61              virtual String EngineName();              virtual String EngineName() OVERRIDE;
62                virtual void   AdjustScaleTuning(const int8_t ScaleTunes[12]) OVERRIDE;
63                virtual void   GetScaleTuning(int8_t* pScaleTunes) OVERRIDE;
64                virtual void   ResetScaleTuning() OVERRIDE;
65    
66              virtual Format GetEngineFormat() = 0;              virtual Format GetEngineFormat() = 0;
67              virtual void   Connect(AudioOutputDevice* pAudioOut) = 0;              virtual void   Connect(AudioOutputDevice* pAudioOut) = 0;
68              virtual void   DisableAndLock();              virtual void   DisableAndLock();
69    
70              void SetVoiceCount(uint Count);// Simple array wrapper just to make sure memory is freed              void SetVoiceCount(uint Count);
             // when liblinuxsampler is unloaded  
71    
72              float Random() {              float Random() {
73                  RandomSeed = RandomSeed * 1103515245 + 12345; // classic pseudo random number generator                  RandomSeed = RandomSeed * 1103515245 + 12345; // classic pseudo random number generator
74                  return RandomSeed / 4294967296.0f;                  return RandomSeed / 4294967296.0f;
75              }              }
76                
77                // Simple array wrapper just to make sure memory is freed
78                // when liblinuxsampler is unloaded
79              class FloatTable {              class FloatTable {
80              private:              private:
81                  const float* array;                  const float* array;
# Line 99  namespace LinuxSampler { Line 104  namespace LinuxSampler {
104              ArrayList<EngineChannel*>  engineChannels; ///< All engine channels of a Engine instance.              ArrayList<EngineChannel*>  engineChannels; ///< All engine channels of a Engine instance.
105              ConditionServer            EngineDisabled;              ConditionServer            EngineDisabled;
106              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
107                ChangeFlagRelaxed          ScaleTuningChanged; ///< Boolean flag indicating whenever ScaleTuning has been modified by a foreign thread (i.e. by API).
108              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).
109              EventGenerator*            pEventGenerator;              EventGenerator*            pEventGenerator;
110              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 110  namespace LinuxSampler { Line 116  namespace LinuxSampler {
116              int                        ActiveVoiceCountMax;   ///< the maximum voice usage since application start              int                        ActiveVoiceCountMax;   ///< the maximum voice usage since application start
117              atomic_t                   ActiveVoiceCount;      ///< number of currently active voices              atomic_t                   ActiveVoiceCount;      ///< number of currently active voices
118              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.
             EqSupport*                 pEq;                   ///< Used for per voice equalization  
119    
120              void RouteAudio(EngineChannel* pEngineChannel, uint Samples);              void RouteAudio(EngineChannel* pEngineChannel, uint Samples);
121              void RouteDedicatedVoiceChannels(EngineChannel* pEngineChannel, optional<float> FxSendLevels[2], uint Samples);              void RouteDedicatedVoiceChannels(EngineChannel* pEngineChannel, optional<float> FxSendLevels[2], uint Samples);
122              void ClearEventLists();              void ClearEventLists();
123              void ImportEvents(uint Samples);              void ImportEvents(uint Samples);
124              void ProcessSysex(Pool<Event>::Iterator& itSysexEvent);              void ProcessSysex(Pool<Event>::Iterator& itSysexEvent);
             void ResetScaleTuning();  
125              void ProcessPitchbend(AbstractEngineChannel* pEngineChannel, Pool<Event>::Iterator& itPitchbendEvent);              void ProcessPitchbend(AbstractEngineChannel* pEngineChannel, Pool<Event>::Iterator& itPitchbendEvent);
126    
127              void ProcessFxSendControllers (              void ProcessFxSendControllers (
# Line 132  namespace LinuxSampler { Line 136  namespace LinuxSampler {
136              virtual void ProcessNoteOn(EngineChannel* pEngineChannel, Pool<Event>::Iterator& itNoteOnEvent) = 0;              virtual void ProcessNoteOn(EngineChannel* pEngineChannel, Pool<Event>::Iterator& itNoteOnEvent) = 0;
137              virtual void ProcessNoteOff(EngineChannel* pEngineChannel, Pool<Event>::Iterator& itNoteOffEvent) = 0;              virtual void ProcessNoteOff(EngineChannel* pEngineChannel, Pool<Event>::Iterator& itNoteOffEvent) = 0;
138              virtual void ProcessControlChange(EngineChannel* pEngineChannel, Pool<Event>::Iterator& itControlChangeEvent) = 0;              virtual void ProcessControlChange(EngineChannel* pEngineChannel, Pool<Event>::Iterator& itControlChangeEvent) = 0;
139                virtual void ProcessChannelPressure(EngineChannel* pEngineChannel, Pool<Event>::Iterator& itChannelPressureEvent) = 0;
140                virtual void ProcessPolyphonicKeyPressure(EngineChannel* pEngineChannel, Pool<Event>::Iterator& itNotePressureEvent) = 0;
141              virtual int  GetMinFadeOutSamples() = 0;              virtual int  GetMinFadeOutSamples() = 0;
142    
143          private:          private:
# Line 143  namespace LinuxSampler { Line 149  namespace LinuxSampler {
149              static float* InitCrossfadeCurve();              static float* InitCrossfadeCurve();
150              static float* InitCurve(const float* segments, int size = 128);              static float* InitCurve(const float* segments, int size = 128);
151    
             void AdjustScale(int8_t ScaleTunes[12]);  
152              bool RouteFxSend(FxSend* pFxSend, AudioChannel* ppSource[2], float FxSendLevel, uint Samples);              bool RouteFxSend(FxSend* pFxSend, AudioChannel* ppSource[2], float FxSendLevel, uint Samples);
153      };      };
154    

Legend:
Removed from v.2297  
changed lines
  Added in v.2559

  ViewVC Help
Powered by ViewVC