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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1108 - (show annotations) (download) (as text)
Thu Mar 22 20:39:04 2007 UTC (12 years, 11 months ago) by iliev
File MIME type: text/x-c++hdr
File size: 6965 byte(s)
* Added new notification events for tracking
effect send changes and global volume changes

1 /***************************************************************************
2 * *
3 * LinuxSampler - modular, streaming capable sampler *
4 * *
5 * Copyright (C) 2003, 2004 by Benno Senoner and Christian Schoenebeck *
6 * Copyright (C) 2005 - 2007 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 * @throws Exception - in case no free ID could be found on
64 * given EngineChannel or @a MidiCtrl is
65 * invalid
66 */
67 FxSend(EngineChannel* pEngineChannel, uint8_t MidiCtrl, String Name = "") throw (Exception);
68
69 /**
70 * Returns the audio output device's audio channel to which effect
71 * send's channel \a SrcChan is currently routed to.
72 */
73 int DestinationChannel(int SrcChan);
74
75 /**
76 * Alters the routing of an audio channel.
77 *
78 * @param SrcChan - the effect send's source channel
79 * @param DstChan - the audio output device's destination channel
80 * @throws Exception - in case arguments out of range
81 */
82 void SetDestinationChannel(int SrcChan, int DstChan) throw (Exception);
83
84 /**
85 * Should be called by the engine channel whenever the amount of
86 * audio channel has changed, so the FxSend object can adjust the
87 * amount of channels to that new number and establish default
88 * routings for new channels if needed.
89 */
90 void UpdateChannels();
91
92 /**
93 * The effect send's current send level ( usually a value between
94 * @c 0.0f and @c 1.0f ).
95 */
96 float Level();
97
98 /**
99 * Alter the effect send's send level ( usually a value between
100 * @c 0.0f and @c 1.0f ).
101 */
102 void SetLevel(float f);
103
104 /**
105 * Alter the effect send's send level by supplying the MIDI
106 * controller's MIDI value. This method is usually only called
107 * by the engine channel.
108 */
109 void SetLevel(uint8_t iMidiValue);
110
111 /**
112 * Reset send level to the default send level (i.e. due to a
113 * MIDI "reset all controllers" message).
114 */
115 void Reset();
116
117 /**
118 * Returns the MIDI controller number which can alter the effect
119 * send's send level.
120 */
121 uint8_t MidiController();
122
123 /**
124 * Alter the MIDI controller number which should alter the effect
125 * send's send level.
126 *
127 * @param MidiCtrl - MIDI controller number
128 * @throws Exception - if MIDI controller number is invalid
129 */
130 void SetMidiController(uint8_t MidiCtrl) throw (Exception);
131
132 /**
133 * Returns the (optional) name of this effect send entity.
134 */
135 String Name();
136
137 /**
138 * Returns the (at least sampler-channel-) unique ID of the
139 * effect send instance. This is actually not used by the engine
140 * at all. It is at the moment only used by the LSCP server to
141 * associate an unique numerical ID with each effect send entity.
142 */
143 uint Id();
144
145 /**
146 * Determines whether the effect send's settings are changed.
147 */
148 bool IsInfoChanged();
149
150 /**
151 * Sets whether the effect send's settings are changed.
152 */
153 void SetInfoChanged(bool b);
154
155 protected:
156 EngineChannel* pEngineChannel;
157 std::vector<int> Routing;
158 uint8_t MidiFxSendController;
159 String sName;
160 uint iId;
161 float fLevel;
162 bool bInfoChanged; // Determines whether there are changes to the settings.
163 };
164
165 } // namespace LinuxSampler
166
167 #endif // LS_FXSEND_H

  ViewVC Help
Powered by ViewVC