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

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

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

revision 2012 by iliev, Fri Oct 23 17:53:17 2009 UTC revision 2382 by persson, Sun Dec 2 16:30:42 2012 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-2012 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_ABSTRACTENGINECHANNEL_H__  #ifndef __LS_ABSTRACTENGINECHANNEL_H__
26  #define __LS_ABSTRACTENGINECHANNEL_H__  #define __LS_ABSTRACTENGINECHANNEL_H__
27    
28  #include "EngineChannel.h"  #include "EngineChannel.h"
29  #include "AbstractEngine.h"  #include "AbstractEngine.h"
# Line 38  namespace LinuxSampler { Line 38  namespace LinuxSampler {
38              // implementation of abstract methods derived from interface class 'LinuxSampler::EngineChannel'              // implementation of abstract methods derived from interface class 'LinuxSampler::EngineChannel'
39              virtual void    PrepareLoadInstrument(const char* FileName, uint Instrument);              virtual void    PrepareLoadInstrument(const char* FileName, uint Instrument);
40              virtual void    Reset();              virtual void    Reset();
41              virtual void    SendNoteOn(uint8_t Key, uint8_t Velocity);              virtual void    SendNoteOn(uint8_t Key, uint8_t Velocity, uint8_t MidiChannel);
42              virtual void    SendNoteOn(uint8_t Key, uint8_t Velocity, int32_t FragmentPos);              virtual void    SendNoteOn(uint8_t Key, uint8_t Velocity, uint8_t MidiChannel, int32_t FragmentPos);
43              virtual void    SendNoteOff(uint8_t Key, uint8_t Velocity);              virtual void    SendNoteOff(uint8_t Key, uint8_t Velocity, uint8_t MidiChannel);
44              virtual void    SendNoteOff(uint8_t Key, uint8_t Velocity, int32_t FragmentPos);              virtual void    SendNoteOff(uint8_t Key, uint8_t Velocity, uint8_t MidiChannel, int32_t FragmentPos);
45              virtual void    SendPitchbend(int Pitch);              virtual void    SendPitchbend(int Pitch, uint8_t MidiChannel);
46              virtual void    SendPitchbend(int Pitch, int32_t FragmentPos);              virtual void    SendPitchbend(int Pitch, uint8_t MidiChannel, int32_t FragmentPos);
47              virtual void    SendControlChange(uint8_t Controller, uint8_t Value);              virtual void    SendControlChange(uint8_t Controller, uint8_t Value, uint8_t MidiChannel);
48              virtual void    SendControlChange(uint8_t Controller, uint8_t Value, int32_t FragmentPos);              virtual void    SendControlChange(uint8_t Controller, uint8_t Value, uint8_t MidiChannel, int32_t FragmentPos);
49              virtual bool    StatusChanged(bool bNewStatus = false);              virtual bool    StatusChanged(bool bNewStatus = false);
50              virtual float   Volume();              virtual float   Volume();
51              virtual void    Volume(float f);              virtual void    Volume(float f);
# Line 63  namespace LinuxSampler { Line 63  namespace LinuxSampler {
63              virtual String  InstrumentName();              virtual String  InstrumentName();
64              virtual int     InstrumentIndex();              virtual int     InstrumentIndex();
65              virtual int     InstrumentStatus();              virtual int     InstrumentStatus();
66              virtual LinuxSampler::Engine* GetEngine();              virtual Engine* GetEngine();
67              virtual String  EngineName();              virtual String  EngineName();
68              virtual FxSend* AddFxSend(uint8_t MidiCtrl, String Name = "") throw (Exception);              virtual FxSend* AddFxSend(uint8_t MidiCtrl, String Name = "") throw (Exception);
69              virtual FxSend* GetFxSend(uint FxSendIndex);              virtual FxSend* GetFxSend(uint FxSendIndex);
# Line 75  namespace LinuxSampler { Line 75  namespace LinuxSampler {
75    
76              virtual AbstractEngine::Format GetEngineFormat() = 0;              virtual AbstractEngine::Format GetEngineFormat() = 0;
77    
78                AudioOutputDevice* GetAudioOutputDeviceSafe();
79    
80                friend class AbstractVoice;
81              friend class AbstractEngine;              friend class AbstractEngine;
82              template<class TV, class TRR, class TR, class TD, class TIM, class TI> friend class EngineBase;              template<class TV, class TRR, class TR, class TD, class TIM, class TI> friend class EngineBase;
83                template<class EC, class R, class S, class D> friend class VoiceBase;
84    
85          protected:          protected:
86              AbstractEngineChannel();              AbstractEngineChannel();
87              virtual ~AbstractEngineChannel();              virtual ~AbstractEngineChannel();
88    
89              AbstractEngine*           pEngine;              AbstractEngine*           pEngine;
90                Mutex                     EngineMutex; ///< protects the Engine from access by the instrument loader thread when lscp is disconnecting
91    
92            protected:
93              AudioChannel*             pChannelLeft;             ///< encapsulates the audio rendering buffer (left)              AudioChannel*             pChannelLeft;             ///< encapsulates the audio rendering buffer (left)
94              AudioChannel*             pChannelRight;            ///< encapsulates the audio rendering buffer (right)              AudioChannel*             pChannelRight;            ///< encapsulates the audio rendering buffer (right)
95              int                       AudioDeviceChannelLeft;   ///< audio device channel number to which the left channel is connected to              int                       AudioDeviceChannelLeft;   ///< audio device channel number to which the left channel is connected to
# Line 98  namespace LinuxSampler { Line 105  namespace LinuxSampler {
105              int                       InstrumentStat;              int                       InstrumentStat;
106              double                    GlobalVolume;             ///< Master volume factor set through the C++ API / LSCP (a value < 1.0 means attenuation, a value > 1.0 means amplification)              double                    GlobalVolume;             ///< Master volume factor set through the C++ API / LSCP (a value < 1.0 means attenuation, a value > 1.0 means amplification)
107              double                    MidiVolume;               ///< Volume factor altered by MIDI CC#7 (a value < 1.0 means attenuation, a value > 1.0 means amplification)              double                    MidiVolume;               ///< Volume factor altered by MIDI CC#7 (a value < 1.0 means attenuation, a value > 1.0 means amplification)
             float                     GlobalPanLeft;  
             float                     GlobalPanRight;  
