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

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

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

revision 670 by schoenebeck, Tue Jun 21 18:00:52 2005 UTC revision 1924 by persson, Sun Jun 28 16:43:38 2009 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 Christian Schoenebeck                              *   *   Copyright (C) 2005 - 2009 Christian Schoenebeck                       *
7   *                                                                         *   *                                                                         *
8   *   This program is free software; you can redistribute it and/or modify  *   *   This program is free software; you can redistribute it and/or modify  *
9   *   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 24  Line 24 
24  #ifndef __LS_GIG_ENGINECHANNEL_H__  #ifndef __LS_GIG_ENGINECHANNEL_H__
25  #define __LS_GIG_ENGINECHANNEL_H__  #define __LS_GIG_ENGINECHANNEL_H__
26    
 #if DEBUG_HEADERS  
 # warning EngineChannel.h included  
 #endif // DEBUG_HEADERS  
   
27  #include "../common/Event.h"  #include "../common/Event.h"
28  #include "../common/EngineChannel.h"  #include "../EngineChannel.h"
29    #include "../../common/RingBuffer.h"
30    #include "../../common/ArrayList.h"
31    #include "../../drivers/audio/AudioChannel.h"
32  #include "EngineGlobals.h"  #include "EngineGlobals.h"
33  #include "Engine.h"  #include "Engine.h"
34  #include "Voice.h"  #include "Voice.h"
# Line 56  namespace LinuxSampler { namespace gig { Line 55  namespace LinuxSampler { namespace gig {
55              virtual void    LoadInstrument();              virtual void    LoadInstrument();
56              virtual void    Reset();              virtual void    Reset();
57              virtual void    SendNoteOn(uint8_t Key, uint8_t Velocity);              virtual void    SendNoteOn(uint8_t Key, uint8_t Velocity);
58                virtual void    SendNoteOn(uint8_t Key, uint8_t Velocity, int32_t FragmentPos);
59              virtual void    SendNoteOff(uint8_t Key, uint8_t Velocity);              virtual void    SendNoteOff(uint8_t Key, uint8_t Velocity);
60                virtual void    SendNoteOff(uint8_t Key, uint8_t Velocity, int32_t FragmentPos);
61              virtual void    SendPitchbend(int Pitch);              virtual void    SendPitchbend(int Pitch);
62                virtual void    SendPitchbend(int Pitch, int32_t FragmentPos);
63              virtual void    SendControlChange(uint8_t Controller, uint8_t Value);              virtual void    SendControlChange(uint8_t Controller, uint8_t Value);
64                virtual void    SendControlChange(uint8_t Controller, uint8_t Value, int32_t FragmentPos);
65                virtual void    SendProgramChange(uint8_t Program);
66              virtual bool    StatusChanged(bool bNewStatus = false);              virtual bool    StatusChanged(bool bNewStatus = false);
67              virtual float   Volume();              virtual float   Volume();
68              virtual void    Volume(float f);              virtual void    Volume(float f);
69                virtual float   Pan();
70                virtual void    Pan(float f);
71              virtual uint    Channels();              virtual uint    Channels();
72              virtual void    Connect(AudioOutputDevice* pAudioOut);              virtual void    Connect(AudioOutputDevice* pAudioOut);
73              virtual void    DisconnectAudioOutputDevice();              virtual void    DisconnectAudioOutputDevice();
74                virtual AudioOutputDevice* GetAudioOutputDevice();
75              virtual void    SetOutputChannel(uint EngineAudioChannel, uint AudioDeviceChannel);              virtual void    SetOutputChannel(uint EngineAudioChannel, uint AudioDeviceChannel);
76              virtual int     OutputChannel(uint EngineAudioChannel);              virtual int     OutputChannel(uint EngineAudioChannel);
77                virtual void    Connect(MidiInputPort* pMidiPort, midi_chan_t MidiChannel);
78                virtual void    DisconnectMidiInputPort();
79                virtual MidiInputPort* GetMidiInputPort();
80                virtual midi_chan_t MidiChannel();
81              virtual String  InstrumentFileName();              virtual String  InstrumentFileName();
82              virtual String  InstrumentName();              virtual String  InstrumentName();
83              virtual int     InstrumentIndex();              virtual int     InstrumentIndex();
84              virtual int     InstrumentStatus();              virtual int     InstrumentStatus();
85              virtual LinuxSampler::Engine* GetEngine();              virtual LinuxSampler::Engine* GetEngine();
86              virtual String  EngineName();              virtual String  EngineName();
87                virtual FxSend* AddFxSend(uint8_t MidiCtrl, String Name = "") throw (Exception);
88                virtual FxSend* GetFxSend(uint FxSendIndex);
89                virtual uint    GetFxSendCount();
90                virtual void    RemoveFxSend(FxSend* pFxSend);
91                virtual void    Connect(VirtualMidiDevice* pDevice);
92                virtual void    Disconnect(VirtualMidiDevice* pDevice);
93    
94              // implementation of abstract methods derived from interface class 'InstrumentConsumer'              // implementation of abstract methods derived from interface class 'InstrumentConsumer'
95              virtual void ResourceToBeUpdated(::gig::Instrument* pResource, void*& pUpdateArg);              virtual void ResourceToBeUpdated(::gig::Instrument* pResource, void*& pUpdateArg);
# Line 81  namespace LinuxSampler { namespace gig { Line 98  namespace LinuxSampler { namespace gig {
98    
99          //protected:          //protected:
100              Engine*                 pEngine;              Engine*                 pEngine;
101              float*                  pOutputLeft;              ///< Audio output channel buffer (left)              AudioChannel*           pChannelLeft;             ///< encapsulates the audio rendering buffer (left)
102              float*                  pOutputRight;             ///< Audio output channel buffer (right)              AudioChannel*           pChannelRight;            ///< encapsulates the audio rendering buffer (right)
103              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
104              int                     AudioDeviceChannelRight;  ///< audio device channel number to which the right channel is connected to              int                     AudioDeviceChannelRight;  ///< audio device channel number to which the right channel is connected to
105              RingBuffer<Event>*      pEventQueue;              ///< Input event queue.              MidiInputPort*          pMidiInputPort;           ///< Points to the connected MIDI input port or NULL if none assigned.
106                midi_chan_t             midiChannel;              ///< MIDI channel(s) on which this engine channel listens to.
107                RingBuffer<Event,false>* pEventQueue;             ///< Input event queue.
108              RTList<Event>*          pEvents;                  ///< All engine channel specific events for the current audio fragment.              RTList<Event>*          pEvents;                  ///< All engine channel specific events for the current audio fragment.
109              RTList<Event>*          pCCEvents;                ///< All control change events for the current audio fragment on this engine channel.              uint8_t                 ControllerTable[129];     ///< Reflects the current values (0-127) of all MIDI controllers for this engine / sampler channel. Number 128 is for channel pressure (mono aftertouch).
             RTList<Event>*          pSynthesisEvents[Event::destination_count]; ///< Events directly affecting synthesis parameters (like pitch, volume and filter).  
             uint8_t                 ControllerTable[128];     ///< Reflects the current values (0-127) of all MIDI controllers for this engine / sampler channel.  
