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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 424 - (hide annotations) (download) (as text)
Fri Mar 4 22:54:11 2005 UTC (19 years, 1 month ago) by schoenebeck
File MIME type: text/x-c++hdr
File size: 6662 byte(s)
* implemented MIDI Control Change 7 (Volume)
* implemented MIDI Control Change 10 (Panpot)

1 schoenebeck 411 /***************************************************************************
2     * *
3     * LinuxSampler - modular, streaming capable sampler *
4     * *
5     * Copyright (C) 2003, 2004 by Benno Senoner and Christian Schoenebeck *
6     * Copyright (C) 2005 Christian Schoenebeck *
7     * *
8     * 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 *
10     * the Free Software Foundation; either version 2 of the License, or *
11     * (at your option) any later version. *
12     * *
13     * This program is distributed in the hope that it will be useful, *
14     * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
16     * GNU General Public License for more details. *
17     * *
18     * You should have received a copy of the GNU General Public License *
19     * along with this program; if not, write to the Free Software *
20     * Foundation, Inc., 59 Temple Place, Suite 330, Boston, *
21     * MA 02111-1307 USA *
22     ***************************************************************************/
23    
24     #ifndef __LS_GIG_ENGINECHANNEL_H__
25     #define __LS_GIG_ENGINECHANNEL_H__
26    
27     #if DEBUG_HEADERS
28     # warning EngineChannel.h included
29     #endif // DEBUG_HEADERS
30    
31     #include "../common/Event.h"
32     #include "../common/EngineChannel.h"
33     #include "EngineGlobals.h"
34     #include "Engine.h"
35 schoenebeck 412 #include "Voice.h"
36 schoenebeck 411 #include "InstrumentResourceManager.h"
37    
38     namespace LinuxSampler { namespace gig {
39    
40 schoenebeck 412 // just symbol prototyping
41 schoenebeck 411 class midi_key_info_t;
42 schoenebeck 412 class Voice;
43 schoenebeck 411
44     class EngineChannel : public LinuxSampler::EngineChannel, public InstrumentConsumer {
45     public:
46     EngineChannel();
47     virtual ~EngineChannel();
48    
49     // implementation of abstract methods derived from interface class 'LinuxSampler::EngineChannel'
50     virtual void PrepareLoadInstrument(const char* FileName, uint Instrument);
51     virtual void LoadInstrument();
52     virtual void SendNoteOn(uint8_t Key, uint8_t Velocity);
53     virtual void SendNoteOff(uint8_t Key, uint8_t Velocity);
54     virtual void SendPitchbend(int Pitch);
55     virtual void SendControlChange(uint8_t Controller, uint8_t Value);
56     virtual float Volume();
57     virtual void Volume(float f);
58     virtual uint Channels();
59     virtual void Connect(AudioOutputDevice* pAudioOut);
60     virtual void DisconnectAudioOutputDevice();
61     virtual void SetOutputChannel(uint EngineAudioChannel, uint AudioDeviceChannel);
62     virtual int OutputChannel(uint EngineAudioChannel);
63     virtual String InstrumentFileName();
64     virtual String InstrumentName();
65     virtual int InstrumentIndex();
66     virtual int InstrumentStatus();
67     virtual LinuxSampler::Engine* GetEngine();
68    
69     // implementation of abstract methods derived from interface class 'InstrumentConsumer'
70     virtual void ResourceToBeUpdated(::gig::Instrument* pResource, void*& pUpdateArg);
71     virtual void ResourceUpdated(::gig::Instrument* pOldResource, ::gig::Instrument* pNewResource, void* pUpdateArg);
72    
73     //protected:
74     Engine* pEngine;
75     float* pOutputLeft; ///< Audio output channel buffer (left)
76     float* pOutputRight; ///< Audio output channel buffer (right)
77     int AudioDeviceChannelLeft; ///< audio device channel number to which the left channel is connected to
78     int AudioDeviceChannelRight; ///< audio device channel number to which the right channel is connected to
79     RingBuffer<Event>* pEventQueue; ///< Input event queue.
80     uint8_t ControllerTable[128]; ///< Reflects the current values (0-127) of all MIDI controllers for this engine / sampler channel.
81     midi_key_info_t* pMIDIKeyInfo; ///< Contains all active voices sorted by MIDI key number and other informations to the respective MIDI key
82     Pool<uint>* pActiveKeys; ///< Holds all keys in it's allocation list with active voices.
83     std::map<uint,uint*> ActiveKeyGroups; ///< Contains active keys (in case they belong to a key group) ordered by key group ID.
84     ::gig::Instrument* pInstrument;
85     bool SustainPedal; ///< true if sustain pedal is down
86     double GlobalVolume; ///< overall volume (a value < 1.0 means attenuation, a value > 1.0 means amplification)
87 schoenebeck 424 float GlobalPanLeft;
88     float GlobalPanRight;
89 schoenebeck 411 int Pitch; ///< Current (absolute) MIDI pitch value.
90     int CurrentKeyDimension; ///< Current value (0-127) for the keyboard dimension, altered by pressing a keyswitching key.
91     String InstrumentFile;
92     int InstrumentIdx;
93     String InstrumentIdxName;
94 schoenebeck 412 int InstrumentStat;
95     RTList<Voice>::Iterator itLastStolenVoice; ///< Only for voice stealing: points to the last voice which was theft in current audio fragment, NULL otherwise.
96     RTList<uint>::Iterator iuiLastStolenKey; ///< Only for voice stealing: key number of last key on which the last voice was theft in current audio fragment, NULL otherwise.
97 schoenebeck 411
98     friend class Engine;
99     friend class Voice;
100     friend class InstrumentResourceManager;
101    
102     private:
103     void ResetInternal();
104     };
105    
106     }} // namespace LinuxSampler::gig
107    
108     #endif // __LS_GIG_ENGINECHANNEL_H__

  ViewVC Help
Powered by ViewVC