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

Diff of /linuxsampler/trunk/src/engines/gig/Engine.h

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

revision 80 by schoenebeck, Sun May 23 19:16:33 2004 UTC revision 244 by schoenebeck, Fri Sep 17 01:01:11 2004 UTC
# Line 29  Line 29 
29  # warning Engine.h included  # warning Engine.h included
30  #endif // DEBUG_HEADERS  #endif // DEBUG_HEADERS
31    
32    #include <map>
33    
34  #include "../../common/RingBuffer.h"  #include "../../common/RingBuffer.h"
35  #include "../../common/RTELMemoryPool.h"  #include "../../common/RTELMemoryPool.h"
36  #include "../../common/ConditionServer.h"  #include "../../common/ConditionServer.h"
# Line 41  Line 43 
43    
44  #define PITCHBEND_SEMITONES             12  #define PITCHBEND_SEMITONES             12
45  #define MAX_AUDIO_VOICES                128  #define MAX_AUDIO_VOICES                128
46    #define SYSEX_BUFFER_SIZE               2048  // 2kB
47    
48  namespace LinuxSampler { namespace gig {  namespace LinuxSampler { namespace gig {
49    
50        using std::map;
51    
52      // just symbol prototyping      // just symbol prototyping
53      class Voice;      class Voice;
54      class DiskThread;      class DiskThread;
# Line 67  namespace LinuxSampler { namespace gig { Line 72  namespace LinuxSampler { namespace gig {
72              virtual void   SendNoteOff(uint8_t Key, uint8_t Velocity);              virtual void   SendNoteOff(uint8_t Key, uint8_t Velocity);
73              virtual void   SendPitchbend(int Pitch);              virtual void   SendPitchbend(int Pitch);
74              virtual void   SendControlChange(uint8_t Controller, uint8_t Value);              virtual void   SendControlChange(uint8_t Controller, uint8_t Value);
75                virtual void   SendSysex(void* pData, uint Size);
76              virtual float  Volume();              virtual float  Volume();
77              virtual void   Volume(float f);              virtual void   Volume(float f);
78                virtual uint   Channels();
79              virtual void   Connect(AudioOutputDevice* pAudioOut);              virtual void   Connect(AudioOutputDevice* pAudioOut);
80              virtual void   DisconnectAudioOutputDevice();              virtual void   DisconnectAudioOutputDevice();
81                virtual void   SetOutputChannel(uint EngineAudioChannel, uint AudioDeviceChannel);
82                virtual int    OutputChannel(uint EngineAudioChannel);
83              virtual int    RenderAudio(uint Samples);              virtual int    RenderAudio(uint Samples);
84              virtual uint   VoiceCount();              virtual uint   VoiceCount();
85              virtual uint   VoiceCountMax();              virtual uint   VoiceCountMax();
# Line 81  namespace LinuxSampler { namespace gig { Line 90  namespace LinuxSampler { namespace gig {
90              virtual String DiskStreamBufferFillPercentage();              virtual String DiskStreamBufferFillPercentage();
91              virtual String Description();              virtual String Description();
92              virtual String Version();              virtual String Version();
93                virtual String EngineName();
94                virtual String InstrumentFileName();
95                virtual int    InstrumentIndex();
96                virtual int    InstrumentStatus();
97    
98              // abstract methods derived from interface class 'InstrumentConsumer'              // abstract methods derived from interface class 'InstrumentConsumer'
99              virtual void ResourceToBeUpdated(::gig::Instrument* pResource, void*& pUpdateArg);              virtual void ResourceToBeUpdated(::gig::Instrument* pResource, void*& pUpdateArg);
100              virtual void ResourceUpdated(::gig::Instrument* pOldResource, ::gig::Instrument* pNewResource, void* pUpdateArg);              virtual void ResourceUpdated(::gig::Instrument* pOldResource, ::gig::Instrument* pNewResource, void* pUpdateArg);
101          protected:          protected:
102              struct midi_key_info_t {              struct midi_key_info_t {
103                  RTEList<Voice>* pActiveVoices; ///< Contains the active voices associated with the MIDI key.                  RTEList<Voice>* pActiveVoices;  ///< Contains the active voices associated with the MIDI key.
104                  bool            KeyPressed;    ///< Is true if the respective MIDI key is currently pressed.                  bool            KeyPressed;     ///< Is true if the respective MIDI key is currently pressed.
105                  bool            Active;        ///< If the key contains active voices.                  bool            Active;         ///< If the key contains active voices.
106                  uint*           pSelf;         ///< hack to allow fast deallocation of the key from the list of active keys                  bool            ReleaseTrigger; ///< If we have to launch release triggered voice(s) when the key is released
107                  RTEList<Event>* pEvents;       ///< Key specific events (only Note-on, Note-off and sustain pedal currently)                  uint*           pSelf;          ///< hack to allow fast deallocation of the key from the list of active keys
108                    RTEList<Event>* pEvents;        ///< Key specific events (only Note-on, Note-off and sustain pedal currently)
109              };              };
110    
111              static InstrumentResourceManager Instruments;              static InstrumentResourceManager Instruments;
112    
113              AudioOutputDevice*      pAudioOutputDevice;              AudioOutputDevice*      pAudioOutputDevice;
114                float*                  pOutputLeft;           ///< Audio output channel buffer (left)
115                float*                  pOutputRight;          ///< Audio output channel buffer (right)
116                int                     AudioDeviceChannelLeft;  ///< audio device channel number to which the left channel is connected to
117                int                     AudioDeviceChannelRight; ///< audio device channel number to which the right channel is connected to
118                uint                    SampleRate;            ///< Sample rate of the engines output audio signal (in Hz)
119                uint                    MaxSamplesPerCycle;    ///< Size of each audio output buffer
120              DiskThread*             pDiskThread;              DiskThread*             pDiskThread;
121              uint8_t                 ControllerTable[128];  ///< Reflects the current values (0-127) of all MIDI controllers for this engine / sampler channel.              uint8_t                 ControllerTable[128];  ///< Reflects the current values (0-127) of all MIDI controllers for this engine / sampler channel.
122              RingBuffer<Event>*      pEventQueue;           ///< Input event queue.              RingBuffer<Event>*      pEventQueue;           ///< Input event queue.
123                RingBuffer<uint8_t>*    pSysexBuffer;          ///< Input buffer for MIDI system exclusive messages.
124              midi_key_info_t         pMIDIKeyInfo[128];     ///< Contains all active voices sorted by MIDI key number and other informations to the respective MIDI key              midi_key_info_t         pMIDIKeyInfo[128];     ///< Contains all active voices sorted by MIDI key number and other informations to the respective MIDI key
125              RTELMemoryPool<Voice>*  pVoicePool;            ///< Contains all voices that can be activated.              RTELMemoryPool<Voice>*  pVoicePool;            ///< Contains all voices that can be activated.
126              RTELMemoryPool<uint>*   pActiveKeys;           ///< Holds all keys in it's allocation list with active voices.              RTELMemoryPool<uint>*   pActiveKeys;           ///< Holds all keys in it's allocation list with active voices.
# Line 111  namespace LinuxSampler { namespace gig { Line 132  namespace LinuxSampler { namespace gig {
132              float*                  pSynthesisParameters[Event::destination_count]; ///< Matrix with final synthesis parameters for the current audio fragment which will be used in the main synthesis loop.              float*                  pSynthesisParameters[Event::destination_count]; ///< Matrix with final synthesis parameters for the current audio fragment which will be used in the main synthesis loop.
133              biquad_param_t*         pBasicFilterParameters; ///< Biquad parameters of the basic bandpass filter.              biquad_param_t*         pBasicFilterParameters; ///< Biquad parameters of the basic bandpass filter.
134              biquad_param_t*         pMainFilterParameters;  ///< Main biquad parameters of the individual filter (lowpass / bandpass / highpass).              biquad_param_t*         pMainFilterParameters;  ///< Main biquad parameters of the individual filter (lowpass / bandpass / highpass).
135                map<uint,uint*>         ActiveKeyGroups;        ///< Contains active keys (in case they belong to a key group) ordered by key group ID.
136              RIFF::File*             pRIFF;              RIFF::File*             pRIFF;
137              ::gig::File*            pGig;              ::gig::File*            pGig;
138              ::gig::Instrument*      pInstrument;              ::gig::Instrument*      pInstrument;
# Line 121  namespace LinuxSampler { namespace gig { Line 143  namespace LinuxSampler { namespace gig {
143              int                     ActiveVoiceCountMax;   ///< the maximum voice usage since application start              int                     ActiveVoiceCountMax;   ///< the maximum voice usage since application start
144              bool                    SuspensionRequested;              bool                    SuspensionRequested;
145              ConditionServer         EngineDisabled;              ConditionServer         EngineDisabled;
146                String                  InstrumentFile;
147                int                     InstrumentIdx;
148                int                     InstrumentStat;
149                int8_t                  ScaleTuning[12];       ///< contains optional detune factors (-64..+63 cents) for all 12 semitones of an octave
150    
151              void ProcessNoteOn(Event* pNoteOnEvent);              void ProcessNoteOn(Event* pNoteOnEvent);
152              void ProcessNoteOff(Event* pNoteOffEvent);              void ProcessNoteOff(Event* pNoteOffEvent);
153              void ProcessPitchbend(Event* pPitchbendEvent);              void ProcessPitchbend(Event* pPitchbendEvent);
154              void ProcessControlChange(Event* pControlChangeEvent);              void ProcessControlChange(Event* pControlChangeEvent);
155              void KillVoice(Voice* pVoice);              void ProcessSysex(Event* pSysexEvent);
156                void LaunchVoice(Event* pNoteOnEvent, int iLayer = 0, bool ReleaseTriggerVoice = false);
157                void KillVoiceImmediately(Voice* pVoice);
158              void ResetSynthesisParameters(Event::destination_t dst, float val);              void ResetSynthesisParameters(Event::destination_t dst, float val);
159              void ResetInternal();              void ResetInternal();
160    
# Line 138  namespace LinuxSampler { namespace gig { Line 166  namespace LinuxSampler { namespace gig {
166              friend class VCOManipulator;              friend class VCOManipulator;
167              friend class InstrumentResourceManager;              friend class InstrumentResourceManager;
168          private:          private:
169              void DisableAndLock();              void    DisableAndLock();
170                uint8_t GSCheckSum(const RingBuffer<uint8_t>::NonVolatileReader AddrReader, uint DataSize);
171                void    AdjustScale(int8_t ScaleTunes[12]);
172      };      };
173    
174  }} // namespace LinuxSampler::gig  }} // namespace LinuxSampler::gig

Legend:
Removed from v.80  
changed lines
  Added in v.244

  ViewVC Help
Powered by ViewVC