110              midi_key_info_t*        pMIDIKeyInfo;             ///< Contains all active voices sorted by MIDI key number and other informations to the respective MIDI key              midi_key_info_t*        pMIDIKeyInfo;             ///< Contains all active voices sorted by MIDI key number and other informations to the respective MIDI key
111              Pool<uint>*             pActiveKeys;              ///< Holds all keys in it's allocation list with active voices.              Pool<uint>*             pActiveKeys;              ///< Holds all keys in it's allocation list with active voices.
112              std::map<uint,uint*>    ActiveKeyGroups;          ///< Contains active keys (in case they belong to a key group) ordered by key group ID.              std::map<uint,uint*>    ActiveKeyGroups;          ///< Contains active keys (in case they belong to a key group) ordered by key group ID.
113              ::gig::Instrument*      pInstrument;              ::gig::Instrument*      pInstrument;
114              bool                    SustainPedal;             ///< true if sustain pedal is down              bool                    SustainPedal;             ///< true if sustain pedal is down
115              double                  GlobalVolume;             ///< overall volume (a value < 1.0 means attenuation, a value > 1.0 means amplification)              bool                    SostenutoPedal;           ///< true if sostenuto pedal is down
116                bool                    SoloMode;                 ///< in Solo Mode we only play one voice (group) at a time
117                int                     SoloKey;                  ///< Currently 'active' solo key, that is the key to which the currently sounding voice belongs to (only if SoloMode is enabled)
118                bool                    PortamentoMode;           ///< in Portamento Mode we slide the pitch from the last note to the current note.
119                float                   PortamentoTime;           ///< How long it will take to glide from the previous note to the current (in seconds)
120                float                   PortamentoPos;            ///< Current position on the keyboard, that is integer and fractional part (only used if PortamentoMode is on)
121                double                  GlobalVolume;             ///< Master volume factor set through the C++ API / LSCP (a value < 1.0 means attenuation, a value > 1.0 means amplification)
122                double                  MidiVolume;               ///< Volume factor altered by MIDI CC#7 (a value < 1.0 means attenuation, a value > 1.0 means amplification)
123              float                   GlobalPanLeft;              float                   GlobalPanLeft;
124              float                   GlobalPanRight;              float                   GlobalPanRight;
125              int                     Pitch;                    ///< Current (absolute) MIDI pitch value.              int                     Pitch;                    ///< Current (absolute) MIDI pitch value.
126              int                     CurrentKeyDimension;      ///< Current value (0-127) 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.
127              String                  InstrumentFile;              String                  InstrumentFile;
128              int                     InstrumentIdx;              int                     InstrumentIdx;
129              String                  InstrumentIdxName;              String                  InstrumentIdxName;
130              int                     InstrumentStat;              int                     InstrumentStat;
131              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.
132              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)
133                std::vector<FxSend*>    fxSends;
134                int                     GlobalTranspose;          ///< amount of semi tones all notes should be transposed
135                int                     iLastPanRequest; ///< just for the return value of Pan(), so we don't have to make an injective function
136    
137                /// Command used by the instrument loader thread to
138                /// request an instrument change on a channel.
139                struct instrument_change_command_t {
140                    bool bChangeInstrument;                             ///< Set to true by the loader when the channel should change instrument.
141                    ::gig::Instrument* pInstrument;                     ///< The new instrument. Also used by the loader to read the previously loaded instrument.
142                    RTList< ::gig::DimensionRegion*>* pDimRegionsInUse; ///< List of dimension regions in use by the currently loaded instrument. Continuously updated by the audio thread.
143                };
144                SynchronizedConfig<instrument_change_command_t> InstrumentChangeCommand;
145                SynchronizedConfig<instrument_change_command_t>::Reader InstrumentChangeCommandReader;
146    
147                RTList< ::gig::DimensionRegion*>* pDimRegionsInUse;     ///< temporary pointer into the instrument change command, used by the audio thread
148    
149                SynchronizedConfig< ArrayList<VirtualMidiDevice*> > virtualMidiDevices;
150                SynchronizedConfig< ArrayList<VirtualMidiDevice*> >::Reader virtualMidiDevicesReader_AudioThread;
151                SynchronizedConfig< ArrayList<VirtualMidiDevice*> >::Reader virtualMidiDevicesReader_MidiThread;
152    
153              void ResetControllers();              void ResetControllers();
154              void ClearEventLists();              void ClearEventLists();
# Line 117  namespace LinuxSampler { namespace gig { Line 160  namespace LinuxSampler { namespace gig {
160    
161          private:          private:
162              void ResetInternal();              void ResetInternal();
163                void RemoveAllFxSends();
164                void ClearDimRegionsInUse();
165                void ResetDimRegionsInUse();
166                instrument_change_command_t& ChangeInstrument(::gig::Instrument* pInstrument);
167      };      };
168    
169  }} // namespace LinuxSampler::gig  }} // namespace LinuxSampler::gig

Legend:
Removed from v.670  
changed lines
  Added in v.1924

  ViewVC Help
Powered by ViewVC