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

Annotation of /linuxsampler/trunk/src/engines/FxSend.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1001 - (hide annotations) (download) (as text)
Wed Dec 27 16:17:08 2006 UTC (17 years, 4 months ago) by schoenebeck
File MIME type: text/x-c++hdr
File size: 6174 byte(s)
* implemented effect sends (also added new LSCP commands for this feature,
  updated LSCP spec document along with this commit batch as well)

1 schoenebeck 1001 /***************************************************************************
2     * *
3     * LinuxSampler - modular, streaming capable sampler *
4     * *
5     * Copyright (C) 2003, 2004 by Benno Senoner and Christian Schoenebeck *
6     * Copyright (C) 2005, 2006 Christian Schoenebeck *
7     * *
8     * This library 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 library 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 library; 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_FXSEND_H
25     #define LS_FXSEND_H
26    
27     #include "../common/global.h"
28     #include "../drivers/audio/AudioChannel.h"
29     #include "EngineChannel.h"
30    
31     #include <vector>
32    
33     namespace LinuxSampler {
34    
35     // just symbol prototyping
36     class EngineChannel;
37    
38     /** @brief Engine Channel Effect Send
39     *
40     * This class is used to manage effect sends on Engine Channels. An effect
41     * send is used to route sampler channel's audio signals to sampler
42     * external effect processors. Each effect send entity can define an
43     * arbitrary MIDI controller number which can alter the effect send's
44     * send level.
45     *
46     * Note: effect sends cannot be routed to a different AudioOutputDevice
47     * than assigned to the FxSend's EngineChannel. Also note that an effect
48     * send always has as much audio channels as its EngineChannel.
49     */
50     class FxSend {
51     public:
52     /**
53     * Constructor. By default all effect send channels are routed to
54     * the @e last available audio channels on the EngineChannel's
55     * AudioOutputDevice.
56     *
57     * @param pEngineChannel - engine channel on which the effect send
58     * is added to
59     * @param MidiCtrl - MIDI controller number which can alter the
60     * effect send level
61     * @param Name - (optional) name for the effect send entity
62     */
63     FxSend(EngineChannel* pEngineChannel, uint8_t MidiCtrl, String Name = "");
64    
65     /**
66     * Returns the audio output device's audio channel to which effect
67     * send's channel \a SrcChan is currently routed to.
68     */
69     int DestinationChannel(int SrcChan);
70    
71     /**
72     * Alters the routing of an audio channel.
73     *
74     * @param SrcChan - the effect send's source channel
75     * @param DstChan - the audio output device's destination channel
76     * @throws Exception - in case arguments out of range
77     */
78     void SetDestinationChannel(int SrcChan, int DstChan) throw (Exception);
79    
80     /**
81     * Should be called by the engine channel whenever the amount of
82     * audio channel has changed, so the FxSend object can adjust the
83     * amount of channels to that new number and establish default
84     * routings for new channels if needed.
85     */
86     void UpdateChannels();
87    
88     /**
89     * The effect send's current send level ( usually a value between
90     * @c 0.0f and @c 1.0f ).
91     */
92     float Level();
93    
94     /**
95     * Alter the effect send's send level ( usually a value between
96     * @c 0.0f and @c 1.0f ).
97     */
98     void SetLevel(float f);
99    
100     /**
101     * Alter the effect send's send level by supplying the MIDI
102     * controller's MIDI value. This method is usually only called
103     * by the engine channel.
104     */
105     void SetLevel(uint8_t iMidiValue);
106    
107     /**
108     * Returns the MIDI controller number which can alter the effect
109     * send's send level.
110     */
111     uint8_t MidiController();
112    
113     /**
114     * Alter the MIDI controller number which should alter the effect
115     * send's send level.
116     *
117     * @param MidiCtrl - MIDI controller number
118     * @throws Exception - if MIDI controller number is invalid
119     */
120     void SetMidiController(uint8_t MidiCtrl) throw (Exception);
121    
122     /**
123     * Returns the (optional) name of this effect send entity.
124     */
125     String Name();
126    
127     /**
128     * Returns the (at least sampler-channel-) unique ID of the
129     * effect send instance. This is actually not used by the engine
130     * at all. It is at the moment only used by the LSCP server to
131     * associate an unique numerical ID with each effect send entity.
132     */
133     uint Id();
134    
135     protected:
136     EngineChannel* pEngineChannel;
137     std::vector<int> Routing;
138     uint8_t MidiFxSendController;
139     String sName;
140     uint iId;
141     float fLevel;
142     };
143    
144     } // namespace LinuxSampler
145    
146     #endif // LS_FXSEND_H

  ViewVC Help
Powered by ViewVC