108              int                       Pitch;                    ///< Current (absolute) MIDI pitch value.              int                       Pitch;                    ///< Current (absolute) MIDI pitch value.
109              float                     CurrentKeyDimension;      ///< Current value (0-1.0) for the keyboard dimension, altered by pressing a keyswitching key.              float                     CurrentKeyDimension;      ///< Current value (0-1.0) for the keyboard dimension, altered by pressing a keyswitching key.
110              bool                      PortamentoMode;           ///< in Portamento Mode we slide the pitch from the last note to the current note.              bool                      PortamentoMode;           ///< in Portamento Mode we slide the pitch from the last note to the current note.
# Line 110  namespace LinuxSampler { Line 115  namespace LinuxSampler {
115              int                       iLastPanRequest;          ///< just for the return value of Pan(), so we don't have to make an injective function              int                       iLastPanRequest;          ///< just for the return value of Pan(), so we don't have to make an injective function
116              int                       iEngineIndexSelf;         ///< Reflects the index of this EngineChannel in the Engine's ArrayList.              int                       iEngineIndexSelf;         ///< Reflects the index of this EngineChannel in the Engine's ArrayList.
117              bool                      bStatusChanged;           ///< true in case an engine parameter has changed (e.g. new instrument, another volumet)              bool                      bStatusChanged;           ///< true in case an engine parameter has changed (e.g. new instrument, another volumet)
118                uint32_t                  RoundRobinIndex;          ///< counter for round robin sample selection, incremented for each note on
119    
120              SynchronizedConfig< ArrayList<VirtualMidiDevice*> > virtualMidiDevices;              SynchronizedConfig< ArrayList<VirtualMidiDevice*> > virtualMidiDevices;
121              SynchronizedConfig< ArrayList<VirtualMidiDevice*> >::Reader virtualMidiDevicesReader_AudioThread;              SynchronizedConfig< ArrayList<VirtualMidiDevice*> >::Reader virtualMidiDevicesReader_AudioThread;
122              SynchronizedConfig< ArrayList<VirtualMidiDevice*> >::Reader virtualMidiDevicesReader_MidiThread;              SynchronizedConfig< ArrayList<VirtualMidiDevice*> >::Reader virtualMidiDevicesReader_MidiThread;
123    
124                // specialization of RTList that doesn't require the pool
125                // to be provided at construction time
126                template<typename T>
127                class LazyList : public RTList<T> {
128                public:
129                    using RTList<T>::allocAppend;
130                    using RTList<T>::pPool;
131    
132                    LazyList() : RTList<T>(0) { }
133                    typename RTList<T>::Iterator allocAppend(Pool<T>* pool) {
134                        pPool = pool;
135                        return allocAppend();
136                    }
137                };
138                
139                typedef std::map<uint, LazyList<Event>*> ActiveKeyGroupMap;
140                ActiveKeyGroupMap ActiveKeyGroups;      ///< Contains event queues for key groups, ordered by key group ID.
141    
142              virtual void ResetControllers();              virtual void ResetControllers();
143              virtual void ResetInternal();              virtual void ResetInternal();
144              virtual void RemoveAllFxSends();              virtual void RemoveAllFxSends();
145    
146              void ImportEvents(uint Samples);              void ImportEvents(uint Samples);
147    
148                void AddGroup(uint group);
149                void HandleKeyGroupConflicts(uint KeyGroup, Pool<Event>::Iterator& itNoteOnEvent);
150                void ClearGroupEventLists();
151                void DeleteGroupEventLists();
152      };      };
153    
154  } // namespace LinuxSampler  } // namespace LinuxSampler
155    
156  #endif  /* __LS_ABSTRACTENGINECHANNEL_H__ */  #endif  /* __LS_ABSTRACTENGINECHANNEL_H__ */
157    

Legend:
Removed from v.2012  
changed lines
  Added in v.2382

  ViewVC Help
Powered by ViewVC